Merge branch 'm29_MDL-49628a' of https://github.com/totara/moodle

This commit is contained in:
Dan Poltawski
2015-06-02 13:54:01 +01:00
8 changed files with 39 additions and 30 deletions
+4 -2
View File
@@ -110,14 +110,16 @@ if (count($acceptedroles) > 1) {
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();
+3 -8
View File
@@ -67,14 +67,9 @@ class award_criteria_overall extends award_criteria {
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');
+12 -11
View File
@@ -783,11 +783,7 @@ class core_badges_renderer extends plugin_renderer_base {
// 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));
@@ -798,16 +794,21 @@ class core_badges_renderer extends plugin_renderer_base {
$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.
+9 -1
View File
@@ -1826,14 +1826,22 @@ class core_renderer extends renderer_base {
* @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);
}
+2 -2
View File
@@ -310,9 +310,9 @@ if (($mode == 'new') && (!empty($newtype)) && confirm_sesskey()) { ///
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">';
+6 -3
View File
@@ -349,7 +349,8 @@ class mod_wiki_renderer extends plugin_renderer_base {
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;
@@ -398,7 +399,8 @@ class mod_wiki_renderer extends plugin_renderer_base {
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;
@@ -435,7 +437,8 @@ class mod_wiki_renderer extends plugin_renderer_base {
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;
+2 -2
View File
@@ -491,8 +491,8 @@ $userlist = $DB->get_recordset_sql("$select $from $where $sort", $params, $table
// 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').'&nbsp;</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) {
+1 -1
View File
@@ -153,7 +153,7 @@ echo '<div class="profileeditor">';
// 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'));