本文整理汇总了PHP中_theme_table_cell函数的典型用法代码示例。如果您正苦于以下问题:PHP _theme_table_cell函数的具体用法?PHP _theme_table_cell怎么用?PHP _theme_table_cell使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_theme_table_cell函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: carbon_preprocess_forum_topic_list
/**
* Implements hook_preprocess_forum_topic_list
*/
function carbon_preprocess_forum_topic_list(&$vars) {
// Recreate the topic list header
$list = array(
array('data' => t('Topic'), 'field' => 'f.title'),
array('data' => t('Replies'), 'field' => 'f.comment_count'),
array('data' => t('Created'), 'field' => 't.created'),
array('data' => t('Last reply'), 'field' => 'f.last_comment_timestamp'),
);
$ts = tablesort_init($list);
$header = '';
foreach ($list as $cell) {
$cell = tablesort_header($cell, $list, $ts);
$header .= _theme_table_cell($cell, TRUE);
}
$vars['header'] = $header;
}
示例2: foreach
if (isset($row['data'])) {
foreach ($row as $key => $value) {
if ($key == 'data') {
$cells = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$cells = $row;
}
if (count($cells)) {
// Add odd/even class
if (empty($row['no_striping'])) {
$class = $flip[$class];
$attributes['class'][] = $class;
}
// Build row
$output .= ' <tr' . drupal_attributes($attributes) . '>';
$i = 0;
foreach ($cells as $cell) {
$cell = tablesort_cell($cell, $header, $ts, $i++);
$output .= _theme_table_cell($cell);
}
$output .= " </tr>\n";
}
}
$output .= "</tbody>\n";
}
$output .= "</table>\n";
print $output;
示例3: phptemplate_table
function phptemplate_table($header, $rows, $attributes = array(), $caption = NULL)
{
$output = '<div class="tablewrapper">';
$output .= '<table' . drupal_attributes($attributes) . " class=\"tableclass\">\n";
if (isset($caption)) {
$output .= '<caption>' . $caption . "</caption>\n";
}
// Format the table header:
if (count($header)) {
$ts = tablesort_init($header);
$output .= ' <thead><tr>';
foreach ($header as $cell) {
$cell = tablesort_header($cell, $header, $ts);
$output .= _theme_table_cell($cell, TRUE);
}
$output .= " </tr></thead>\n";
}
// Format the table rows:
$output .= "<tbody>\n";
if (count($rows)) {
$flip = array('even' => 'odd', 'odd' => 'even');
$class = 'even';
foreach ($rows as $number => $row) {
$attributes = array();
// Check if we're dealing with a simple or complex row
if (isset($row['data'])) {
foreach ($row as $key => $value) {
if ($key == 'data') {
$cells = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$cells = $row;
}
// Add odd/even class
$class = $flip[$class];
if (isset($attributes['class'])) {
$attributes['class'] .= ' ' . $class;
} else {
$attributes['class'] = $class;
}
// Build row
$output .= ' <tr' . drupal_attributes($attributes) . '>';
$i = 0;
foreach ($cells as $cell) {
$cell = tablesort_cell($cell, $header, $ts, $i++);
$output .= _theme_table_cell($cell);
}
$output .= " </tr>\n";
}
}
$output .= "</tbody></table>\n";
$output .= "</div>\n";
return $output;
}
示例4: mothership_table
function mothership_table($header, $rows, $attributes = array(), $caption = NULL)
{
// Add sticky headers, if applicable.
if (count($header)) {
drupal_add_js('misc/tableheader.js');
// Add 'sticky-enabled' class to the table to identify it for JS.
// This is needed to target tables constructed by this function.
$attributes['class'] = empty($attributes['class']) ? 'sticky-enabled' : $attributes['class'] . ' sticky-enabled';
}
$output = '<table' . drupal_attributes($attributes) . ">\n";
if (isset($caption)) {
$output .= '<caption>' . $caption . "</caption>\n";
}
// Format the table header:
if (count($header)) {
$ts = tablesort_init($header);
// HTML requires that the thead tag has tr tags in it follwed by tbody
// tags. Using ternary operator to check and see if we have any rows.
$output .= count($rows) ? ' <thead><tr>' : ' <tr>';
foreach ($header as $cell) {
$cell = tablesort_header($cell, $header, $ts);
$output .= _theme_table_cell($cell, TRUE);
}
// Using ternary operator to close the tags based on whether or not there are rows
$output .= count($rows) ? " </tr></thead>\n" : "</tr>\n";
} else {
$ts = array();
}
// Format the table rows:
if (count($rows)) {
$output .= "<tbody>\n";
$flip = array('even' => 'odd', 'odd' => 'even');
$class = 'even';
foreach ($rows as $number => $row) {
$attributes = array();
// Check if we're dealing with a simple or complex row
if (isset($row['data'])) {
foreach ($row as $key => $value) {
if ($key == 'data') {
$cells = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$cells = $row;
}
if (count($cells)) {
// Add odd/even class
$class = $flip[$class];
if (isset($attributes['class'])) {
$attributes['class'] .= ' ' . $class;
} else {
$attributes['class'] = $class;
}
// Build row
$output .= ' <tr' . drupal_attributes($attributes) . '>';
$i = 0;
foreach ($cells as $cell) {
$cell = tablesort_cell($cell, $header, $ts, $i++);
$output .= _theme_table_cell($cell);
}
$output .= " </tr>\n";
}
}
$output .= "</tbody>\n";
}
$output .= "</table>\n";
return $output;
}
示例5: ec_resp_table
/**
* Implements theme_table().
*/
function ec_resp_table($variables)
{
$header = $variables['header'];
$rows = $variables['rows'];
$attributes = $variables['attributes'];
$caption = $variables['caption'];
$colgroups = $variables['colgroups'];
$sticky = $variables['sticky'];
$empty = $variables['empty'];
// Add sticky headers, if applicable.
if (count($header) && $sticky) {
drupal_add_js('misc/tableheader.js');
// Add 'sticky-enabled' class to the table to identify it for JS.
// This is needed to target tables constructed by this function.
$attributes['class'][] = 'sticky-enabled table table-striped';
}
$output = '<table' . drupal_attributes($attributes) . ">\n";
if (isset($caption)) {
$output .= '<caption>' . $caption . "</caption>\n";
}
// Format the table columns:
if (count($colgroups)) {
foreach ($colgroups as $number => $colgroup) {
$attributes = array();
// Check if we're dealing with a simple or complex column.
if (isset($colgroup['data'])) {
foreach ($colgroup as $key => $value) {
if ($key == 'data') {
$cols = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$cols = $colgroup;
}
// Build colgroup.
if (is_array($cols) && count($cols)) {
$output .= ' <colgroup' . drupal_attributes($attributes) . '>';
$i = 0;
foreach ($cols as $col) {
$output .= ' <col' . drupal_attributes($col) . ' />';
}
$output .= " </colgroup>\n";
} else {
$output .= ' <colgroup' . drupal_attributes($attributes) . " />\n";
}
}
}
// Add the 'empty' row message if available.
if (!count($rows) && $empty) {
$header_count = 0;
foreach ($header as $header_cell) {
if (is_array($header_cell)) {
$header_count += isset($header_cell['colspan']) ? $header_cell['colspan'] : 1;
} else {
$header_count++;
}
}
$rows[] = array(array('data' => $empty, 'colspan' => $header_count, 'class' => array('empty', 'message')));
}
// Format the table header:
if (count($header)) {
$ts = tablesort_init($header);
// HTML requires that the thead tag has tr tags in it followed by tbody
// tags. Using ternary operator to check and see if we have any rows.
$output .= count($rows) ? ' <thead><tr>' : ' <tr>';
foreach ($header as $cell) {
$cell = tablesort_header($cell, $header, $ts);
$output .= _theme_table_cell($cell, TRUE);
}
// Using ternary operator to close the tags based on whether
// or not there are rows.
$output .= count($rows) ? " </tr></thead>\n" : "</tr>\n";
} else {
$ts = array();
}
// Format the table rows:
if (count($rows)) {
$output .= "<tbody>\n";
$flip = array('even' => 'odd', 'odd' => 'even');
$class = 'even';
foreach ($rows as $number => $row) {
// Check if we're dealing with a simple or complex row.
if (isset($row['data'])) {
foreach ($row as $key => $value) {
if ($key == 'data') {
$cells = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$cells = $row;
}
if (count($cells)) {
// Add odd/even class.
//.........这里部分代码省略.........
示例6: foreach
}
?>
</tr>
<?php
}
?>
</thead>
<?php
}
?>
<tbody>
<?php
foreach ($rows as $row_count => $row) {
?>
<tr <?php
if ($row_classes[$row_count]) {
print 'class="' . implode(' ', $row_classes[$row_count]) . '"';
}
?>
>
<?php
foreach ($row as $cell) {
print _theme_table_cell($cell);
}
?>
</tr>
<?php
}
?>
</tbody>
</table>
示例7: bootstrap_template_framework_table
/**
* @Implement of hook_template_framework_x()
*/
function bootstrap_template_framework_table(array $header, $rows = array(), array $attributes = array(), $caption = NULL, $sub_header = NULL)
{
if (!empty($attributes['class'])) {
$attributes['class'] .= ' table table-bordered table-condensed';
} else {
$attributes['class'] = 'table table-bordered table-condensed';
}
$output = '<table' . dd_attributes($attributes) . ">\n";
if (isset($caption)) {
$output .= '<caption>' . $caption . "</caption>\n";
}
if (!empty($header)) {
$ts = table_init($header);
if (!empty($rows)) {
$output .= '<thead>';
}
$output .= '<tr>';
foreach ($header as $cell) {
$cell = table_header($cell, $header, $ts);
$output .= _theme_table_cell($cell, true);
}
$output .= '</tr>';
if (!empty($sub_header)) {
foreach ($sub_header as $row) {
$attributes = array();
if (isset($row['data'])) {
foreach ($row as $key => $value) {
if ($key == 'data') {
$cells = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$cells = $row;
}
$i = 0;
$output .= '<tr' . dd_attributes($attributes) . '>';
foreach ($cells as $cell) {
$cell = table_cell($cell, $header, $ts, $i++);
$output .= _theme_table_cell($cell, true);
}
$output .= '</tr>';
}
}
if (!empty($rows)) {
$output .= '</thead>';
}
} else {
$ts = array();
}
if (!empty($rows)) {
$output .= "<tbody>\n";
$flip = array('even' => 'odd', 'odd' => 'even');
$class = 'even';
foreach ($rows as $number => $row) {
$attributes = array();
if (isset($row['data'])) {
foreach ($row as $key => $value) {
if ($key == 'data') {
$cells = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$cells = $row;
}
if (count($cells)) {
$class = $flip[$class];
if (isset($attributes['class'])) {
$attributes['class'] .= ' ' . $class;
} else {
$attributes['class'] = $class;
}
$output .= ' <tr' . dd_attributes($attributes) . '>';
$i = 0;
foreach ($cells as $cell) {
$cell = table_cell($cell, $header, $ts, $i++);
$output .= _theme_table_cell($cell);
}
$output .= " </tr>\n";
}
}
$output .= "</tbody>\n";
}
$output .= "</table>\n";
return $output;
}
示例8: dynamo_table
/**
* Overrides table theme function with support for colgroups
* based on Drupal 7 theme function.
*/
function dynamo_table($header, $rows, $attributes = array(), $caption = NULL)
{
// Get colgroups out if attributes
$colgroups = $attributes['colgroups'];
if (!empty($attributes['colgroups'])) {
unset($attributes['colgroups']);
}
// Add sticky headers, if applicable.
if (count($header)) {
drupal_add_js('misc/tableheader.js');
// Add 'sticky-enabled' class to the table to identify it for JS.
// This is needed to target tables constructed by this function.
array_push($attributes['class'], 'sticky-enabled');
}
$output = '<table' . drupal_attributes($attributes) . ">\n";
if (isset($caption)) {
$output .= '<caption>' . $caption . "</caption>\n";
}
// Format the table columns:
if (count($colgroups)) {
foreach ($colgroups as $number => $colgroup) {
$attributes = array();
// Check if we're dealing with a simple or complex column
if (isset($colgroup['data'])) {
foreach ($colgroup as $key => $value) {
if ($key == 'data') {
$cols = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$cols = $colgroup;
}
// Build colgroup
if (is_array($cols) && count($cols)) {
$output .= ' <colgroup' . drupal_attributes($attributes) . '>';
$i = 0;
foreach ($cols as $col) {
$output .= ' <col' . drupal_attributes($col) . ' />';
}
$output .= " </colgroup>\n";
} else {
$output .= ' <colgroup' . drupal_attributes($attributes) . " />\n";
}
}
}
// Format the table header:
if (count($header)) {
$ts = tablesort_init($header);
// HTML requires that the thead tag has tr tags in it followed by tbody
// tags. Using ternary operator to check and see if we have any rows.
$output .= count($rows) ? ' <thead><tr>' : ' <tr>';
foreach ($header as $cell) {
$cell = tablesort_header($cell, $header, $ts);
$output .= _theme_table_cell($cell, TRUE);
}
// Using ternary operator to close the tags based on whether or not there are rows
$output .= count($rows) ? " </tr></thead>\n" : "</tr>\n";
} else {
$ts = array();
}
// Format the table rows:
if (count($rows)) {
$output .= "<tbody>\n";
$flip = array('even' => 'odd', 'odd' => 'even');
$class = 'even';
foreach ($rows as $number => $row) {
$attributes = array();
// Check if we're dealing with a simple or complex row
if (isset($row['data'])) {
foreach ($row as $key => $value) {
if ($key == 'data') {
$cells = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$cells = $row;
}
if (count($cells)) {
// Add odd/even class
$class = $flip[$class];
// TODO: This code looks broken. I've added the is_array check
// to prevent errors, but I don't know if it'll ever be true.
// mikl, 2010-05-24
if (is_array($attributes['class'])) {
array_push($attributes['class'], $class);
}
// Build row
$output .= ' <tr' . drupal_attributes($attributes) . '>';
$i = 0;
foreach ($cells as $cell) {
$cell = tablesort_cell($cell, $header, $ts, $i++);
$output .= _theme_table_cell($cell);
//.........这里部分代码省略.........
示例9: badm_table
/**
* Overrides theme_table().
*/
function badm_table($variables)
{
$header = $variables['header'];
$rows = $variables['rows'];
$attributes = $variables['attributes'];
$caption = $variables['caption'];
$colgroups = $variables['colgroups'];
$empty = $variables['empty'];
$attributes['class'][] = 'table';
$attributes['class'][] = 'table-striped';
$output = '<table' . drupal_attributes($attributes) . ">\n";
if (isset($caption)) {
$output .= '<caption>' . $caption . "</caption>\n";
}
// Format the table columns:
if (count($colgroups)) {
foreach ($colgroups as $colgroup) {
$attributes = array();
// Check if we're dealing with a simple or complex column
if (isset($colgroup['data'])) {
foreach ($colgroup as $key => $value) {
if ($key == 'data') {
$cols = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$cols = $colgroup;
}
// Build colgroup
if (is_array($cols) && count($cols)) {
$output .= ' <colgroup' . drupal_attributes($attributes) . '>';
$i = 0;
foreach ($cols as $col) {
$output .= ' <col' . drupal_attributes($col) . ' />';
}
$output .= " </colgroup>\n";
} else {
$output .= ' <colgroup' . drupal_attributes($attributes) . " />\n";
}
}
}
// Add the 'empty' row message if available.
if (!count($rows) && $empty) {
$header_count = 0;
foreach ($header as $header_cell) {
if (is_array($header_cell)) {
$header_count += isset($header_cell['colspan']) ? $header_cell['colspan'] : 1;
} else {
$header_count++;
}
}
$rows[] = array(array('data' => $empty, 'colspan' => $header_count, 'class' => array('empty', 'message')));
}
// Format the table header:
if (count($header)) {
$ts = tablesort_init($header);
// HTML requires that the thead tag has tr tags in it followed by tbody
// tags. Using ternary operator to check and see if we have any rows.
$output .= count($rows) ? ' <thead><tr>' : ' <tr>';
foreach ($header as $cell) {
$cell = tablesort_header($cell, $header, $ts);
$output .= _theme_table_cell($cell, TRUE);
}
// Using ternary operator to close the tags based on whether or not there are rows
$output .= count($rows) ? " </tr></thead>\n" : "</tr>\n";
} else {
$ts = array();
}
// Format the table rows:
if (count($rows)) {
$output .= "<tbody>\n";
foreach ($rows as $row) {
$attributes = array();
// Check if we're dealing with a simple or complex row
if (isset($row['data'])) {
foreach ($row as $key => $value) {
if ($key == 'data') {
$cells = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$cells = $row;
}
if (count($cells)) {
// Build row
$output .= ' <tr' . drupal_attributes($attributes) . '>';
$i = 0;
foreach ($cells as $cell) {
$cell = tablesort_cell($cell, $header, $ts, $i++);
$output .= _theme_table_cell($cell);
}
$output .= " </tr>\n";
}
//.........这里部分代码省略.........
示例10: unset
unset($attributes['no_striping']);
} else {
$cells = $row;
$attributes = array();
$no_striping = FALSE;
}
if (count($cells)) {
// Add odd/even class
if (!$no_striping) {
$class = $flip[$class];
$attributes['class'][] = $class;
}
// Build row
$output .= ' <tr' . drupal_attributes($attributes) . '>';
$i = 0;
foreach ($cells as $cell) {
if (isset($cell['class'])) {
if (is_array($cell['class']) && in_array('checkbox', $cell['class']) || $cell['class'] == 'checkbox') {
$cell['class'] = array('checkboxes');
}
}
$cell = tablesort_cell($cell, $header, $ts, $i++);
$output .= _theme_table_cell($cell, $header = FALSE);
}
$output .= " </tr>\n";
}
}
$output .= "</tbody>\n";
}
$output .= "</table>\n";
print $output;