mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
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:
parent
64c3e85374
commit
90fcc576ea
49 changed files with 1530 additions and 1709 deletions
|
@ -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();
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue