mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-73354 mod_assign: General tidy up of tertiary navigation.
This commit is contained in:
parent
5897242361
commit
33e6a36daf
5 changed files with 28 additions and 99 deletions
|
@ -286,6 +286,12 @@ class renderer extends \plugin_renderer_base {
|
|||
$o = '';
|
||||
$o .= $this->output->container_start('gradingsummary');
|
||||
$o .= $this->output->heading(get_string('gradingsummary', 'assign'), 3);
|
||||
|
||||
if (isset($summary->cm)) {
|
||||
$currenturl = new \moodle_url('/mod/assign/view.php', array('id' => $summary->cm->id));
|
||||
$o .= groups_print_activity_menu($summary->cm, $currenturl->out(), true);
|
||||
}
|
||||
|
||||
$o .= $this->output->box_start('boxaligncenter gradingsummarytable');
|
||||
$t = new \html_table();
|
||||
$t->attributes['class'] = 'generaltable table-bordered';
|
||||
|
@ -844,86 +850,6 @@ class renderer extends \plugin_renderer_base {
|
|||
$o .= \html_writer::table($t);
|
||||
$o .= $this->output->box_end();
|
||||
|
||||
// Links.
|
||||
if ($status->view == assign_submission_status::STUDENT_VIEW) {
|
||||
if ($status->canedit) {
|
||||
if (!$submission || $submission->status == ASSIGN_SUBMISSION_STATUS_NEW) {
|
||||
$o .= $this->output->box_start('generalbox submissionaction');
|
||||
$urlparams = array('id' => $status->coursemoduleid, 'action' => 'editsubmission');
|
||||
|
||||
if ($timelimitenabled && empty($submission->timestarted)) {
|
||||
$confirmation = new \confirm_action(
|
||||
get_string(
|
||||
'confirmstart',
|
||||
'assign',
|
||||
format_time($status->timelimit)
|
||||
),
|
||||
null,
|
||||
get_string('beginassignment', 'assign')
|
||||
);
|
||||
$o .= $this->output->action_link(
|
||||
new \moodle_url('/mod/assign/view.php', $urlparams),
|
||||
get_string('beginassignment', 'assign'),
|
||||
$confirmation,
|
||||
array('class' => 'btn btn-primary')
|
||||
);
|
||||
} else {
|
||||
$o .= $this->output->single_button(
|
||||
new \moodle_url('/mod/assign/view.php', $urlparams),
|
||||
get_string('addsubmission', 'assign'), 'get', array('primary' => true)
|
||||
);
|
||||
}
|
||||
|
||||
$o .= $this->output->box_start('boxaligncenter submithelp');
|
||||
$o .= get_string('addsubmission_help', 'assign');
|
||||
$o .= $this->output->box_end();
|
||||
$o .= $this->output->box_end();
|
||||
} else if ($submission->status == ASSIGN_SUBMISSION_STATUS_REOPENED) {
|
||||
$o .= $this->output->box_start('generalbox submissionaction');
|
||||
$urlparams = array('id' => $status->coursemoduleid,
|
||||
'action' => 'editprevioussubmission',
|
||||
'sesskey'=>sesskey());
|
||||
$o .= $this->output->single_button(new \moodle_url('/mod/assign/view.php', $urlparams),
|
||||
get_string('addnewattemptfromprevious', 'assign'), 'get');
|
||||
$o .= $this->output->box_start('boxaligncenter submithelp');
|
||||
$o .= get_string('addnewattemptfromprevious_help', 'assign');
|
||||
$o .= $this->output->box_end();
|
||||
$o .= $this->output->box_end();
|
||||
$o .= $this->output->box_start('generalbox submissionaction');
|
||||
$urlparams = array('id' => $status->coursemoduleid, 'action' => 'editsubmission');
|
||||
$o .= $this->output->single_button(new \moodle_url('/mod/assign/view.php', $urlparams),
|
||||
get_string('addnewattempt', 'assign'), 'get');
|
||||
$o .= $this->output->box_start('boxaligncenter submithelp');
|
||||
$o .= get_string('addnewattempt_help', 'assign');
|
||||
$o .= $this->output->box_end();
|
||||
$o .= $this->output->box_end();
|
||||
} else {
|
||||
$o .= $this->output->box_start('generalbox submissionaction');
|
||||
$urlparams = array('id' => $status->coursemoduleid, 'action' => 'editsubmission');
|
||||
$o .= $this->output->single_button(new \moodle_url('/mod/assign/view.php', $urlparams),
|
||||
get_string('editsubmission', 'assign'), 'get');
|
||||
$urlparams = array('id' => $status->coursemoduleid, 'action' => 'removesubmissionconfirm');
|
||||
$o .= $this->output->single_button(new \moodle_url('/mod/assign/view.php', $urlparams),
|
||||
get_string('removesubmission', 'assign'), 'get');
|
||||
$o .= $this->output->box_start('boxaligncenter submithelp');
|
||||
$o .= get_string('editsubmission_help', 'assign');
|
||||
$o .= $this->output->box_end();
|
||||
$o .= $this->output->box_end();
|
||||
}
|
||||
}
|
||||
|
||||
if ($status->cansubmit) {
|
||||
$urlparams = array('id' => $status->coursemoduleid, 'action'=>'submit');
|
||||
$o .= $this->output->box_start('generalbox submissionaction');
|
||||
$o .= $this->output->single_button(new \moodle_url('/mod/assign/view.php', $urlparams),
|
||||
get_string('submitassignment', 'assign'), 'get');
|
||||
$o .= $this->output->box_start('boxaligncenter submithelp');
|
||||
$o .= get_string('submitassignment_help', 'assign');
|
||||
$o .= $this->output->box_end();
|
||||
$o .= $this->output->box_end();
|
||||
}
|
||||
}
|
||||
|
||||
$o .= $this->output->container_end();
|
||||
return $o;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ class user_submission_actionmenu implements templatable, renderable {
|
|||
$data['edit']['help'] = $newattempthelp->export_for_template($output);
|
||||
}
|
||||
if ($status === ASSIGN_SUBMISSION_STATUS_NEW) {
|
||||
$newattemptbutton = new single_button($url, get_string('addsubmission', 'mod_assign'), 'get');
|
||||
$newattemptbutton = new single_button($url, get_string('addsubmission', 'mod_assign'), 'get', true);
|
||||
$data['edit']['button'] = $newattemptbutton->export_for_template($output);
|
||||
$data['edit']['help'] = '';
|
||||
}
|
||||
|
|
|
@ -442,15 +442,6 @@ function assign_extend_settings_navigation(settings_navigation $settings, naviga
|
|||
$navref->add_node($node, $beforekey);
|
||||
}
|
||||
|
||||
// Link to gradebook.
|
||||
if (has_capability('gradereport/grader:view', $cm->context) &&
|
||||
has_capability('moodle/grade:viewall', $cm->context)) {
|
||||
$link = new moodle_url('/grade/report/grader/index.php', array('id' => $course->id));
|
||||
$linkname = get_string('viewgradebook', 'assign');
|
||||
$node = $navref->add($linkname, $link, navigation_node::TYPE_SETTING);
|
||||
$node->set_force_into_more_menu(true);
|
||||
}
|
||||
|
||||
if (has_capability('mod/assign:revealidentities', $context)) {
|
||||
$dbparams = array('id'=>$cm->instance);
|
||||
$assignment = $DB->get_record('assign', $dbparams, 'blindmarking, revealidentities');
|
||||
|
|
|
@ -4521,7 +4521,7 @@ class assign {
|
|||
* @return string
|
||||
*/
|
||||
protected function view_grading_table() {
|
||||
global $USER, $CFG, $SESSION;
|
||||
global $USER, $CFG, $SESSION, $PAGE;
|
||||
|
||||
// Include grading options form.
|
||||
require_once($CFG->dirroot . '/mod/assign/gradingoptionsform.php');
|
||||
|
@ -4563,6 +4563,7 @@ class assign {
|
|||
|
||||
$gradingactions = new url_select($links);
|
||||
$gradingactions->set_label(get_string('choosegradingaction', 'assign'));
|
||||
$gradingactions->class .= ' mb-1';
|
||||
|
||||
$gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions');
|
||||
|
||||
|
@ -4643,6 +4644,7 @@ class assign {
|
|||
$buttons = new \mod_assign\output\grading_actionmenu($this->get_course_module()->id);
|
||||
$actionformtext = $this->get_renderer()->render($buttons);
|
||||
$actionformtext .= $this->get_renderer()->render($gradingactions);
|
||||
$PAGE->activityheader->set_attrs(['hidecompletion' => true]);
|
||||
|
||||
$currenturl = new moodle_url('/mod/assign/view.php', ['id' => $this->get_course_module()->id, 'action' => 'grading']);
|
||||
|
||||
|
@ -4651,11 +4653,14 @@ class assign {
|
|||
false,
|
||||
$this->get_course_module()->id,
|
||||
get_string('grading', 'assign'),
|
||||
$actionformtext,
|
||||
'',
|
||||
'',
|
||||
$currenturl);
|
||||
$o .= $this->get_renderer()->render($header);
|
||||
|
||||
$o .= $actionformtext;
|
||||
|
||||
$o .= $this->get_renderer()->heading(get_string('gradeitem:submissions', 'mod_assign'), 2);
|
||||
|
||||
$o .= groups_print_activity_menu($this->get_course_module(), $currenturl, true);
|
||||
|
||||
|
@ -4924,6 +4929,8 @@ class assign {
|
|||
$bc->content = $navbc;
|
||||
$PAGE->blocks->add_fake_block($bc, reset($regions));
|
||||
}
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
$o .= $this->get_renderer()->render(
|
||||
new assign_header($this->get_instance(),
|
||||
$this->get_context(),
|
||||
|
@ -5835,7 +5842,8 @@ class assign {
|
|||
$course->relativedatesmode,
|
||||
$course->startdate,
|
||||
$this->can_grade(),
|
||||
$isvisible
|
||||
$isvisible,
|
||||
$this->get_course_module()
|
||||
);
|
||||
} else {
|
||||
// The active group has already been updated in groups_print_activity_menu().
|
||||
|
@ -5856,7 +5864,8 @@ class assign {
|
|||
$course->relativedatesmode,
|
||||
$course->startdate,
|
||||
$this->can_grade(),
|
||||
$isvisible
|
||||
$isvisible,
|
||||
$this->get_course_module()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -5922,10 +5931,6 @@ class assign {
|
|||
$actionbuttons = new \mod_assign\output\actionmenu($this->get_course_module()->id);
|
||||
$o .= $this->get_renderer()->submission_actionmenu($actionbuttons);
|
||||
|
||||
// Group selector will only be displayed if necessary.
|
||||
$currenturl = new moodle_url('/mod/assign/view.php', array('id' => $this->get_course_module()->id));
|
||||
$o .= groups_print_activity_menu($this->get_course_module(), $currenturl->out(), true);
|
||||
|
||||
$summary = $this->get_assign_grading_summary_renderable();
|
||||
$o .= $this->get_renderer()->render($summary);
|
||||
}
|
||||
|
@ -8207,6 +8212,8 @@ class assign {
|
|||
$requiresubmissionstatement = false;
|
||||
}
|
||||
|
||||
$mform->addElement('header', 'submission header', get_string('addsubmission', 'mod_assign'));
|
||||
|
||||
// Only show submission statement if we are editing our own submission.
|
||||
if ($requiresubmissionstatement && !$draftsenabled && $userid == $USER->id) {
|
||||
$mform->addElement('checkbox', 'submissionstatement', '', $submissionstatement);
|
||||
|
|
|
@ -541,6 +541,8 @@ class assign_grading_summary implements renderable {
|
|||
public $cangrade = false;
|
||||
/** @var boolean isvisible - Is the assignment's context module visible to students? */
|
||||
public $isvisible = true;
|
||||
/** @var cm_info $cm - The course module object. */
|
||||
public $cm = null;
|
||||
|
||||
/** @var string no warning needed about group submissions */
|
||||
const WARN_GROUPS_NO = false;
|
||||
|
@ -568,6 +570,7 @@ class assign_grading_summary implements renderable {
|
|||
* @param int $coursestartdate unix timestamp representation of the course start date.
|
||||
* @param bool $cangrade
|
||||
* @param bool $isvisible
|
||||
* @param cm_info $cm The course module object.
|
||||
*/
|
||||
public function __construct($participantcount,
|
||||
$submissiondraftsenabled,
|
||||
|
@ -584,7 +587,8 @@ class assign_grading_summary implements renderable {
|
|||
$courserelativedatesmode,
|
||||
$coursestartdate,
|
||||
$cangrade = true,
|
||||
$isvisible = true) {
|
||||
$isvisible = true,
|
||||
cm_info $cm = null) {
|
||||
$this->participantcount = $participantcount;
|
||||
$this->submissiondraftsenabled = $submissiondraftsenabled;
|
||||
$this->submissiondraftscount = $submissiondraftscount;
|
||||
|
@ -601,6 +605,7 @@ class assign_grading_summary implements renderable {
|
|||
$this->coursestartdate = $coursestartdate;
|
||||
$this->cangrade = $cangrade;
|
||||
$this->isvisible = $isvisible;
|
||||
$this->cm = $cm;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue