mod-glossary MDL-19809 Updated print_header and build_navigation to OUTPUT and PAGE equivalents

This commit is contained in:
samhemelryk
2009-09-07 03:20:35 +00:00
parent be6c8dfe5a
commit e6855d1aa0
13 changed files with 55 additions and 70 deletions
+7 -8
View File
@@ -207,6 +207,7 @@ function glossary_comment_edit() {
//////////////////////////////////
function glossary_comment_print_header($course, $cm, $glossary, $entry, $action) {
global $PAGE, $OUTPUT;
switch ($action){
case 'add':
$straction = get_string('addingcomment','glossary');
@@ -222,14 +223,12 @@ function glossary_comment_print_header($course, $cm, $glossary, $entry, $action)
$strglossary = get_string('modulename', 'glossary');
$strcomments = get_string('comments', 'glossary');
$navlinks = array();
$navlinks[] = array('name' => $strcomments, 'link' => "comments.php?id=$cm->id&eid=$entry->id", 'type' => 'title');
$navlinks[] = array('name' => $straction, 'link' => '', 'type' => 'action');
$navigation = build_navigation($navlinks, $cm);
print_header_simple(format_string($glossary->name), '', $navigation,
'', '', true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
$PAGE->navbar->add($strcomments, new moodle_url($CFG->wwwroot.'/mod/glossary/comments.php', array('id'=>$cm->id,'eid'=>$entry->id)));
$PAGE->navbar->add($straction);
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
echo $OUTPUT->header();
/// print original glossary entry for any comment action (add, update, delete)
glossary_print_entry($course, $cm, $glossary, $entry, 'approval', '', false);
}
+4 -4
View File
@@ -40,10 +40,10 @@
$strcomments = get_string("comments", "glossary");
$straddcomment = get_string("addcomment", "glossary");
$navigation = build_navigation($strcomments, $cm);
print_header_simple(strip_tags("$strcomments: $entry->concept"), "", $navigation,
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
$PAGE->navbar->add($strcomments);
$PAGE->set_title(strip_tags("$strcomments: $entry->concept"));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
echo $OUTPUT->header();
/// original glossary entry
+3 -5
View File
@@ -38,8 +38,6 @@
$strareyousuredelete = get_string("areyousuredelete","glossary");
$navigation = build_navigation('', $cm);
if (($entry->userid != $USER->id) and !$manageentries) { // guest id is never matched, no need for special check here
print_error('nopermissiontodelentry');
}
@@ -92,9 +90,9 @@
redirect("view.php?id=$cm->id&mode=$prevmode&hook=$hook");
} else { // the operation has not been confirmed yet so ask the user to do so
print_header_simple(format_string($glossary->name), "", $navigation,
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
echo $OUTPUT->header();
$areyousure = "<b>".format_string($entry->concept)."</b><p>$strareyousuredelete</p>";
$linkyes = 'deleteentry.php';
$linkno = 'view.php';
+3 -4
View File
@@ -165,10 +165,9 @@ if ($mform->is_cancelled()){
$stredit = empty($entry->id) ? get_string('addentry', 'glossary') : get_string('edit');
$navigation = build_navigation($stredit, $cm);
print_header_simple(format_string($glossary->name), "", $navigation, "",
"", true, "", navmenu($course, $cm));
$PAGE->navbar->add($stredit);
$PAGE->set_title(format_string($glossary->name));
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($glossary->name));
$mform->display();
+6 -10
View File
@@ -47,16 +47,12 @@
$strglossaries = get_string("modulenameplural", "glossary");
$strglossary = get_string("modulename", "glossary");
$navlinks = array();
$navlinks[] = array('name' => $strglossaries, 'link' => "index.php?id=$course->id", 'type' => 'activity');
$navlinks[] = array('name' => format_string($glossary->name), 'link' => "view.php?id=$cm->id&amp;tab=GLOSSARY_CATEGORY_VIEW", 'type' => 'activityinstance');
$navlinks[] = array('name' => get_string("categories","glossary"), 'link' => '', 'type' => 'title');
$navigation = build_navigation($navlinks);
print_header_simple(format_string($glossary->name), "", $navigation,
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
$PAGE->navbar->add($strglossaries, new moodle_url($CFG->wwwroot.'/mod/glossary/index.php', array('id'=>$course->id)));
$PAGE->navbar->add(format_string($glossary->name), new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->id,'tab'=>'GLOSSARY_CATEGORY_VIEW')));
$PAGE->navbar->add(get_string("categories","glossary"));
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
echo $OUTPUT->header();
if ( $hook >0 ) {
+4 -5
View File
@@ -37,13 +37,12 @@
$strexportfile = get_string("exportfile", "glossary");
$strexportentries = get_string('exportentriestoxml', 'glossary');
$navigation = build_navigation($strexportentries, $cm);
print_header_simple(format_string($glossary->name), "",$navigation,
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
$PAGE->navbar->add($strexportentries);
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
echo $OUTPUT->header();
echo $OUTPUT->heading($strexportentries);
echo $OUTPUT->box_start('glossarydisplay generalbox');
?>
<form action="exportfile.php" method="post">
+4 -4
View File
@@ -58,11 +58,10 @@
$entryalreadyexist = get_string('entryalreadyexist','glossary');
$entryexported = get_string('entryexported','glossary');
$navigation = build_navigation('', $cm);
if (!$mainglossary->allowduplicatedentries) {
if ($DB->get_record('glossary_entries', array('glossaryid'=>$mainglossary->id, 'lower(concept)'=>moodle_strtolower($entry->concept)))) {
print_header_simple(format_string($glossary->name), '', $navigation, '', '', true, '', navmenu($course, $cm));
$PAGE->set_title(format_string($glossary->name));
echo $OUTPUT->header();
echo $OUTPUT->notification(get_string('errconceptalreadyexists', 'glossary'));
echo $OUTPUT->continue_button($returnurl);
echo $OUTPUT->box_end();
@@ -72,7 +71,8 @@
}
if (!data_submitted() or !$confirm or !confirm_sesskey()) {
print_header_simple(format_string($glossary->name), '', $navigation, '', '', true, '', navmenu($course, $cm));
$PAGE->set_title(format_string($glossary->name));
echo $OUTPUT->header();
echo '<div class="boxaligncenter">';
$areyousure = '<h2>'.format_string($entry->concept).'</h2><p align="center">'.get_string('areyousureexport','glossary').'<br /><b>'.format_string($mainglossary->name).'</b>?';
$linkyes = 'exportentry.php';
+5 -5
View File
@@ -44,11 +44,11 @@
$strsearch = get_string("search");
$strimportentries = get_string('importentriesfromxml', 'glossary');
$navigation = build_navigation($strimportentries, $cm);
print_header_simple(format_string($glossary->name), "", $navigation,
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
$PAGE->navbar->add($strimportentries);
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
echo $OUTPUT->header();
echo $OUTPUT->heading($strimportentries);
if ( !$step ) {
+3 -5
View File
@@ -28,11 +28,9 @@
/// Print the header
$navlinks = array();
$navlinks[] = array('name' => $strglossarys, 'link' => "index.php?id=$course->id", 'type' => 'activity');
$navigation = build_navigation($navlinks);
print_header_simple("$strglossarys", "", $navigation, "", "", true, "", navmenu($course));
$PAGE->navbar->add($strglossarys, "index.php?id=$course->id");
$PAGE->set_title($strglossarys);
echo $OUTPUT->header();
/// Get all the appropriate data
+1 -1
View File
@@ -30,7 +30,7 @@
$entriesbypage = $CFG->glossary_entbypage;
}
print_header();
echo $OUTPUT->header();
require_course_login($course, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
+2 -1
View File
@@ -48,7 +48,8 @@
$strname = get_string('name');
$strtime = get_string('time');
print_header("$strratings: $entry->concept");
$PAGE->set_title("$strratings: $entry->concept");
echo $OUTPUT->header();
if (!$ratings = glossary_get_ratings($entry->id, $sqlsort)) {
print_error('ratingno', 'glossary');
+6 -8
View File
@@ -48,16 +48,14 @@
$strsearch = get_string("search");
$CFG->framename = "newwindow";
$navlinks = array();
$navlinks[] = array('name' => $strglossaries, 'link' => '', 'type' => 'activity');
$navlinks[] = array('name' => $strsearch, 'link' => '', 'type' => 'title');
$navigation = build_navigation($navlinks);
print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), $course->fullname, $navigation, "", "", true, "&nbsp;", "&nbsp;");
$PAGE->navbar->add($strglossaries);
$PAGE->navbar->add($strsearch);
$PAGE->set_title(strip_tags("$course->shortname: $strglossaries $strsearch"));
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
} else {
print_header(); // Needs to be something here to allow linking back to the whole glossary
echo $OUTPUT->header(); // Needs to be something here to allow linking back to the whole glossary
}
if ($entries) {
+7 -10
View File
@@ -115,7 +115,7 @@
require_login($course->id);
}
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $context)) {
print_header();
echo $OUTPUT->header();
notice(get_string("activityiscurrentlyhidden"));
}
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id&amp;tab=$tab", $glossary->id, $cm->id);
@@ -226,18 +226,15 @@
$strwaitingapproval = get_string('waitingapproval', 'glossary');
/// If we are in approval mode, prit special header
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
if ($tab == GLOSSARY_APPROVAL_VIEW) {
require_capability('mod/glossary:approve', $context);
$navigation = build_navigation($strwaitingapproval, $cm);
print_header_simple(format_string($glossary->name), "", $navigation, "", "", true,
update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm));
$PAGE->navbar->add($strwaitingapproval);
echo $OUTPUT->header();
echo $OUTPUT->heading($strwaitingapproval);
} else { /// Print standard header
$navigation = build_navigation('', $cm);
print_header_simple(format_string($glossary->name), "", $navigation, "", "", true,
update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm));
} else { /// Print standard header
echo $OUTPUT->header();
}
/// All this depends if whe have $showcommonelements