public function test_label_with_no_and_x() { $expected = '<span class="label label-important">_no <i class="icon-remove icon-white"></i></span>'; $actual = label::no(); $this->assertSame($expected, $actual); }
protected function backup_course_sections($details) { foreach ($details->sections as $key => $section) { $included = $key . '_included'; if (!$section->settings[$included]) { continue; } $userinfo = $key . '_userinfo'; if ($section->settings[$userinfo]) { $userinfo = label::yes(); } else { $userinfo = label::no(); } $form_section = $this->backup_detail_item('includeuserinfo', $userinfo); $table = null; foreach ($details->activities as $activitykey => $activity) { if ($activity->sectionid != $section->sectionid) { continue; } if (empty($table)) { $table = new html_table(); $table->head = array('Module', 'Title', 'Userinfo'); //TODO: the above aren't translateable, see MDL-37211 $table->colclasses = array('modulename', 'moduletitle', 'userinfoincluded'); $table->align = array('left', 'left', 'center'); $table->attributes = array('class' => 'table table-striped'); $table->data = array(); } $name = get_string('pluginname', $activity->modulename); $icon = new pix_icon('icon', $name, $activity->modulename); $table->data[] = array($this->output->render($icon) . ' ' . $name, $activity->title, $activity->settings[$activitykey . '_userinfo'] ? label::yes() : label::no()); } if (!empty($table)) { $form_section .= form::row(get_string('sectionactivities', 'backup'), html_writer::table($table)); } $out[] = form::section(get_string('backupcoursesection', 'backup', $section->title), $form_section); } return implode($out); }