$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
-//
-// TODO navigation will be changed yet for Moodle 2.0
-$navigation = build_navigation(get_string('allocation', 'workshop'), $cm);
+$PAGE->navbar->add(get_string('allocation', 'workshop'));
$allocator = $workshop->allocator_instance($method);
$initresult = $allocator->init();
// Output starts here
//
$wsoutput = $PAGE->theme->get_renderer('mod_workshop', $PAGE);
-echo $OUTPUT->header($navigation);
+echo $OUTPUT->header();
$allocators = $workshop->installed_allocators();
$tabrow = array();
$PAGE->set_url($workshop->previewform_url());
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
+ $PAGE->navbar->add(get_string('editingassessmentform', 'workshop'), null, null, navigation_node::TYPE_CUSTOM,
+ $workshop->editform_url());
+ $PAGE->navbar->add(get_string('previewassessmentform', 'workshop'));
} elseif ('assessment' == $mode) {
if (!has_any_capability(array('mod/workshop:peerassess', 'mod/workshop:assessallsubmissions'), $PAGE->context)) {
$PAGE->set_url($workshop->assess_url($assessment->id));
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
+ $PAGE->navbar->add(get_string('assessingsubmission', 'workshop'));
}
-// build the navigation and the header - todo this will be changed by the new navigation api
-$navlinks = array();
-$navlinks[] = array('name' => get_string('modulenameplural', 'workshop'),
- 'link' => "index.php?id=$course->id",
- 'type' => 'activity');
-$navlinks[] = array('name' => format_string($workshop->name),
- 'link' => "view.php?id=$cm->id",
- 'type' => 'activityinstance');
-if ($mode == 'preview') {
- $navlinks[] = array('name' => get_string('editingassessmentform', 'workshop'),
- 'link' => $workshop->editform_url()->out(),
- 'type' => 'title');
- $navlinks[] = array('name' => get_string('previewassessmentform', 'workshop'),
- 'link' => '',
- 'type' => 'title');
-} elseif ($mode == 'assessment') {
- $navlinks[] = array('name' => get_string('assessingsubmission', 'workshop'),
- 'link' => '',
- 'type' => 'title');
-}
-$navigation = build_navigation($navlinks);
-
// load the grading strategy logic
$strategy = $workshop->grading_strategy_instance();
}
$rawgrade = $strategy->save_assessment($assessment, $data);
if (!is_null($rawgrade) and isset($data->saveandclose)) {
- echo $OUTPUT->header($navigation);
+ echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('assessmentresult', 'workshop'), 2);
echo $OUTPUT->box('Given grade: ' . sprintf("%01.2f", $rawgrade * 100) . ' %'); // todo more detailed info using own renderer
echo $OUTPUT->continue_button($workshop->view_url());
// Output starts here
-echo $OUTPUT->header($navigation);
+echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('assessmentform', 'workshop'), 2);
if ('assessment' === $mode) {
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'workshop'));
+$PAGE->navbar->add('Development tools');
$wsoutput = $PAGE->theme->get_renderer('mod_workshop', $PAGE);
-$navigation = build_navigation('Development tools', $cm);
-// todo $menu = navmenu($course, $cm);
-
switch ($tool) {
case 'mksubmissions':
$authors = $workshop->get_peer_authors(false);
$authorswithsubmission = $workshop->get_peer_authors(true);
$authors = array_diff_key($authors, $authorswithsubmission);
- echo $OUTPUT->header($navigation);
+ echo $OUTPUT->header();
$c = 0; // counter
foreach ($authors as $authorid => $author) {
$timenow = time() - rand(0, 60 * 60 * 24 * 7); // submitted sometimes during last week
case 'menu':
// no break, skip to default
default:
- echo $OUTPUT->header($navigation);
+ echo $OUTPUT->header();
echo $OUTPUT->heading('Workshop development tools', 1);
echo '<ul>';
echo '<li><a href="' . $PAGE->url->out(false, array('tool' => 'mksubmissions')) . '">Fake submissions</a></li>';
$PAGE->set_url($workshop->editform_url());
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
+$PAGE->navbar->add(get_string('editingassessmentform', 'workshop'));
// load the grading strategy logic
$strategy = $workshop->grading_strategy_instance();
add_to_log($course->id, 'workshop', 'view all', "index.php?id=$course->id", '');
-/// Print the header
-
$PAGE->set_url('mod/workshop/view.php', array('id' => $id));
$PAGE->set_title($course->fullname);
$PAGE->set_heading($course->shortname);
+$PAGE->navbar->add(get_string('modulenameplural', 'workshop'));
-// todo navigation will be changed yet for Moodle 2.0
-$navlinks = array();
-$navlinks[] = array('name' => get_string('modulenameplural', 'workshop'),
- 'link' => '',
- 'type' => 'activity');
-$navigation = build_navigation($navlinks);
+/// Output starts here
-echo $OUTPUT->header($navigation);
+echo $OUTPUT->header();
/// Get all the appropriate data
defined('MOODLE_INTERNAL') || die();
+$string[''] = '';
$string['accesscontrol'] = 'Access control';
$string['agreeassessments'] = 'Assessments must be agreed';
$string['agreeassessmentsdesc'] = 'Authors may comment assessments of their work and agree/disagree with it';
-$string['allocation'] = 'Submission allocation';
+$string['allocate'] = 'Allocate submissions';
$string['allocationdone'] = 'Allocation done';
$string['allocationerror'] = 'Allocation error';
+$string['allocation'] = 'Submission allocation';
$string['areadimensiondescription'] = 'Assessment form fields';
$string['areasubmissionattachment'] = 'Submission attachments';
$string['areasubmissioncontent'] = 'Submission texts';
$string['confignexassessments'] = 'Default number of examples to be reviewed by a user in the example assessment phase';
$string['confignsassessments'] = 'Default number of allocated submissions to be reviewed by a user in the assessment phase';
$string['configstrategy'] = 'Default grading strategy for workshops';
+$string['editassessmentform'] = 'Edit assessment form';
$string['editingassessmentform'] = 'Editing assessment form';
$string['editingsubmission'] = 'Editing submission';
$string['editsubmission'] = 'Edit submission';
$string['messageclose'] = '(hide)';
$string['modulenameplural'] = 'Workshops';
$string['modulename'] = 'Workshop';
+$string['mysubmission'] = 'My submission';
$string['nattachments'] = 'Maximum number of submission attachments';
$string['nexassessments'] = 'Number of required assessments of examples';
$string['nogradeyet'] = 'No grade yet';
$string['useselfassessmentdesc'] = 'Users perform self assessment of their own work';
$string['useselfassessment'] = 'Use self assessment';
$string['withoutsubmission'] = 'Warning - reviewer without own submission';
+$string['workshopadministration'] = 'Workshop administration';
$string['workshopfeatures'] = 'Workshop features';
$string['workshopname'] = 'Workshop name';
}
}
+/**
+ * Extends the global navigation tree by adding workshop nodes if there is a relevant content
+ *
+ * @param navigation_node $navref An object representing the navigation tree node of the workshop module instance
+ * @param stdClass $course
+ * @param stdClass $module
+ * @param stdClass $cm
+ */
+function workshop_extend_navigation(navigation_node $navref, stdClass $course, stdClass $module, stdClass $cm) {
+ global $CFG;
+
+ if (has_capability('mod/workshop:submit', $cm->context)) {
+ $url = new moodle_url($CFG->wwwroot.'/mod/workshop/submission.php', array('cmid' => $cm->id));
+ $mysubmissionkey = $navref->add(get_string('mysubmission', 'workshop'), null, null, navigation_node::TYPE_CUSTOM, $url);
+ }
+}
+
+/**
+ * Extends the settings navigation with the Workshop settings
+
+ * This function is called when the context for the page is a workshop module.
+ *
+ * @param settings_navigation $settingsnav {@link settings_navigation}
+ * @param stdClass $module
+ * @return void|mixed The key to the modules branch
+ */
+function workshop_extend_settings_navigation(settings_navigation $settingsnav, stdClass $module=null) {
+ global $CFG, $PAGE;
+
+ $workshopkey = $settingsnav->add(get_string('workshopadministration', 'workshop'));
+ $workshopnode = $settingsnav->get($workshopkey);
+ $workshopnode->forceopen = true;
+ //$workshopobject = $DB->get_record("workshop", array("id" => $PAGE->cm->instance));
+
+ if (has_capability('mod/workshop:editdimensions', $PAGE->context)) {
+ $url = new moodle_url($CFG->wwwroot . '/mod/workshop/editform.php', array('cmid' => $PAGE->cm->id));
+ $workshopnode->add(get_string('editassessmentform', 'workshop'), null, null, settings_navigation::TYPE_SETTING, $url);
+ }
+ if (has_capability('mod/workshop:allocate', $PAGE->context)) {
+ $url = new moodle_url($CFG->wwwroot . '/mod/workshop/allocation.php', array('cmid' => $PAGE->cm->id));
+ $workshopnode->add(get_string('allocate', 'workshop'), null, null, settings_navigation::TYPE_SETTING, $url);
+ }
+}
+
+
+
////////////////////////////////////////////////////////////////////////////////
// Other functions needed by Moodle core follows. They can't be put into //
// locallib.php because they are used by some core scripts (like modedit.php) //
return new moodle_url($CFG->wwwroot . '/mod/workshop/assessment.php', array('asid' => $assessmentid));
}
+ /**
+ * @return stdClass {@link moodle_url} the URL of the page to view own submission
+ */
+ public function submission_url() {
+ global $CFG;
+ return new moodle_url($CFG->wwwroot . '/mod/workshop/submission.php', array('cmid' => $this->cm->id));
+ }
+
/**
* Returns an object containing all data to display the user's full name and picture
*
$PAGE->set_url('mod/workshop/submission.php', array('cmid' => $cm->id));
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
+// the default navbar node for non-editing mode is set in {@link workshop_extend_navigation()}
+if ($edit) {
+ $PAGE->navbar->add(get_string('mysubmission', 'workshop'), null, null, navigation_node::TYPE_CUSTOM,
+ $workshop->submission_url());
+ $PAGE->navbar->add(get_string('editingsubmission', 'workshop'));
+}
// Output starts here
-$stredit = empty($submission->id) ? get_string('editingsubmission', 'workshop') : get_string('edit');
-$navigation = build_navigation($stredit, $cm);
-echo $OUTPUT->header($navigation);
+echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($workshop->name), 2);
if ($edit) {
$buttons[] = $OUTPUT->update_module_button($cm->id, 'workshop');
$PAGE->set_button(implode('', $buttons));
-// todo navigation will be changed yet for Moodle 2.0
-$navlinks = array();
-$navlinks[] = array('name' => get_string('modulenameplural', 'workshop'),
- 'link' => "index.php?id=$course->id",
- 'type' => 'activity');
-$navlinks[] = array('name' => format_string($workshop->name),
- 'link' => '',
- 'type' => 'activityinstance');
-$navigation = build_navigation($navlinks);
-//$menu = navmenu($course, $cm); todo
-
/// Output starts here
-echo $OUTPUT->header($navigation);
+echo $OUTPUT->header();
/// Print the main part of the page - todo these are just links to help during development
echo $OUTPUT->box_start();