Replaced edit/delete element strings with icons

This commit is contained in:
Mark Nelson 2015-03-12 22:42:20 -07:00
parent 131c05a40d
commit 7739eefea1

View file

@ -205,8 +205,8 @@ class mod_customcert_edit_form extends moodleform {
$numelements = count($elements); $numelements = count($elements);
// Create a table to display these elements. // Create a table to display these elements.
$table = new html_table(); $table = new html_table();
$table->head = array(get_string('name', 'customcert'), get_string('type', 'customcert'), '', ''); $table->head = array(get_string('name', 'customcert'), get_string('type', 'customcert'), '');
$table->align = array('left', 'left', 'center', 'center'); $table->align = array('left', 'left', 'center');
// If we have more than one element then we can change the order, so add extra column for the up and down arrow. // If we have more than one element then we can change the order, so add extra column for the up and down arrow.
if ($numelements > 1) { if ($numelements > 1) {
$table->head[] = ''; $table->head[] = '';
@ -217,16 +217,14 @@ class mod_customcert_edit_form extends moodleform {
$row = new html_table_row(); $row = new html_table_row();
$row->cells[] = $element->name; $row->cells[] = $element->name;
$row->cells[] = $element->element; $row->cells[] = $element->element;
// Link to delete the element.
$deletelink = new moodle_url('/mod/customcert/edit.php', array('cmid' => $this->_customdata['cmid'], 'deleteelement' => $element->id));
$deletelink = html_writer::tag('a', get_string('delete', 'customcert'), array('href' => $deletelink->out(false)));
$row->cells[] = $deletelink;
// Link to edit this element. // Link to edit this element.
$editlink = new moodle_url('/mod/customcert/edit_element.php', array('id' => $element->id, $editlink = new moodle_url('/mod/customcert/edit_element.php', array('id' => $element->id,
'cmid' => $this->_customdata['cmid'], 'cmid' => $this->_customdata['cmid'],
'action' => 'edit')); 'action' => 'edit'));
$editlink = html_writer::tag('a', get_string('edit'), array('href' => $editlink->out(false))); $icons = $OUTPUT->action_icon($editlink, new pix_icon('t/edit', get_string('edit')));
$row->cells[] = $editlink; // Link to delete the element.
$deletelink = new moodle_url('/mod/customcert/edit.php', array('cmid' => $this->_customdata['cmid'], 'deleteelement' => $element->id));
$icons .= $OUTPUT->action_icon($deletelink, new pix_icon('t/delete', get_string('delete', 'customcert')));
// Now display any moving arrows if they are needed. // Now display any moving arrows if they are needed.
if ($numelements > 1) { if ($numelements > 1) {
// Only display the move up arrow if it is not the first. // Only display the move up arrow if it is not the first.
@ -240,8 +238,9 @@ class mod_customcert_edit_form extends moodleform {
$url = new moodle_url('/mod/customcert/edit.php', array('cmid' => $this->_customdata['cmid'], 'emovedown' => $element->id)); $url = new moodle_url('/mod/customcert/edit.php', array('cmid' => $this->_customdata['cmid'], 'emovedown' => $element->id));
$moveicons .= $OUTPUT->action_icon($url, new pix_icon('t/down', get_string('movedown'))); $moveicons .= $OUTPUT->action_icon($url, new pix_icon('t/down', get_string('movedown')));
} }
$row->cells[] = $moveicons; $icons .= $moveicons;
} }
$row->cells[] = $icons;
$table->data[] = $row; $table->data[] = $row;
} }
// Add the table to the form. // Add the table to the form.