本文整理汇总了PHP中HTML_Table::addTSection方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Table::addTSection方法的具体用法?PHP HTML_Table::addTSection怎么用?PHP HTML_Table::addTSection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_Table
的用法示例。
在下文中一共展示了HTML_Table::addTSection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_user_role_name
<?php
$tbl = new HTML_Table('', 'data-table table table-striped table-bordered', array('data-title' => 'List of Users'));
$tbl->addTSection('thead');
$tbl->addRow();
$tbl->addCell("<a class='pull btn btn-success btn-md' href ='" . $_SERVER['PHP_SELF'] . "?route=modules/users/add_user'>Add New User <span class='glyphicon glyphicon-plus'></span></a>");
$tbl->addRow();
$tbl->addCell('Login Name', '', 'header');
$tbl->addCell('Avatar', '', 'header');
$tbl->addCell('Full Name', '', 'header');
$tbl->addCell('Email', '', 'header');
$tbl->addCell('User Role', '', 'header');
$tbl->addCell('Status', '', 'header');
$tbl->addCell('Actions', '', 'header');
$tbl->addTSection('tbody');
function get_user_role_name($role_id)
{
$user_role_name = DB::queryFirstField("SELECT role_name from tams_user_roles WHERE role_id = {$role_id}");
return $user_role_name;
}
$sql = 'SELECT * FROM tams_users WHERE user_status = "active"';
$get_users = DB::query($sql);
foreach ($get_users as $user) {
$tbl->addRow();
$tbl->addCell($user['user_name'] . " (" . $user['user_id'] . ") ");
$tbl->addCell('<img src="' . $user['user_avatar_url'] . '" alt="avatar" />');
$tbl->addCell($user['user_title'] . " " . $user['first_name'] . " " . $user['last_name']);
$tbl->addCell("<a href='mailto:" . $user['user_email'] . "' >" . $user['user_email'] . "</a>");
$tbl->addCell(get_user_role_name($user['role_id']));
$tbl->addCell($user['user_status']);
$tbl->addCell("<a class='pull btn btn-danger btn-xs' href ='" . $_SERVER['PHP_SELF'] . "?route=modules/users/edit_user&user_id=" . $user['user_id'] . "'>Edit User <span class='glyphicon glyphicon-edit'></span></a>\n\t\t\t ");
示例2: mZ_mindbody_show_schedule
public function mZ_mindbody_show_schedule($atts, $account = 0)
{
require_once MZ_MINDBODY_SCHEDULE_DIR . '/lib/html_table.class.php';
global $add_mz_ajax_script;
$add_mz_ajax_script = true;
// optionally pass in a type parameter. Defaults to week.
$atts = shortcode_atts(array('type' => 'week', 'location' => '1', 'account' => '0', 'filter' => '0', 'grid' => '0', 'hide' => ''), $atts);
$type = $atts['type'];
$location = $atts['location'];
$account = $atts['account'];
$filter = $atts['filter'];
$grid = $atts['grid'];
if ($grid == 1 && $type == 'day') {
return '<div style="color:red"><h2>' . __('Grid Calendar Incompatible with Single Day Mode!', 'mz_mndbody_api') . '</h2></div>';
}
if ($grid == 0) {
$mz_date = empty($_GET['mz_date']) ? date_i18n('Y-m-d') : mz_validate_date($_GET['mz_date']);
} else {
$hide = explode(', ', $atts['hide']);
$mz_date = empty($_GET['mz_date']) ? date_i18n('Y-m-d', strtotime('last monday')) : mz_validate_date($_GET['mz_date']);
}
if ($type == __('day', 'mz-mindbody-api')) {
$mz_timeframe = array_slice(mz_getDateRange($mz_date, 1), 0, 1);
$mz_schedule_cache = "mz_schedule_day_cache_" . mt_rand(1, 10);
} else {
$mz_timeframe = array_slice(mz_getDateRange($mz_date, 7), 0, 1);
$mz_schedule_cache = "mz_schedule_week_cache_" . mt_rand(1, 10);
}
//While we still need to support php 5.2 and can't use [0] on above
$mz_timeframe = array_pop($mz_timeframe);
// START caching
$mz_cache_reset = isset($options['mz_mindbody_clear_cache']) ? "on" : "off";
if ($mz_cache_reset == "on") {
delete_transient($mz_schedule_cache);
}
$mz_schedule_data = get_transient($mz_schedule_cache);
mz_pr('' == $mz_schedule_data);
if (isset($_GET['mz_date']) || '' == $mz_schedule_data) {
//Send the timeframe to the GetClasses class, unless already cached
$mb = instantiate_mbo_API();
if ($account == 0) {
$mz_schedule_data = $mb->GetClasses($mz_timeframe);
} else {
$mb->sourceCredentials['SiteIDs'][0] = $account;
$mz_schedule_data = $mb->GetClasses($mz_timeframe);
}
//Cache the mindbody call for 24 hours
// TODO make cache timeout configurable.
set_transient($mz_schedule_cache, $mz_schedule_data, 60 * 60 * 24);
}
$return = '';
if (!empty($mz_schedule_data['GetClassesResult']['Classes']['Class'])) {
$mz_days = $this->makeNumericArray($mz_schedule_data['GetClassesResult']['Classes']['Class']);
if ($grid == 0) {
$mz_days = sortClassesByDate($mz_days, $this->time_format, $location);
} else {
$mz_days = sortClassesByTimeThenDay($mz_days, $this->time_format, $location);
}
$return .= '<div id="mz_mbo_schedule" class="mz_mbo_schedule">';
if ($type == __('week', 'mz-mindbody-api')) {
$return .= mz_mbo_schedule_nav($mz_date, __('Week', 'mz-mindbody-api'));
}
if ($filter == 1) {
$tbl = new HTML_Table('', 'mz-schedule-filter');
} else {
$tbl = new HTML_Table('', 'mz-schedule-table');
}
if ($grid == 0) {
foreach ($mz_days as $classDate => $mz_classes) {
$tbl->addRow('header');
// arguments: cell content, class, type (default is 'data' for td, pass 'header' for th)
// can include associative array of optional additional attributes
$tbl->addCell(date_i18n($this->mz_date_display, strtotime($classDate)), '', 'header', array('scope' => 'header'));
$tbl->addCell(__('Class Name', 'mz-mindbody-api'), '', 'header', array('scope' => 'header'));
$tbl->addCell(__('Instructor', 'mz-mindbody-api'), '', 'header', array('scope' => 'header'));
$tbl->addCell(__('Class Type', 'mz-mindbody-api'), '', 'header', array('scope' => 'header'));
$tbl->addTSection('tbody');
foreach ($mz_classes as $class) {
// mz_pr($class);
$sDate = date_i18n('m/d/Y', strtotime($class['StartDateTime']));
$sLoc = $class['Location']['ID'];
$sTG = $class['ClassDescription']['Program']['ID'];
$studioid = $class['Location']['SiteID'];
$sclassid = $class['ClassScheduleID'];
$sclassidID = $class['ID'];
$classDescription = $class['ClassDescription']['Description'];
$sType = -7;
$showCancelled = $class['IsCanceled'] == 1 ? '<div class="mz_cancelled_class">' . __('Cancelled', 'mz-mindbody-api') . '</div>' : '';
$className = $class['ClassDescription']['Name'];
$startDateTime = date_i18n('Y-m-d H:i:s', strtotime($class['StartDateTime']));
$endDateTime = date_i18n('Y-m-d H:i:s', strtotime($class['EndDateTime']));
$staffName = $class['Staff']['Name'];
$sessionType = $class['ClassDescription']['SessionType']['Name'];
$isAvailable = $class['IsAvailable'];
$linkURL = "https://clients.mindbodyonline.com/ws.asp?sDate={$sDate}&sLoc={$sLoc}&sTG={$sTG}&sType={$sType}&sclassid={$sclassid}&studioid={$studioid}";
if (date_i18n('H', strtotime($startDateTime)) < 12) {
$time_of_day = __('morning', 'mz-mindbody-api');
} else {
if (date_i18n('H', strtotime($startDateTime)) > 16) {
$time_of_day = __('evening', 'mz-mindbody-api');
//.........这里部分代码省略.........