Merge branch 'wip-MDL-44287-m25' of git://github.com/marinaglancy/moodle into MOODLE_25_STABLE
This commit is contained in:
@@ -69,15 +69,14 @@ require_capability('mod/glossary:managecategories', $context);
|
||||
$strglossaries = get_string("modulenameplural", "glossary");
|
||||
$strglossary = get_string("modulename", "glossary");
|
||||
|
||||
$PAGE->navbar->add($strglossaries, new moodle_url('/mod/glossary/index.php', array('id'=>$course->id)));
|
||||
$PAGE->navbar->add(get_string("categories","glossary"));
|
||||
$PAGE->navbar->add(get_string("categories","glossary"),
|
||||
new moodle_url('/mod/glossary/editcategories.php', array('id' => $cm->id,'mode' => 'cat')));
|
||||
if (!empty($action)) {
|
||||
$navaction = get_string($action). " " . textlib::strtolower(get_string("category","glossary"));
|
||||
$PAGE->navbar->add($navaction);
|
||||
}
|
||||
$PAGE->set_title($glossary->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Prepare format_string/text options
|
||||
$fmtoptions = array(
|
||||
@@ -106,6 +105,7 @@ if ( $hook >0 ) {
|
||||
add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook,$cm->id);
|
||||
|
||||
} else {
|
||||
echo $OUTPUT->header();
|
||||
echo "<h3 class=\"main\">" . get_string("edit"). " " . get_string("category","glossary") . "</h3>";
|
||||
|
||||
$name = $category->name;
|
||||
@@ -120,14 +120,11 @@ if ( $hook >0 ) {
|
||||
$DB->delete_records("glossary_entries_categories", array("categoryid"=>$hook));
|
||||
$DB->delete_records("glossary_categories", array("id"=>$hook));
|
||||
|
||||
echo $OUTPUT->box_start('generalbox boxaligncenter errorboxcontent boxwidthnarrow');
|
||||
echo "<div>" . get_string("categorydeleted","glossary") ."</div>";
|
||||
echo $OUTPUT->box_end();
|
||||
|
||||
add_to_log($course->id, "glossary", "delete category", "editcategories.php?id=$cm->id", $hook,$cm->id);
|
||||
|
||||
redirect("editcategories.php?id=$cm->id");
|
||||
redirect("editcategories.php?id=$cm->id", get_string("categorydeleted", "glossary"), 2);
|
||||
} else {
|
||||
echo $OUTPUT->header();
|
||||
echo "<p>" . get_string("delete"). " " . get_string("category","glossary"). "</p>";
|
||||
|
||||
echo $OUTPUT->box_start('generalbox boxaligncenter errorboxcontent boxwidthnarrow');
|
||||
@@ -172,14 +169,7 @@ if ( $hook >0 ) {
|
||||
if ( $confirm ) {
|
||||
$dupcategory = $DB->get_records_sql("SELECT * FROM {glossary_categories} WHERE ".$DB->sql_like('name','?', false)." AND glossaryid=?", array($name, $glossary->id));
|
||||
if ( $dupcategory ) {
|
||||
echo "<h3 class=\"main\">" . get_string("add"). " " . get_string("category","glossary"). "</h3>";
|
||||
|
||||
echo $OUTPUT->box_start('generalbox boxaligncenter errorboxcontent boxwidthnarrow');
|
||||
echo "<div>" . get_string("duplicatecategory","glossary") ."</div>";
|
||||
echo $OUTPUT->box_end();
|
||||
|
||||
redirect("editcategories.php?id=$cm->id&action=add&name=$name");
|
||||
|
||||
redirect("editcategories.php?id=$cm->id&action=add&name=$name", get_string("duplicatecategory", "glossary"), 2);
|
||||
} else {
|
||||
$action = "";
|
||||
$cat = new stdClass();
|
||||
@@ -191,6 +181,7 @@ if ( $hook >0 ) {
|
||||
add_to_log($course->id, "glossary", "add category", "editcategories.php?id=$cm->id", $cat->id,$cm->id);
|
||||
}
|
||||
} else {
|
||||
echo $OUTPUT->header();
|
||||
echo "<h3 class=\"main\">" . get_string("add"). " " . get_string("category","glossary"). "</h3>";
|
||||
$name="";
|
||||
require "editcategories.html";
|
||||
@@ -202,6 +193,8 @@ if ( $action ) {
|
||||
die;
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
?>
|
||||
|
||||
<form method="post" action="editcategories.php">
|
||||
|
||||
@@ -98,7 +98,7 @@ if ($xml = glossary_read_imported_file($result)) {
|
||||
$glossary->showall = ($xmlglossary['SHOWALL'][0]['#']);
|
||||
$glossary->timecreated = time();
|
||||
$glossary->timemodified = time();
|
||||
$glossary->cmidnumber = $cm->idnumber;
|
||||
$glossary->cmidnumber = null;
|
||||
|
||||
// Setting the default values if no values were passed
|
||||
if ( isset($xmlglossary['ENTBYPAGE'][0]['#']) ) {
|
||||
@@ -132,6 +132,9 @@ if ($xml = glossary_read_imported_file($result)) {
|
||||
$glossary->defaultapproval = $CFG->glossary_defaultapproval;
|
||||
}
|
||||
|
||||
// This field was not included in export, assume zero.
|
||||
$glossary->assessed = 0;
|
||||
|
||||
// Include new glossary and return the new ID
|
||||
if ( !$glossary->id = glossary_add_instance($glossary) ) {
|
||||
echo $OUTPUT->notification("Error while trying to create the new glossary.");
|
||||
@@ -141,6 +144,7 @@ if ($xml = glossary_read_imported_file($result)) {
|
||||
} else {
|
||||
//The instance has been created, so lets do course_modules
|
||||
//and course_sections
|
||||
$mod = new stdClass();
|
||||
$mod->groupmode = $course->groupmode; /// Default groupmode the same as course
|
||||
|
||||
$mod->instance = $glossary->id;
|
||||
|
||||
Reference in New Issue
Block a user