mod MDL-21169 Removed update this module button and ensured there was a link in the settings block for it.

This commit is contained in:
Sam Hemelryk 2009-12-23 01:57:55 +00:00
parent 0a1f8f8ffe
commit 92059c7ee5
53 changed files with 228 additions and 92 deletions

View File

@ -2,6 +2,7 @@
$string['contentheader'] = 'Content';
$string['foldercontent'] = 'Files and subfolders';
$string['folderadministration'] = 'Folder administration';
$string['modulename'] = 'Folder';
$string['modulenameplural'] = 'Folders';
$string['neverseen'] = 'Never seen';

View File

@ -6,6 +6,7 @@ $string['contentheader'] = 'Content';
$string['deploymenterror'] = 'Content package error!';
$string['keepold'] = 'Archive packages';
$string['keepoldexplain'] = 'How many packages should be archived?';
$string['imscpadministration'] = 'IMSCP Administration';
$string['modulename'] = 'IMS Content Package';
$string['modulenameplural'] = 'IMS Content packages';
$string['navigation'] = 'Navigation';

View File

@ -13,6 +13,7 @@ $string['legacyfilesactive'] = 'Active';
$string['legacyfilesdone'] = 'Finished';
$string['modulename'] = 'Page';
$string['modulenameplural'] = 'Pages';
$string['pageadministration'] = 'Page administration';
$string['popupheight'] = 'Popup height (in pixels)';
$string['popupheightexplain'] = 'Specifies default height of popup windows.';
$string['popupwidth'] = 'Popup width (in pixels)';

View File

@ -33,3 +33,4 @@ $string['printheadingexplain'] = 'Display URL name above content? Some display t
$string['printintro'] = 'Display URL description';
$string['printintroexplain'] = 'Display URL description bellow content? Some display types may not display description even if enabled.';
$string['rolesinparams'] = 'Include role names in parameters';
$string['urladministration'] = 'URL administration';

View File

@ -186,7 +186,6 @@ class assignment_base {
$PAGE->set_title($this->pagetitle);
$PAGE->set_heading($this->course->fullname);
$PAGE->set_button($OUTPUT->update_module_button($this->cm->id, 'assignment'));
echo $OUTPUT->header();
@ -1126,7 +1125,6 @@ class assignment_base {
add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id='.$this->cm->id, $this->assignment->id, $this->cm->id);
$PAGE->navbar->add($this->strsubmissions);
$PAGE->set_title(format_string($this->assignment->name,true));
$PAGE->set_button( update_module_button($cm->id, $course->id, $this->strassignment));
echo $OUTPUT->header();
$course_context = get_context_instance(CONTEXT_COURSE, $course->id);

View File

@ -72,18 +72,16 @@
$title = $course->shortname . ': ' . format_string($chat->name);
$buttons = '<table><tr><td>'.$OUTPUT->update_module_button($cm->id, $cm->modname).'</td>';
if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) {
$buttons .= '<td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
$buttons = '<table><tr><td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
'<input type="hidden" name="id" value="'.$cm->id.'" />'.
'<input type="hidden" name="edit" value="'.($PAGE->user_is_editing()?'off':'on').'" />'.
'<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td>';
'<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td></tr></table>';
$PAGE->set_button($buttons);
}
$buttons .= '</tr></table>';
$PAGE->set_title($title);
$PAGE->set_heading($course->fullname);
$PAGE->set_button($buttons);
echo $OUTPUT->header();
/// Check to see if groups are being used here

View File

@ -53,7 +53,6 @@
if (!$download) {
$PAGE->navbar->add($strresponses);
$PAGE->set_title(format_string($choice->name).": $strresponses");
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'choice'));
echo $OUTPUT->header();
/// Check to see if groups are being used in this choice
$groupmode = groups_get_activity_groupmode($cm);

View File

@ -43,7 +43,6 @@
}
$PAGE->set_title(format_string($choice->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'choice'));
echo $OUTPUT->header();
/// Submit any new data if there is any

View File

@ -131,7 +131,6 @@ if ($rid) {
}
$PAGE->set_title($data->name);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'data'));
echo $OUTPUT->header();
/// Check to see if groups are being used here

View File

@ -83,7 +83,6 @@ if($mform->is_cancelled()) {
} elseif (!$formdata = (array) $mform->get_data()) {
// build header to match the rest of the UI
$PAGE->set_title($data->name);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'data'));
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($data->name));

