• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP tablesort_header函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中tablesort_header函数的典型用法代码示例。如果您正苦于以下问题:PHP tablesort_header函数的具体用法?PHP tablesort_header怎么用?PHP tablesort_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了tablesort_header函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:rtdean93,项目名称:tbytam,代码行数:21,代码来源:template.php


示例2: isset

        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) {
        $attributes = array();
        // Check if we're dealing with a simple or complex row
开发者ID:kimlop,项目名称:platform-dev,代码行数:31,代码来源:table.tpl.php


示例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;
}
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:57,代码来源:template.php


示例4: 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.
//.........这里部分代码省略.........
开发者ID:ec-europa,项目名称:platform-dev,代码行数:101,代码来源:template.php


示例5: 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;
}
开发者ID:Joanl,项目名称:ding,代码行数:70,代码来源:template.table.php


示例6: 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);
//.........这里部分代码省略.........
开发者ID:reload,项目名称:dynamo,代码行数:101,代码来源:template.php


示例7: 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";
            }
//.........这里部分代码省略.........
开发者ID:pounard,项目名称:drupal-badm,代码行数:101,代码来源:template.php


示例8: badm_preprocess_table

/**
 * Implements hook_preprocess_HOOK().
 */
function badm_preprocess_table(&$vars)
{
    // Make it bootstrap yeah!
    if (isset($vars['attributes']['class']) && is_string($vars['attributes']['class'])) {
        $vars['attributes']['class'] = array($vars['attributes']['class']);
    }
    $vars['attributes']['class'][] = 'table';
    if (empty($vars['attributes']['no_strip'])) {
        $vars['attributes']['class'][] = 'table-striped';
    }
    $vars['attributes']['class'][] = 'table-condensed';
    // Count header for later, better here than over there.
    $header_count = 0;
    if (!empty($vars['header'])) {
        foreach ($vars['header'] as &$header_cell) {
            if (is_array($header_cell)) {
                $header_count += isset($header_cell['colspan']) ? $header_cell['colspan'] : 1;
            } else {
                $header_count++;
            }
        }
    }
    // Need this in template.
    $vars['header_count'] = $header_count;
    if ($header_count) {
        $vars['sortheader'] = tablesort_init($vars['header']);
    } else {
        $vars['sortheader'] = [];
    }
    if (!empty($vars['header'])) {
        foreach ($vars['header'] as &$header_cell) {
            $header_cell = tablesort_header($header_cell, $vars['header'], $vars['sortheader']);
        }
    }
    if (!empty($vars['rows'])) {
        foreach ($vars['rows'] as &$row) {
            $i = 0;
            foreach ($row as &$cell) {
                $cell = tablesort_cell($cell, $vars['header'], $vars['sortheader'], $i);
                $i++;
            }
        }
    }
    // Add the 'empty' row message if available.
    if ($vars['empty'] && empty($vars['rows'])) {
        $vars['rows'][] = [['data' => $vars['empty'], 'colspan' => $header_count, 'class' => ['empty', 'message']]];
    }
    // Manage main attributes
    if (isset($vars['colgroups'])) {
        _badm_extract_data_from_attributes($vars, 'colgroups');
    }
    if (isset($vars['header'])) {
        _badm_extract_data_from_attributes($vars, 'header');
    }
    if (isset($vars['rows'])) {
        _badm_extract_data_from_attributes($vars, 'rows');
    }
    // Manage cells attributes, because they are deeper.
    $vars['cells_attributes'] = [];
    foreach ($vars['rows'] as $row_index => &$row) {
        if (is_array($row)) {
            foreach ($row as $cell_index => &$cell) {
                $vars['cells_attributes'][$row_index][$cell_index] = [];
                if (isset($cell['data']) || is_array($cell) && count(element_properties($cell)) == 0) {
                    $temp_real_value = '';
                    foreach ($cell as $key => $value) {
                        if ($key == 'data') {
                            $temp_real_value = $value;
                        } else {
                            $vars['cells_attributes'][$row_index][$cell_index][$key] = $value;
                        }
                    }
                    $cell = $temp_real_value;
                }
            }
        }
    }
    $vars['theme_hook_suggestions'][] = 'table';
}
开发者ID:makinacorpus,项目名称:drupal-badm,代码行数:82,代码来源:template.php



注:本文中的tablesort_header函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP tablesort_init函数代码示例发布时间:2022-05-23
下一篇:
PHP tablesort_cell函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap