コード例 #1
0
ファイル: DataTableSnippet.php プロジェクト: jivoo/jivoo
 /**
  * {@inheritdoc}
  */
 public function before()
 {
     parent::before();
     if (isset($this->request->cookies['data-table-per-page'])) {
         $this->object->rowsPerPage = intval($this->request->cookies['data-table-per-page']);
     }
     if (isset($this->request->cookies['data-table-density'])) {
         $this->object->density = $this->request->cookies['data-table-density'];
     } else {
         $this->object->density = 'medium';
     }
     $tableSettings = new Form('tableSettings');
     $tableSettings->addField('perPage', DataType::integer(DataType::UNSIGNED));
     $tableSettings->__set('perPage', $this->object->rowsPerPage);
     $tableSettings->addField('density', DataType::enum(array('low', 'medium', 'high')));
     $tableSettings->__set('density', $this->object->density);
     $this->viewData['tableSettings'] = $tableSettings;
 }