if (!$role) {
$pageurl = new moodle_url('/badges/award.php', array('id' => $badgeid));
echo $OUTPUT->header();
- echo $OUTPUT->box(get_string('selectaward', 'badges') . $OUTPUT->single_select(new moodle_url($pageurl), 'role', $select));
+ echo $OUTPUT->box($OUTPUT->single_select(new moodle_url($pageurl), 'role', $select, '', array('' => 'choosedots'),
+ null, array('label' => get_string('selectaward', 'badges'))));
echo $OUTPUT->footer();
die();
} else {
$pageurl = new moodle_url('/badges/award.php', array('id' => $badgeid));
$issuerrole = new stdClass();
$issuerrole->roleid = $role;
- $roleselect = get_string('selectaward', 'badges') . $OUTPUT->single_select(new moodle_url($pageurl), 'role', $select, $role, null);
+ $roleselect = $OUTPUT->single_select(new moodle_url($pageurl), 'role', $select, $role, null, null,
+ array('label' => get_string('selectaward', 'badges')));
}
} else {
echo $OUTPUT->header();
echo $OUTPUT->box($editaction, array('criteria-header'));
$url = new moodle_url('criteria.php', array('id' => $data->id, 'sesskey' => sesskey()));
- $table = new html_table();
- $table->attributes = array('class' => 'clearfix');
- $table->colclasses = array('', 'activatebadge');
- $table->data[] = array(
- $OUTPUT->single_select($url, 'update', $agg, $data->get_aggregation_method($this->criteriatype), null),
- get_string('overallcrit', 'badges')
- );
- echo html_writer::table($table);
+ echo $OUTPUT->single_select($url, 'update', $agg, $data->get_aggregation_method($this->criteriatype),
+ null, null, array('aria-describedby' => 'overall'));
+ echo html_writer::span(get_string('overallcrit', 'badges'), '', array('id' => 'overall'));
} else {
echo $OUTPUT->box(get_string('criteria_descr_' . $this->criteriatype, 'badges',
core_text::strtoupper($agg[$data->get_aggregation_method()])), 'clearfix');
// Prints criteria actions for badge editing.
public function print_criteria_actions(badge $badge) {
- $table = new html_table();
- $table->attributes = array('class' => 'boxaligncenter', 'id' => 'badgeactions');
- $table->colclasses = array('activatebadge');
-
- $actions = array();
+ $output = '';
if (!$badge->is_active() && !$badge->is_locked()) {
$accepted = $badge->get_accepted_criteria();
$potential = array_diff($accepted, array_keys($badge->criteria));
$select[$p] = get_string('criteria_' . $p, 'badges');
}
}
- $actions[] = get_string('addbadgecriteria', 'badges');
- $actions[] = $this->output->single_select(new moodle_url('/badges/criteria_settings.php',
- array('badgeid' => $badge->id, 'add' => true)), 'type', $select);
+ $output .= $this->output->single_select(
+ new moodle_url('/badges/criteria_settings.php', array('badgeid' => $badge->id, 'add' => true)),
+ 'type',
+ $select,
+ '',
+ array('' => 'choosedots'),
+ null,
+ array('label' => get_string('addbadgecriteria', 'badges'))
+ );
} else {
- $actions[] = $this->output->box(get_string('nothingtoadd', 'badges'), 'clearfix');
+ $output .= $this->output->box(get_string('nothingtoadd', 'badges'), 'clearfix');
}
}
- $table->data[] = $actions;
- return html_writer::table($table);
+ return $output;
}
// Renders a table with users who have earned the badge.
* @param string $selected selected element
* @param array $nothing
* @param string $formid
+ * @param array $attributes other attributes for the single select
* @return string HTML fragment
*/
- public function single_select($url, $name, array $options, $selected = '', $nothing = array('' => 'choosedots'), $formid = null) {
+ public function single_select($url, $name, array $options, $selected = '',
+ $nothing = array('' => 'choosedots'), $formid = null, $attributes = array()) {
if (!($url instanceof moodle_url)) {
$url = new moodle_url($url);
}
$select = new single_select($url, $name, $options, $selected, $nothing, $formid);
+ if (array_key_exists('label', $attributes)) {
+ $select->set_label($attributes['label']);
+ unset($attributes['label']);
+ }
+ $select->attributes = $attributes;
+
return $this->render($select);
}
echo '<div class="fieldadd">';
- echo '<label for="fieldform_jump">'.get_string('newfield','data').$OUTPUT->help_icon('newfield', 'data').'</label>';
$popupurl = $CFG->wwwroot.'/mod/data/field.php?d='.$data->id.'&mode=new&sesskey='. sesskey();
- echo $OUTPUT->single_select(new moodle_url($popupurl), 'newtype', $menufield, null, array(''=>'choosedots'), 'fieldform');
+ echo $OUTPUT->single_select(new moodle_url($popupurl), 'newtype', $menufield, null, array('' => 'choosedots'),
+ 'fieldform', array('label' => get_string('newfield', 'data') . $OUTPUT->help_icon('newfield', 'data')));
echo '</div>';
echo '<div class="sortdefault">';
echo $this->output->container_start('wiki_right');
$name = 'uid';
$selected = $subwiki->userid;
- echo $this->output->single_select($baseurl, $name, $options, $selected, null);
+ echo $this->output->single_select($baseurl, $name, $options, $selected, null, null,
+ array('label' => get_string('user') . ':'));
echo $this->output->container_end();
}
return;
echo $this->output->container_start('wiki_right');
$name = 'groupanduser';
$selected = $subwiki->groupid . '-' . $subwiki->userid;
- echo $this->output->single_select($baseurl, $name, $options, $selected, null);
+ echo $this->output->single_select($baseurl, $name, $options, $selected, null, null,
+ array('label' => get_string('user') . ':'));
echo $this->output->container_end();
return;
echo $this->output->container_start('wiki_right');
$name = 'groupanduser';
$selected = $subwiki->groupid . '-' . $subwiki->userid;
- echo $this->output->single_select($baseurl, $name, $options, $selected, null);
+ echo $this->output->single_select($baseurl, $name, $options, $selected, null, null,
+ array('label' => get_string('user') . ':'));
echo $this->output->container_end();
return;
// If there are multiple Roles in the course, then show a drop down menu for switching.
if (count($rolenames) > 1) {
echo '<div class="rolesform">';
- echo '<label for="rolesform_jump">'.get_string('currentrole', 'role').' </label>';
- echo $OUTPUT->single_select($rolenamesurl, 'roleid', $rolenames, $roleid, null, 'rolesform');
+ echo $OUTPUT->single_select($rolenamesurl, 'roleid', $rolenames, $roleid, null,
+ 'rolesform', array('label' => get_string('currentrole', 'role')));
echo '</div>';
} else if (count($rolenames) == 1) {
// Create a new field link.
$options = profile_list_datatypes();
$popupurl = new moodle_url('/user/profile/index.php?id=0&action=editfield');
-echo $OUTPUT->single_select($popupurl, 'datatype', $options, '', array('' => $strcreatefield), 'newfieldform');
+echo $OUTPUT->single_select($popupurl, 'datatype', $options, '', null, 'newfieldform', array('label' => $strcreatefield));
// Add a div with a class so themers can hide, style or reposition the text.
html_writer::start_tag('div', array('class' => 'adminuseractionhint'));