';
//retrieve tags from DB
@@ -253,27 +254,32 @@ if ($tagrecords = $DB->get_records_sql($query, $params, $table->get_page_start()
//populate table with data
foreach ($tagrecords as $tag) {
- $id = $tag->id;
- $name = '
'. tag_display_name($tag) .'';
- $owner = '
' . fullname($tag) . '';
- $count = $tag->count;
- $flag = $tag->flag;
- $timemodified = format_time(time() - $tag->timemodified);
- $checkbox = '
';
- $text = html_writer::label(get_string('newname', 'tag'), 'newname_' . $tag->id, false, array('class' => 'accesshide'));
- $text .= '
';
- $tagtype = html_writer::label(get_string('tagtype', 'tag'), 'menutagtypes'. $tag->id, false, array('class' => 'accesshide'));
- $tagtype .= html_writer::select($existing_tagtypes, 'tagtypes['.$tag->id.']', $tag->tagtype, false, array('id' => 'menutagtypes'. $tag->id));
+ $id = $tag->id;
+ $params = array('id' => $tag->id);
+ $taglink = new moodle_url($CFG->wwwroot . '/tag/index.php', $params);
+ $name = html_writer::link($taglink, tag_display_name($tag));
+ $params = array('id' => $tag->owner);
+ $ownerlink = new moodle_url($CFG->wwwroot . '/user/view.php', $params);
+ $owner = html_writer::link($ownerlink, fullname($tag));
+ $count = $tag->count;
+ $flag = $tag->flag;
+ $timemodified = format_time(time() - $tag->timemodified);
+ $checkbox = html_writer::tag('input', '', array('type' => 'checkbox', 'name' => 'tagschecked[]', 'value' => $tag->id));
+ $attrs = array('type' => 'text', 'id' => 'newname_' . $tag->id, 'name' => 'newname["'.$tag->id.'"]');
+ $text = html_writer::label(get_string('newname', 'tag'), 'newname_' . $tag->id, false, array('class' => 'accesshide'));
+ $text .= html_writer::empty_tag('input', $attrs);
+ $tagtype = html_writer::label(get_string('tagtype', 'tag'), 'menutagtypes'. $tag->id, false, array('class' => 'accesshide'));
+ $tagtype .= html_writer::select($existing_tagtypes, 'tagtypes['.$tag->id.']', $tag->tagtype, false, array('id' => 'menutagtypes'. $tag->id));
//if the tag if flagged, highlight it
if ($tag->flag > 0) {
- $id = '
' . $id . '';
- $name = '
' . $name . '';
- $owner = '
' . $owner . '';
- $count = '
' . $count . '';
- $flag = '
' . $flag . '';
- $timemodified = '
' . $timemodified . '';
- $tagtype = '
'. $tagtype. '';
+ $id = html_writer::tag('span', $id, array('class' => 'flagged-tag'));
+ $name = html_writer::tag('span', $name, array('class' => 'flagged-tag'));
+ $owner = html_writer::tag('span', $owner, array('class' => 'flagged-tag'));
+ $count = html_writer::tag('span', $count, array('class' => 'flagged-tag'));
+ $flag = html_writer::tag('span', $flag, array('class' => 'flagged-tag'));
+ $timemodified = html_writer::tag('span', $timemodified, array('class' => 'flagged-tag'));
+ $tagtype = html_writer::tag('span', $tagtype, array('class' => 'flagged-tag'));
}
$data = array($id, $name, $owner, $count, $flag, $timemodified, $text, $tagtype, $checkbox);
@@ -281,32 +287,43 @@ if ($tagrecords = $DB->get_records_sql($query, $params, $table->get_page_start()
$table->add_data($data);
}
- echo '
';
- echo '
';
- echo '
';
- echo '
';
- echo html_writer::label(get_string('withselectedtags', 'tag'), 'menuformaction', false, array('class' => 'accesshide'));
- echo '';
+ echo html_writer::empty_tag('input', array('type' => 'button', 'onclick' => 'checkall()', 'value' => get_string('selectall')));
+ echo html_writer::empty_tag('input', array('type' => 'button', 'onclick' => 'checknone()', 'value' => get_string('deselectall')));
+ echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
+ echo html_writer::empty_tag('br');
+ echo html_writer::empty_tag('br');
- echo '
';
+ echo html_writer::label(get_string('withselectedtags', 'tag'), 'menuformaction', false, array('class' => 'accesshide'));
+ $options = array('' => get_string('withselectedtags', 'tag'),
+ 'reset' => get_string('resetflag', 'tag'),
+ 'delete' => get_string('delete', 'tag'),
+ 'changetype' => get_string('changetype', 'tag'),
+ 'changename' => get_string('changename', 'tag'));
+ echo html_writer::select($options, 'action', '', array(), array('id' => 'menuformaction'));
+
+ echo html_writer::tag('button', get_string('ok'), array('id' => 'tag-management-submit', 'type' => 'submit'));
}
$table->print_html();
+
+//@todo MDL-35474 convert to mform
echo '