public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $repository = $this->get(self::REPOSITORY_NAME); $repository->setProject($this->getActiveProject()); $this->crudInfo = $this->newCrudInfo($repository)->setTemplateLocation('CantigaLinksBundle:Links:')->setItemNameProperty('name')->setPageTitle('Important links')->setPageSubtitle('Manage the links displayed on dashboards')->setIndexPage('project_links_index')->setInfoPage('project_links_info')->setInsertPage('project_links_insert')->setEditPage('project_links_edit')->setRemovePage('project_links_remove')->setItemCreatedMessage('The link \'0\' has been created.')->setItemRemovedMessage('The link \'0\' has been removed.')->setRemoveQuestion('Do you really want to remove the link \'0\'?'); $this->breadcrumbs()->workgroup('manage')->entryLink($this->trans('Important links', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $repository = $this->get(self::REPOSITORY_NAME); $repository->setArea($this->getMembership()->getItem()); $this->crudInfo = $this->newCrudInfo($repository)->setTemplateLocation('WioEdkBundle:AreaParticipant:')->setItemNameProperty('name')->setPageTitle('Participants')->setPageSubtitle('Manage registered participants')->setIndexPage('area_edk_participant_index')->setInfoPage('area_edk_participant_info')->setInsertPage('area_edk_participant_insert')->setEditPage('area_edk_participant_edit')->setRemovePage('area_edk_participant_remove')->setItemCreatedMessage('The participant \'0\' has been created.')->setItemUpdatedMessage('The participant \'0\' has been updated.')->setItemRemovedMessage('The participant \'0\' has been removed.')->setRemoveQuestion('Do you really want to remove the participant \'0\'?'); $this->breadcrumbs()->workgroup('participants')->entryLink($this->trans('Participants', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $repository = $this->get(self::REPOSITORY_NAME); $repository->setRootEntity($this->getMembership()->getItem()); $this->crudInfo = $this->newCrudInfo($repository)->setTemplateLocation('WioEdkBundle:EdkRoute:')->setItemNameProperty('name')->setPageTitle('Routes')->setPageSubtitle('Manage the routes of Extreme Way of the Cross')->setIndexPage('project_route_index')->setInfoPage('project_route_info')->setInsertPage('project_route_insert')->setEditPage('project_route_edit')->setRemovePage('project_route_remove')->setItemCreatedMessage('The route \'0\' has been created.')->setItemUpdatedMessage('The route \'0\' has been updated.')->setItemRemovedMessage('The route \'0\' has been removed.')->setRemoveQuestion('Do you really want to remove the route \'0\'?'); $this->breadcrumbs()->workgroup('data')->entryLink($this->trans('Routes', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $repository = $this->get(self::REPOSITORY_NAME); $repository->setRootEntity($this->getMembership()->getItem()); $this->crudInfo = $this->newCrudInfo($repository)->setTemplateLocation('WioEdkBundle:RegistrationSettings:')->setItemNameProperty('name')->setPageTitle('Registration settings')->setPageSubtitle('Manage the registration settings for the routes')->setIndexPage('project_reg_settings_index')->setInfoPage('project_reg_settings_info')->setEditPage('project_reg_settings_edit')->setItemUpdatedMessage('The registration settings \'0\' have been updated.'); $this->breadcrumbs()->workgroup('participants')->entryLink($this->trans('Registration settings', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $repository = $this->get(self::REPOSITORY_NAME); $repository->setProject($this->getActiveProject()); $this->crudInfo = $this->newCrudInfo($repository)->setTemplateLocation('CantigaCoreBundle:ProjectAreaStatus:')->setItemNameProperty('name')->setPageTitle('Area status')->setPageSubtitle('Manage available status flags of areas')->setIndexPage('project_area_status_index')->setInfoPage('project_area_status_info')->setInsertPage('project_area_status_insert')->setEditPage('project_area_status_edit')->setRemovePage('project_area_status_remove')->setRemoveQuestion('Do you really want to remove the status \'0\'?'); $this->breadcrumbs()->workgroup('manage')->entryLink($this->trans('Area status', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $repository = $this->get(self::REPOSITORY_NAME); $repository->setProject($this->getActiveProject()); $this->crudInfo = $this->newCrudInfo($repository)->setTemplateLocation('CantigaCoreBundle:ProjectGroupCategory:')->setItemNameProperty('name')->setPageTitle('Group categories')->setPageSubtitle('Categorize your groups to ease the management and searching')->setIndexPage('project_group_category_index')->setInfoPage('project_group_category_info')->setInsertPage('project_group_category_insert')->setEditPage('project_group_category_edit')->setRemovePage('project_group_category_remove')->setItemCreatedMessage('The group category \'0\' has been created.')->setItemUpdatedMessage('The group category \'0\' has been updated.')->setItemRemovedMessage('The group category \'0\' has been removed.')->setRemoveQuestion('Do you really want to remove the group category \'0\'?'); $this->breadcrumbs()->workgroup('data')->entryLink($this->trans('Group categories', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $repository = $this->get(self::REPOSITORY_NAME); $repository->setProject($this->getActiveProject()); $this->crudInfo = $this->newCrudInfo(self::REPOSITORY_NAME)->setTemplateLocation('CantigaCoreBundle:AppText:')->setItemNameProperty('title')->setPageTitle('Application texts')->setPageSubtitle('Manage project-specific texts displayed in various places of the application')->setIndexPage('project_app_text_index')->setInfoPage('project_app_text_info')->setInsertPage('project_app_text_insert')->setEditPage('project_app_text_edit')->setRemovePage('project_app_text_remove')->setItemCreatedMessage('The text \'0\' has been created.')->setItemUpdatedMessage('The text \'0\' has been updated.')->setItemRemovedMessage('The text \'0\' has been removed.')->setRemoveQuestion('Do you really want to remove \'0\' text?'); $this->breadcrumbs()->workgroup('manage')->entryLink($this->trans('Application texts', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $repository = $this->get(self::REPOSITORY_NAME); $repository->setProject($this->getActiveProject()); $this->crudInfo = $this->newCrudInfo($repository)->setTemplateLocation('CantigaMilestoneBundle:ProjectMilestoneStatusRule:')->setItemNameProperty('name')->setPageTitle('Status rules')->setPageSubtitle('Create the automatic rules for setting the area status')->setIndexPage('project_milestone_status_rule_index')->setInfoPage('project_milestone_status_rule_info')->setInsertPage('project_milestone_status_rule_insert')->setEditPage('project_milestone_status_rule_edit')->setRemovePage('project_milestone_status_rule_remove')->setItemCreatedMessage('The status rule \'0\' has been created.')->setItemUpdatedMessage('The status rule \'0\' has been updated.')->setItemRemovedMessage('The status rule \'0\' has been removed.')->setRemoveQuestion('Do you really want to remove the status rule \'0\'?'); $this->breadcrumbs()->workgroup('manage')->entryLink($this->trans('Status rules', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $repository = $this->get(self::REPOSITORY_NAME); $repository->setRootEntity($this->getMembership()->getItem()); $this->crudInfo = $this->newCrudInfo($repository)->setTemplateLocation('WioEdkBundle:AreaMessage:')->setItemNameProperty('subject')->setPageTitle('Messages')->setPageSubtitle('View messages sent you by the participants')->setIndexPage('area_edk_message_index')->setInfoPage('area_edk_message_info'); $this->breadcrumbs()->workgroup('participants')->entryLink($this->trans('Messages', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); }
protected function performCourse($selfPage, $id, Request $request) { try { $repository = $this->get(self::REPOSITORY_NAME); $course = $repository->getCourse($id); $this->breadcrumbs()->staticItem($this->trans('Courses', [], 'pages'))->link($course->getName(), $selfPage, ['id' => $course->getId(), 'slug' => $this->getSlug()]); return $this->render($this->crudInfo->getTemplateLocation() . 'course-info.html.twig', array('pageTitle' => $this->crudInfo->getPageTitle(), 'pageSubtitle' => $this->crudInfo->getPageSubtitle(), 'item' => $course, 'indexPage' => $this->crudInfo->getIndexPage())); } catch (ItemNotFoundException $exception) { return $this->showPageWithError($this->trans($exception->getMessage()), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); } }
/** * @Route("/{id}/upload-test", name="project_course_upload_test") */ public function uploadTestAction($id, Request $request) { try { $repository = $this->crudInfo->getRepository(); $item = $repository->getItem($id); $form = $this->createForm(CourseTestUploadForm::class); $form->handleRequest($request); if ($form->isValid()) { $data = $form->getData(); if (!$data['file'] instanceof UploadedFile) { return $this->showPageWithError($this->trans('An error occurred during uploading the test questions.'), $this->crudInfo->getInfoPage(), array('id' => $id, 'slug' => $this->getSlug())); } if ($data['file']->getMimeType() != 'application/xml') { return $this->showPageWithError($this->trans('Please upload an XML file!'), $this->crudInfo->getInfoPage(), array('id' => $id, 'slug' => $this->getSlug())); } $content = file_get_contents($data['file']->getRealPath()); $item->createTest($content); $this->verifyFileCorrectness($item->getTest()); $repository->saveTest($item); return $this->showPageWithMessage($this->trans('The course test questions have been uploaded correctly.'), $this->crudInfo->getInfoPage(), array('id' => $id, 'slug' => $this->getSlug())); } $this->breadcrumbs()->link($item->getName(), 'project_course_info', ['id' => $item->getId(), 'slug' => $this->getSlug()])->link($this->trans('Upload test'), 'project_course_upload_test', ['id' => $item->getId(), 'slug' => $this->getSlug()]); return $this->render($this->crudInfo->getTemplateLocation() . 'upload-test.html.twig', array('pageTitle' => $this->crudInfo->getPageTitle(), 'pageSubtitle' => $this->crudInfo->getPageSubtitle(), 'item' => $item, 'form' => $form->createView())); } catch (ItemNotFoundException $exception) { return $this->showPageWithError($this->crudInfo->getItemNotFoundErrorMessage(), $this->crudInfo->getIndexPage()); } catch (ModelException $exception) { return $this->showPageWithError($this->trans($exception->getMessage()), $this->crudInfo->getIndexPage()); } }
/** * @Route("/index", name="admin_user_index") */ public function indexAction(Request $request) { $repository = $this->get(self::REPOSITORY_NAME); $jumpForm = $this->createForm(UserJumpForm::class, [], ['action' => $this->generateUrl($this->crudInfo->getIndexPage())]); $jumpForm->handleRequest($request); if ($jumpForm->isValid()) { $data = $jumpForm->getData(); $userId = $repository->tryJumpToUser($data['login'], $data['email']); if (!empty($userId)) { return $this->redirect($this->generateUrl($this->crudInfo->getInfoPage(), ['id' => $userId])); } else { $this->addFlash('alert', $this->trans('User with the specified login or e-mail not found.')); } } $dataTable = $repository->createDataTable(); return $this->render($this->crudInfo->getTemplateLocation() . 'index.html.twig', array('pageTitle' => $this->crudInfo->getPageTitle(), 'pageSubtitle' => $this->crudInfo->getPageSubtitle(), 'dataTable' => $dataTable, 'locale' => $request->getLocale(), 'form' => $jumpForm->createView())); }
/** * @Route("/{id}/test", name="area_course_test") */ public function testAction($id, Request $request) { try { $repo = $this->get(self::REPOSITORY_NAME); $item = $repo->getItem($id); $minQuestionNum = $this->getMinQuestionNum(); if (!$item->hasTest()) { return $this->showPageWithError($this->trans('TestQuestionsNotPublishedMsg'), $this->crudInfo->getInfoPage(), ['id' => $id, 'slug' => $this->getSlug()]); } $result = $repo->getTestResult($this->getUser(), $item); if ($result->getResult() == Question::RESULT_CORRECT) { return $this->showPageWithMessage($this->trans('CourseAlreadyCompletedMsg'), $this->crudInfo->getInfoPage(), ['id' => $id, 'slug' => $this->getSlug()]); } if ($this->get('session')->has('trial')) { if (!$request->isMethod('POST')) { return $this->showPageWithError($this->trans('TestAlreadyInProgressMsg'), $this->crudInfo->getInfoPage(), ['id' => $id, 'slug' => $this->getSlug()]); } $testTrial = $this->get('session')->get('trial'); } else { $repo->startNewTrial($result); $testTrial = $item->getTest()->constructTestTrial($minQuestionNum); $this->get('session')->set('trial', $testTrial); } $form = $testTrial->generateTestForm($this->createFormBuilder(), $this->getTranslator()); $form->handleRequest($request); if ($form->isValid()) { $this->get('session')->remove('trial'); $ok = $testTrial->validateTestTrial($form->getData()); $repo->completeTrial($result, $this->getMembership()->getItem(), $testTrial); if ($ok) { return $this->showPageWithMessage($this->trans('TestPassedMsg'), $this->crudInfo->getInfoPage(), ['id' => $id, 'slug' => $this->getSlug()]); } else { return $this->showPageWithError($this->trans('TestFailedMsg'), $this->crudInfo->getInfoPage(), ['id' => $id, 'slug' => $this->getSlug()]); } } $this->breadcrumbs()->link($this->trans('Test', [], 'course'), 'area_course_test', ['slug' => $this->getSlug(), 'id' => $item->getId()]); return $this->render($this->crudInfo->getTemplateLocation() . 'test.html.twig', array('item' => $item, 'form' => $form->createView(), 'fieldNames' => $testTrial->generateFormFieldNames(), 'testTime' => $testTrial->getTimeLimitInMinutes(), 'pageSubtitle' => 'Take the on-line course')); } catch (ItemNotFoundException $exception) { return $this->showPageWithError($this->trans('CourseNotFoundMsg'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); } catch (TrainingTestException $exception) { return $this->showPageWithError($this->trans($exception->getMessage()), $this->crudInfo->getInfoPage(), ['id' => $id, 'slug' => $this->getSlug()]); } catch (ModelException $exception) { return $this->showPageWithError($this->trans($exception->getMessage()), $this->crudInfo->getInfoPage(), ['id' => $id, 'slug' => $this->getSlug()]); } }
/** * @Route("/{id}/revoke", name="project_area_request_revoke") */ public function revokeAction($id, Request $request) { try { $repository = $this->get(self::REPOSITORY_NAME); $item = $repository->getItem($id); $question = new QuestionHelper($this->trans('Do you really want to revoke the request \'0\'? This operation cannot be undone.', [$item->getName()])); $question->onSuccess(function () use($repository, $item) { $repository->revoke($item); }); $question->respond('project_area_request_revoke', ['id' => $item->getId(), 'slug' => $this->getSlug()]); $question->path($this->crudInfo->getInfoPage(), ['id' => $item->getId(), 'slug' => $this->getSlug()]); $question->title($this->trans('AreaRequest: 0', [$item->getName()]), $this->crudInfo->getPageSubtitle()); $this->breadcrumbs()->link($item->getName(), $this->crudInfo->getInfoPage(), ['id' => $item->getId(), 'slug' => $this->getSlug()]); return $question->handleRequest($this, $request); } catch (ModelException $exception) { return $this->showPageWithError($exception->getMessage(), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); } }
/** * @Route("/prune", name="admin_registration_prune") */ public function pruneAction(Request $request) { try { $repository = $this->get(self::REPOSITORY_NAME); $question = new QuestionHelper($this->trans('PruneRegistrationsQuestionText')); $question->onSuccess(function () use($repository) { $number = $repository->pruneOld(); $this->get('session')->getFlashBag()->add('info', $this->trans('PrunedRegistrations: 0', [$number])); }); $question->respond('admin_registration_prune'); $question->path($this->crudInfo->getIndexPage()); $question->title($this->trans($this->crudInfo->getPageTitle()), $this->crudInfo->getPageSubtitle()); $this->breadcrumbs()->link($this->trans('Prune', [], 'general'), 'admin_registration_prune'); return $question->handleRequest($this, $request); } catch (ModelException $exception) { return $this->showPageWithError($exception->getMessage(), $this->crudInfo->getIndexPage()); } }
/** * @Route("/{id}/edit", name="user_area_request_edit") */ public function editAction($id, Request $request) { try { $repository = $this->get(self::REPOSITORY_NAME); $item = $repository->getItem($id); $settings = $this->getProjectSettings(); $settings->setProject($item->getProject()); $formModel = $this->getExtensionPoints()->getImplementation(CoreExtensions::AREA_REQUEST_FORM, $item->getProject()->createExtensionPointFilter()->fromSettings($settings, CoreSettings::AREA_REQUEST_FORM)); $this->territoryRepository->setProject($item->getProject()); $form = $this->createForm(UserAreaRequestForm::class, $item, ['action' => $this->generateUrl($this->crudInfo->getEditPage(), ['id' => $id]), 'customFormModel' => $formModel, 'projectSettings' => $settings, 'territoryRepository' => $this->territoryRepository]); $form->handleRequest($request); if ($form->isValid()) { $repository->update($item); return $this->showPageWithMessage($this->trans('The area request has been updated.'), $this->crudInfo->getInfoPage(), ['id' => $item->getId()]); } $this->breadcrumbs()->link($item->getName(), $this->crudInfo->getInfoPage(), ['id' => $id]); $this->breadcrumbs()->link($this->trans('Edit', [], 'pages'), $this->crudInfo->getEditPage(), ['id' => $id]); return $this->render($this->crudInfo->getTemplateLocation() . 'edit.html.twig', array('item' => $item, 'pageTitle' => $this->crudInfo->getPageTitle(), 'pageSubtitle' => $this->crudInfo->getPageSubtitle(), 'form' => $form->createView(), 'formRenderer' => $formModel->createFormRenderer(), 'project' => $item->getProject())); } catch (ModelException $ex) { return $this->showPageWithError($this->trans($ex->getMessage()), $this->crudInfo->getIndexPage()); } }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $this->crudInfo = $this->newCrudInfo(self::REPOSITORY_NAME)->setTemplateLocation('CantigaExportBundle:AdminExport:')->setItemNameProperty('name')->setPageTitle('Export settings')->setPageSubtitle('Configure data export to external systems via REST')->setIndexPage('admin_export_index')->setInfoPage('admin_export_info')->setInsertPage('admin_export_insert')->setEditPage('admin_export_edit')->setRemovePage('admin_export_remove')->setItemCreatedMessage('ExportSettingsCreated: 0')->setItemUpdatedMessage('ExportSettingsUpdated: 0')->setItemRemovedMessage('ExportSettingsRemoved: 0')->setRemoveQuestion('ExportSettingsRemoveQuestion: 0'); $this->breadcrumbs()->workgroup('projects')->entryLink($this->trans('Export settings', [], 'pages'), $this->crudInfo->getIndexPage()); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $this->crudInfo = $this->newCrudInfo(self::REPOSITORY_NAME)->setTemplateLocation('CantigaCoreBundle:ProjectArea:')->setItemNameProperty('name')->setPageTitle('Areas')->setPageSubtitle('Manage the areas in this project')->setIndexPage('project_area_index')->setInfoPage('project_area_info')->setInsertPage('project_area_insert')->setEditPage('project_area_edit')->setItemUpdatedMessage('The area profile \'0\' has been updated.'); $this->breadcrumbs()->workgroup('data')->entryLink($this->trans('Areas', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); $this->get(self::REPOSITORY_NAME)->setActiveProject($this->getActiveProject()); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $this->crudInfo = $this->newCrudInfo(self::REPOSITORY_NAME)->setTemplateLocation('CantigaCoreBundle:MemberList:')->setItemNameProperty('name')->setPageTitle('Member list')->setPageSubtitle('Explore your colleagues')->setIndexPage('group_memberlist_index')->setInfoPage('group_memberlist_profile')->setInfoTemplate('profile.html.twig'); $this->breadcrumbs()->workgroup('community')->entryLink($this->trans('Member list', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $this->crudInfo = $this->newCrudInfo(self::REPOSITORY_NAME)->setTemplateLocation('CantigaCoreBundle:ProjectGroup:')->setItemNameProperty('name')->setPageTitle('Groups')->setPageSubtitle('Organize the areas and users into groups to ease the management')->setIndexPage('project_area_group_index')->setInfoPage('project_area_group_info')->setInsertPage('project_area_group_insert')->setEditPage('project_area_group_edit')->setRemovePage('project_area_group_remove')->setRemoveQuestion('Do you really want to remove \'0\' item?'); $this->breadcrumbs()->workgroup('data')->entryLink($this->trans('Groups', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); $this->get(self::REPOSITORY_NAME)->setProject($this->getActiveProject()); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $repository = $this->get(self::REPOSITORY_NAME); $this->crudInfo = $this->newCrudInfo($repository)->setTemplateLocation('CantigaCourseBundle:Summary:')->setItemNameProperty('name')->setPageTitle('Course results')->setPageSubtitle('See the total course results of all the members of your area')->setIndexPage('area_course_index')->setInfoPage('area_course_info'); $this->breadcrumbs()->workgroup('summary')->entryLink($this->trans('Course results', [], 'pages'), $this->crudInfo->getIndexPage(), ['slug' => $this->getSlug()]); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $this->setLocale($request); $this->crudInfo = $this->newCrudInfo('cantiga.core.repo.language')->setTemplateLocation('CantigaCoreBundle:AdminLanguage:')->setItemNameProperty('name')->setPageTitle('Languages')->setPageSubtitle('Manage the system languages available for the users')->setIndexPage('admin_language_index')->setInfoPage('admin_language_info')->setInsertPage('admin_language_insert')->setEditPage('admin_language_edit')->setRemovePage('admin_language_remove'); $this->breadcrumbs()->workgroup('settings')->entryLink($this->trans('Languages', [], 'pages'), $this->crudInfo->getIndexPage()); }
public function initialize(Request $request, AuthorizationCheckerInterface $authChecker) { $this->crudInfo = $this->newCrudInfo(self::REPOSITORY_NAME)->setTemplateLocation('CantigaCoreBundle:AdminProject:')->setItemNameProperty('name')->setPageTitle('Projects')->setPageSubtitle('Manage your active projects')->setIndexPage('admin_project_index')->setInfoPage('admin_project_info')->setInsertPage('admin_project_insert')->setEditPage('admin_project_edit')->setRemovePage('admin_project_remove')->setRemoveQuestion('Do you really want to remove \'0\' item?'); $this->breadcrumbs()->workgroup('projects')->entryLink($this->trans('Projects', [], 'pages'), $this->crudInfo->getIndexPage()); }