本文整理汇总了PHP中table_sql::setup方法的典型用法代码示例。如果您正苦于以下问题:PHP table_sql::setup方法的具体用法?PHP table_sql::setup怎么用?PHP table_sql::setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table_sql
的用法示例。
在下文中一共展示了table_sql::setup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
/**
* Overides setup to ensure it will only run a single time.
*/
public function setup()
{
// Check if the setup function has been called before, we should not run it twice.
// If we do the sortorder of the table will be broken.
if (!empty($this->setup)) {
return;
}
parent::setup();
}
示例2: array
/**
* setup_report_table
*
* @param xxx $tablecolumns
* @param xxx $baseurl
* @param xxx $usercount (optional, default value = 10)
*/
function setup_report_table($tablecolumns, $baseurl, $usercount = 10)
{
// generate headers (using "header_xxx()" methods below)
$tableheaders = array();
foreach ($tablecolumns as $tablecolumn) {
$tableheaders[] = $this->format_header($tablecolumn);
}
$this->define_columns($tablecolumns);
$this->define_headers($tableheaders);
$this->define_baseurl($baseurl);
if ($this->has_column('fullname')) {
$this->pageable(true);
$this->sortable(true);
$this->initialbars($usercount > 20);
// this information is only printed once per user
$this->column_suppress('fullname');
$this->column_suppress('picture');
$this->column_suppress('grade');
// special css class for "picture" column
$this->column_class('picture', 'picture');
} else {
$this->pageable(false);
$this->sortable(false);
// you can set specific columns to be unsortable:
// $this->no_sorting('columnname');
}
// basically all columns are centered
$this->column_style_all('text-align', 'center');
// some columns are not centered
if ($this->has_column('fullname')) {
$this->column_style('fullname', 'text-align', '');
}
if ($this->has_column('responsefield')) {
$this->column_style('responsefield', 'text-align', 'right');
}
// attributes in the table tag
$this->set_attribute('id', 'attempts');
$this->set_attribute('align', 'center');
$this->set_attribute('class', $this->output->mode);
parent::setup();
}