本文整理汇总了PHP中flexible_table::is_persistent方法的典型用法代码示例。如果您正苦于以下问题:PHP flexible_table::is_persistent方法的具体用法?PHP flexible_table::is_persistent怎么用?PHP flexible_table::is_persistent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexible_table
的用法示例。
在下文中一共展示了flexible_table::is_persistent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_persistent_table
public function test_persistent_table()
{
global $SESSION;
$data = $this->generate_data(5, 5);
$columns = $this->generate_columns(5);
$headers = $this->generate_headers(5);
// Testing without persistence first to verify that the results are different.
$table1 = new flexible_table('tablelib_test');
$table1->define_columns($columns);
$table1->define_headers($headers);
$table1->define_baseurl('/invalid.php');
$table1->sortable(true);
$table1->collapsible(true);
$table1->is_persistent(false);
$_GET['thide'] = 'column0';
$_GET['tsort'] = 'column1';
$_GET['tifirst'] = 'A';
$_GET['tilast'] = 'Z';
foreach ($data as $row) {
$table1->add_data_keyed($row);
}
$table1->setup();
// Clear session data between each new table.
unset($SESSION->flextable);
$table2 = new flexible_table('tablelib_test');
$table2->define_columns($columns);
$table2->define_headers($headers);
$table2->define_baseurl('/invalid.php');
$table2->sortable(true);
$table2->collapsible(true);
$table2->is_persistent(false);
unset($_GET);
foreach ($data as $row) {
$table2->add_data_keyed($row);
}
$table2->setup();
$this->assertNotEquals($table1, $table2);
unset($SESSION->flextable);
// Now testing with persistence to check that the tables are the same.
$table3 = new flexible_table('tablelib_test');
$table3->define_columns($columns);
$table3->define_headers($headers);
$table3->define_baseurl('/invalid.php');
$table3->sortable(true);
$table3->collapsible(true);
$table3->is_persistent(true);
$_GET['thide'] = 'column0';
$_GET['tsort'] = 'column1';
$_GET['tifirst'] = 'A';
$_GET['tilast'] = 'Z';
foreach ($data as $row) {
$table3->add_data_keyed($row);
}
$table3->setup();
unset($SESSION->flextable);
$table4 = new flexible_table('tablelib_test');
$table4->define_columns($columns);
$table4->define_headers($headers);
$table4->define_baseurl('/invalid.php');
$table4->sortable(true);
$table4->collapsible(true);
$table4->is_persistent(true);
unset($_GET);
foreach ($data as $row) {
$table4->add_data_keyed($row);
}
$table4->setup();
$this->assertEquals($table3, $table4);
unset($SESSION->flextable);
// Finally, another test with no persistence, but without clearing the session data.
$table5 = new flexible_table('tablelib_test');
$table5->define_columns($columns);
$table5->define_headers($headers);
$table5->define_baseurl('/invalid.php');
$table5->sortable(true);
$table5->collapsible(true);
$table5->is_persistent(true);
$_GET['thide'] = 'column0';
$_GET['tsort'] = 'column1';
$_GET['tifirst'] = 'A';
$_GET['tilast'] = 'Z';
foreach ($data as $row) {
$table5->add_data_keyed($row);
}
$table5->setup();
$table6 = new flexible_table('tablelib_test');
$table6->define_columns($columns);
$table6->define_headers($headers);
$table6->define_baseurl('/invalid.php');
$table6->sortable(true);
$table6->collapsible(true);
$table6->is_persistent(true);
unset($_GET);
foreach ($data as $row) {
$table6->add_data_keyed($row);
}
$table6->setup();
$this->assertEquals($table5, $table6);
}