MDL-21781 integrating cohorts into UI - admin tree and list of categories in edit mode (there is no other better place which shows all categories imho)
This commit is contained in:
@@ -12,7 +12,9 @@ if ($hassiteconfig
|
||||
or has_capability('moodle/user:update', $systemcontext)
|
||||
or has_capability('moodle/user:delete', $systemcontext)
|
||||
or has_capability('moodle/role:manage', $systemcontext)
|
||||
or has_capability('moodle/role:assign', $systemcontext)) { // speedup for non-admins, add all caps used on this page
|
||||
or has_capability('moodle/role:assign', $systemcontext)
|
||||
or has_capability('moodle/cohort:manage', $systemcontext)
|
||||
or has_capability('moodle/cohort:view', $systemcontext)) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
|
||||
$temp = new admin_settingpage('manageauths', get_string('authsettings', 'admin'));
|
||||
@@ -75,6 +77,7 @@ if ($hassiteconfig
|
||||
$ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers'), "$CFG->wwwroot/$CFG->admin/uploaduser.php", 'moodle/site:uploadusers'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('uploadpictures', get_string('uploadpictures','admin'), "$CFG->wwwroot/$CFG->admin/uploadpicture.php", 'moodle/site:uploadusers'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('cohorts', get_string('cohorts', 'cohort'), $CFG->wwwroot . '/cohort/index.php', array('moodle/cohort:manage', 'moodle/cohort:view')));
|
||||
|
||||
|
||||
// stuff under the "roles" subcategory
|
||||
|
||||
+7
-7
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
require('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$contextid = optional_param('contextid', 0, PARAM_INT);
|
||||
|
||||
@@ -50,18 +51,17 @@ if (!$manager) {
|
||||
require_capability('moodle/cohort:view', $context);
|
||||
}
|
||||
|
||||
// TODO: use admin_external_page in system context
|
||||
|
||||
$strcohorts = get_string('cohorts', 'cohort');
|
||||
|
||||
$PAGE->set_url('/cohort/index.php', array('contextid'=>$context->id));
|
||||
$PAGE->set_title($strcohorts);
|
||||
$PAGE->set_context($context);
|
||||
|
||||
if ($category) {
|
||||
$PAGE->set_url('/cohort/index.php', array('contextid'=>$context->id));
|
||||
$PAGE->set_title($strcohorts);
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->navbar->add($category->name, new moodle_url('/course/index.php', array('categoryedit'=>'1')));
|
||||
$PAGE->navbar->add($strcohorts);
|
||||
} else {
|
||||
admin_externalpage_setup('cohorts');
|
||||
}
|
||||
$PAGE->navbar->add($strcohorts);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
|
||||
@@ -295,6 +295,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
|
||||
$str->edit = get_string('editthiscategory');
|
||||
$str->hide = get_string('hide');
|
||||
$str->show = get_string('show');
|
||||
$str->cohorts = get_string('cohorts', 'cohort');
|
||||
$str->spacer = '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" class="iconsmall" alt="" /> ';
|
||||
}
|
||||
|
||||
@@ -333,6 +334,11 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
|
||||
' src="'.$OUTPUT->pix_url('t/show') . '" class="iconsmall" alt="'.$str->show.'" /></a> ';
|
||||
}
|
||||
|
||||
if (has_capability('moodle/cohort:manage', $category->context) or has_capability('moodle/cohort:view', $category->context)) {
|
||||
echo '<a title="'.$str->cohorts.'" href="'.$CFG->wwwroot.'/cohort/index.php?contextid='.$category->context->id.'"><img'.
|
||||
' src="'.$OUTPUT->pix_url('i/cohort') . '" class="iconsmall" alt="'.$str->cohorts.'" /></a> ';
|
||||
}
|
||||
|
||||
if ($up) {
|
||||
echo '<a title="'.$str->moveup.'" href="index.php?moveup='.$category->id.'&sesskey='.sesskey().'"><img'.
|
||||
' src="'.$OUTPUT->pix_url('t/up') . '" class="iconsmall" alt="'.$str->moveup.'" /></a> ';
|
||||
|
||||
Reference in New Issue
Block a user