/** * Returns the CRUDControllerWorkerInterface instance for the current request * @return Worker\CRUDControllerWorkerInterface * @throws NotFoundHttpException */ protected function getWorker() { $worker = $this->CRUDRequest->getWorker(); if (!$worker) { throw new NotFoundHttpException(); } return $worker; }
public function render($value, array $options = array()) { $request = $this->CRUDRequest->getRequest(); $sortDirection = $request->get('sortDirection', 'asc'); $classes = ''; if ($request->get('sortField') == $options['column_name']) { if ($sortDirection == 'asc') { $sortDirection = 'desc'; } $classes = "sorted {$sortDirection}"; } $link = $this->CRUDRequest->getConfiguration()->getPathGenerator()->generate(CRUDAction::INDEX, array('sortField' => $options['column_name'], 'sortDirection' => $sortDirection)); return sprintf('<a class="%s" href="%s">%s</a>', $classes, htmlspecialchars($link), $this->renderParent($value, $options)); }
public function render($value, array $options = array()) { $configuration = $this->CRUDRequest->getConfiguration(); $security = $configuration->getSecurityContext(); $action = false; $actions = isset($options['actions']) ? $options['actions'] : ($configuration->getShowTemplate() ? array(CRUDAction::SHOW, CRUDAction::UPDATE) : array(CRUDAction::UPDATE)); $template = isset($options['template']) ? $options['template'] : '<a href="%s">%s</a>'; foreach ($actions as $_action) { if ($security->isActionAllowed($_action, $options['object'], $options['object_vars'])) { $action = $_action; break; } } if ($action) { $link = $configuration->getPathGenerator()->generate($action, isset($options['link_parameters']) ? $options['link_parameters'] : array(), $options['object'], $options['object_vars']); return sprintf($template, htmlspecialchars($link), $this->renderParent($value, $options)); } else { return $this->renderParent($value, $options); } }
private function addFlash($text) { $this->CRUDRequest->getRequest()->getSession()->getFlashBag()->add('notice', $text); }
private function getRedirectionManager() { return $this->CRUDRequest->getRedirectionManager(); }