/** * For page render */ public function viewAction() { $id = _get('id'); $row = $this->getModel('page')->find($id); $page = $row->toArray(); $page['module'] = $this->getModule(); $form = new BaseForm(); $form->add(array('name' => 'tag', 'type' => 'tag')); $this->view()->assign('form', $form); $this->view()->assign('page', $page); $this->view()->setTemplate('page-content'); }
/** * Get sort form instance * * @param int $from * @param array $sibling * * @return Form */ protected function getSortForm($from, array $sibling) { $name = $sibling[$from]; unset($sibling[$from]); $form = new Form(); $elements = array(array('name' => 'from', 'options' => array('label' => __('From')), 'attributes' => array('class' => 'form-control', 'options' => array($from => $name)), 'type' => 'select'), array('name' => 'to', 'options' => array('label' => __('To')), 'attributes' => array('class' => 'form-control', 'options' => array(0 => __('First of')) + $sibling), 'type' => 'select'), array('name' => 'security', 'type' => 'csrf'), array('name' => 'submit', 'attributes' => array('value' => __('Submit')), 'type' => 'submit')); foreach ($elements as $element) { $form->add($element); } return $form; }