Removed notices by introducing new function print_header_simple() which works on site as well as in courses without extra logic.

This commit is contained in:
gustav_delius 2004-08-21 20:20:58 +00:00
parent 64c3e85374
commit 90fcc576ea
49 changed files with 1530 additions and 1709 deletions

View file

@ -46,11 +46,6 @@
}
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id);
/// Printing the page header
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
switch ( $action ){
case "add":
$straction = get_string("addingcomment","glossary");
@ -66,8 +61,8 @@
$strglossary = get_string("modulename", "glossary");
$strcomments = get_string("comments", "glossary");
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> <A HREF=view.php?id=$cm->id>$glossary->name</a> -> <A HREF=comments.php?id=$cm->id&eid=$entry->id>$strcomments</a> -> " . $straction,
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> -> <A HREF=comments.php?id=$cm->id&eid=$entry->id>$strcomments</a> -> " . $straction,
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
@ -77,7 +72,7 @@
if ( $action == "delete" ) {
if ( $confirm ) {
delete_records("glossary_comments","id", $cid);
delete_records("glossary_comments","id", $cid);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("commentdeleted","glossary") . "</center>";
@ -89,7 +84,7 @@
} else {
glossary_print_comment($course, $cm, $glossary, $entry, $comment);
glossary_print_comment($course, $cm, $glossary, $entry, $comment);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center><br>" . get_string("areyousuredeletecomment","glossary");

View file

@ -6,8 +6,8 @@
require_variable($id); // Course Module ID
require_variable($eid); // Entry ID
global $THEME, $USER, $CFG;
global $THEME, $USER, $CFG;
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
@ -33,12 +33,6 @@
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id);
/// Printing the page header
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
$strglossaries = get_string("modulenameplural", "glossary");
$strglossary = get_string("modulename", "glossary");
$strallcategories = get_string("allcategories", "glossary");
@ -50,8 +44,8 @@
$strcomments = get_string("comments", "glossary");
$straddcomment = get_string("addcomment", "glossary");
print_header(strip_tags("$course->shortname: $strcomments: $entry->concept"), "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> <A HREF=view.php?id=$cm->id>$glossary->name</a> -> $strcomments",
print_header_simple(strip_tags("$strcomments: $entry->concept"), "",
"<A HREF=index.php?id=$course->id>$strglossaries</A> -> <A HREF=view.php?id=$cm->id>$glossary->name</a> -> $strcomments",
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
@ -65,13 +59,13 @@
print_heading(get_string('commentson','glossary')." <b>\"$entry->concept\"</b>");
if ($glossary->allowcomments) {
if ($glossary->allowcomments) {
print_heading("<a href=\"comment.php?id=$cm->id&eid=$entry->id\">$straddcomment</a> <img title=\"$straddcomment\" src=\"comment.gif\" height=11 width=11 border=0>");
}
if ($comments = get_records("glossary_comments","entryid",$entry->id,"timemodified ASC")) {
foreach ($comments as $comment) {
glossary_print_comment($course, $cm, $glossary, $entry, $comment);
glossary_print_comment($course, $cm, $glossary, $entry, $comment);
echo '<br />';
}
} else {

View file

@ -40,18 +40,14 @@
$entryfields = get_record("glossary_entries", "id", $entry);
$strareyousuredelete = get_string("areyousuredelete","glossary");
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
print_header("$course->shortname: $glossary->name", "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
print_header_simple("$glossary->name", "",
"<A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
/// If data submitted, then process and store.
if ($confirm) { // the operation was confirmed.
if ($confirm) { // the operation was confirmed.
// if it is an imported entry, just delete the relation
$entry = get_record("glossary_entries","id", $entry);
@ -59,7 +55,7 @@
$entry->glossaryid = $entry->sourceglossaryid;
$entry->sourceglossaryid = 0;
if (! update_record("glossary_entries", $entry)) {
error("Could not update your glossary");
error("Could not update your glossary");
}
} else {
@ -69,7 +65,7 @@
delete_records("glossary_comments", "entryid",$entry->id);
delete_records("glossary_alias", "entryid", $entry->id);
delete_records("glossary_ratings", "entryid", $entry->id);
delete_records("glossary_entries","id", $entry->id);
delete_records("glossary_entries","id", $entry->id);
}
add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id&mode=$prevmode&hook=$hook", $entry,$cm->id);

View file

@ -15,7 +15,7 @@
optional_variable($name); // confirm the action
$action = strtolower($action);
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
}
@ -36,15 +36,11 @@
// add_to_log($course->id, "glossary", "edit categories", "view.php?id=$cm->id", "$glossary->id", $cm->id);
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strglossaries = get_string("modulenameplural", "glossary");
$strglossary = get_string("modulename", "glossary");
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> <A HREF=view.php?id=$cm->id&tab=GLOSSARY_CATEGORY_VIEW>$glossary->name</a> -> " . get_string("categories","glossary"),
print_header_simple(strip_tags("$glossary->name"), "",
"<A HREF=index.php?id=$course->id>$strglossaries</A> -> <A HREF=view.php?id=$cm->id&tab=GLOSSARY_CATEGORY_VIEW>$glossary->name</a> -> " . get_string("categories","glossary"),
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
@ -59,8 +55,8 @@
$cat->usedynalink = $usedynalink;
if ( !update_record("glossary_categories", $cat) ) {
error("Weird error. The category was not updated.");
redirect("editcategories.php?id=$cm->id");
error("Weird error. The category was not updated.");
redirect("editcategories.php?id=$cm->id");
} else {
add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook,$cm->id);
}
@ -76,26 +72,26 @@
} elseif ( $action == "delete" ) {
if ( $confirm ) {
delete_records("glossary_entries_categories","categoryid", $hook);
delete_records("glossary_entries_categories","categoryid", $hook);
delete_records("glossary_categories","id", $hook);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("categorydeleted","glossary") ."</center>";
echo "</center>";
print_simple_box_end();
print_footer($course);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("categorydeleted","glossary") ."</center>";
echo "</center>";
print_simple_box_end();
print_footer($course);
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");
} else {
echo "<p align=\"center\">" . get_string("delete"). " " . get_string("category","glossary") . "<font size=\"3\">";
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center><b>$category->name</b><br>";
$num_entries = count_records("glossary_entries_categories","categoryid",$category->id);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center><b>$category->name</b><br>";
$num_entries = count_records("glossary_entries_categories","categoryid",$category->id);
if ( $num_entries ) {
print_string("deletingnoneemptycategory","glossary");
}
@ -105,7 +101,7 @@
?>
<form name="form" method="post" action="editcategories.php">
<input type="hidden" name=id value="<?php p($cm->id) ?>">
<input type="hidden" name=id value="<?php p($cm->id) ?>">
<input type="hidden" name=action value="delete">
<input type="hidden" name=confirm value="1">
<input type="hidden" name=mode value="<?php echo $mode ?>">
@ -119,8 +115,8 @@
$options = array ("id" => $id);
print_single_button("editcategories.php", $options, get_string("no") );
echo "</td></tr></table>";
echo "</center>";
print_simple_box_end();
echo "</center>";
print_simple_box_end();
}
}
} elseif ( $action == "add" ) {
@ -129,14 +125,14 @@
if ( $dupcategory ) {
echo "<p align=\"center\">" . get_string("add"). " " . get_string("category","glossary") . "<font size=\"3\">";
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("duplicatedcategory","glossary") ."</center>";
echo "</center>";
print_simple_box_end();
print_footer($course);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("duplicatedcategory","glossary") ."</center>";
echo "</center>";
print_simple_box_end();
print_footer($course);
redirect("editcategories.php?id=$cm->id&action=add&&name=$name");
redirect("editcategories.php?id=$cm->id&action=add&&name=$name");
} else {
$action = "";
@ -145,9 +141,9 @@
$cat->glossaryid = $glossary->id;
if ( ! $cat->id = insert_record("glossary_categories", $cat) ) {
error("Weird error. The category was not inserted.");
redirect("editcategories.php?id=$cm->id");
error("Weird error. The category was not inserted.");
redirect("editcategories.php?id=$cm->id");
} else {
add_to_log($course->id, "glossary", "add category", "editcategories.php?id=$cm->id", $cat->id,$cm->id);
}
@ -195,8 +191,8 @@
</td>
<td width="10%" align="center"><b>
<?php
echo "<a href=\"editcategories.php?id=$cm->id&action=delete&mode=cat&hook=$category->id\"><img alt=\"" . get_string("delete") . "\"src=\"../../pix/t/delete.gif\" height=11 width=11 border=0></a> ";
echo "<a href=\"editcategories.php?id=$cm->id&action=edit&mode=cat&hook=$category->id\"><img alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
echo "<a href=\"editcategories.php?id=$cm->id&action=delete&mode=cat&hook=$category->id\"><img alt=\"" . get_string("delete") . "\"src=\"../../pix/t/delete.gif\" height=11 width=11 border=0></a> ";
echo "<a href=\"editcategories.php?id=$cm->id&action=edit&mode=cat&hook=$category->id\"><img alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
?>
</b></td>
</tr>

View file

@ -1,31 +1,31 @@
<?PHP // $Id$
require_once("../../config.php");
require_once("lib.php");
require_once("../../config.php");
require_once("lib.php");
require_variable($id); // course module ID
require_variable($entry); // Entry ID
optional_variable($confirm); // confirmation
optional_variable($mode);
optional_variable($hook);
global $THEME, $USER, $CFG;
require_variable($id); // course module ID
require_variable($entry); // Entry ID
optional_variable($confirm); // confirmation
optional_variable($mode);
optional_variable($hook);
global $THEME, $USER, $CFG;
$PermissionGranted = 1;
$PermissionGranted = 1;
$cm = get_record("course_modules","id",$id);
if ( ! $cm ) {
$PermissionGranted = 0;
} else {
$mainglossary = get_record("glossary","course",$cm->course, "mainglossary",1);
if ( ! $mainglossary ) {
$PermissionGranted = 0;
}
}
$cm = get_record("course_modules","id",$id);
if ( ! $cm ) {
$PermissionGranted = 0;
} else {
$mainglossary = get_record("glossary","course",$cm->course, "mainglossary",1);
if ( ! $mainglossary ) {
$PermissionGranted = 0;
}
}
if ( !isteacher($cm->course) ) {
$PermissionGranted = 0;
error("You must be a teacher to use this page.");
}
if ( !isteacher($cm->course) ) {
$PermissionGranted = 0;
error("You must be a teacher to use this page.");
}
if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured");
@ -39,69 +39,65 @@
$entryalreadyexist = get_string("entryalreadyexist","glossary");
$entryexported = get_string("entryexported","glossary");
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
print_header("$course->shortname: $glossary->name", "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
print_header_simple("$glossary->name", "",
"<A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
"", "", true, "",
navmenu($course, $cm));
if ( $PermissionGranted ) {
$entry = get_record("glossary_entries", "id", $entry);
if ( $PermissionGranted ) {
$entry = get_record("glossary_entries", "id", $entry);
if ( !$confirm ) {
echo "<center>";
if ( !$confirm ) {
echo "<center>";
$areyousure = get_string("areyousureexport","glossary");
notice_yesno ("<center><h2>$entry->concept</h2><p align=center>$areyousure<br><b>$mainglossary->name</b>?",
"exportentry.php?id=$id&mode=$mode&hook=$hook&entry=$entry->id&confirm=1",
"view.php?id=$cm->id&mode=$mode&hook=$hook" );
notice_yesno ("<center><h2>$entry->concept</h2><p align=center>$areyousure<br><b>$mainglossary->name</b>?",
"exportentry.php?id=$id&mode=$mode&hook=$hook&entry=$entry->id&confirm=1",
"view.php?id=$cm->id&mode=$mode&hook=$hook" );
} else {
if ( ! $mainglossary->allowduplicatedentries ) {
$dupentry = get_record("glossary_entries","glossaryid", $mainglossary->id, "UCASE(concept)",strtoupper($entry->concept));
if ( $dupentry ) {
$PermissionGranted = 0;
}
}
if ( $PermissionGranted ) {
} else {
if ( ! $mainglossary->allowduplicatedentries ) {
$dupentry = get_record("glossary_entries","glossaryid", $mainglossary->id, "UCASE(concept)",strtoupper($entry->concept));
if ( $dupentry ) {
$PermissionGranted = 0;
}
}
if ( $PermissionGranted ) {
$entry->glossaryid = $mainglossary->id;
$entry->sourceglossaryid = $glossary->id;
if (! update_record("glossary_entries", $entry)) {
error("Could not export the entry to the main glossary");
} else {
error("Could not export the entry to the main glossary");
} else {
print_simple_box_start("center", "60%", "$THEME->cellheading");
echo "<p align=center><font size=3>$entryexported</font></p></font>";
print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
print_simple_box_end();
print_footer();
print_footer();
redirect("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
die;
}
} else {
print_simple_box_start("center", "60%", "#FFBBBB");
echo "<p align=center><font size=3>$entryalreadyexist</font></p></font>";
echo "<p align=center>";
redirect("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
die;
}
} else {
print_simple_box_start("center", "60%", "#FFBBBB");
echo "<p align=center><font size=3>$entryalreadyexist</font></p></font>";
echo "<p align=center>";
print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
print_simple_box_end();
}
}
} else {
print_simple_box_start("center", "60%", "#FFBBBB");
notice("A weird error was found while trying to export this entry. Operation cancelled.");
print_simple_box_end();
}
}
} else {
print_simple_box_start("center", "60%", "#FFBBBB");
notice("A weird error was found while trying to export this entry. Operation cancelled.");
print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
print_simple_box_end();
}
print_simple_box_end();
}
print_footer();
print_footer();
?>

View file

@ -32,10 +32,6 @@
error("You must be a teacher to use this page.");
}
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
if ($dest != 'new' and $dest != 'current') {
$dest = 'current';
}
@ -48,8 +44,8 @@
$strsearchindefinition = get_string("searchindefinition", "glossary");
$strsearch = get_string("search");
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
print_header_simple(strip_tags("$glossary->name"), "",
"<A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));

View file

@ -27,11 +27,7 @@
/// Print the header
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
print_header("$course->shortname: $strglossarys", "$course->fullname", "$navigation $strglossarys", "", "", true, "", navmenu($course));
print_header_simple("$strglossarys", "", "$strglossarys", "", "", true, "", navmenu($course));
/// Get all the appropriate data