本文整理汇总了PHP中get_separator函数的典型用法代码示例。如果您正苦于以下问题:PHP get_separator函数的具体用法?PHP get_separator怎么用?PHP get_separator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_separator函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: navbar
public function navbar()
{
global $CFG;
$items = $this->page->navbar->get_items();
/* Added for subadmin */
$context = get_context_instance(CONTEXT_SYSTEM);
$roles = get_user_roles($context, $USER->id, false);
$role = key($roles);
$rolename = $roles[$role]->shortname;
$htmlblocks = array();
// Iterate the navarray and display each node
$itemcount = count($items);
$separator = get_separator();
for ($i = 0; $i < $itemcount; $i++) {
$item = $items[$i];
$item->hideicon = true;
if ($i === 0) {
if ($rolename == 'subadmin') {
$item->action = new moodle_url($CFG->wwwroot . '/my/');
}
$content = html_writer::tag('li', $this->render($item));
} else {
$content = html_writer::tag('li', $separator . $this->render($item));
}
$htmlblocks[] = $content;
}
//accessibility: heading for navbar list (MDL-20446)
$navbarcontent = html_writer::tag('span', get_string('pagepath'), array('class' => 'accesshide'));
$navbarcontent .= html_writer::tag('ul', join('', $htmlblocks), array('role' => 'navigation'));
// XHTML
return $navbarcontent;
}
开发者ID:vinoth4891,项目名称:clinique,代码行数:32,代码来源:renderers.php
示例2: __construct
/**
* Constructor.
*
* @param bool $showpasses Whether this reporter should output anything for passes.
*/
function __construct($showpasses)
{
parent::__construct('UTF-8');
$this->showpasses = $showpasses;
$this->strrunonlyfolder = $this->get_string('runonlyfolder');
$this->strrunonlyfile = $this->get_string('runonlyfile');
$this->strseparator = get_separator();
}
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:13,代码来源:ex_reporter.php
示例3: ExHtmlReporter
/**
* Constructor.
*
* @param bool $showpasses Whether this reporter should output anything for passes.
*/
function ExHtmlReporter($showpasses)
{
$this->HtmlReporter();
$this->showpasses = $showpasses;
$this->strrunonlyfolder = $this->get_string('runonlyfolder');
$this->strrunonlyfile = $this->get_string('runonlyfile');
$this->strseparator = get_separator();
}
开发者ID:nigeldaley,项目名称:moodle,代码行数:13,代码来源:ex_reporter.php
示例4: navbar
public function navbar()
{
$items = $this->page->navbar->get_items();
$breadcrumbs = array();
foreach ($items as $item) {
$item->hideicon = true;
$breadcrumbs[] = $this->render($item);
}
$divider = '<span class="divider">' . get_separator() . '</span>';
$list_items = '<li>' . join(" {$divider}</li><li>", $breadcrumbs) . '</li>';
$title = '<span class="accesshide">' . get_string('pagepath') . '</span>';
return $title . "<ul class=\"breadcrumb\">{$list_items}</ul>";
}
开发者ID:digitalquest,项目名称:moodle_themex,代码行数:13,代码来源:core_renderer_back020714.php
示例5: progress_bar
/**
* Renderers a progress bar for the backup or restore given the items that
* make it up.
* @param array $items An array of items
* @return string
*/
public function progress_bar(array $items) {
foreach ($items as &$item) {
$text = $item['text'];
unset($item['text']);
if (array_key_exists('link', $item)) {
$link = $item['link'];
unset($item['link']);
$item = html_writer::link($link, $text, $item);
} else {
$item = html_writer::tag('span', $text, $item);
}
}
return html_writer::tag('div', join(get_separator(), $items), array('class'=>'backup_progress clearfix'));
}
开发者ID:ncsu-delta,项目名称:moodle,代码行数:20,代码来源:renderer.php
示例6: navbar
public function navbar()
{
$items = $this->page->navbar->get_items();
if (empty($items)) {
return '';
}
$breadcrumbs = array();
foreach ($items as $item) {
$item->hideicon = true;
$breadcrumbs[] = $this->render($item);
}
$divider = '<span class="divider">' . get_separator() . '</span>';
$list_items = '<li>' . join(" {$divider}</li><li>", $breadcrumbs) . '</li>';
$title = '<span class="accesshide" id="navbar-label">' . get_string('pagepath') . '</span>';
return $title . '<nav aria-labelledby="navbar-label"><ul class="breadcrumb">' . $list_items . '</ul></nav>';
}
开发者ID:aleph-n,项目名称:lms.aaenl,代码行数:16,代码来源:core_renderer.php
示例7: navbar
/**
* Return the navbar content so that it can be echoed out by the layout
*
* @return string XHTML navbar
*/
public function navbar() {
$items = $this->page->navbar->get_items();
$itemcount = count($items);
if ($itemcount === 0) {
return '';
}
$htmlblocks = array();
// Iterate the navarray and display each node
$separator = get_separator();
for ($i=0;$i < $itemcount;$i++) {
$item = $items[$i];
$item->hideicon = true;
if ($i===0) {
$content = html_writer::tag('li', $this->render($item));
} else {
$content = html_writer::tag('li', $separator.$this->render($item));
}
$htmlblocks[] = $content;
}
//accessibility: heading for navbar list (MDL-20446)
$navbarcontent = html_writer::tag('span', get_string('pagepath'), array('class'=>'accesshide'));
$navbarcontent .= html_writer::tag('nav', html_writer::tag('ul', join('', $htmlblocks)));
// XHTML
return $navbarcontent;
}
开发者ID:afgal,项目名称:moodle-1,代码行数:32,代码来源:outputrenderers.php
示例8: build_navigation
//.........这里部分代码省略.........
*
* @param mixed $extranavlinks - Normally an array of arrays, keys: name, link, type. If you
* only want one extra item with no link, you can pass a string instead. If you don't want
* any extra links, pass an empty string.
* @param mixed $cm - optionally the $cm object, if you want this function to generate the
* activity and activityinstance levels of navigation too.
*
* @return $navigation as an object so it can be differentiated from old style
* navigation strings.
*/
function build_navigation($extranavlinks, $cm = null)
{
global $CFG, $COURSE, $DB, $SITE;
if (is_string($extranavlinks)) {
if ($extranavlinks == '') {
$extranavlinks = array();
} else {
$extranavlinks = array(array('name' => $extranavlinks, 'link' => '', 'type' => 'title'));
}
}
$navlinks = array();
//Site name
if (!empty($SITE->shortname)) {
$navlinks[] = array('name' => format_string($SITE->shortname), 'link' => "{$CFG->wwwroot}/", 'type' => 'home');
}
// Course name, if appropriate.
if (isset($COURSE) && $COURSE->id != SITEID) {
$navlinks[] = array('name' => format_string($COURSE->shortname), 'link' => "{$CFG->wwwroot}/course/view.php?id={$COURSE->id}", 'type' => 'course');
}
// Activity type and instance, if appropriate.
if (is_object($cm)) {
if (!isset($cm->modname)) {
debugging('The field $cm->modname should be set if you call build_navigation with ' . 'a $cm parameter. If you get $cm using get_coursemodule_from_instance or ' . 'get_coursemodule_from_id, this will be done automatically.', DEBUG_DEVELOPER);
if (!($cm->modname = $DB->get_field('modules', 'name', array('id' => $cm->module)))) {
print_error('cannotmoduletype');
}
}
if (!isset($cm->name)) {
debugging('The field $cm->name should be set if you call build_navigation with ' . 'a $cm parameter. If you get $cm using get_coursemodule_from_instance or ' . 'get_coursemodule_from_id, this will be done automatically.', DEBUG_DEVELOPER);
if (!($cm->name = $DB->get_field($cm->modname, 'name', array('id' => $cm->instance)))) {
print_error('cannotmodulename');
}
}
$navlinks[] = array('name' => get_string('modulenameplural', $cm->modname), 'link' => $CFG->wwwroot . '/mod/' . $cm->modname . '/index.php?id=' . $cm->course, 'type' => 'activity');
$navlinks[] = array('name' => format_string($cm->name), 'link' => $CFG->wwwroot . '/mod/' . $cm->modname . '/view.php?id=' . $cm->id, 'type' => 'activityinstance');
}
//Merge in extra navigation links
$navlinks = array_merge($navlinks, $extranavlinks);
// Work out whether we should be showing the activity (e.g. Forums) link.
// Note: build_navigation() is called from many places --
// install & upgrade for example -- where we cannot count on the
// roles infrastructure to be defined. Hence the $CFG->rolesactive check.
if (!isset($CFG->hideactivitytypenavlink)) {
$CFG->hideactivitytypenavlink = 0;
}
if ($CFG->hideactivitytypenavlink == 2) {
$hideactivitylink = true;
} else {
if ($CFG->hideactivitytypenavlink == 1 && $CFG->rolesactive && !empty($COURSE->id) && $COURSE->id != SITEID) {
if (!isset($COURSE->context)) {
$COURSE->context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
}
$hideactivitylink = !has_capability('moodle/course:manageactivities', $COURSE->context);
} else {
$hideactivitylink = false;
}
}
//Construct an unordered list from $navlinks
//Accessibility: heading hidden from visual browsers by default.
$navigation = get_accesshide(get_string('youarehere', 'access'), 'h2') . " <ul>\n";
$lastindex = count($navlinks) - 1;
$i = -1;
// Used to count the times, so we know when we get to the last item.
$first = true;
foreach ($navlinks as $navlink) {
$i++;
$last = $i == $lastindex;
if (!is_array($navlink)) {
continue;
}
if (!empty($navlink['type']) && $navlink['type'] == 'activity' && !$last && $hideactivitylink) {
continue;
}
$navigation .= '<li class="first">';
if (!$first) {
$navigation .= get_separator();
}
if (!empty($navlink['link']) && !$last) {
$navigation .= "<a onclick=\"this.target='{$CFG->framename}'\" href=\"{$navlink['link']}\">";
}
$navigation .= "{$navlink['name']}";
if (!empty($navlink['link']) && !$last) {
$navigation .= "</a>";
}
$navigation .= "</li>";
$first = false;
}
$navigation .= "</ul>";
return array('newnav' => true, 'navlinks' => $navigation);
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:101,代码来源:weblib.php
示例9: print_navigation
/**
* Prints breadcrumb trail of links, called in theme/-/header.html
*
* @uses $CFG
* @param mixed $navigation The breadcrumb navigation string to be printed
* @param string $separator The breadcrumb trail separator. The default 0 leads to the use
* of $THEME->rarrow, themes could use '→', '/', or '' for a style-sheet solution.
* @param boolean $return False to echo the breadcrumb string (default), true to return it.
*/
function print_navigation($navigation, $separator = 0, $return = false)
{
global $CFG, $THEME;
$output = '';
if (0 === $separator) {
$separator = get_separator();
} else {
$separator = '<span class="sep">' . $separator . '</span>';
}
if ($navigation) {
if (!is_array($navigation)) {
$ar = explode('->', $navigation);
$navigation = array();
foreach ($ar as $a) {
if (strpos($a, '</a>') === false) {
$navigation[] = array('title' => $a, 'url' => '');
} else {
if (preg_match('/<a.*href="([^"]*)">(.*)<\\/a>/', $a, $matches)) {
$navigation[] = array('title' => $matches[2], 'url' => $matches[1]);
}
}
}
}
if (!($site = get_site())) {
$site = new object();
$site->shortname = get_string('home');
}
//Accessibility: breadcrumb links now in a list, » replaced with a 'silent' character.
$output .= get_accesshide(get_string('youarehere', 'access'), 'h2') . "<ul>\n";
$output .= '<li class="first">' . "\n" . '<a ' . $CFG->frametarget . ' onclick="this.target=\'' . $CFG->framename . '\'" href="' . $CFG->wwwroot . (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) && !empty($USER->id) && !empty($CFG->mymoodleredirect) && !isguest() ? '/my' : '') . '/">' . format_string($site->shortname) . "</a>\n</li>\n";
foreach ($navigation as $navitem) {
$title = trim(strip_tags(format_string($navitem['title'], false)));
$url = $navitem['url'];
if (empty($url)) {
$output .= '<li class="first">' . "{$separator} {$title}</li>\n";
} else {
$output .= '<li class="first">' . "{$separator}\n<a " . $CFG->frametarget . ' onclick="this.target=\'' . $CFG->framename . '\'" href="' . $url . '">' . "{$title}</a>\n</li>\n";
}
}
$output .= "</ul>\n";
}
if ($return) {
return $output;
} else {
echo $output;
}
}
开发者ID:veritech,项目名称:pare-project,代码行数:56,代码来源:weblib.php
示例10: build_navigation
/**
* This function will build the navigation string to be used by print_header
* and others
* @uses $CFG
* @uses $THEME
* @param $extranavlinks - array of associative arrays, keys: name, link, type
* @return $navigation as an object so it can be differentiated from old style
* navigation strings.
*/
function build_navigation($extranavlinks)
{
global $CFG, $COURSE;
$navigation = '';
$navlinks = array();
//Site name
if ($site = get_site()) {
$navlinks[] = array('name' => format_string($site->shortname), 'link' => "{$CFG->wwwroot}/", 'type' => 'home');
}
if ($COURSE) {
if ($COURSE->id != SITEID) {
//Course
$navlinks[] = array('name' => format_string($COURSE->shortname), 'link' => "{$CFG->wwwroot}/course/view.php?id={$COURSE->id}", 'type' => 'course');
}
}
//Merge in extra navigation links
$navlinks = array_merge($navlinks, $extranavlinks);
//Construct an unordered list from $navlinks
//Accessibility: heading hidden from visual browsers by default.
$navigation = '<h2 class="accesshide">' . get_string('youarehere', 'access') . "</h2> <ul>\n";
$countlinks = count($navlinks);
$i = 0;
foreach ($navlinks as $navlink) {
if ($i >= $countlinks || !is_array($navlink)) {
continue;
}
// Check the link type to see if this link should appear in the trail
//
// NOTE: we should move capchecks _out_ to the callers. build_navigation() is
// called from many places -- install & upgrade for example -- where we cannot
// count on the roles infrastructure to be defined.
//
$cap = 0;
if (!empty($COURSE->id) && $COURSE->id != SITEID) {
if (!isset($COURSE->context)) {
$COURSE->context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
}
$cap = has_capability('moodle/course:manageactivities', $COURSE->context);
}
$hidetype_is2 = isset($CFG->hideactivitytypenavlink) && $CFG->hideactivitytypenavlink == 2;
$hidetype_is1 = isset($CFG->hideactivitytypenavlink) && $CFG->hideactivitytypenavlink == 1;
if ($navlink['type'] == 'activity' && $i + 1 < $countlinks && ($hidetype_is2 || $hidetype_is1 && !$cap)) {
continue;
}
$navigation .= '<li class="first">';
if ($i > 0) {
$navigation .= get_separator();
}
if (!empty($navlink['link']) && $i + 1 < $countlinks) {
$navigation .= "<a onclick=\"this.target='{$CFG->framename}'\" href=\"{$navlink['link']}\">";
}
$navigation .= "{$navlink['name']}";
if (!empty($navlink['link']) && $i + 1 < $countlinks) {
$navigation .= "</a>";
}
$navigation .= "</li>";
$i++;
}
$navigation .= "</ul>";
return array('newnav' => true, 'navlinks' => $navigation);
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:70,代码来源:weblib.php
示例11: navbar
public function navbar()
{
$items = $this->page->navbar->get_items();
$breadcrumbs = array();
foreach ($items as $item) {
$item->hideicon = true;
/*
* Trying to replace the 'My home' breadcrumb
* not very elegant; another solution may be considered later
*/
$ismyhome = strcasecmp($item->text, get_string('myhome')) == 0;
if ($ismyhome) {
$breadcrumbs[] = '<a href="/" id="moo-home-button"> <i class="fa fa-home fa-lg"></i></a>';
continue;
// go to next element
}
/**/
$a = $this->render($item);
if (strpos($a, "/course/view.php") !== false) {
$breadcrumbs[] = html_writer::div($a, 'coursetitle');
} else {
$breadcrumbs[] = $a;
}
}
// ADD ELLIPSES ...
$new_breadcrumbs = array();
$counter = 0;
foreach ($breadcrumbs as $breadcrumb) {
//add ellipses in second position
if ($counter == 1) {
$new_breadcrumbs[] = "<span id='ellipses'>...</span>";
}
$new_breadcrumbs[] = $breadcrumb;
$counter++;
}
//
$divider = '<span class="divider">' . get_separator() . '</span>';
$list_items = '<li>' . join(" {$divider}</li><li>", $new_breadcrumbs) . '</li>';
$title = '<span class="accesshide">' . get_string('pagepath') . '</span>';
return $title . "<ul id=\"bc1\" class=\"breadcrumb\">{$list_items}</ul>";
}
开发者ID:digitalquest,项目名称:moodle_themex,代码行数:41,代码来源:core_renderer.php
注:本文中的get_separator函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论