View File

@ -1984,7 +1984,6 @@ function data_print_header($course, $cm, $data, $currenttab='') {
global $CFG, $displaynoticegood, $displaynoticebad, $OUTPUT, $PAGE;
$PAGE->set_title($data->name);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'data'));
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($data->name));

View File

@ -91,7 +91,6 @@ $bodytag .= '" ';
$PAGE->navbar->add(get_string($mode,'data'));
$PAGE->requires->js('mod/data/data.js');
$PAGE->set_title($data->name);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'data'));
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($data->name));

View File

@ -282,14 +282,13 @@
// The code will be much nicer than this eventually.
$title = $course->shortname.': ' . format_string($data->name);
$buttons = '<table><tr><td>'.$OUTPUT->update_module_button($cm->id, $cm->modname).'</td>';
if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) {
$buttons .= '<td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
$buttons = '<table><tr><td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
'<input type="hidden" name="id" value="'.$cm->id.'" />'.
'<input type="hidden" name="edit" value="'.($PAGE->user_is_editing()?'off':'on').'" />'.
'<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td>';
'<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td></tr></table>';
$PAGE->set_button($buttons);
}
$buttons .= '</tr></table>';
if ($mode == 'asearch') {
$PAGE->navbar->add(get_string('search'));
@ -297,7 +296,7 @@
$PAGE->set_title($title);
$PAGE->set_heading($course->fullname);
$PAGE->set_button($buttons);
echo $OUTPUT->header();
/// Check to see if groups are being used here

View File

@ -65,7 +65,6 @@ $strfeedback = get_string("modulename", "feedback");
$PAGE->navbar->add(get_string('analysis','feedback'));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
/// print the tabs

View File

@ -73,7 +73,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
$PAGE->navbar->add(format_string($feedback->name));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
/// print the tabs

View File

@ -127,7 +127,6 @@ $strfeedback = get_string("modulename", "feedback");
$PAGE->navbar->add(get_string('feedback:complete', 'feedback'));
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/feedback/complete.php', array('id'=>$cm->id, 'gopage'=>$gopage, 'courseid'=>$course->id)));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
//ishidden check.

View File

@ -131,7 +131,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
$PAGE->navbar->add(format_string($feedback->name));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
//ishidden check. hidden feedbacks except feedbacks on mainsite are only accessible with related capabilities

View File

@ -70,7 +70,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
$PAGE->navbar->add(format_string($feedback->name));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
/// Print the main part of the page

View File

@ -62,7 +62,6 @@
$PAGE->navbar->add(format_string($feedback->name));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
/// Print the main part of the page

View File

@ -87,7 +87,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
$PAGE->navbar->add(format_string($feedback->name));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
/// print the tabs

View File

@ -152,7 +152,6 @@ if ($do_show == 'edit') {
}
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/feedback/edit.php', array('id'=>$cm->id, 'do_show'=>$do_show)));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
/// print the tabs

View File

@ -170,7 +170,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
$PAGE->navbar->add(format_string($feedback->name));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
/// print the tabs
include('tabs.php');

View File

@ -88,7 +88,6 @@
$PAGE->navbar->add(format_string($feedback->name));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
/// Print the main part of the page

View File

@ -77,7 +77,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
$PAGE->navbar->add(format_string($feedback->name));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
include('tabs.php');

View File

@ -46,7 +46,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
$PAGE->navbar->add(format_string($feedback->name));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
/// Print the main part of the page

View File

@ -71,7 +71,6 @@ $strfeedback = get_string("modulename", "feedback");
$PAGE->navbar->add(get_string('show_entries','feedback'));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
include('tabs.php');

View File

@ -72,7 +72,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
$PAGE->navbar->add(format_string($feedback->name));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
/// Print the main part of the page

View File

@ -73,7 +73,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
$PAGE->navbar->add(format_string($feedback->name));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
/// Print the main part of the page

View File

@ -82,7 +82,6 @@ $strfeedback = get_string("modulename", "feedback");
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/feedback/view.php', array('id'=>$cm->id, 'do_show'=>'view')));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
echo $OUTPUT->header();
//ishidden check.

View File

@ -306,3 +306,54 @@ function folder_pluginfile($course, $cminfo, $context, $filearea, $args, $forced
// finally send the file
send_stored_file($file, 86400, 0, $forcedownload);
}
/**
* This function extends the global navigaiton for the site.
* It is important to note that you should not rely on PAGE objects within this
* body of code as there is no guarantee that during an AJAX request they are
* available
*
* @param navigation_node $navigation The folder node within the global navigation
* @param stdClass $course The course object returned from the DB
* @param stdClass $module The module object returned from the DB
* @param stdClass $cm The course module isntance returned from the DB
*/
function folder_extend_navigation($navigation, $course, $module, $cm) {
/**
* This is currently just a stub so that it can be easily expanded upon.
* When expanding just remove this comment and the line below and then add
* you content.
*/
$navigation->nodetype = navigation_node::NODETYPE_LEAF;
}
/**
* This function extends the settings navigation block for the site.
*
* It is safe to rely on PAGE here as we will only ever be within the module
* context when this is called.
*
* @param settings_navigation $settings
* @param stdClass $module
*/
function folder_extend_settings_navigation($settings, $module) {
global $PAGE, $CFG, $DB;
// Load the folder instance from the database
$folder = $DB->get_record('folder', array('id'=>$PAGE->cm->instance));
// Add a folder node to the settings navigation.
$foldernavkey = $settings->add(get_string('folderadministration', 'folder'));
$foldernav = $settings->get($foldernavkey);
$foldernav->forceopen = true;
// If the user has the capability add an update this module link for the folder instance
if (has_capability('moodle/course:manageactivities', $PAGE->cm->context)) {
$url = new moodle_url($CFG->wwwroot.'/course/mod.php', array('update'=>$PAGE->cm->id, 'return'=>true, 'sesskey'=>sesskey()));
$foldernav->add(get_string('updatethis', '', get_string('modulename', 'folder')), $url);
}
// Check if any children have been added. If not remove the node to save on clutter.
if (count($foldernav->children)<1) {
$settings->remove_child($foldernavkey);
}
}

View File

@ -53,7 +53,6 @@ $PAGE->requires->js('mod/folder/functions.js');
$PAGE->set_title($course->shortname.': '.$folder->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_activity_record($folder);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'folder'));
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($folder->name), 2);

