本文整理汇总了PHP中fix_align_rtl函数的典型用法代码示例。如果您正苦于以下问题:PHP fix_align_rtl函数的具体用法?PHP fix_align_rtl怎么用?PHP fix_align_rtl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fix_align_rtl函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: table
/**
* Renders HTML table
*
* This method may modify the passed instance by adding some default properties if they are not set yet.
* If this is not what you want, you should make a full clone of your data before passing them to this
* method. In most cases this is not an issue at all so we do not clone by default for performance
* and memory consumption reasons.
*
* Please do not use .r0/.r1 for css, as they will be removed in Moodle 2.9.
* @todo MDL-43902 , remove r0 and r1 from tr classes.
*
* @param html_table $table data to be rendered
* @return string HTML code
*/
public static function table(html_table $table)
{
// prepare table data and populate missing properties with reasonable defaults
if (!empty($table->align)) {
foreach ($table->align as $key => $aa) {
if ($aa) {
$table->align[$key] = 'text-align:' . fix_align_rtl($aa) . ';';
// Fix for RTL languages
} else {
$table->align[$key] = null;
}
}
}
if (!empty($table->size)) {
foreach ($table->size as $key => $ss) {
if ($ss) {
$table->size[$key] = 'width:' . $ss . ';';
} else {
$table->size[$key] = null;
}
}
}
if (!empty($table->wrap)) {
foreach ($table->wrap as $key => $ww) {
if ($ww) {
$table->wrap[$key] = 'white-space:nowrap;';
} else {
$table->wrap[$key] = '';
}
}
}
if (!empty($table->head)) {
foreach ($table->head as $key => $val) {
if (!isset($table->align[$key])) {
$table->align[$key] = null;
}
if (!isset($table->size[$key])) {
$table->size[$key] = null;
}
if (!isset($table->wrap[$key])) {
$table->wrap[$key] = null;
}
}
}
if (empty($table->attributes['class'])) {
$table->attributes['class'] = 'generaltable';
}
if (!empty($table->tablealign)) {
$table->attributes['class'] .= ' boxalign' . $table->tablealign;
}
// explicitly assigned properties override those defined via $table->attributes
$table->attributes['class'] = trim($table->attributes['class']);
$attributes = array_merge($table->attributes, array('id' => $table->id, 'width' => $table->width, 'summary' => $table->summary, 'cellpadding' => $table->cellpadding, 'cellspacing' => $table->cellspacing));
$output = html_writer::start_tag('table', $attributes) . "\n";
$countcols = 0;
if (!empty($table->head)) {
$countcols = count($table->head);
$output .= html_writer::start_tag('thead', array()) . "\n";
$output .= html_writer::start_tag('tr', array()) . "\n";
$keys = array_keys($table->head);
$lastkey = end($keys);
foreach ($table->head as $key => $heading) {
// Convert plain string headings into html_table_cell objects
if (!$heading instanceof html_table_cell) {
$headingtext = $heading;
$heading = new html_table_cell();
$heading->text = $headingtext;
$heading->header = true;
}
if ($heading->header !== false) {
$heading->header = true;
}
if ($heading->header && empty($heading->scope)) {
$heading->scope = 'col';
}
$heading->attributes['class'] .= ' header c' . $key;
if (isset($table->headspan[$key]) && $table->headspan[$key] > 1) {
$heading->colspan = $table->headspan[$key];
$countcols += $table->headspan[$key] - 1;
}
if ($key == $lastkey) {
$heading->attributes['class'] .= ' lastcol';
}
if (isset($table->colclasses[$key])) {
$heading->attributes['class'] .= ' ' . $table->colclasses[$key];
}
//.........这里部分代码省略.........
开发者ID:jtibbetts,项目名称:moodle,代码行数:101,代码来源:outputcomponents.php
示例2: print_table
/**
* Print a nicely formatted table.
*
* @param array $table is an object with several properties.
* <ul>
* <li>$table->head - An array of heading names.
* <li>$table->align - An array of column alignments
* <li>$table->size - An array of column sizes
* <li>$table->wrap - An array of "nowrap"s or nothing
* <li>$table->data[] - An array of arrays containing the data.
* <li>$table->width - A percentage of the page
* <li>$table->tablealign - Align the whole table
* <li>$table->cellpadding - Padding on each cell
* <li>$table->cellspacing - Spacing between cells
* <li>$table->class - class attribute to put on the table
* <li>$table->id - id attribute to put on the table.
* <li>$table->rowclass[] - classes to add to particular rows.
* <li>$table->summary - Description of the contents for screen readers.
* </ul>
* @param bool $return whether to return an output string or echo now
* @return boolean or $string
* @todo Finish documenting this function
*/
function print_table($table, $return = false)
{
$output = '';
if (isset($table->align)) {
foreach ($table->align as $key => $aa) {
if ($aa) {
$align[$key] = ' text-align:' . fix_align_rtl($aa) . ';';
// Fix for RTL languages
} else {
$align[$key] = '';
}
}
}
if (isset($table->size)) {
foreach ($table->size as $key => $ss) {
if ($ss) {
$size[$key] = ' width:' . $ss . ';';
} else {
$size[$key] = '';
}
}
}
if (isset($table->wrap)) {
foreach ($table->wrap as $key => $ww) {
if ($ww) {
$wrap[$key] = ' white-space:nowrap;';
} else {
$wrap[$key] = '';
}
}
}
if (empty($table->width)) {
$table->width = '80%';
}
if (empty($table->tablealign)) {
$table->tablealign = 'center';
}
if (!isset($table->cellpadding)) {
$table->cellpadding = '5';
}
if (!isset($table->cellspacing)) {
$table->cellspacing = '1';
}
if (empty($table->class)) {
$table->class = 'generaltable';
}
$tableid = empty($table->id) ? '' : 'id="' . $table->id . '"';
$output .= '<table width="' . $table->width . '" ';
if (!empty($table->summary)) {
$output .= " summary=\"{$table->summary}\"";
}
$output .= " cellpadding=\"{$table->cellpadding}\" cellspacing=\"{$table->cellspacing}\" class=\"{$table->class} boxalign{$table->tablealign}\" {$tableid}>\n";
$countcols = 0;
if (!empty($table->head)) {
$countcols = count($table->head);
$output .= '<tr>';
$keys = array_keys($table->head);
$lastkey = end($keys);
foreach ($table->head as $key => $heading) {
if (!isset($size[$key])) {
$size[$key] = '';
}
if (!isset($align[$key])) {
$align[$key] = '';
}
if ($key == $lastkey) {
$extraclass = ' lastcol';
} else {
$extraclass = '';
}
$output .= '<th style="vertical-align:top;' . $align[$key] . $size[$key] . ';white-space:nowrap;" class="header c' . $key . $extraclass . '" scope="col">' . $heading . '</th>';
}
$output .= '</tr>' . "\n";
}
if (!empty($table->data)) {
$oddeven = 1;
$keys = array_keys($table->data);
//.........这里部分代码省略.........
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:101,代码来源:weblib.php
示例3: print_table
/**
* Print a nicely formatted table.
*
* @param array $table is an object with several properties.
* <ul>
* <li>$table->head - An array of heading names.
* <li>$table->align - An array of column alignments
* <li>$table->size - An array of column sizes
* <li>$table->wrap - An array of "nowrap"s or nothing
* <li>$table->data[] - An array of arrays containing the data.
* <li>$table->width - A percentage of the page
* <li>$table->tablealign - Align the whole table
* <li>$table->cellpadding - Padding on each cell
* <li>$table->cellspacing - Spacing between cells
* <li>$table->class - class attribute to put on the table
* <li>$table->id - id attribute to put on the table.
* <li>$table->rowclass[] - classes to add to particular rows. (space-separated string)
* <li>$table->colclass[] - classes to add to every cell in a particular colummn. (space-separated string)
* <li>$table->summary - Description of the contents for screen readers.
* <li>$table->headspan can be used to make a heading span multiple columns.
* <li>$table->rotateheaders - Causes the contents of the heading cells to be rotated 90 degrees.
* </ul>
* @param bool $return whether to return an output string or echo now
* @return boolean or $string
* @todo Finish documenting this function
*/
function print_table($table, $return = false)
{
$output = '';
if (isset($table->align)) {
foreach ($table->align as $key => $aa) {
if ($aa) {
$align[$key] = ' text-align:' . fix_align_rtl($aa) . ';';
// Fix for RTL languages
} else {
$align[$key] = '';
}
}
}
if (isset($table->size)) {
foreach ($table->size as $key => $ss) {
if ($ss) {
$size[$key] = ' width:' . $ss . ';';
} else {
$size[$key] = '';
}
}
}
if (isset($table->wrap)) {
foreach ($table->wrap as $key => $ww) {
if ($ww) {
$wrap[$key] = ' white-space:nowrap;';
} else {
$wrap[$key] = '';
}
}
}
if (empty($table->width)) {
$table->width = '80%';
}
if (empty($table->tablealign)) {
$table->tablealign = 'center';
}
if (!isset($table->cellpadding)) {
$table->cellpadding = '5';
}
if (!isset($table->cellspacing)) {
$table->cellspacing = '1';
}
if (empty($table->class)) {
$table->class = 'generaltable';
}
if (!empty($table->rotateheaders)) {
$table->class .= ' rotateheaders';
} else {
$table->rotateheaders = false;
// Makes life easier later.
}
$tableid = empty($table->id) ? '' : 'id="' . $table->id . '"';
$output .= '<table width="' . $table->width . '" ';
if (!empty($table->summary)) {
$output .= " summary=\"{$table->summary}\"";
}
$output .= " cellpadding=\"{$table->cellpadding}\" cellspacing=\"{$table->cellspacing}\" class=\"{$table->class} boxalign{$table->tablealign}\" {$tableid}>\n";
$countcols = 0;
if (!empty($table->head)) {
$countcols = count($table->head);
$output .= '<tr>';
$keys = array_keys($table->head);
$lastkey = end($keys);
foreach ($table->head as $key => $heading) {
$classes = array('header', 'c' . $key);
if (!isset($size[$key])) {
$size[$key] = '';
}
if (!isset($align[$key])) {
$align[$key] = '';
}
if (isset($table->headspan[$key]) && $table->headspan[$key] > 1) {
$colspan = ' colspan="' . $table->headspan[$key] . '"';
//.........这里部分代码省略.........
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:101,代码来源:weblib.php
示例4: css_styles
function css_styles()
{
?>
<style type="text/css">
body { background-color: #fafafa; }
p, li, td {
font-family: helvetica, arial, sans-serif;
font-size: 10pt;
}
a { text-decoration: none; color: blue; }
a img {
border: none;
}
.errormsg {
color: red;
font-weight: bold;
}
blockquote {
font-family: courier, monospace;
font-size: 10pt;
}
.input_database {
width: 270px;
}
.install_table {
width: 500px;
margin-left:auto;
margin-right:auto;
}
.td_left {
text-align: <?php
echo fix_align_rtl("right");
?>
;
font-weight: bold;
}
.td_left_nowrap{
text-align: <?php
echo fix_align_rtl("right");
?>
;
font-weight: bold;
white-space: nowrap;
width: 160px;
padding-left: 10px;
}
.td_right {
text-align: <?php
echo fix_align_rtl("left");
?>
;
}
.main {
width: 80%;
border-width: 1px;
border-style: solid;
border-color: #dddddd;
margin-left:auto;
margin-right:auto;
-moz-border-radius-bottomleft: 15px;
-moz-border-radius-bottomright: 15px;
}
.td_mainheading {
background-color: #eeeeee;
padding-left: 10px;
}
.td_main {
text-align: center;
}
.td_mainlogo {
vertical-align: middle;
}
.p_mainlogo {
margin-top: 0px;
margin-bottom: 0px;
}
.p_mainheading {
font-size: 11pt;
margin-top: 16px;
margin-bottom: 16px;
}
.p_subheading {
font-size: 10pt;
padding-left: 10px;
margin-top: 16px;
margin-bottom: 16px;
}
.p_mainheader{
text-align: right;
font-size: 20pt;
font-weight: bold;
margin-top: 0px;
margin-bottom: 0px;
}
.p_pass {
color: green;
font-weight: bold;
margin-top: 0px;
//.........这里部分代码省略.........
开发者ID:jperezpamos,项目名称:marsupial-mps,代码行数:101,代码来源:install.php
示例5: css_styles
function css_styles()
{
?>
<style type="text/css">
body { background-color: #ffeece; }
p, li, td {
font-family: helvetica, arial, sans-serif;
font-size: 10pt;
}
a { text-decoration: none; color: blue; }
a img {
border: none;
}
.errormsg {
color: red;
font-weight: bold;
}
blockquote {
font-family: courier, monospace;
font-size: 10pt;
}
.install_table {
width: 500px;
}
.td_left {
text-align: <?php
echo fix_align_rtl("right");
?>
;
font-weight: bold;
}
.td_right {
text-align: <?php
echo fix_align_rtl("left");
?>
;
}
.main {
width: 500px;
border-width: 1px;
border-style: solid;
border-color: #ffc85f;
-moz-border-radius-bottomleft: 15px;
-moz-border-radius-bottomright: 15px;
}
.td_mainheading {
background-color: #fee6b9;
padding: 10px;
}
.td_main {
text-align: center;
}
.td_mainlogo {
}
.p_mainlogo {
}
.p_mainheading {
font-size: 11pt;
}
.p_subheading {
font-size: 10pt;
padding: 10px;
}
.p_mainheader{
text-align: right;
font-size: 20pt;
font-weight: bold;
}
.p_pass {
color: green;
font-weight: bold;
}
.p_fail {
color: red;
font-weight: bold;
}
.p_caution {
color: #ff6600;
font-weight: bold;
}
.p_help {
text-align: center;
font-family: helvetica, arial, sans-serif;
font-size: 14pt;
font-weight: bold;
color: #333333;
}
.environmenttable {
font-size: 10pt;
border-color: #ffc85f;
}
table.environmenttable .error {
background-color : red;
color : inherit;
}
table.environmenttable .warn {
background-color : yellow;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:101,代码来源:install.php
示例6: print_table
/**
* Print a nicely formatted table.
* Note: This function is copied from core Moodle and contains modifications by RL
*
* @param array $table is an object with several properties.
* <ul>
* <li>$table->head - An array of heading names.
* <li>$table->align - An array of column alignments
* <li>$table->size - An array of column sizes
* <li>$table->wrap - An array of "nowrap"s or nothing
* <li>$table->data[] - An array of arrays containing the data.
* <li>$table->width - A percentage of the page
* <li>$table->tablealign - Align the whole table
* <li>$table->class - class attribute to put on the table
* <li>$table->id - id attribute to put on the table.
* <li>$table->rowclass[] - classes to add to particular rows.
* <li>$table->summary - Description of the contents for screen readers.
* <li>$table->firstcolumn - If set, only use first column
* <li>$table->spanrow - If set, span entire row
* <li>$table->headercolumncss - CSS for specific columns in header
* <li>$table->columncss - CSS for specific columns in data
* </ul>
* @param bool $return whether to return an output string or echo now
* @return boolean or $string
* @todo Finish documenting this function
*/
function print_table($table, $return=false) {
$output = '';
if (isset($table->align)) {
foreach ($table->align as $key => $aa) {
if ($aa) {
$align[$key] = ' text-align:'. fix_align_rtl($aa) .';'; // Fix for RTL languages
} else {
$align[$key] = '';
}
}
}
if (isset($table->size)) {
foreach ($table->size as $key => $ss) {
if ($ss) {
$size[$key] = ' width:'. $ss .';';
} else {
$size[$key] = '';
}
}
}
if (isset($table->wrap)) {
foreach ($table->wrap as $key => $ww) {
if ($ww) {
$wrap[$key] = '';
} else {
$wrap[$key] = ' white-space:nowrap;';
}
}
}
if (isset($table->header_wrap)) {
foreach ($table->header_wrap as $key => $ww) {
if ($ww) {
$header_wrap[$key] = '';
} else {
$header_wrap[$key] = '; white-space:nowrap;';
}
}
}
if (empty($table->width)) {
$table->width = '80%';
}
if (empty($table->tablealign)) {
$table->tablealign = 'center';
}
if (empty($table->class)) {
$table->class = ''; //removed generaltable
}
$tableid = empty($table->id) ? '' : 'id="'.$table->id.'"';
$output .= '<table width="'.$table->width.'" ';
if (!empty($table->summary)) {
$output .= " summary=\"$table->summary\"";
}
$output .= " class=\"$table->class boxalign$table->tablealign\" $tableid>\n";
$countcols = 0;
// Toggle for whether a column header should be shown
$need_columns_header = false;
if (!empty($table->head)) {
$countcols = count($table->head);
$columns_header_output = '<tr class="column_header">'."\n";
$keys=array_keys($table->head);
$lastkey = end($keys);
foreach ($table->head as $key => $heading) {
//.........这里部分代码省略.........
开发者ID:jamesmcq,项目名称:elis,代码行数:101,代码来源:table_report.class.php
示例7: prepare
/**
* @see moodle_html_component::prepare()
* @return void
*/
public function prepare()
{
if (!empty($this->align)) {
foreach ($this->align as $key => $aa) {
if ($aa) {
$this->align[$key] = 'text-align:' . fix_align_rtl($aa) . ';';
// Fix for RTL languages
} else {
$this->align[$key] = '';
}
}
}
if (!empty($this->size)) {
foreach ($this->size as $key => $ss) {
if ($ss) {
$this->size[$key] = 'width:' . $ss . ';';
} else {
$this->size[$key] = '';
}
}
}
if (!empty($this->wrap)) {
foreach ($this->wrap as $key => $ww) {
if ($ww) {
$this->wrap[$key] = 'white-space:nowrap;';
} else {
$this->wrap[$key] = '';
}
}
}
if (!empty($this->head)) {
foreach ($this->head as $key => $val) {
if (!isset($this->align[$key])) {
$this->align[$key] = '';
}
if (!isset($this->size[$key])) {
$this->size[$key] = '';
}
if (!isset($this->wrap[$key])) {
$this->wrap[$key] = '';
}
}
}
if (empty($this->classes)) {
// must be done before align
$this->set_classes(array('generaltable'));
}
if (!empty($this->tablealign)) {
$this->add_class('boxalign' . $this->tablealign);
}
if (!empty($this->rotateheaders)) {
$this->add_class('rotateheaders');
} else {
$this->rotateheaders = false;
// Makes life easier later.
}
parent::prepare();
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:62,代码来源:outputcomponents.php
示例8: cr_print_table
function cr_print_table($table, $return = false) {
global $COURSE;
$output = '';
if (isset($table->align)) {
foreach ($table->align as $key => $aa) {
if ($aa) {
$align[$key] = ' text-align:' . fix_align_rtl($aa) . ';'; // Fix for RTL languages
} else {
$align[$key] = '';
}
}
}
if (isset($table->size)) {
foreach ($table->size as $key => $ss) {
if ($ss) {
$size[$key] = ' width:' . $ss . ';';
} else {
$size[$key] = '';
}
}
}
if (isset($table->wrap)) {
foreach ($table->wrap as $key => $ww) {
if ($ww) {
$wrap[$key] = ' white-space:nowrap;';
} else {
$wrap[$key] = '';
}
}
}
if (empty($table->width)) {
$table->width = '80%';
}
if (empty($table->tablealign)) {
$table->tablealign = 'center';
}
if (!isset($table->cellpadding)) {
$table->cellpadding = '5';
}
if (!isset($table->cellspacing)) {
$table->cellspacing = '1';
}
if (empty($table->class)) {
$table->class = 'generaltable';
}
$tableid = empty($table->id) ? '' : 'id="' . $table->id . '"';
$output .= '<form action="send_emails.php" method="post" id="sendemail">';
$output .= '<table width="' . $table->width . '" ';
if (!empty($table->summary)) {
$output .= " summary=\"$table->summary\"";
}
$output .= " cellpadding=\"$table->cellpadding\" cellspacing=\"$table->cellspacing\" class=\"$table->class boxalign$table->tablealign\" $tableid>\n";
$countcols = 0;
$isuserid = -1;
if (!empty($table->head)) {
$countcols = count($table->head);
$output .= '<thead><tr>';
$keys = array_keys($table->head);
$lastkey = end($keys);
foreach ($table->head as $key => $heading) {
if ($heading == 'sendemail') {
$isuserid = $key;
}
if (!isset($size[$key])) {
$size[$key] = '';
}
if (!isset($align[$key])) {
$align[$key] = '';
}
if ($key == $lastkey) {
$extraclass = ' lastcol';
} else {
$extraclass = '';
}
$output .= '<th style="vertical-align:top;' . $align[$key] . $size[$key] . ';white-space:normal;" class="header c' . $key . $extraclass . '" scope="col">' . ucfirst($heading) . '</th>';
}
$output .= '</tr></thead>' . "\n";
}
if (!empty($table->data)) {
$oddeven = 1;
$keys = array_keys($table->data);
$lastrowkey = end($keys);
foreach ($table->data as $key => $row) {
$oddeven = $oddeven ? 0 : 1;
if (!isset($table->rowclass[$key])) {
$table->rowclass[$key] = '';
}
if ($key == $lastrowkey) {
$table->rowclass[$key] .= ' lastrow';
}
//.........这里部分代码省略.........
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:101,代码来源:locallib.php
注:本文中的fix_align_rtl函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论