Beispiel #1
0
 /**
  * (non-PHPdoc)
  *
  * @see \Simplify\Controller::indexAction()
  */
 protected function indexAction()
 {
     try {
         $this->Form->execute();
     } catch (\Simplify\ValidationException $e) {
         \Simplify::session()->warnings(__('Ocorreram erros'));
     }
     $this->set('formBody', $this->Form->render());
 }
Beispiel #2
0
 /**
  * (non-PHPdoc)
  * 
  * @see \Simplify\Controller::indexAction()
  */
 protected function indexAction()
 {
     try {
         $this->Form = new \Simplify\Form('options', __('Opções'));
         $this->Form->showMenu = false;
         $this->Form->addAction(new \Simplify\Form\Action\Config('config', __('Gerais'), \Simplify::config()->get('amp:tables:options'), 'option_name', 'option_value'));
         $this->Form->addElement(new \Simplify\Form\Element\Text('site_name', __('Nome do site')), \Simplify\Form::ACTION_CONFIG);
         $url = new \Simplify\Form\Element\Text('site_url', __('URL do site'));
         $this->Form->addElement($url, \Simplify\Form::ACTION_CONFIG);
         $this->Form->execute();
     } catch (\Simplify\ValidationException $e) {
         \Simplify::session()->warnings(__('Ocorreram erros'));
     }
     $this->set('formBody', $this->Form->render());
 }
Beispiel #3
0
 /**
  * (non-PHPdoc)
  *
  * @see \Simplify\Controller::indexAction()
  */
 protected function indexAction()
 {
     try {
         $result = $this->Form->execute();
         if ($result == \Simplify\Form::RESULT_SUCCESS) {
             \Simplify::session()->notices('Success');
             return \Simplify::response()->redirect($this->Form->url()->extend()->set('formAction', null));
         }
     } catch (\Simplify\ValidationException $e) {
         \Simplify::session()->warnings(__('Verifique os erros abaixo'));
         $errors = (array) $e->getErrors();
         foreach ($errors as $key => $errors) {
             if (is_int($key)) {
                 \Simplify::session()->warnings($errors);
             }
         }
     } catch (\Exception $e) {
         \Simplify::session()->warnings($e->getMessage());
     }
     $this->set('formBody', $this->Form->render());
 }
Beispiel #4
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form::onCreateItemMenu()
  */
 public function onCreateItemMenu(\Simplify\Menu $menu, \Simplify\Form\Action $action, $data)
 {
     if ($action->show(\Simplify\Form::ACTION_LIST)) {
         $moveMenu = new \Simplify\Menu('move', null, __('Mover'));
         $moveMenu->addItem(new \Simplify\MenuItem('move-first', __('Para o começo'), 'fast-backward', $this->url()->extend(null, array('listAction' => self::LIST_ACTION_SORT, 'index' => 'first', \Simplify\Form::ID => $data[\Simplify\Form::ID]))));
         $moveMenu->addItem(new \Simplify\MenuItem('move-previous', __('Para cima'), 'backward', $this->url()->extend(null, array('listAction' => self::LIST_ACTION_SORT, 'index' => 'previous', \Simplify\Form::ID => $data[\Simplify\Form::ID]))));
         $moveMenu->addItem(new \Simplify\MenuItem('move-next', __('Para baixo'), 'forward', $this->url()->extend(null, array('listAction' => self::LIST_ACTION_SORT, 'index' => 'next', \Simplify\Form::ID => $data[\Simplify\Form::ID]))));
         $moveMenu->addItem(new \Simplify\MenuItem('move-last', __('Para o fim'), 'fast-forward', $this->url()->extend(null, array('listAction' => self::LIST_ACTION_SORT, 'index' => 'last', \Simplify\Form::ID => $data[\Simplify\Form::ID]))));
         $moveItem = new \Simplify\MenuItem('move', __('Mover'), null, null, $moveMenu);
         $menu->addItem(new \Simplify\Menu('sortable', array($moveItem), __('Mover')));
         //$menu->addItem($moveMenu);
     }
     parent::onCreateItemMenu($menu, $action, $data);
 }
Beispiel #5
0
 /**
  * (non-PHPdoc)
  *
  * @see \Simplify\Form::onCreateItemMenu()
  */
 public function onCreateItemMenu(\Simplify\Menu $menu, \Simplify\Form\Action $action, $data)
 {
     if ($action->show(\Simplify\Form::ACTION_LIST)) {
         $children = new \Simplify\MenuItem('children', __('Filhos'), 'folder-open', $this->url()->extend(null, array($this->repository()->parent => $data[\Simplify\Form::ID])));
         $moveMenu = new \Simplify\Menu('mptt');
         $moveMenu->addItem(new \Simplify\MenuItem('move_top', __('Primeiro'), 'arrow_top', $this->url()->extend(null, array('listAction' => self::LIST_ACTION_SORT, 'index' => 'first', \Simplify\Form::ID => $data[\Simplify\Form::ID]))));
         $moveMenu->addItem(new \Simplify\MenuItem('move_up', __('Anterior'), 'arrow_up', $this->url()->extend(null, array('listAction' => self::LIST_ACTION_SORT, 'index' => 'previous', \Simplify\Form::ID => $data[\Simplify\Form::ID]))));
         $moveMenu->addItem(new \Simplify\MenuItem('move_down', __('Próximo'), 'arrow_down', $this->url()->extend(null, array('listAction' => self::LIST_ACTION_SORT, 'index' => 'next', \Simplify\Form::ID => $data[\Simplify\Form::ID]))));
         $moveMenu->addItem(new \Simplify\MenuItem('move_bottom', __('Último'), 'arrow_bottom', $this->url()->extend(null, array('listAction' => self::LIST_ACTION_SORT, 'index' => 'last', \Simplify\Form::ID => $data[\Simplify\Form::ID]))));
         $moveItem = new \Simplify\MenuItem('move', 'Move', null, null, $moveMenu);
         $menu->addItem(new \Simplify\Menu('mptt', array($moveItem, $children)));
     }
     parent::onCreateItemMenu($menu, $action, $data);
 }
Beispiel #6
0
 /**
  *
  * @return Repository
  */
 protected function repository()
 {
     return $this->form->repository();
 }