View File

@ -103,7 +103,6 @@ if ($confirm and confirm_sesskey()) { // the operation was confirmed.
} else { // the operation has not been confirmed yet so ask the user to do so
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
echo $OUTPUT->header();
$areyousure = "<b>".format_string($entry->concept)."</b><p>$strareyousuredelete</p>";
$linkyes = 'deleteentry.php';

View File

@ -73,7 +73,6 @@ $PAGE->navbar->add($strglossaries, new moodle_url($CFG->wwwroot.'/mod/glossary/i
$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($OUTPUT->update_module_button($cm->id, 'glossary'));
echo $OUTPUT->header();
if ( $hook >0 ) {

View File

@ -52,7 +52,6 @@ $strexportentries = get_string('exportentriestoxml', 'glossary');
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/glossary/export.php', array('id'=>$cm->id)));
$PAGE->navbar->add($strexportentries);
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
echo $OUTPUT->header();
echo $OUTPUT->heading($strexportentries);

View File

@ -68,7 +68,6 @@ $strimportentries = get_string('importentriesfromxml', 'glossary');
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/glossary/import.php', array('id'=>$cm->id, 'mode'=>$mode, 'hook'=>$hook)));
$PAGE->navbar->add($strimportentries);
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
echo $OUTPUT->header();
echo $OUTPUT->heading($strimportentries);

View File

@ -230,7 +230,6 @@ $strwaitingapproval = get_string('waitingapproval', 'glossary');
/// If we are in approval mode, prit special header
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->id));
if (isset($mode)) {
$url->param('mode', $mode);

View File

@ -373,3 +373,54 @@ function imscp_pluginfile($course, $cminfo, $context, $filearea, $args, $forcedo
return false;
}
}
/**
* This function extends the global navigaiton for the site.
* It is important to note that you should not rely on PAGE objects within this
* body of code as there is no guarantee that during an AJAX request they are
* available
*
* @param navigation_node $navigation The imscp node within the global navigation
* @param stdClass $course The course object returned from the DB
* @param stdClass $module The module object returned from the DB
* @param stdClass $cm The course module isntance returned from the DB
*/
function imscp_extend_navigation($navigation, $course, $module, $cm) {
/**
* This is currently just a stub so that it can be easily expanded upon.
* When expanding just remove this comment and the line below and then add
* you content.
*/
$navigation->nodetype = navigation_node::NODETYPE_LEAF;
}
/**
* This function extends the settings navigation block for the site.
*
* It is safe to rely on PAGE here as we will only ever be within the module
* context when this is called.
*
* @param settings_navigation $settings
* @param stdClass $module
*/
function imscp_extend_settings_navigation($settings, $module) {
global $PAGE, $CFG, $DB;
// Load the imscp instance from the database
$imscp = $DB->get_record('imscp', array('id'=>$PAGE->cm->instance));
// Add a imscp node to the settings navigation.
$imscpnavkey = $settings->add(get_string('imscpadministration', 'imscp'));
$imscpnav = $settings->get($imscpnavkey);
$imscpnav->forceopen = true;
// If the user has the capability add an update this module link for the imscp instance
if (has_capability('moodle/course:manageactivities', $PAGE->cm->context)) {
$imscp = new moodle_imscp($CFG->wwwroot.'/course/mod.php', array('update'=>$PAGE->cm->id, 'return'=>true, 'sesskey'=>sesskey()));
$imscpnav->add(get_string('updatethis', '', get_string('modulename', 'imscp')), $imscp);
}
// Check if any children have been added. If not remove the node to save on clutter.
if (count($imscpnav->children)<1) {
$settings->remove_child($imscpnavkey);
}
}

View File

@ -67,7 +67,6 @@ $PAGE->requires->string_for_js('show', 'moodle');
$PAGE->set_title($course->shortname.': '.$imscp->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_activity_record($imscp);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'imscp'));
echo $OUTPUT->header();
// verify imsmanifest was parsed properly

View File

@ -562,19 +562,14 @@ function lesson_menu_block_contents($cmid, $lesson) {
*/
function lesson_add_header_buttons($cm, $context, $extraeditbuttons=false, $lessonpageid=null) {
global $CFG, $PAGE, $OUTPUT;
if (has_capability('mod/lesson:edit', $context)) {
$buttons = $OUTPUT->update_module_button($cm->id, 'lesson');
if ($extraeditbuttons) {
if ($lessonpageid === null) {
print_error('invalidpageid', 'lesson');
}
if (!empty($lessonpageid) && $lessonpageid != LESSON_EOL) {
$options = array('id'=>$cm->id, 'redirect'=>'navigation', 'pageid'=>$lessonpageid);
$buttonform = html_form::make_button($CFG->wwwroot.'/mod/lesson/lesson.php', $options, get_string('editpagecontent', 'lesson'));
$buttons .= $OUTPUT->button($buttonform);
}
$buttons = $OUTPUT->box($buttons, 'edit_buttons');
if (has_capability('mod/lesson:edit', $context) && $extraeditbuttons) {
if ($lessonpageid === null) {
print_error('invalidpageid', 'lesson');
}
if (!empty($lessonpageid) && $lessonpageid != LESSON_EOL) {
$options = array('id'=>$cm->id, 'redirect'=>'navigation', 'pageid'=>$lessonpageid);
$buttonform = html_form::make_button($CFG->wwwroot.'/mod/lesson/lesson.php', $options, get_string('editpagecontent', 'lesson'));
$PAGE->set_button($OUTPUT->button($buttonform));
}
$PAGE->set_button($buttons);
}
}

View File

@ -378,3 +378,55 @@ function page_pluginfile($course, $cminfo, $context, $filearea, $args, $forcedow
// finally send the file
send_stored_file($file, 86400, 0, $forcedownload);
}
/**
* This function extends the global navigaiton for the site.
* It is important to note that you should not rely on PAGE objects within this
* body of code as there is no guarantee that during an AJAX request they are
* available
*
* @param navigation_node $navigation The page node within the global navigation
* @param stdClass $course The course object returned from the DB
* @param stdClass $module The module object returned from the DB
* @param stdClass $cm The course module isntance returned from the DB
*/
function page_extend_navigation($navigation, $course, $module, $cm) {
/**
* This is currently just a stub so that it can be easily expanded upon.
* When expanding just remove this comment and the line below and then add
* you content.
*/
$navigation->nodetype = navigation_node::NODETYPE_LEAF;
}
/**
* This function extends the settings navigation block for the site.
*
* It is safe to rely on PAGE here as we will only ever be within the module
* context when this is called.
*
* @param settings_navigation $settings
* @param stdClass $module
*/
function page_extend_settings_navigation($settings, $module) {
global $PAGE, $CFG, $DB;
// Load the page instance from the database
$page = $DB->get_record('page', array('id'=>$PAGE->cm->instance));
// Add a page node to the settings navigation.
$pagenavkey = $settings->add(get_string('pageadministration', 'page'));
$pagenav = $settings->get($pagenavkey);
$pagenav->forceopen = true;
// If the user has the capability add an update this module link for the page instance
if (has_capability('moodle/course:manageactivities', $PAGE->cm->context)) {
$url = new moodle_url($CFG->wwwroot.'/course/mod.php', array('update'=>$PAGE->cm->id, 'return'=>true, 'sesskey'=>sesskey()));
$pagenav->add(get_string('updatethis', '', get_string('modulename', 'page')), $url);
}
// Check if any children have been added. If not remove the node to save on clutter.
if (count($pagenav->children)<1) {
$settings->remove_child($pagenavkey);
}
}

View File

@ -70,7 +70,6 @@ if ($inpopup and $page->display == RESOURCELIB_DISPLAY_POPUP) {
$PAGE->set_title($course->shortname.': '.$page->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_activity_record($page);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'page'));
echo $OUTPUT->header();
if (!empty($options['printheading'])) {

View File

@ -76,13 +76,8 @@ if (! $course = $DB->get_record('course', array('id' => $quiz->course))) {
require_capability('mod/quiz:manage', $contexts->lowest());
// Print basic page layout.
$strupdatemodule = '';
if (has_capability('moodle/course:manageactivities', $contexts->lowest())) {
$strupdatemodule = $OUTPUT->update_module_button($cm->id, 'quiz');
}
$PAGE->navbar->add($streditingquiz);
$PAGE->set_title($streditingquiz);
$PAGE->set_button($strupdatemodule);
echo $OUTPUT->header();
if (!$quizname = $DB->get_field($cm->modname, 'name', array('id' => $cm->instance))) {

View File

@ -105,7 +105,6 @@
echo $OUTPUT->header();
} else {
$PAGE->set_title(format_string($attemptobj->get_quiz_name()));
$PAGE->set_button($attemptobj->update_module_button());
echo $OUTPUT->header();
}
echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib

View File

@ -315,21 +315,6 @@ class quiz {
}
// Bits of content =====================================================================
/**
* @return string the HTML snipped that needs to be supplied to print_header_simple
* as the $button parameter.
*/
public function update_module_button() {
global $OUTPUT ;
if (has_capability('moodle/course:manageactivities',
get_context_instance(CONTEXT_COURSE, $this->course->id))) {
return $OUTPUT->update_module_button($this->cm->id, 'quiz');
} else {
return '';
}
}
/**
* @param string $title the name of this particular quiz page.

View File

@ -438,17 +438,13 @@ $questionbank->process_actions($thispageurl, $cm);
$questionbankmanagement = '<a href="'.$CFG->wwwroot.
'/question/edit.php?courseid='.$course->id.'">'.
get_string('questionbankmanagement', 'quiz').'</a> ';
$strupdatemodule = has_capability('moodle/course:manageactivities',
$contexts->lowest()) ?
$OUTPUT->update_module_button($cm->id, 'quiz') :
"";
$PAGE->navbar->add($pagetitle);
$PAGE->requires->skip_link_to('questionbank', get_string('skipto', 'access', get_string('questionbank', 'question')));
$PAGE->requires->skip_link_to('quizcontentsblock', get_string('skipto', 'access', get_string('questionsinthisquiz', 'quiz')));
$PAGE->set_title($pagetitle);
$PAGE->set_button($questionbankmanagement.$strupdatemodule);
$PAGE->set_button($questionbankmanagement);
echo $OUTPUT->header();
// Initialise the JavaScript.

View File

@ -28,7 +28,6 @@ class quiz_default_report {
$strquiz = get_string("modulename", "quiz");
/// Print the page header
$PAGE->set_title(format_string($quiz->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'quiz'));
echo $OUTPUT->header();
/// Print the tabs
$currenttab = 'reports';

View File

@ -99,7 +99,6 @@
} else {
$attemptobj->navigation($strreviewtitle);
$PAGE->set_title(format_string($attemptobj->get_quiz_name()));
$PAGE->set_button($attemptobj->update_module_button());
echo $OUTPUT->header();
}
echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib

View File

@ -59,7 +59,6 @@ if ($accessmanager->securewindow_required($attemptobj->is_preview_user())) {
} else {
$attemptobj->navigation($title);
$PAGE->set_title(format_string($attemptobj->get_quiz_name()));
$PAGE->set_button($attemptobj->update_module_button());
echo $OUTPUT->header();
}

View File

@ -72,18 +72,17 @@
// The code will be much nicer than this eventually.
$title = $course->shortname . ': ' . format_string($quiz->name);
$buttons = '<table><tr><td>'.$OUTPUT->update_module_button($cm->id, $cm->modname).'</td>';
if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) {
$buttons .= '<td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
$buttons = '<table><tr><td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
'<input type="hidden" name="id" value="'.$cm->id.'" />'.
'<input type="hidden" name="edit" value="'.($PAGE->user_is_editing()?'off':'on').'" />'.
'<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td>';
'<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td></tr></table>';
$PAGE->set_button($buttons);
}
$buttons .= '</tr></table>';
$PAGE->set_title($title);
$PAGE->set_heading($course->fullname);
$PAGE->set_button($buttons);
echo $OUTPUT->header();
/// Print heading and tabs (if there is more than one).

View File

@ -119,7 +119,6 @@
$PAGE->set_title("$course->shortname: ".format_string($survey->name));
$PAGE->set_heading($course->fullname);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'survey'));
echo $OUTPUT->header();
/// Check to see if groups are being used in this survey

View File

@ -59,7 +59,6 @@
$strsurvey = get_string("modulename", "survey");
$PAGE->set_title(format_string($survey->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'survey'));
echo $OUTPUT->header();
/// Check to see if groups are being used in this survey

View File

@ -286,3 +286,53 @@ function url_get_coursemodule_info($coursemodule) {
return $info;
}
/**
* This function extends the global navigaiton for the site.
* It is important to note that you should not rely on PAGE objects within this
* body of code as there is no guarantee that during an AJAX request they are
* available
*
* @param navigation_node $navigation The url node within the global navigation
* @param stdClass $course The course object returned from the DB
* @param stdClass $module The module object returned from the DB
* @param stdClass $cm The course module isntance returned from the DB
*/
function url_extend_navigation($navigation, $course, $module, $cm) {
/**
* This is currently just a stub so that it can be easily expanded upon.
* When expanding just remove this comment and the line below and then add
* you content.
*/
$navigation->nodetype = navigation_node::NODETYPE_LEAF;
}
/**
* This function extends the settings navigation block for the site.
*
* It is safe to rely on PAGE here as we will only ever be within the module
* context when this is called.
*
* @param settings_navigation $settings
* @param stdClass $module
*/
function url_extend_settings_navigation($settings, $module) {
global $PAGE, $CFG, $DB;
// Load the url instance from the database
$url = $DB->get_record('url', array('id'=>$PAGE->cm->instance));
// Add a url node to the settings navigation.
$urlnavkey = $settings->add(get_string('urladministration', 'url'));
$urlnav = $settings->get($urlnavkey);
$urlnav->forceopen = true;
// If the user has the capability add an update this module link for the url instance
if (has_capability('moodle/course:manageactivities', $PAGE->cm->context)) {
$url = new moodle_url($CFG->wwwroot.'/course/mod.php', array('update'=>$PAGE->cm->id, 'return'=>true, 'sesskey'=>sesskey()));
$urlnav->add(get_string('updatethis', '', get_string('modulename', 'url')), $url);
}
// Check if any children have been added. If not remove the node to save on clutter.
if (count($urlnav->children)<1) {
$settings->remove_child($urlnavkey);
}
}

View File

@ -83,7 +83,6 @@ function url_print_header($url, $cm, $course) {
$PAGE->set_title($course->shortname.': '.$url->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_activity_record($url);
$PAGE->set_button(update_module_button($cm->id, '', get_string('modulename', 'url')));
echo $OUTPUT->header();
}