Commit eaf45bce authored by Damyon Wiese's avatar Damyon Wiese
Browse files

MDL-56724 boost: Update mod_choice to use bootstrap classes for styles

parent 0b8e0c37
......@@ -44,7 +44,7 @@ class mod_choice_renderer extends plugin_renderer_base {
$disabled = empty($options['previewonly']) ? array() : array('disabled' => 'disabled');
$html = html_writer::start_tag('form', $attributes);
$html .= html_writer::start_tag('ul', array('class'=>'choices' ));
$html .= html_writer::start_tag('ul', array('class'=>'choices list-unstyled unstyled' ));
$availableoption = count($options['options']);
$choicecount = 0;
......@@ -59,6 +59,7 @@ class mod_choice_renderer extends plugin_renderer_base {
$option->attributes->type = 'radio';
}
$option->attributes->id = 'choice_'.$choicecount;
$option->attributes->class = 'm-x-1';
$labeltext = $option->text;
if (!empty($option->attributes->disabled)) {
......@@ -83,7 +84,7 @@ class mod_choice_renderer extends plugin_renderer_base {
$html .= html_writer::tag('label', get_string('choicefull', 'choice'));
} else {
$html .= html_writer::empty_tag('input',
array('type' => 'submit', 'value' => get_string('savemychoice', 'choice'), 'class' => 'button'));
array('type' => 'submit', 'value' => get_string('savemychoice', 'choice'), 'class' => 'btn btn-primary'));
}
if (!empty($options['allowupdate']) && ($options['allowupdate'])) {
......@@ -147,7 +148,7 @@ class mod_choice_renderer extends plugin_renderer_base {
$table = new html_table();
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->attributes['class'] = 'results names ';
$table->attributes['class'] = 'results names table table-bordered';
$table->tablealign = 'center';
$table->summary = get_string('responsesto', 'choice', format_string($choices->name));
$table->data = array();
......@@ -223,6 +224,7 @@ class mod_choice_renderer extends plugin_renderer_base {
}
$userfullname = fullname($user, $choices->fullnamecapability);
$mediabody = '';
if ($choices->viewresponsecapability && $choices->deleterepsonsecapability) {
$checkboxid = 'attempt-user'.$user->id.'-option'.$optionid;
$attemptaction = html_writer::label($userfullname . ' ' . $optionsnames[$optionid],
......@@ -234,16 +236,17 @@ class mod_choice_renderer extends plugin_renderer_base {
$attemptaction .= html_writer::checkbox('userid[]', $user->id, '', null,
array('id' => $checkboxid));
}
$data .= html_writer::tag('div', $attemptaction, array('class'=>'attemptaction'));
$mediabody .= html_writer::tag('div', $attemptaction, array('class'=>'media-left p-t-1'));
}
$userimage = $this->output->user_picture($user, array('courseid'=>$choices->courseid));
$data .= html_writer::tag('div', $userimage, array('class'=>'image'));
$mediabody .= html_writer::tag('div', $userimage, array('class'=>'media-left'));
$userlink = new moodle_url('/user/view.php', array('id'=>$user->id,'course'=>$choices->courseid));
$name = html_writer::tag('a', $userfullname, array('href'=>$userlink, 'class'=>'username'));
$data .= html_writer::tag('div', $name, array('class'=>'fullname'));
$data .= html_writer::tag('div','', array('class'=>'clearfloat'));
$optionusers .= html_writer::tag('div', $data, array('class'=>'user'));
$userlink = new moodle_url('/user/view.php', array('id'=>$user->id,'course' => $choices->courseid));
$name = html_writer::tag('a', $userfullname, array('href' => $userlink));
$mediabody .= html_writer::tag('div', $name, array('class' => 'media-body'));
$data .= html_writer::tag('div', $mediabody, array('class' => 'media m-b-1'));
$optionusers .= $data;
}
$cell->text = $optionusers;
}
......
......@@ -257,19 +257,19 @@
$options["id"] = "$cm->id";
$options["download"] = "ods";
$button = $OUTPUT->single_button(new moodle_url("report.php", $options), get_string("downloadods"));
$downloadoptions[] = html_writer::tag('li', $button, array('class'=>'reportoption'));
$downloadoptions[] = html_writer::tag('li', $button, array('class'=>'reportoption list-inline-item'));
$options["download"] = "xls";
$button = $OUTPUT->single_button(new moodle_url("report.php", $options), get_string("downloadexcel"));
$downloadoptions[] = html_writer::tag('li', $button, array('class'=>'reportoption'));
$downloadoptions[] = html_writer::tag('li', $button, array('class'=>'reportoption list-inline-item'));
$options["download"] = "txt";
$button = $OUTPUT->single_button(new moodle_url("report.php", $options), get_string("downloadtext"));
$downloadoptions[] = html_writer::tag('li', $button, array('class'=>'reportoption'));
$downloadoptions[] = html_writer::tag('li', $button, array('class'=>'reportoption list-inline-item'));
$downloadlist = html_writer::tag('ul', implode('', $downloadoptions));
$downloadlist = html_writer::tag('ul', implode('', $downloadoptions), array('class' => 'list-inline inline'));
$downloadlist .= html_writer::tag('div', '', array('class'=>'clearfloat'));
echo html_writer::tag('div',$downloadlist, array('class'=>'downloadreport'));
echo html_writer::tag('div',$downloadlist, array('class'=>'downloadreport m-t-1'));
}
echo $OUTPUT->footer();
.path-mod-choice .results {
border-collapse: separate;
}
.path-mod-choice .results .data {
vertical-align: top;
white-space: nowrap;
}
.path-mod-choice .button {
text-align: center;
}
.path-mod-choice .attemptcell {
width: 5px;
white-space: nowrap;
}
.path-mod-choice .anonymous,
.path-mod-choice .names {
margin-left: auto;
margin-right: auto;
width: 100%;
}
.path-mod-choice .downloadreport {
border-width: 0;
margin-left: 10%;
}
.path-mod-choice .choiceresponse {
width: 100%;
}
.path-mod-choice .choiceresponse .picture {
width: 10px;
white-space: nowrap;
}
.path-mod-choice .choiceresponse .fullname {
width: 100%;
white-space: nowrap;
}
.path-mod-choice .responseheader {
width: 100%;
text-align: center;
margin-top: 10px;
}
.path-mod-choice .choices .option label {
vertical-align: top;
}
.path-mod-choice .choices .option input {
vertical-align: middle;
}
.path-mod-choice .horizontal,
.path-mod-choice .vertical {
margin-left: 10%;
margin-right: 10%;
}
.path-mod-choice .horizontal .choices .option {
padding-right: 20px;
display: inline-block;
white-space: normal;
}
.path-mod-choice .horizontal .choices .button {
margin-top: 10px;
}
.path-mod-choice ul.choices li {
list-style: none;
}
.path-mod-choice .results {
text-align: center;
}
.path-mod-choice .results.anonymous .graph.horizontal {
vertical-align: middle;
text-align: left;
width: 70%;
}
.path-mod-choice .results.anonymous .graph.vertical,
.path-mod-choice .cell {
vertical-align: bottom;
text-align: center;
}
.path-mod-choice .results.names .header {
width: 10%;
white-space: normal;
}
.path-mod-choice .results.names .cell {
vertical-align: top;
text-align: left;
}
.path-mod-choice .results.names .user,
.path-mod-choice #yourselection {
padding: 5px;
}
.path-mod-choice .results.names .user .attemptaction,
.path-mod-choice .results.names .user .image,
.path-mod-choice .results.names .user .fullname {
float: left;
}
.path-mod-choice .results.names .user .fullname {
padding-left: 5px;
}
.path-mod-choice .results .data.header {
width: 10%;
}
.path-mod-choice .responseaction {
text-align: center;
}
.path-mod-choice .results .option {
white-space: normal;
}
.path-mod-choice .response {
overflow: auto;
}
.path-mod-choice .results .option,
.path-mod-choice .results .numberofuser,
.path-mod-choice .results .percentage {
font-weight: bold;
font-size: 108%;
}
#page-mod-choice-report .downloadreport ul li {
list-style: none;
padding: 0 20px;
float: left;
}
.path-mod-choice .clearfloat {
float: none;
clear: both;
}
......@@ -208,21 +208,6 @@ div#dock {
// Choice module
.path-mod-choice {
.horizontal .choices {
margin: 0;
.option {
display: inline-block;
padding: 10px;
}
}
.results .data {
white-space: normal;
}
}
// Lesson module
/** General styles (scope: all of lesson) **/
......
......@@ -291,15 +291,9 @@ div#dock {
// Choice module
.path-mod-choice {
.horizontal .choices {
margin: 0;
.option {
display: inline-block;
padding: 10px;
}
}
.results .data {
white-space: normal;
.media-left {
float: left;
padding-right: 1em;
}
}
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment