public function progress_bar(array $items) { foreach ($items as $step) { if ($step['class'] == 'backup_stage backup_stage_current') { $steps[] = html::span(label::inverse($step['text'])); } else { $steps[] = html::span($step['text']); } } return html::ul('breadcrumb', '<li>' . implode(' > </li><li>', $steps) . '</li>'); //TODO: there's better bootstrap wizard progress out there, but this'll do for now }
public static function signed_in($user, $loginfailures, $mnet, $real, $role_switch, $logout) { $links[] = bootstrap::li_icon_link($user['link'], 'user', 'Profile'); if ($mnet !== null) { $links[] = bootstrap::li_icon_link($mnet['link'], 'globe', $mnet['name']); } if (isset($loginfailures)) { $links[] = bootstrap::li_icon_link($loginfailures['link'], 'warning-sign', $loginfailures['name']); $user['name'] .= ' ' . bootstrap::icon('warning-sign'); } if ($role_switch !== null) { $links[] = bootstrap::li_icon_link($role_switch['link'], 'repeat', $role_switch['name']); } if ($real !== null) { $links[] = bootstrap::li_icon_link($real['link'], 'user', $real['name']); } $links[] = bootstrap::list_divider(); $links[] = bootstrap::li_icon_link($logout['link'], 'off', $logout['name']); return html::ul('nav pull-right', bootstrap::dropdown_menu($user['name'], $links)); }
/** * Render legend * * @param string $topic */ public static function render_topic($topic = null) { if (empty($topic)) { $data = self::$topics; } else { $data = [$topic => self::$topics[$topic]]; } $temp = []; foreach ($data as $k => $v) { if (isset($v['options'])) { $value = html::a(['href' => $v['href'], 'value' => $v['name']]); $temp2 = []; foreach ($v['options'] as $k2 => $v2) { $temp2[] = html::a(['href' => $v2['href'], 'value' => $v2['name']]); } $value .= html::ul(['options' => $temp2]); $temp[] = $value; } else { $temp[] = html::a(['href' => $v['href'], 'value' => $v['name']]); } } echo html::ul(['options' => $temp]); }
protected function render_custom_menu(custom_menu $menu) { foreach ($menu->get_children() as $item) { $items[] = $this->render_custom_menu_item($item); } if (isset($items)) { return html::ul('nav', $items); } else { return ''; } }
private static function menu($items) { $attributes = array('class' => 'dropdown-menu', 'role' => 'menu', 'aria-labelledby' => 'dropdownMenu'); return html::ul($attributes, $items); }
public static function msg($messages, $type = 'notice') { $html[] = '<div class="zotop-msg clearfix ' . $type . '">'; $html[] = ' <div class="zotop-msg-icon"><div class="zotop-icon zotop-icon-' . $type . '"></div></div>'; $html[] = ' <div class="zotop-msg-content">'; $html[] = is_array($messages) ? html::ul($messages) : $messages; $html[] = ' </div>'; $html[] = '</div>'; return implode("\n", $html); }
/** * Formats the information that needs to go in the 'Requires' column. * @param plugininfo_base $plugin the plugin we are rendering the row for. * @param plugin_manager $pluginman provides data on all the plugins. * @param string $version * @return string HTML code */ protected function required_column(plugininfo_base $plugin, plugin_manager $pluginman, $version) { $requires = array(); if (!empty($plugin->versionrequires)) { $required = get_string('moodleversion', 'core_plugin', $plugin->versionrequires); if ($plugin->versionrequires > $version) { $required = label::important($required); } $requires[] = html::li($required); } foreach ($plugin->get_other_required_plugins() as $component => $requiredversion) { $ok = true; $otherplugin = $pluginman->get_plugin_info($component); if (is_null($otherplugin)) { $ok = false; } else { if ($requiredversion != ANY_VERSION and $otherplugin->versiondisk < $requiredversion) { $ok = false; } } if ($requiredversion != ANY_VERSION) { $required = get_string('otherpluginversion', 'core_plugin', array('component' => $component, 'version' => $requiredversion)); } else { $required = get_string('otherplugin', 'core_plugin', array('component' => $component, 'version' => $requiredversion)); } if (!$ok) { $required = label::important($required); } $requires[] = html::li($required); } if (!$requires) { return ''; } return html::ul('unstyled', $requires); }
protected function disabled_navigation_node(navigation_node $node, $wrap = true) { $items = $node->children; if ($items->count() == 0) { return ''; } foreach ($items as $item) { if (!$item->display) { continue; } $isbranch = $item->children->count() > 0 || $item->nodetype == navigation_node::NODETYPE_BRANCH; if ($isbranch) { $item->hideicon = true; } $content = $this->output->render($item); $classes = 'tree_item'; $expanded = 'true'; if (!$item->forceopen || !$item->forceopen && $item->collapse || $item->children->count() == 0 && $item->nodetype == navigation_node::NODETYPE_BRANCH) { $classes = classes::add_to($classes, 'collapsed'); if ($isbranch) { $expanded = "false"; $classes = classes::add_to($classes, 'branch'); } } if ($item->isactive === true) { $classes = classes::add_to($classes, 'active'); } $attributes = array('class' => $classes, 'aria-expanded' => $expanded); $content .= $this->navigation_node($item); $lis[] = html::li($attributes, $content); } $output = implode($lis); if ($wrap) { return html::ul('nav nav-list block_tree', $output); } return $output; }
static function tolist($list, $type, $style = null) { $html_list = ''; foreach ($list as $url => $value) { if (is_array($value)) { $row = html::tolist($value, $type, $style); } else { $row = $value; } $html_list .= html::a(html::li($row), "href='{$url}'"); } switch ($type) { case 'ol': $html_list = html::ol($html_list, "type='{$style}'"); break; case 'ul': $html_list = html::ul($html_list, "style='list-style-type:{$style}'"); break; default: $html_list = html::ul($html_list, "style='list-style-type:none'"); break; } return $html_list; }