/** * (non-PHPdoc) * * @see \Simplify\Form\Action::onCreateItemMenu() */ public function onCreateItemMenu(Menu $menu, Action $action, $data) { if (!$action->show(Form::ACTION_CREATE) && !$action->show(Form::ACTION_EDIT)) { $url = $this->editUrl($data); $item = new MenuItem($this->getName(), $this->getTitle(), Form::ICON_EDIT, $url); $menu->getItemByName('main')->addItem($item); } }
/** * (non-PHPdoc) * @see \Simplify\Form\Element::onRender() */ public function onRender(\Simplify\Form\Action $action, $data, $index) { $params = array('formAction' => 'services', 'serviceName' => $this->getName(), 'serviceAction' => 'toggle', \Simplify\Form::ID => $data[\Simplify\Form::ID]); $this->set('ajaxUrl', \Simplify\URL::make(null, $params)->format(\Simplify\URL::JSON)); $this->set('jsName', str_replace(array('[', ']'), array('\\\\[', '\\\\]'), $this->getInputName($index) . '[]')); $this->set('useAjax', $action->show(\Simplify\Form::ACTION_LIST)); return parent::onRender($action, $data, $index); }
/** * (non-PHPdoc) * * @see \Simplify\Form\Action::onCreateItemMenu() */ public function onCreateItemMenu(\Simplify\Menu $menu, \Simplify\Form\Action $action, $data) { if (!$action->show(\Simplify\Form::ACTION_CREATE)) { $url = $this->form->url()->extend(); $url->set('formAction', $this->getName()); $url->set(Form::ID, $data[Form::ID]); $item = new \Simplify\MenuItem($this->getName(), $this->getTitle(), Form::ICON_DELETE, $url); $menu->getItemByName('main')->addItem($item); } }
/** * (non-PHPdoc) * @see \Simplify\Form\Element::onRenderHeaders() */ public function onRenderHeaders(\Simplify\Form\Action $action, &$headers) { if ($action->show(\Simplify\Form::ACTION_LIST)) { $elements = $this->getElements($action); while ($elements->valid()) { $element = $elements->current(); $element->onRenderHeaders($action, $headers); $elements->next(); } } else { $headers[$this->getName()] = $this->getLabel(); } }
/** * (non-PHPdoc) * * @see \Simplify\Form\Action::onCreateItemMenu() */ public function onCreateItemMenu(Menu $menu, Action $action, $data) { if (!$action->show(Form::ACTION_VIEW)) { $url = $this->form->url()->extend(null, array('formAction' => $this->getName(), Form::ID => $data[Form::ID])); $menu->getItemByName('main')->addItem(new MenuItem($this->getName(), $this->getTitle(), 'search', $url)); } }
/** * (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); }
/** * (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); }
/** * On validate callback. * * @param Action $action * current action * @param array $data * form data */ public function onValidate(Action $action, $data) { if ($this->unique && $action->show($this->unique)) { $unique = $this->getError('unique', __('Valor duplicado')); $rule = new \Simplify\Form\Validation\Unique($unique, $this, sy_get_param($data, $this->form->getPrimaryKey())); $rule->validate($this->getValue($data)); } }
/** * (non-PHPdoc) * @see \Simplify\Form\Element::onRenderControls() */ public function onRenderControls(\Simplify\Form\Action $action, &$line, $data, $index) { $element = array(); if ($this->matchOriginal) { $label = __('Current password'); } else { $label = $action->show(\Simplify\Form::ACTION_CREATE) || $this->exists === false ? __('Senha') : __('Nova senha'); } $this->set('inputNameSufix', '[a]'); $element['id'] = $this->getElementId($index); $element['name'] = $this->getInputName($index); $element['class'] = $this->getElementClass(); $element['label'] = $label; $element['controls'] = $this->onRender($action, $data, $index)->render(); $element['state'] = $this->state; $element['stateMessage'] = $this->stateMessage; $line['elements'][$this->getName() . '_a'] = $element; if ($this->askForConfirmation) { $element = array(); $this->set('inputNameSufix', '[b]'); $element['id'] = $this->getElementId($index); $element['name'] = $this->getInputName($index); $element['class'] = $this->getElementClass(); $element['label'] = __('Confirmação de senha'); $element['controls'] = $this->onRender($action, $data, $index)->render(); $element['state'] = $this->state; $line['elements'][$this->getName() . '_b'] = $element; } }