当前位置: 首页>>代码示例>>PHP>>正文


PHP flexible_table::is_persistent方法代码示例

本文整理汇总了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);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:99,代码来源:tablelib_test.php


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