Index: temp_moodle_dev/moodle/mod/glossary/edit.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/glossary/edit.php,v diff -u -r1.4 -r1.5 --- temp_moodle_dev/moodle/mod/glossary/edit.php 10 Dec 2008 23:55:07 -0000 1.4 +++ temp_moodle_dev/moodle/mod/glossary/edit.php 28 Oct 2009 07:32:01 -0000 1.5 @@ -13,6 +13,7 @@ $mode = optional_param('mode', '', PARAM_ALPHA); // categories if by category? $hook = optional_param('hook', '', PARAM_ALPHANUM); // CategoryID $next=0;//lams: variable that after editing we pass to the view page to let it know we have edit an entry + if (! $cm = get_coursemodule_from_id('glossary', $id)) { error("Course Module ID was incorrect"); } @@ -50,7 +51,6 @@ $mform =& new mod_glossary_entry_form(null, compact('cm', 'glossary', 'hook', 'mode', 'e', 'context')); if ($mform->is_cancelled()){ if ($e){ - redirect("view.php?id=$cm->id&mode=entry&hook=$e"); } else { redirect("view.php?id=$cm->id"); @@ -95,34 +95,30 @@ } if (update_record('glossary_entries', $todb)) { - $next=1;//lams: variable we pass to the view page to tell it that there is a new entry + $next=1;//lams: variable we pass to the view page to tell it that there is a new entry add_to_log($course->id, "glossary", "update entry", "view.php?id=$cm->id&mode=entry&hook=$todb->id", $todb->id, $cm->id); - - } else { error("Could not update your glossary"); } } else { - + $todb->userid = $USER->id; $todb->timecreated = $timenow; $todb->sourceglossaryid = 0; $todb->teacherentry = has_capability('mod/glossary:manageentries', $context); - + if ($todb->id = insert_record("glossary_entries", $todb)) { $e = $todb->id; $dir = glossary_file_area_name($todb); if ($mform->save_files($dir) and $newfilename = $mform->get_new_filename()) { set_field("glossary_entries", "attachment", $newfilename, "id", $todb->id); } - $next=1;//lams: variable we pass to the view page to tell it that there is a new entry + $next=1;//lams: variable we pass to the view page to tell it that there is a new entry add_to_log($course->id, "glossary", "add entry", "view.php?id=$cm->id&mode=entry&hook=$todb->id", $todb->id,$cm->id); - - } else { error("Could not insert this new entry"); } @@ -133,7 +129,6 @@ delete_records("glossary_alias", "entryid", $e); if (empty($fromform->notcategorised) && isset($fromform->categories)) { - $newcategory->entryid = $e; foreach ($fromform->categories as $category) { if ( $category > 0 ) { @@ -180,7 +175,6 @@ $toform->fullmatch = $fromdb->fullmatch; $toform->aliases = ''; $ineditperiod = ((time() - $fromdb->timecreated < $CFG->maxeditingtime) || $glossary->editalways); - if ((!$ineditperiod || $USER->id != $fromdb->userid) and !has_capability('mod/glossary:manageentries', $context)) { if ( $USER->id != $fromdb->userid ) { print_error('errcannoteditothers', 'glossary'); @@ -195,14 +189,13 @@ } $mform->set_data($toform); } - } $stredit = empty($e) ? get_string('addentry', 'glossary') : get_string("edit"); $navigation = build_navigation($stredit, $cm); - //we pass a new parameter to the function so it won't we printed if is_lams=1 +//we pass a new parameter to the function so it won't we printed if is_lams=1 print_header_simple(format_string($glossary->name), "", $navigation, "", - "", true, "", navmenu($course, $cm),false,'',false,$cm->is_lams); + "", true, "", navmenu($course, $cm),false,'',false,$cm->is_lams); print_heading(format_string($glossary->name)); @@ -225,6 +218,7 @@ ///glossary_print_tabbed_table_end(); + //we pass a new parameter to the function so it won't we printed if is_lams=1 print_footer($course,null, false,$glossary->is_lams);