public function render(CantigaController $controller, Request $request, Workspace $workspace, Project $project = null) { $rootEntity = $controller->getMembership()->getItem(); $this->repository->setRootEntity($rootEntity); $this->settingsRepository->setRootEntity($rootEntity); return $this->templating->render('WioEdkBundle:Extension:route-summary.html.twig', ['routeNum' => $this->repository->countRoutes(), 'participantNum' => $this->settingsRepository->countParticipants()]); }
public function run(CantigaController $controller, $id, $customDataGenerator = null) { try { $repository = $this->info->getRepository(); $fetch = $this->fetch; $item = $fetch($repository, $id); $nameProperty = 'get' . ucfirst($this->info->getItemNameProperty()); $name = $item->{$nameProperty}(); $customData = null; if (is_callable($customDataGenerator)) { $customData = $customDataGenerator($item); } $vars = $this->getVars(); $vars['pageTitle'] = $this->info->getPageTitle(); $vars['pageSubtitle'] = $this->info->getPageSubtitle(); $vars['item'] = $item; $vars['name'] = $name; $vars['custom'] = $customData; $vars['indexPage'] = $this->info->getIndexPage(); $vars['infoPage'] = $this->info->getInfoPage(); $vars['insertPage'] = $this->info->getInsertPage(); $vars['editPage'] = $this->info->getEditPage(); $vars['removePage'] = $this->info->getRemovePage(); $controller->breadcrumbs()->link($name, $this->info->getInfoPage(), $this->slugify(['id' => $id])); return $controller->render($this->info->getTemplateLocation() . $this->info->getInfoTemplate(), $vars); } catch (ItemNotFoundException $exception) { return $this->onError($controller, $controller->trans($this->info->getItemNotFoundErrorMessage())); } catch (ModelException $exception) { return $this->onError($controller, $controller->trans($exception->getMessage())); } }
public function render(CantigaController $controller, Request $request, Workspace $workspace, Project $project = null) { if ($controller->getProjectSettings()->get(CoreSettings::DASHBOARD_SHOW_CHAT)->getValue()) { $this->repository->setActiveProject($project); return $this->templating->render('CantigaCoreBundle:Project:recent-comments.html.twig', ['comments' => $this->repository->getRecentFeedbackActivity(8)]); } return ''; }
public function render(CantigaController $controller, Request $request, Workspace $workspace, Project $project = null) { if ($controller->getProjectSettings()->get(CoreSettings::DASHOBARD_SHOW_REQUESTS)->getValue()) { $this->repository->setActiveProject($project); return $this->templating->render('CantigaCoreBundle:Project:recent-area-requests.html.twig', ['requests' => $this->repository->getRecentRequests(5)]); } return ''; }
public function run(CantigaController $controller, $id, Request $request) { try { $repository = $this->info->getRepository(); $item = $repository->getItem($id); $nameProperty = 'get' . ucfirst($this->info->getItemNameProperty()); $name = $item->{$nameProperty}(); if (!$item instanceof RemovableEntityInterface) { throw new LogicException('This entity does not support removing.'); } if (!$item->canRemove()) { throw new ModelException($controller->trans($this->info->getCannotRemoveMessage(), [$name])); } $answer = $request->query->get('answer', null); if ($answer == 'yes') { $repository->remove($item); return $this->onSuccess($controller, $controller->trans($this->info->getItemRemovedMessage(), [$item->{$nameProperty}()])); } elseif ($answer == 'no') { return $this->toIndexPage($controller); } else { $controller->breadcrumbs()->link($name, $this->info->getInfoPage(), $this->slugify(['id' => $id])); $controller->breadcrumbs()->link($controller->trans('Remove', [], 'general'), $this->info->getRemovePage(), $this->slugify(['id' => $id])); $vars = $this->getVars(); $vars['pageTitle'] = $this->info->getPageTitle(); $vars['pageSubtitle'] = $this->info->getPageSubtitle(); $vars['questionTitle'] = $controller->trans($this->info->getRemoveQuestionTitle()); $vars['question'] = $controller->trans($this->info->getRemoveQuestion(), [$item->{$nameProperty}()]); $vars['successPath'] = $controller->generateUrl($this->info->getRemovePage(), $this->slugify(['id' => $id, 'answer' => 'yes'])); $vars['failurePath'] = $controller->generateUrl($this->info->getRemovePage(), $this->slugify(['id' => $id, 'answer' => 'no'])); $vars['successBtn'] = $controller->trans('Indeed, remove it', [], 'general'); $vars['failureBtn'] = $controller->trans('Cancel', [], 'general'); $vars['indexPage'] = $this->info->getIndexPage(); $vars['infoPage'] = $this->info->getInfoPage(); $vars['insertPage'] = $this->info->getInsertPage(); $vars['editPage'] = $this->info->getEditPage(); $vars['removePage'] = $this->info->getRemovePage(); return $controller->render('CantigaCoreBundle:layout:question.html.twig', $vars); } } catch (ItemNotFoundException $exception) { return $this->onError($controller, $controller->trans($this->info->getItemNotFoundErrorMessage())); } catch (ModelException $exception) { return $this->onError($controller, $controller->trans($exception->getMessage())); } }
public function showBreadcrumbs(ShowBreadcrumbsEvent $event) { if (null !== $this->controller) { $event->setBreadcrumbs($this->controller->breadcrumbs()->fetch($this->workspaceSource->getWorkspace())); } }
public function render(CantigaController $controller, Request $request, Workspace $workspace, Project $project = null) { $this->repository->setArea($controller->getMembership()->getItem()); return $controller->renderView('CantigaCourseBundle:Extension:course-summary.html.twig', ['progress' => $this->repository->findProgress()]); }
public function render(CantigaController $controller, Request $request, Workspace $workspace, Project $project = null) { $item = $controller->getMembership()->getItem(); $this->repository->setRootEntity($item); return $this->templating->render('WioEdkBundle:Extension:recent-routes.html.twig', ['routeInfoPath' => lcfirst($item->getEntity()->getType()) . '_route_info', 'routes' => $this->repository->getRecentlyChangedRoutes(5)]); }
public function handleRequest(CantigaController $ctrl, Request $request) { $answer = $request->query->get('answer', null); if ($answer == 'yes') { $callback = $this->successCallback; $callback(); return $ctrl->redirect($ctrl->generateUrl($this->routeName, $this->routeArgs)); } elseif ($answer == 'no') { return $ctrl->redirect($ctrl->generateUrl($this->routeName, $this->routeArgs)); } else { $successArgs = $this->respondArgs; $cancelArgs = $this->respondArgs; $successArgs['answer'] = 'yes'; $cancelArgs['answer'] = 'no'; return $ctrl->render('CantigaCoreBundle:layout:question.html.twig', array('pageTitle' => $this->title, 'pageSubtitle' => $this->subtitle, 'questionTitle' => $ctrl->trans('Question', [], 'general'), 'question' => $this->question, 'successPath' => $ctrl->generateUrl($this->respondName, $successArgs), 'failurePath' => $ctrl->generateUrl($this->respondName, $cancelArgs), 'successBtn' => $ctrl->trans('Indeed', [], 'general'), 'failureBtn' => $ctrl->trans('Cancel', [], 'general'))); } }
public function render(CantigaController $controller, Request $request, Workspace $workspace, Project $project = null) { $entity = $controller->getMembership()->getItem()->getEntity(); return $this->templating->render('CantigaMilestoneBundle:Dashboard:milestone-progress.html.twig', ['progress' => $this->repository->computeTotalProgress($entity, $project), 'incomingDeadline' => $this->repository->findClosestDeadline($entity, $project), 'milestoneEditorPage' => lcfirst($entity->getType()) . '_milestone_editor']); }
public function render(CantigaController $controller, Request $request, Workspace $workspace, Project $project = null) { $area = $controller->getMembership()->getItem(); return $this->templating->render('CantigaCoreBundle:Area:area-summary.html.twig', ['area' => $area, 'bgcolor' => $this->translateColor($area)]); }