mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-73354 mod_assign: Overrides page updates to tertiary navigation.
This commit is contained in:
parent
33e6a36daf
commit
1b0fec7f03
5 changed files with 19 additions and 11 deletions
|
@ -44,8 +44,6 @@ class override_actionmenu implements templatable, renderable {
|
|||
protected $currenturl;
|
||||
/** @var \cm_info course module information */
|
||||
protected $cm;
|
||||
/** @var int The activity group mode */
|
||||
protected $groupmode;
|
||||
/** @var bool Can all groups be accessed */
|
||||
protected $canaccessallgroups;
|
||||
/** @var array Groups related to this activity */
|
||||
|
@ -60,8 +58,8 @@ class override_actionmenu implements templatable, renderable {
|
|||
public function __construct(moodle_url $currenturl, \cm_info $cm) {
|
||||
$this->currenturl = $currenturl;
|
||||
$this->cm = $cm;
|
||||
$this->groupmode = groups_get_activity_groupmode($this->cm);
|
||||
$this->canaccessallgroups = ($this->groupmode === NOGROUPS) ||
|
||||
$groupmode = groups_get_activity_groupmode($this->cm);
|
||||
$this->canaccessallgroups = ($groupmode === NOGROUPS) ||
|
||||
has_capability('moodle/site:accessallgroups', $this->cm->context);
|
||||
$this->groups = $this->canaccessallgroups ? groups_get_all_groups($this->cm->course) :
|
||||
groups_get_activity_allowed_groups($this->cm);
|
||||
|
@ -83,15 +81,14 @@ class override_actionmenu implements templatable, renderable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Whether to show groups or not.
|
||||
* Whether to show groups or not. Assignments can be have group overrides if there are groups available in the course.
|
||||
* There is no restriction related to the assignment group setting.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function show_groups(): bool {
|
||||
if ($this->groupmode == NOGROUPS) {
|
||||
return false;
|
||||
}
|
||||
return !empty($this->groups);
|
||||
$groups = groups_get_all_groups($this->cm->course);
|
||||
return !(empty($groups));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -389,6 +389,8 @@ $string['none'] = 'None';
|
|||
$string['noonlinesubmissions'] = 'This assignment does not require you to submit anything online';
|
||||
$string['noopen'] = 'No open date';
|
||||
$string['nooverridedata'] = 'You must override at least one of the assignment settings.';
|
||||
$string['nogroupoverrides'] = 'There are currently no group overrides.';
|
||||
$string['nouseroverrides'] = 'There are currently no user overrides.';
|
||||
$string['nosavebutnext'] = 'Next';
|
||||
$string['nosubmission'] = 'Nothing has been submitted for this assignment';
|
||||
$string['nosubmissionyet'] = 'No submissions have been made yet';
|
||||
|
|
|
@ -98,12 +98,11 @@ class assign_override_form extends moodleform {
|
|||
$assigninstance = $this->assign->get_instance($userid);
|
||||
$inrelativedatesmode = !empty($this->assign->get_course()->relativedatesmode);
|
||||
|
||||
$mform->addElement('header', 'override', get_string('override', 'assign'));
|
||||
|
||||
$assigngroupmode = groups_get_activity_groupmode($cm);
|
||||
$accessallgroups = ($assigngroupmode == NOGROUPS) || has_capability('moodle/site:accessallgroups', $this->context);
|
||||
|
||||
if ($this->groupmode) {
|
||||
$mform->addElement('header', 'override', get_string('groupoverrides', 'assign'));
|
||||
// Group override.
|
||||
if ($this->groupid) {
|
||||
// There is already a groupid, so freeze the selector.
|
||||
|
@ -141,6 +140,7 @@ class assign_override_form extends moodleform {
|
|||
$mform->addRule('groupid', get_string('required'), 'required', null, 'client');
|
||||
}
|
||||
} else {
|
||||
$mform->addElement('header', 'override', get_string('useroverrides', 'assign'));
|
||||
// User override.
|
||||
if ($this->userid) {
|
||||
// There is already a userid, so freeze the selector.
|
||||
|
|
|
@ -257,6 +257,7 @@ $PAGE->navbar->add($pagetitle);
|
|||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_title($pagetitle);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_secondary_active_tab('mod_assign_useroverrides');
|
||||
$activityheader = $PAGE->activityheader;
|
||||
$activityheader->set_attrs([
|
||||
'description' => '',
|
||||
|
|
|
@ -89,6 +89,7 @@ $activityheader->set_attrs([
|
|||
'title' => $activityheader->is_title_allowed() ? format_string($assign->name, true, ['context' => $context]) : ""
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('overrides', 'mod_assign'), 2);
|
||||
$overridemenu = new \mod_assign\output\override_actionmenu($url, $cm);
|
||||
$renderer = $PAGE->get_renderer('mod_assign');
|
||||
echo $renderer->render($overridemenu);
|
||||
|
@ -298,7 +299,14 @@ foreach ($overrides as $override) {
|
|||
echo html_writer::start_tag('div', array('id' => 'assignoverrides'));
|
||||
if (count($table->data)) {
|
||||
echo html_writer::table($table);
|
||||
} else {
|
||||
if ($groupmode) {
|
||||
echo $OUTPUT->notification(get_string('nogroupoverrides', 'mod_assign'), 'info');
|
||||
} else {
|
||||
echo $OUTPUT->notification(get_string('nouseroverrides', 'mod_assign'), 'info');
|
||||
}
|
||||
}
|
||||
|
||||
if ($hasinactive) {
|
||||
echo $OUTPUT->notification(get_string('inactiveoverridehelp', 'assign'), 'dimmed_text');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue