Skip to content

Commit

Permalink
Merge branch 'wip-MDL-50191-m28' of https://github.com/marinaglancy/m…
Browse files Browse the repository at this point in the history
…oodle into MOODLE_28_STABLE
  • Loading branch information
stronk7 committed May 26, 2015
2 parents b6e389b + a5dcc1b commit 02ee1ef
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions cohort/index.php
Expand Up @@ -118,6 +118,7 @@
echo $OUTPUT->paging_bar($cohorts['totalcohorts'], $page, 25, $baseurl);

$data = array();
$editcolumnisempty = true;
foreach($cohorts['cohorts'] as $cohort) {
$line = array();
$cohortcontext = context::instance_by_id($cohort->contextid);
Expand Down Expand Up @@ -148,27 +149,29 @@

$urlparams = array('id' => $cohort->id, 'returnurl' => $baseurl->out_as_local_url());
$showhideurl = new moodle_url('/cohort/edit.php', $urlparams + array('sesskey' => sesskey()));
if ($cohort->visible) {
$showhideurl->param('hide', 1);
$visibleimg = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/hide'), 'alt' => get_string('hide'), 'class' => 'iconsmall'));
$buttons[] = html_writer::link($showhideurl, $visibleimg, array('title' => get_string('hide')));
} else {
$showhideurl->param('show', 1);
$visibleimg = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/show'), 'alt' => get_string('show'), 'class' => 'iconsmall'));
$buttons[] = html_writer::link($showhideurl, $visibleimg, array('title' => get_string('show')));
}
if ($cohortmanager) {
if ($cohort->visible) {
$showhideurl->param('hide', 1);
$visibleimg = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/hide'), 'alt' => get_string('hide'), 'class' => 'iconsmall'));
$buttons[] = html_writer::link($showhideurl, $visibleimg, array('title' => get_string('hide')));
} else {
$showhideurl->param('show', 1);
$visibleimg = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/show'), 'alt' => get_string('show'), 'class' => 'iconsmall'));
$buttons[] = html_writer::link($showhideurl, $visibleimg, array('title' => get_string('show')));
}
$buttons[] = html_writer::link(new moodle_url('/cohort/edit.php', $urlparams + array('delete' => 1)),
html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/delete'), 'alt' => get_string('delete'), 'class' => 'iconsmall')),
array('title' => get_string('delete')));
$buttons[] = html_writer::link(new moodle_url('/cohort/edit.php', $urlparams),
html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/edit'), 'alt' => get_string('edit'), 'class' => 'iconsmall')),
array('title' => get_string('edit')));
$editcolumnisempty = false;
}
if ($cohortcanassign) {
$buttons[] = html_writer::link(new moodle_url('/cohort/assign.php', $urlparams),
html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/users'), 'alt' => get_string('assign', 'core_cohort'), 'class' => 'iconsmall')),
array('title' => get_string('assign', 'core_cohort')));
$editcolumnisempty = false;
}
}
$line[] = implode(' ', $buttons);
Expand All @@ -180,12 +183,21 @@
}
$table = new html_table();
$table->head = array(get_string('name', 'cohort'), get_string('idnumber', 'cohort'), get_string('description', 'cohort'),
get_string('memberscount', 'cohort'), get_string('component', 'cohort'), get_string('edit'));
$table->colclasses = array('leftalign name', 'leftalign id', 'leftalign description', 'leftalign size','centeralign source', 'centeralign action');
get_string('memberscount', 'cohort'), get_string('component', 'cohort'));
$table->colclasses = array('leftalign name', 'leftalign id', 'leftalign description', 'leftalign size','centeralign source');
if ($showall) {
array_unshift($table->head, get_string('category'));
array_unshift($table->colclasses, 'leftalign category');
}
if (!$editcolumnisempty) {
$table->head[] = get_string('edit');
$table->colclasses[] = 'centeralign action';
} else {
// Remove last column from $data.
foreach ($data as $row) {
array_pop($row->cells);
}
}
$table->id = 'cohorts';
$table->attributes['class'] = 'admintable generaltable';
$table->data = $data;
Expand Down

0 comments on commit 02ee1ef

Please sign in to comment.