function initialize($entity = null, $options = null) { $date = new Date('date'); $date->setLabel('Input Date'); $date->setFilters(array('striptags', 'string')); $date->setDefault(date('Y-m-d')); $date->addValidators(array(new PresenceOf(array('message' => 'Date is required')))); $this->add($date); $start_time = new Text('start_hour'); $start_time->setLabel('Input Start Hour'); $start_time->setFilters(array('striptags', 'string')); $start_time->addValidators(array(new PresenceOf(array('message' => 'Start Time is required')))); $this->add($start_time); $finish_time = new Text('finish_hour'); $finish_time->setLabel('Input Finish Hour'); $finish_time->setFilters(array('striptags', 'string')); $finish_time->addValidators(array(new PresenceOf(array('message' => 'Finish Time is required')))); $this->add($finish_time); $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true)); $systemId->setLabel('Select System'); $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required')))); if ($entity) { $systemId->setDefault(array($entity->system_id)); } $this->add($systemId); $description = new TextArea('description'); $description->setLabel('Input Description'); $description->addValidators(array(new PresenceOf(array('message' => 'Description is required')))); $this->add($description); $hidden = new Hidden('id'); if ($entity) { $hidden->setDefault(array($entity->id)); } $this->add($hidden); }
function IndexAction() { $this->assets->addCss('public/vendor/twbs/bootstrap/dist/css/bootstrap.min.css')->addCss('public/vendor/twbs/bootstrap/dist/css/bootstrap-theme.min.css')->addCss('public/vendor/twbs/bootstrap/docs/assets/css/ie10-viewport-bug-workaround.css'); $this->assets->addJs('public/vendor/twbs/bootstrap/dist/js/bootstrap.min.js')->addJs('public/vendor/twbs/bootstrap/docs/assets/js/vendor/jquery.min.js')->addJs('public/vendor/twbs/bootstrap/docs/assets/css/ie10-viewport-bug-workaround.js'); $this->view->systems = Systems::find(array('order' => ' name ASC ')); }
function initialize($entity = null, $options = null) { $date = new Date('date_found'); $date->setLabel('Input Date Found'); $date->setFilters(array('striptags', 'string')); $this->add($date); /*====================== Number =====================*/ $number = new Text('number'); $number->setLabel('Input Number'); $number->setFilters(array('striptags', 'string')); $number->addValidators(array(new PresenceOf(array('message' => 'Number is required')))); $this->add($number); /*====================== Solved =====================*/ $isSolved = new Radio('is_solved', array('name' => 'is_solved', 'value' => '1')); $isSolved->setLabel('Is Solved'); $isSolved->addValidators(array(new PresenceOf(array('message' => 'Is solved is required')))); $this->add($isSolved); $isSolved2 = new Radio('is_solved2', array('name' => 'is_solved', 'value' => '0', 'checked' => TRUE)); $isSolved2->setLabel('Is Solved2'); $isSolved2->addValidators(array(new PresenceOf(array('message' => 'Is solved is required')))); $this->add($isSolved2); $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true)); $systemId->setLabel('Select System'); $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required')))); if ($entity) { $systemId->setDefault(array($entity->system_id)); } $this->add($systemId); $modulesId = new Select('modules_id', Modules::find(), array('using' => array('id', 'name'), 'useEmpty' => true)); $modulesId->setLabel('Select Modules'); $modulesId->addValidators(array(new PresenceOf(array('message' => 'Modules is required')))); if ($entity) { $modulesId->setDefault(array($entity->modules_id)); } $this->add($modulesId); /*===== Bug =============*/ $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true)); $systemId->setLabel('Select System'); $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required')))); if ($entity) { $systemId->setDefault(array($entity->system_id)); } $this->add($systemId); $description = new TextArea('description'); $description->setLabel('Input Description'); $description->addValidators(array(new PresenceOf(array('message' => 'Description is required')))); $this->add($description); $hidden = new Hidden('id'); if ($entity) { $hidden->setDefault(array($entity->id)); } $this->add($hidden); }