Skip to content
Permalink
Browse files

Fixed up the display after adding/editing new entries to make it more…

… standard.

Also shuffled a little code to make it easier ofr me to read.
  • Loading branch information...
moodler
moodler committed Mar 1, 2005
1 parent 0afedf6 commit e5515b381694672cc85e61e1c9308a7bcb32c383
Showing with 16 additions and 18 deletions.
  1. +16 −18 mod/glossary/edit.php
@@ -96,12 +96,6 @@
print_footer($course);
die;
}
print_header_simple(strip_tags("$glossary->name"), "",
"<A HREF=\"index.php?id=$course->id\">$strglossaries</A> ->
<A HREF=\"view.php?id=$cm->id\">$glossary->name</A> -> $stredit", "form.text",
"", true, "", navmenu($course, $cm));
print_heading($glossary->name);
if ($e) {
//We are updating an entry, so we compare current session user with
@@ -142,11 +136,13 @@
unset($newentry->attachment);
}
if (! update_record("glossary_entries", $newentry)) {
error("Could not update your glossary");
if (update_record("glossary_entries", $newentry)) {
add_to_log($course->id, "glossary", "update entry",
"view.php?id=$cm->id&amp;mode=entry&amp;hook=$newentry->id",
$newentry->id, $cm->id);
$redirectmessage = get_string('entryupdated','glossary');
} else {
add_to_log($course->id, "glossary", "update entry", "view.php?id=$cm->id&amp;mode=entry&amp;hook=$newentry->id", $newentry->id,$cm->id);
notify(get_string('entryupdated','glossary'));
error("Could not update your glossary");
}
} else {
error("Could not update this glossary entry because this concept already exist.");
@@ -165,9 +161,7 @@
}
}
if ( $permissiongranted ) {
if (! $newentry->id = insert_record("glossary_entries", $newentry)) {
error("Could not insert this new entry");
} else {
if ($newentry->id = insert_record("glossary_entries", $newentry)) {
$e = $newentry->id;
$newentry->attachment = $_FILES["attachment"];
if ($newfilename = glossary_add_attachment($newentry, 'attachment')) {
@@ -176,8 +170,11 @@
unset($newentry->attachment);
}
set_field("glossary_entries", "attachment", $newfilename, "id", $newentry->id);
add_to_log($course->id, "glossary", "add entry", "view.php?id=$cm->id&amp;mode=entry&amp;hook=$newentry->id", $newentry->id,$cm->id);
notify(get_string('entrysaved','glossary'));
add_to_log($course->id, "glossary", "add entry",
"view.php?id=$cm->id&amp;mode=entry&amp;hook=$newentry->id", $newentry->id,$cm->id);
$redirectmessage = get_string('entrysaved','glossary');
} else {
error("Could not insert this new entry");
}
} else {
error("Could not insert this glossary entry because this concept already exist.");
@@ -211,9 +208,8 @@
}
}
}
print_continue("view.php?id=$cm->id&amp;mode=entry&amp;hook=$newentry->id");
print_footer();
die;
redirect("view.php?id=$cm->id&amp;mode=entry&amp;hook=$newentry->id", $redirectmessage);
} else {
if ($e) {
$form = get_record("glossary_entries", "id", $e);
@@ -238,6 +234,8 @@
}
}
}
//Fill and print the form.
//We check every field has a default values here!!
if (!isset($newentry->concept)) {

0 comments on commit e5515b3

Please sign in to comment.
You can’t perform that action at this time.