TRUE, 'edit'=>TRUE, 'list'=>TRUE, ); protected $icon = 'fa fa-calendar'; /** * Add a new site dates */ public function action_add() { Block::factory() ->type('form-horizontal') ->title('New Site Date') ->title_icon($this->icon) ->body($this->add_edit()); } private function add_edit($id=NULL,$output='') { $o = ORM::factory('Site_Dates',$id); if ($this->request->post() AND $o->values($this->request->post())->changed()) { // Some validation if ($o->code == 'S') { $o->date_stop = NULL; $o->date_start = strtotime(date('Y',$o->date_start).'-01-01'); $o->date_stop = strtotime(date('Y',$o->date_start).'-12-31'); } if (! $this->save($o)) $o->reload(); } $this->meta->title = $o->loaded() ? sprintf('Site Date: %s',$o->id) : 'New Site Date'; return View::factory('site/date/admin/add_edit') ->set('o',$o); } /** * Edit a Module Configuration */ public function action_edit() { Block::factory() ->type('form-horizontal') ->title('Update Site Date') ->title_icon($this->icon) ->body($this->add_edit($this->request->param('id'))); } /** * List site dates */ public function action_list() { $this->meta->title = 'A|List Site Dates'; Block::factory() ->title('Site Dates') ->title_icon($this->icon) ->body(View::factory('site/date/list')->set('o',ORM::factory('Site_Dates')->find_all())); } } ?>