本文整理汇总了PHP中right_to_left函数的典型用法代码示例。如果您正苦于以下问题:PHP right_to_left函数的具体用法?PHP right_to_left怎么用?PHP right_to_left使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了right_to_left函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_csswww
public function get_csswww()
{
global $CFG;
if (!$this->theme_essential_lte_ie9()) {
if (right_to_left()) {
$moodlecss = 'essential-rtl.css';
} else {
$moodlecss = 'essential.css';
}
$syscontext = context_system::instance();
$itemid = theme_get_revision();
$url = moodle_url::make_file_url("{$CFG->wwwroot}/pluginfile.php", "/{$syscontext->id}/theme_essential/style/{$itemid}/{$moodlecss}");
$url = preg_replace('|^https?://|i', '//', $url->out(false));
return '<link rel="stylesheet" href="' . $url . '">';
} else {
if (right_to_left()) {
$moodlecssone = 'essential-rtl_ie9-blessed1.css';
$moodlecsstwo = 'essential-rtl_ie9.css';
} else {
$moodlecssone = 'essential_ie9-blessed1.css';
$moodlecsstwo = 'essential_ie9.css';
}
$syscontext = context_system::instance();
$itemid = theme_get_revision();
$urlone = moodle_url::make_file_url("{$CFG->wwwroot}/pluginfile.php", "/{$syscontext->id}/theme_essential/style/{$itemid}/{$moodlecssone}");
$urlone = preg_replace('|^https?://|i', '//', $urlone->out(false));
$urltwo = moodle_url::make_file_url("{$CFG->wwwroot}/pluginfile.php", "/{$syscontext->id}/theme_essential/style/{$itemid}/{$moodlecsstwo}");
$urltwo = preg_replace('|^https?://|i', '//', $urltwo->out(false));
return '<link rel="stylesheet" href="' . $urlone . '"><link rel="stylesheet" href="' . $urltwo . '">';
}
}
示例2: get_nav_links_content
protected function get_nav_links_content($course, $sections, $sectionno, $buffer = 0)
{
// FIXME: This is really evil and should by using the navigation API.
$course = \course_get_format($course)->get_course();
$left = 'left';
$right = 'right';
if (\right_to_left()) {
$temp = $left;
$left = $right;
$right = $temp;
}
$previousarrow = '<span aria-hidden="true" class="fa fa-chevron-circle-' . $left . '"></span>';
$nextarrow = '<span aria-hidden="true" class="fa fa-chevron-circle-' . $right . '"></span>';
$canviewhidden = \has_capability('moodle/course:viewhiddensections', \context_course::instance($course->id)) or !$course->hiddensections;
$links = array('previous' => '', 'next' => '');
$back = $sectionno - 1;
while ($back > $buffer and empty($links['previous'])) {
if ($canviewhidden || $sections[$back]->uservisible) {
$params = array('id' => 'previous_section');
if (!$sections[$back]->visible) {
$params['class'] = 'dimmed_text';
}
$previouslink = \html_writer::start_tag('div', array('class' => 'nav_icon'));
$previouslink .= $previousarrow;
$previouslink .= \html_writer::end_tag('div');
$previouslink .= \html_writer::start_tag('span', array('class' => 'text'));
$previouslink .= \html_writer::start_tag('span', array('class' => 'nav_guide'));
$previouslink .= \get_string('previoussection', 'theme_essential');
$previouslink .= \html_writer::end_tag('span');
$previouslink .= \html_writer::empty_tag('br');
$previouslink .= \get_section_name($course, $sections[$back]);
$previouslink .= \html_writer::end_tag('span');
$links['previous'] = \html_writer::link(course_get_url($course, $back), $previouslink, $params);
}
$back--;
}
$forward = $sectionno + 1;
while ($forward <= $course->numsections and empty($links['next'])) {
if ($canviewhidden || $sections[$forward]->uservisible) {
$params = array('id' => 'next_section');
if (!$sections[$forward]->visible) {
$params['class'] = 'dimmed_text';
}
$nextlink = \html_writer::start_tag('div', array('class' => 'nav_icon'));
$nextlink .= $nextarrow;
$nextlink .= \html_writer::end_tag('div');
$nextlink .= \html_writer::start_tag('span', array('class' => 'text'));
$nextlink .= \html_writer::start_tag('span', array('class' => 'nav_guide'));
$nextlink .= \get_string('nextsection', 'theme_essential');
$nextlink .= \html_writer::end_tag('span');
$nextlink .= \html_writer::empty_tag('br');
$nextlink .= \get_section_name($course, $sections[$forward]);
$nextlink .= \html_writer::end_tag('span');
$links['next'] = \html_writer::link(course_get_url($course, $forward), $nextlink, $params);
}
$forward++;
}
return $links;
}
示例3: get_content
function get_content()
{
global $CFG, $WS, $USER;
if (empty($WS->dfwiki)) {
$this->content->text = get_string('block_warning', 'wiki');
return $this->content;
}
// $this->content->footer = '<br />'
// . helpbutton('ranking', $this->title, 'wiki', true, false, '', true)
// . $this->title;
// dfwiki-block || course-block
if ($this->instance->pagetype == 'mod-wiki-view') {
$dir = $CFG->wwwroot . '/mod/wiki/view.php?id=' . $WS->cm->id;
} else {
$dir = $CFG->wwwroot . '/course/view.php?id=' . $WS->cm->course;
}
if (!empty($WS->dfwiki) && $WS->dfwiki->votemode == 0) {
$this->content->text = get_string('vote_warning', 'wiki');
return $this->content;
}
$vote = optional_param('Vote', NULL, PARAM_ALPHA);
$wikimanager = wiki_manager_get_instance();
if ($WS->dfwiki->votemode == 1 and $vote == 'Vote') {
$wikimanager->vote_page($WS->dfwiki->id, $WS->page, $WS->pagedata->version, $USER->username);
}
$ranking = $wikimanager->get_vote_ranking($WS->dfwiki->id);
$this->content = new stdClass();
if (!$ranking) {
$this->content->text = get_string('nopages', 'wiki');
$this->content->footer = '';
return $this->content;
}
if (right_to_left()) {
// rtl support for table cell alignment (nadavkav patch)
$alignmentleft = 'right';
$alignmentright = 'left';
} else {
$alignmentleft = 'left';
$alignmentright = 'right';
}
$text = '<table border="0" width="100" cellpadding="0" cellspacing="0">' . '<tr><th>' . get_string('page') . '</th><th>' . get_string('votes', 'wiki') . '</th></tr>';
$n_rows = 0;
foreach ($ranking as $row) {
$text .= '<tr><td align="' . $alignmentleft . '">' . '<a href="' . $dir . '&page=' . urlencode($row->pagename) . '">' . $this->trim_string($row->pagename, 20) . '</a></td>' . '<td align="center">' . $row->votes . '</td></tr>';
// Show only the first 5 rows.
if (++$n_rows == 5) {
break;
}
}
$text .= '</table>';
$this->content->text = $text;
$this->content->footer = ' ';
return $this->content;
}
示例4: get_content
function get_content()
{
global $CFG, $WS;
if ($this->content !== NULL) {
return $this->content;
}
//If we are out of a dfwiki activity or in a different
//dfwiki format course and we want to create a block:
if (empty($WS->dfwiki)) {
$this->content->text = get_string('block_warning', 'wiki');
return $this->content;
}
$this->content = new stdClass();
$this->content->items = array();
$this->content->icons = array();
//$this->content->footer = '<br />'.helpbutton ('updated', get_string('block_updated', 'wiki'), 'wiki', true, false, '', true).get_string('block_updated', 'wiki');
$ead = wiki_manager_get_instance();
$pages = $ead->get_wiki_most_uptodate_pages(10);
// dfwiki-block || course-block
$dir = "";
if ($this->instance->pagetype == "mod-wiki-view") {
$dir = $CFG->wwwroot . '/mod/wiki/view.php?id=' . $WS->cm->id;
} else {
$dir = $CFG->wwwroot . '/course/view.php?id=' . $WS->cm->course;
}
// rtl / ltr CSS alignment support (nadavkav)
if (right_to_left()) {
$nwikialignment = 'nwikirightnow';
} else {
$nwikialignment = 'nwikileftnow';
}
if (count($pages) != 0) {
$text = '<table border="0" cellpadding="0" cellspacing="0">';
$i = 1;
foreach ($pages as $page) {
$pageinfo = wiki_page_last_version($page);
$brs = strlen($page) > 12 ? '<br /> ' : '';
$text .= '<tr>
<td class="' . $nwikialignment . '">
' . $i . '- <a href="' . $dir . '&page=' . urlencode($page) . '" title="' . $page . '">' . $this->trim_string($page, 40) . '</a>' . $brs . '
- <small>(' . strftime('%d %b %y', $pageinfo->lastmodified) . ')</small>
' . wiki_get_user_info($pageinfo->author, 40, false) . '
</td>
</tr>';
$i++;
}
$text .= '</table>';
} else {
$text = get_string('nopages', 'wiki');
}
$this->content->text = $text;
return $this->content;
}
示例5: __construct
/**
* Constructor method, calls the parent constructor - MDL-21097
*
* @param moodle_page $page
* @param string $target one of rendering target constants
*/
public function __construct(moodle_page $page, $target)
{
parent::__construct($page, $target);
$this->togglelib = new topcoll_togglelib();
$this->courseformat = course_get_format($page->course);
// Needed for collapsed topics settings retrieval.
/* Since format_topcoll_renderer::section_edit_controls() only displays the 'Set current section' control when editing
mode is on we need to be sure that the link 'Turn editing mode on' is available for a user who does not have any
other managing capability. */
$page->set_other_editing_capability('moodle/course:setcurrentsection');
global $PAGE;
$this->userisediting = $PAGE->user_is_editing();
$this->tctoggleiconsize = clean_param(get_config('format_topcoll', 'defaulttoggleiconsize'), PARAM_TEXT);
$this->rtl = right_to_left();
}
示例6: checklist_class
function checklist_class($cmid = 'staticonly', $userid = 0, $checklist = NULL, $cm = NULL, $course = NULL)
{
global $COURSE;
if ($cmid == 'staticonly') {
//use static functions only!
return;
}
$this->userid = $userid;
global $CFG;
if (right_to_left()) {
// rtl support for table cell alignment (nadavkav patch)
$alignleft = 'right';
$alignright = 'left';
} else {
$alignleft = 'left';
$alignright = 'right';
}
if ($cm) {
$this->cm = $cm;
} else {
if (!($this->cm = get_coursemodule_from_id('checklist', $cmid))) {
error('Course Module ID was incorrect');
}
}
$this->context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
if ($course) {
$this->course = $course;
} else {
if ($this->cm->course == $COURSE->id) {
$this->course = $COURSE;
} else {
if (!($this->course = get_record('course', 'id', $this->cm->course))) {
error('Course is misconfigured');
}
}
}
if ($checklist) {
$this->checklist = $checklist;
} else {
if (!($this->checklist = get_record('checklist', 'id', $this->cm->instance))) {
error('assignment ID was incorrect');
}
}
$this->strchecklist = get_string('modulename', 'checklist');
$this->strchecklists = get_string('modulenameplural', 'checklist');
$this->pagetitle = strip_tags($this->course->shortname . ': ' . $this->strchecklist . ': ' . format_string($this->checklist->name, true));
$this->get_items();
}
示例7: get_other_values
public function get_other_values(renderer_base $output)
{
$values = array();
$values['autostart'] = $this->comment->get_autostart();
$values['canpost'] = $this->comment->can_post();
$values['canview'] = $this->comment->can_view();
$values['collapsediconurl'] = $output->pix_url(right_to_left() ? 't/collapsed_rtl' : 't/collapsed')->out(false);
$values['count'] = $this->comment->count();
$values['displaycancel'] = $this->comment->get_displaycancel();
$values['displaytotalcount'] = $this->comment->get_displaytotalcount();
$values['fullwidth'] = $this->comment->get_fullwidth();
$values['linktext'] = $this->comment->get_linktext();
$values['notoggle'] = $this->comment->get_notoggle();
$values['template'] = $this->comment->get_template();
$values['canpostorhascomments'] = $values['canpost'] || $values['canview'] && $values['count'] > 0;
return $values;
}
示例8: module_specific_actions
/**
* Callback function called from question_list() function (which is called from showbank())
* Displays action icon as first action for each question.
*/
function module_specific_actions($pageurl, $questionid, $cmid, $canuse)
{
global $CFG;
if ($canuse) {
// for RTL languages: switch right and left arrows /****/
if (right_to_left()) {
$movearrow = 'removeright.gif';
} else {
$movearrow = 'moveleft.gif';
}
$straddtoquiz = get_string("addtoquiz", "quiz");
$out = "<a title=\"{$straddtoquiz}\" href=\"edit.php?" . $pageurl->get_query_string() . "&addquestion={$questionid}&sesskey=" . sesskey() . "\"><img\n src=\"{$CFG->pixpath}/t/{$movearrow}\" alt=\"{$straddtoquiz}\" /></a> ";
return $out;
} else {
return '';
}
}
示例9: navbar
public function navbar()
{
$items = $this->page->navbar->get_items();
if (right_to_left()) {
$dividericon = 'fa-angle-left';
} else {
$dividericon = 'fa-angle-right';
}
$divider = html_writer::tag('span', html_writer::start_tag('i', array('class' => 'fa ' . $dividericon . ' fa-lg')) . html_writer::end_tag('i'), array('class' => 'divider'));
$breadcrumbs = array();
foreach ($items as $item) {
$item->hideicon = true;
$breadcrumbs[] = $this->render($item);
}
$list_items = html_writer::start_tag('li') . implode("{$divider}" . html_writer::end_tag('li') . html_writer::start_tag('li'), $breadcrumbs) . html_writer::end_tag('li');
$title = html_writer::tag('span', get_string('pagepath'), array('class' => 'accesshide'));
return $title . html_writer::tag('ul', "{$list_items}", array('class' => 'breadcrumb'));
}
示例10: admin_authorised_user_selector
/**
* Display the authorised user selector
*
* @param stdClass $options It contains alloweduserselector, potentialuserselector and serviceid
* @return string html
*/
public function admin_authorised_user_selector(&$options)
{
global $CFG;
$formcontent = html_writer::empty_tag('input', array('name' => 'sesskey', 'value' => sesskey(), 'type' => 'hidden'));
$table = new html_table();
$table->size = array('45%', '10%', '45%');
$table->attributes['class'] = 'roleassigntable generaltable generalbox boxaligncenter';
$table->summary = '';
$table->cellspacing = 0;
$table->cellpadding = 0;
// LTR/RTL support, for drawing button arrows in the right direction
if (right_to_left()) {
$addarrow = '▶';
$removearrow = '◀';
} else {
$addarrow = '◀';
$removearrow = '▶';
}
//create the add and remove button
$addinput = html_writer::empty_tag('input', array('name' => 'add', 'id' => 'add', 'type' => 'submit', 'value' => $addarrow . ' ' . get_string('add'), 'title' => get_string('add')));
$addbutton = html_writer::tag('div', $addinput, array('id' => 'addcontrols'));
$removeinput = html_writer::empty_tag('input', array('name' => 'remove', 'id' => 'remove', 'type' => 'submit', 'value' => $removearrow . ' ' . get_string('remove'), 'title' => get_string('remove')));
$removebutton = html_writer::tag('div', $removeinput, array('id' => 'removecontrols'));
//create the three cells
$label = html_writer::tag('label', get_string('serviceusers', 'webservice'), array('for' => 'removeselect'));
$label = html_writer::tag('p', $label);
$authoriseduserscell = new html_table_cell($label . $options->alloweduserselector->display(true));
$authoriseduserscell->id = 'existingcell';
$buttonscell = new html_table_cell($addbutton . html_writer::empty_tag('br') . $removebutton);
$buttonscell->id = 'buttonscell';
$label = html_writer::tag('label', get_string('potusers', 'webservice'), array('for' => 'addselect'));
$label = html_writer::tag('p', $label);
$otheruserscell = new html_table_cell($label . $options->potentialuserselector->display(true));
$otheruserscell->id = 'potentialcell';
$cells = array($authoriseduserscell, $buttonscell, $otheruserscell);
$row = new html_table_row($cells);
$table->data[] = $row;
$formcontent .= html_writer::table($table);
$formcontent = html_writer::tag('div', $formcontent);
$actionurl = new moodle_url('/' . $CFG->admin . '/webservice/service_users.php', array('id' => $options->serviceid));
$html = html_writer::tag('form', $formcontent, array('id' => 'assignform', 'action' => $actionurl, 'method' => 'post'));
return $html;
}
示例11: init
function init()
{
global $CFG, $WS;
$this->title = get_string('block_index_current', 'wiki') . helpbutton('index_current', get_string('block_index_current', 'wiki'), 'wiki', true, false, '', true);
$this->version = 2004081200;
//initiates images array
if (isset($WS->dfcourse)) {
$imgclass = 'wiki_folding_co';
} else {
$imgclass = 'wiki_folding';
}
if (right_to_left()) {
$squaredir = 'left';
} else {
$squaredir = 'right';
}
// rtl support (nadavkav patch)
$this->images = array('plus' => '<img src="' . $CFG->wwwroot . '/mod/wiki/images/plus.gif" class="' . $imgclass . '" alt="" />', 'minus' => '<img src="' . $CFG->wwwroot . '/mod/wiki/images/minus.gif" class="' . $imgclass . '" alt="" />', 'square' => '<img src="' . $CFG->wwwroot . '/mod/wiki/images/square-' . $squaredir . '.png" alt="" />');
}
示例12: _createElements
function _createElements()
{
$this->_elements = array();
for ($i = 1; $i <= 31; $i++) {
$days[$i] = $i;
}
for ($i = 1; $i <= 12; $i++) {
$months[$i] = userdate(gmmktime(12, 0, 0, $i, 15, 2000), "%B");
}
for ($i = $this->_options['startyear']; $i <= $this->_options['stopyear']; $i++) {
$years[$i] = $i;
}
for ($i = 0; $i <= 23; $i++) {
$hours[$i] = sprintf("%02d", $i);
}
for ($i = 0; $i < 60; $i += $this->_options['step']) {
$minutes[$i] = sprintf("%02d", $i);
}
$this->_elements[] =& MoodleQuickForm::createElement('select', 'day', get_string('day', 'form'), $days, $this->getAttributes(), true);
$this->_elements[] =& MoodleQuickForm::createElement('select', 'month', get_string('month', 'form'), $months, $this->getAttributes(), true);
$this->_elements[] =& MoodleQuickForm::createElement('select', 'year', get_string('year', 'form'), $years, $this->getAttributes(), true);
if (right_to_left()) {
// Switch order of elements for Right-to-Left
$this->_elements[] =& MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
$this->_elements[] =& MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
} else {
$this->_elements[] =& MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
$this->_elements[] =& MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
}
// If optional we add a checkbox which the user can use to turn if on
if ($this->_options['optional']) {
$this->_elements[] =& MoodleQuickForm::createElement('checkbox', 'off', null, get_string('disable'), $this->getAttributes(), true);
}
foreach ($this->_elements as $element) {
if (method_exists($element, 'setHiddenLabel')) {
$element->setHiddenLabel(true);
}
}
}
示例13: render_custom_menu_item
/**
* Renders a custom menu node as part of a submenu
*
* The custom menu this method override the render_custom_menu_item function
* in outputrenderers.php
*
* @see render_custom_menu()
*
* @staticvar int $submenucount
* @param custom_menu_item $menunode
* @return string
*/
protected function render_custom_menu_item(custom_menu_item $menunode)
{
if (!right_to_left()) {
// Keep YUI3 navmenu for LTR UI
parent::render_custom_menu_item($menunode);
}
// Required to ensure we get unique trackable id's
static $submenucount = 0;
$content = html_writer::start_tag('li');
if ($menunode->has_children()) {
// If the child has menus render it as a sub menu
$submenucount++;
if ($menunode->get_url() !== null) {
$url = $menunode->get_url();
} else {
$url = '#cm_submenu_' . $submenucount;
}
$content .= html_writer::start_tag('span', array('class' => 'customitem'));
$content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
$content .= html_writer::end_tag('span');
$content .= html_writer::start_tag('ul');
foreach ($menunode->get_children() as $menunode) {
$content .= $this->render_custom_menu_item($menunode);
}
$content .= html_writer::end_tag('ul');
} else {
// The node doesn't have children so produce a final menuitem
if ($menunode->get_url() !== null) {
$url = $menunode->get_url();
} else {
$url = '#';
}
$content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
}
$content .= html_writer::end_tag('li');
// Return the sub menu
return $content;
}
示例14: get_csswww
static public function get_csswww() {
global $CFG;
if (!self::lte_ie9()) {
if (\right_to_left()) {
$moodlecss = 'essential-rtl.css';
} else {
$moodlecss = 'essential.css';
}
$syscontext = \context_system::instance();
$itemid = \theme_get_revision();
$url = \moodle_url::make_file_url("$CFG->wwwroot/pluginfile.php",
"/$syscontext->id/theme_essential/style/$itemid/$moodlecss");
$url = preg_replace('|^https?://|i', '//', $url->out(false));
return '<link rel="stylesheet" href="' . $url . '">';
} else {
if (\right_to_left()) {
$moodlecssone = 'essential-rtl_ie9-blessed1.css';
$moodlecsstwo = 'essential-rtl_ie9.css';
} else {
$moodlecssone = 'essential_ie9-blessed1.css';
$moodlecsstwo = 'essential_ie9.css';
}
$syscontext = \context_system::instance();
$itemid = \theme_get_revision();
$urlone = \moodle_url::make_file_url("$CFG->wwwroot/pluginfile.php",
"/$syscontext->id/theme_essential/style/$itemid/$moodlecssone");
$urlone = preg_replace('|^https?://|i', '//', $urlone->out(false));
$urltwo = \moodle_url::make_file_url("$CFG->wwwroot/pluginfile.php",
"/$syscontext->id/theme_essential/style/$itemid/$moodlecsstwo");
$urltwo = preg_replace('|^https?://|i', '//', $urltwo->out(false));
return '<link rel="stylesheet" href="'.$urlone . '"><link rel="stylesheet" href="'.$urltwo.'">';
}
}
示例15: theme_ent90_get_html_for_settings
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* The two column layout.
*
* @package theme_ent90
* @copyright 2013 Moodle, moodle.org
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Get the HTML for the settings bits.
$html = theme_ent90_get_html_for_settings($OUTPUT, $PAGE);
$left = !right_to_left();
// To know if to add 'pull-right' and 'desktop-first-column' classes in the layout for LTR.
echo $OUTPUT->doctype();
?>
<html <?php
echo $OUTPUT->htmlattributes();
?>
>
<head>
<title><?php
echo $OUTPUT->page_title();
?>
</title>
<link rel="shortcut icon" href="<?php
echo $OUTPUT->favicon();
?>