本文整理汇总了PHP中HTML_Table::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Table::__construct方法的具体用法?PHP HTML_Table::__construct怎么用?PHP HTML_Table::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_Table
的用法示例。
在下文中一共展示了HTML_Table::__construct方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function __construct($attributes, $table_name, $page_name)
{
// table-header
parent::__construct($attributes);
$this->setAutoGrow(true);
$this->setAutoFill(" ");
}
示例2: array
function __construct()
{
$lang = services::getService('lang');
// table-header
parent::__construct(array("width" => "100%", "class" => "pools"));
$this->setHeaderContents(0, 0, $lang->getMsg('tableheaders_name'));
$this->setHeaderContents(0, 1, $lang->getMsg('tableheaders_area'));
$this->setHeaderContents(0, 2, $lang->getMsg('tableheaders_adress'));
$this->setHeaderContents(0, 3, $lang->getMsg('tableheaders_rescount'));
$this->setRowAttributes(0, array("class" => "pools2"));
}
示例3: __construct
/**
* Create a new SortableTable
* @param string $table_name A name for the table (default = 'table')
* @param string $get_total_number_function A user defined function to get
* the total number of items in the table
* @param string $get_data_function A function to get the data to display on
* the current page
* @param int $default_column The default column on which the data should be
* sorted
* @param int $default_items_per_page The default number of items to show
* on one page
* @param string $default_order_direction The default order direction;
* either the constant 'ASC' or 'DESC'
* @param string $table_id
*/
public function __construct($table_name = 'table', $get_total_number_function = null, $get_data_function = null, $default_column = 1, $default_items_per_page = 20, $default_order_direction = 'ASC', $table_id = null)
{
if (empty($table_id)) {
$table_id = $table_name . uniqid();
}
$this->table_id = $table_id;
parent::__construct(array('id' => $table_id, 'class' => 'table table-striped table-hover table-bordered'));
$this->table_name = $table_name;
$this->additional_parameters = array();
$this->param_prefix = $table_name . '_';
$this->page_nr = isset($_SESSION[$this->param_prefix . 'page_nr']) ? intval($_SESSION[$this->param_prefix . 'page_nr']) : 1;
$this->page_nr = isset($_GET[$this->param_prefix . 'page_nr']) ? intval($_GET[$this->param_prefix . 'page_nr']) : $this->page_nr;
$this->column = isset($_SESSION[$this->param_prefix . 'column']) ? intval($_SESSION[$this->param_prefix . 'column']) : $default_column;
$this->column = isset($_GET[$this->param_prefix . 'column']) ? intval($_GET[$this->param_prefix . 'column']) : $this->column;
// Default direction
if (in_array(strtoupper($default_order_direction), array('ASC', 'DESC'))) {
$this->direction = $default_order_direction;
}
if (isset($_SESSION[$this->param_prefix . 'direction'])) {
$my_session_direction = $_SESSION[$this->param_prefix . 'direction'];
if (!in_array($my_session_direction, array('ASC', 'DESC'))) {
$this->direction = 'ASC';
} else {
if ($my_session_direction == 'ASC') {
$this->direction = 'ASC';
} elseif ($my_session_direction == 'DESC') {
$this->direction = 'DESC';
}
}
}
if (isset($_GET[$this->param_prefix . 'direction'])) {
$my_get_direction = $_GET[$this->param_prefix . 'direction'];
if (!in_array($my_get_direction, array('ASC', 'DESC'))) {
$this->direction = 'ASC';
} else {
if ($my_get_direction == 'ASC') {
$this->direction = 'ASC';
} elseif ($my_get_direction == 'DESC') {
$this->direction = 'DESC';
}
}
}
// Allow to change paginate in multiples tabs
unset($_SESSION[$this->param_prefix . 'per_page']);
$this->per_page = isset($_SESSION[$this->param_prefix . 'per_page']) ? intval($_SESSION[$this->param_prefix . 'per_page']) : $default_items_per_page;
$this->per_page = isset($_GET[$this->param_prefix . 'per_page']) ? intval($_GET[$this->param_prefix . 'per_page']) : $this->per_page;
$_SESSION[$this->param_prefix . 'per_page'] = $this->per_page;
$_SESSION[$this->param_prefix . 'direction'] = $this->direction;
$_SESSION[$this->param_prefix . 'page_nr'] = $this->page_nr;
$_SESSION[$this->param_prefix . 'column'] = $this->column;
$this->pager = null;
$this->default_items_per_page = $default_items_per_page;
$this->total_number_of_items = -1;
$this->get_total_number_function = $get_total_number_function;
$this->get_data_function = $get_data_function;
$this->column_filters = array();
$this->form_actions = array();
$this->checkbox_name = null;
$this->td_attributes = array();
$this->th_attributes = array();
$this->other_tables = array();
}
示例4: __construct
public function __construct($attrs = array(), $options = array())
{
global $_ARRAYLANG;
if ($attrs instanceof \Cx\Core_Modules\Listing\Model\Entity\DataSet) {
$hasMasterTableHeader = !empty($options['header']);
// add master table-header-row
if ($hasMasterTableHeader) {
$this->addRow(array(0 => $options['header']), null, 'th');
}
$first = true;
$row = 1 + $hasMasterTableHeader;
foreach ($attrs as $rowname => $rows) {
$col = 0;
$virtual = $rows['virtual'];
unset($rows['virtual']);
if (isset($options['multiActions'])) {
$this->setCellContents($row, $col, '<input name="select-' . $rowname . '" value="' . $rowname . '" type="checkbox" />', 'TD', '0', false);
$col++;
}
foreach ($rows as $header => $data) {
$encode = true;
if (isset($options['fields']) && isset($options['fields'][$header]) && isset($options['fields'][$header]['showOverview']) && !$options['fields'][$header]['showOverview']) {
continue;
}
$origHeader = $header;
if (isset($options['fields'][$header]['sorting'])) {
$sorting = $options['fields'][$header]['sorting'];
} else {
if (isset($options['functions']['sorting'])) {
$sorting = $options['functions']['sorting'];
}
}
if ($first) {
if (isset($options['fields'][$header]['header'])) {
$header = $options['fields'][$header]['header'];
}
if (isset($_ARRAYLANG[$header])) {
$header = $_ARRAYLANG[$header];
}
if (is_array($options['functions']) && isset($options['functions']['sorting']) && $options['functions']['sorting'] && $sorting !== false) {
$order = '';
$img = '↑↓';
if (isset($_GET['order'])) {
$supOrder = explode('/', $_GET['order']);
if (current($supOrder) == $origHeader) {
$order = '/DESC';
$img = '↓';
if (count($supOrder) > 1 && $supOrder[1] == 'DESC') {
$order = '';
$img = '↑';
}
}
}
$header = '<a href="' . \Env::get('cx')->getRequest()->getUrl() . '&order=' . $origHeader . $order . '" style="white-space: nowrap;">' . $header . ' ' . $img . '</a>';
}
if ($hasMasterTableHeader) {
$this->setCellContents(1, $col, $header, 'td', 0);
} else {
$this->setCellContents(0, $col, $header, 'th', 0);
}
}
if (isset($options['fields']) && isset($options['fields'][$origHeader]) && isset($options['fields'][$origHeader]['table']) && isset($options['fields'][$origHeader]['table']['parse']) && is_callable($options['fields'][$origHeader]['table']['parse'])) {
$callback = $options['fields'][$origHeader]['table']['parse'];
$data = $callback($data, $rows);
$encode = false;
// todo: this should be set by callback
} else {
if (is_object($data) && get_class($data) == 'DateTime') {
$data = $data->format(ASCMS_DATE_FORMAT);
} else {
if (isset($options['fields'][$origHeader]) && isset($options['fields'][$origHeader]['type']) && $options['fields'][$origHeader]['type'] == '\\Country') {
$data = \Cx\Core\Country\Controller\Country::getNameById($data);
if (empty($data)) {
$data = \Cx\Core\Country\Controller\Country::getNameById(204);
}
} else {
if (gettype($data) == 'boolean') {
$data = '<i>' . ($data ? $_ARRAYLANG['TXT_YES'] : $_ARRAYLANG['TXT_NO']) . '</i>';
$encode = false;
} else {
if ($data === null) {
$data = '<i>' . $_ARRAYLANG['TXT_CORE_NONE'] . '</i>';
$encode = false;
} else {
if (empty($data)) {
$data = '<i>(empty)</i>';
$encode = false;
}
}
}
}
}
}
$this->setCellContents($row, $col, $data, 'TD', 0, $encode);
$col++;
}
if ($this->hasRowFunctions($options['functions'], $virtual)) {
if ($first) {
$header = 'Functions';
if (isset($_ARRAYLANG['TXT_FUNCTIONS'])) {
//.........这里部分代码省略.........
示例5: __construct
public function __construct($attrs = array(), $options = array())
{
global $_ARRAYLANG;
if ($attrs instanceof \Cx\Core_Modules\Listing\Model\Entity\DataSet) {
$hasMasterTableHeader = !empty($options['header']);
// add master table-header-row
if ($hasMasterTableHeader) {
$this->addRow(array(0 => $options['header']), null, 'th');
}
$first = true;
$row = 1 + $hasMasterTableHeader;
$sortBy = isset($options['functions']['sortBy']) && is_array($options['functions']['sortBy']) ? $options['functions']['sortBy'] : array();
$sortingKey = !empty($sortBy) && isset($sortBy['sortingKey']) ? $sortBy['sortingKey'] : '';
$sortField = !empty($sortingKey) && isset($sortBy['field']) ? key($sortBy['field']) : '';
$component = !empty($sortBy) && isset($sortBy['component']) ? $sortBy['component'] : '';
$entity = !empty($sortBy) && isset($sortBy['entity']) ? $sortBy['entity'] : '';
$sortOrder = !empty($sortBy) && isset($sortBy['sortOrder']) ? $sortBy['sortOrder'] : '';
$pagingPos = !empty($sortBy) && isset($sortBy['pagingPosition']) ? $sortBy['pagingPosition'] : '';
foreach ($attrs as $rowname => $rows) {
$col = 0;
$virtual = $rows['virtual'];
unset($rows['virtual']);
if (isset($options['multiActions'])) {
$this->setCellContents($row, $col, '<input name="select-' . $rowname . '" value="' . $rowname . '" type="checkbox" />', 'TD', '0', false);
$col++;
}
foreach ($rows as $header => $data) {
if (!empty($sortingKey) && $header === $sortingKey) {
//Add the additional attribute id, for getting the updated sort order after the row sorting
$this->updateRowAttributes($row, array('id' => 'sorting' . $entity . '_' . $data), true);
}
$encode = true;
if (isset($options['fields']) && isset($options['fields'][$header]) && isset($options['fields'][$header]['showOverview']) && !$options['fields'][$header]['showOverview']) {
continue;
}
if (!empty($sortField) && $header === $sortField) {
//Add the additional attribute class, to display the updated sort order after the row sorting
$this->updateColAttributes($col, array('class' => 'sortBy' . $sortField));
}
$origHeader = $header;
if (isset($options['fields'][$header]['sorting'])) {
$sorting = $options['fields'][$header]['sorting'];
} else {
if (isset($options['functions']['sorting'])) {
$sorting = $options['functions']['sorting'];
}
}
if ($first) {
if (isset($options['fields'][$header]['header'])) {
$header = $options['fields'][$header]['header'];
}
if (isset($_ARRAYLANG[$header])) {
$header = $_ARRAYLANG[$header];
}
if (is_array($options['functions']) && isset($options['functions']['sorting']) && $options['functions']['sorting'] && $sorting !== false) {
$order = '';
$img = '↑↓';
$sortParamName = !empty($sortBy) ? $entity . 'Order' : 'order';
if (isset($_GET[$sortParamName])) {
$supOrder = explode('/', $_GET[$sortParamName]);
if (current($supOrder) == $origHeader) {
$order = '/DESC';
$img = '↓';
if (count($supOrder) > 1 && $supOrder[1] == 'DESC') {
$order = '';
$img = '↑';
}
}
}
$header = '<a href="' . \Env::get('cx')->getRequest()->getUrl() . '&' . $sortParamName . '=' . $origHeader . $order . '" style="white-space: nowrap;">' . $header . ' ' . $img . '</a>';
}
if ($hasMasterTableHeader) {
$this->setCellContents(1, $col, $header, 'td', 0);
} else {
$this->setCellContents(0, $col, $header, 'th', 0);
}
}
/* We use json to do parse the field function. The 'else if' is for backwards compatibility so you can declare
* the function directly without using json. This is not recommended and not working over session */
if (isset($options['fields']) && isset($options['fields'][$origHeader]) && isset($options['fields'][$origHeader]['table']) && isset($options['fields'][$origHeader]['table']['parse'])) {
$callback = $options['fields'][$origHeader]['table']['parse'];
if (is_array($callback) && isset($callback['adapter']) && isset($callback['method'])) {
$json = new \Cx\Core\Json\JsonData();
$jsonResult = $json->data($callback['adapter'], $callback['method'], array('data' => $data, 'rows' => $rows));
if ($jsonResult['status'] == 'success') {
$data = $jsonResult["data"];
}
} else {
if (is_callable($callback)) {
$data = $callback($data, $rows);
}
}
$encode = false;
// todo: this should be set by callback
} else {
if (is_object($data) && get_class($data) == 'DateTime') {
$data = $data->format(ASCMS_DATE_FORMAT);
} else {
if (isset($options['fields'][$origHeader]) && isset($options['fields'][$origHeader]['type']) && $options['fields'][$origHeader]['type'] == '\\Country') {
$data = \Cx\Core\Country\Controller\Country::getNameById($data);
//.........这里部分代码省略.........
示例6: __construct
public function __construct()
{
parent::__construct();
$this->setTableClasses(array('table'));
}
示例7: __construct
/**
* Constructor
*
* Set class of Table to "pear-size"
*/
public function __construct()
{
parent::__construct(array("class" => "pear-size"));
}