Permalink
Browse files

Merge branch 'w31_MDL-28468_m21_cohortassign' of git://github.com/sko…

…dak/moodle into MOODLE_21_STABLE
  • Loading branch information...
2 parents 2e81c30 + a5410db commit a9fbf9fb878142540ba033facaf940fb078d6df9 Sam Hemelryk committed Aug 8, 2011
Showing with 10 additions and 10 deletions.
  1. +10 −10 cohort/index.php
View
@@ -47,6 +47,7 @@
}
$manager = has_capability('moodle/cohort:manage', $context);
+$canassign = has_capability('moodle/cohort:assign', $context);
if (!$manager) {
require_capability('moodle/cohort:view', $context);
}
@@ -86,18 +87,17 @@
$line[] = get_string('pluginname', $cohort->component);
}
- if ($manager) {
- if (empty($cohort->component)) {
- $buttons = html_writer::link(new moodle_url('/cohort/edit.php', array('id'=>$cohort->id)), get_string('edit'));
- $buttons .= ' '.html_writer::link(new moodle_url('/cohort/edit.php', array('id'=>$cohort->id, 'delete'=>1)), get_string('delete'));
- $buttons .= ' '.html_writer::link(new moodle_url('/cohort/assign.php', array('id'=>$cohort->id)), get_string('assign', 'cohort'));
- } else {
- $buttons = '';
+ $buttons = array();
+ if (empty($cohort->component)) {
+ if ($manager) {
+ $buttons[] = html_writer::link(new moodle_url('/cohort/edit.php', array('id'=>$cohort->id, 'delete'=>1)), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/delete'), 'alt'=>get_string('delete'), 'class'=>'iconsmall')));
+ $buttons[] = html_writer::link(new moodle_url('/cohort/edit.php', array('id'=>$cohort->id)), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/edit'), 'alt'=>get_string('edit'), 'class'=>'iconsmall')));
+ }
+ if ($manager or $canassign) {
+ $buttons[] = html_writer::link(new moodle_url('/cohort/assign.php', array('id'=>$cohort->id)), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('i/users'), 'alt'=>get_string('assign', 'core_cohort'), 'class'=>'iconsmall')));
}
- } else {
- $buttons = '';
}
- $line[] = $buttons;
+ $line[] = implode(' ', $buttons);
$data[] = $line;
}

0 comments on commit a9fbf9f

Please sign in to comment.