Skip to content

Commit

Permalink
mod MDL-21169 Removed update this module button and ensured there was…
Browse files Browse the repository at this point in the history
… a link in the settings block for it.
  • Loading branch information
Sam Hemelryk committed Dec 23, 2009
1 parent 0a1f8f8 commit 92059c7
Show file tree
Hide file tree
Showing 53 changed files with 228 additions and 92 deletions.
1 change: 1 addition & 0 deletions lang/en_utf8/folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
1 change: 1 addition & 0 deletions lang/en_utf8/imscp.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$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';
Expand Down
1 change: 1 addition & 0 deletions lang/en_utf8/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
$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)';
Expand Down
1 change: 1 addition & 0 deletions lang/en_utf8/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@
$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';
2 changes: 0 additions & 2 deletions mod/assignment/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ function view_header($subpage='') {

$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();

Expand Down Expand Up @@ -1126,7 +1125,6 @@ function display_submissions($message='') {
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);
Expand Down
8 changes: 3 additions & 5 deletions mod/chat/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion mod/choice/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion mod/choice/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion mod/data/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
}

$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
Expand Down
1 change: 0 additions & 1 deletion mod/data/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
} 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));

Expand Down
1 change: 0 additions & 1 deletion mod/data/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
1 change: 0 additions & 1 deletion mod/data/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
$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));

Expand Down
9 changes: 4 additions & 5 deletions mod/data/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,22 +282,21 @@
// 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'));
}

$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
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/analysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@

$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
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/analysis_course.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,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 tabs
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/complete.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
$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.
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/complete_guest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,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();

//ishidden check. hidden feedbacks except feedbacks on mainsite are only accessible with related capabilities
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/delete_completed.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,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
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/delete_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/delete_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,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 tabs
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
}
$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
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/edit_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,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 tabs
include('tabs.php');
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/mapcourse.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,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();

include('tabs.php');
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/print.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,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
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/show_entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@

$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');
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/show_entries_anonym.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,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
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/use_templ.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,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
Expand Down
1 change: 0 additions & 1 deletion mod/feedback/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@

$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.
Expand Down
51 changes: 51 additions & 0 deletions mod/folder/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
1 change: 0 additions & 1 deletion mod/folder/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
$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);
Expand Down
1 change: 0 additions & 1 deletion mod/glossary/deleteentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@

} 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';
Expand Down
1 change: 0 additions & 1 deletion mod/glossary/editcategories.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
$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 ) {
Expand Down
1 change: 0 additions & 1 deletion mod/glossary/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
$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);
Expand Down
1 change: 0 additions & 1 deletion mod/glossary/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
$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);
Expand Down
1 change: 0 additions & 1 deletion mod/glossary/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@

/// 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);
Expand Down
Loading

0 comments on commit 92059c7

Please sign in to comment.