Esempio n. 1
0
 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()]);
 }
Esempio n. 3
0
 /**
  * @Route("/ajax-list", name="admin_app_text_ajax_list")
  */
 public function ajaxListAction(Request $request)
 {
     $routes = $this->dataRoutes()->link('info_link', $this->crudInfo->getInfoPage(), ['id' => '::id'])->link('edit_link', $this->crudInfo->getEditPage(), ['id' => '::id'])->link('remove_link', $this->crudInfo->getRemovePage(), ['id' => '::id']);
     $repository = $this->get(self::REPOSITORY_NAME);
     $dataTable = $repository->createDataTable();
     $dataTable->process($request);
     return new JsonResponse($routes->process($repository->listData($dataTable)));
 }
 /**
  * @Route("/ajax-list", name="project_milestone_status_rule_ajax_list")
  */
 public function ajaxListAction(Request $request)
 {
     $routes = $this->dataRoutes()->link('info_link', $this->crudInfo->getInfoPage(), ['id' => '::id', 'slug' => $this->getSlug()])->link('edit_link', $this->crudInfo->getEditPage(), ['id' => '::id', 'slug' => $this->getSlug()])->link('remove_link', $this->crudInfo->getRemovePage(), ['id' => '::id', 'slug' => $this->getSlug()]);
     $repository = $this->crudInfo->getRepository();
     $dataTable = $repository->createDataTable();
     $dataTable->process($request);
     return new JsonResponse($routes->process($repository->listData($dataTable, $this->getTranslator())));
 }
 /**
  * @Route("/ajax-list", name="project_territory_ajax_list")
  */
 public function ajaxListAction(Request $request)
 {
     $routes = $this->dataRoutes()->link('info_link', 'project_territory_info', ['id' => '::id', 'slug' => $this->getSlug()])->link('edit_link', 'project_territory_edit', ['id' => '::id', 'slug' => $this->getSlug()])->link('remove_link', 'project_territory_remove', ['id' => '::id', 'slug' => $this->getSlug()]);
     $repository = $this->crudInfo->getRepository();
     $dataTable = $repository->createDataTable();
     $dataTable->process($request);
     return new JsonResponse($routes->process($repository->listData($dataTable)));
 }
Esempio n. 6
0
 /**
  * @Route("/ajax-list", name="project_area_ajax_list")
  */
 public function ajaxListAction(Request $request)
 {
     $filter = $this->get(self::FILTER_NAME);
     $filter->setTargetProject($this->getActiveProject());
     $filterForm = $filter->createForm($this->createFormBuilder($filter));
     $filterForm->handleRequest($request);
     $routes = $this->dataRoutes()->link('info_link', $this->crudInfo->getInfoPage(), ['id' => '::id', 'slug' => $this->getSlug()])->link('edit_link', $this->crudInfo->getEditPage(), ['id' => '::id', 'slug' => $this->getSlug()]);
     $repository = $this->get(self::REPOSITORY_NAME);
     $dataTable = $repository->createDataTable();
     $dataTable->filter($filter);
     $dataTable->process($request);
     return new JsonResponse($routes->process($repository->listData($dataTable, $this->getTranslator())));
 }
Esempio n. 7
0
 /**
  * @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());
     }
 }
Esempio n. 8
0
 /**
  * @Route("/{id}/duplicate", name="area_edk_message_duplicate")
  */
 public function duplicateAction($id)
 {
     try {
         $item = $this->crudInfo->getRepository()->getItem($id);
         $this->crudInfo->getRepository()->changeDuplicateFlag($item);
         return $this->showPageWithMessage($this->trans('MsgDuplicateStatusChanged', [], 'edk'), 'area_edk_message_info', ['slug' => $this->getSlug(), 'id' => $item->getId()]);
     } catch (ModelException $ex) {
         return $this->showPageWithError($this->trans($ex->getMessage(), [], 'edk'), 'area_edk_message_index', ['slug' => $this->getSlug()]);
     }
 }
Esempio n. 9
0
 /**
  * @Route("/{id}/complete", name="area_course_complete")
  */
 public function goodFaithCompletionAction($id)
 {
     try {
         $repo = $this->get(self::REPOSITORY_NAME);
         $item = $repo->getItem($id);
         if ($item->hasTest()) {
             return $this->showPageWithError($this->trans('CourseHasTestMsg'), $this->crudInfo->getInfoPage(), ['id' => $id, 'slug' => $this->getSlug()]);
         }
         $repo->confirmGoodFaithCompletion($this->getMembership()->getItem(), $this->getUser(), $item);
         return $this->showPageWithMessage($this->trans('CourseCompletedConfirmationMsg'), $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()]);
     }
 }
Esempio n. 10
0
 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("/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}/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()]);
     }
 }
Esempio n. 13
0
 /**
  * @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());
     }
 }
Esempio n. 14
0
 /**
  * @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()));
 }
Esempio n. 15
0
 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()]);
 }
Esempio n. 16
0
 /**
  * @Route("/index", name="admin_language_index")
  */
 public function indexAction(Request $request)
 {
     $repository = $this->get('cantiga.core.repo.language');
     $dataTable = $repository->createDataTable();
     return $this->render('CantigaCoreBundle:AdminLanguage:index.html.twig', array('pageTitle' => $this->crudInfo->getPageTitle(), 'pageSubtitle' => $this->crudInfo->getPageSubtitle(), 'dataTable' => $dataTable, 'locale' => $request->getLocale()));
 }
Esempio n. 17
0
 public function newCrudInfo($repositoryService)
 {
     $info = new CRUDInfo();
     if (is_object($repositoryService)) {
         $info->setRepository($repositoryService);
     } else {
         $info->setRepository($this->get($repositoryService));
     }
     return $info;
 }
Esempio n. 18
0
 /**
  * @Route("/index", name="admin_project_index")
  */
 public function indexAction(Request $request)
 {
     $repository = $this->get(self::REPOSITORY_NAME);
     $dataTable = $repository->createDataTable();
     return $this->render('CantigaCoreBundle:AdminProject:index.html.twig', array('pageTitle' => $this->crudInfo->getPageTitle(), 'pageSubtitle' => $this->crudInfo->getPageSubtitle(), 'dataTable' => $dataTable, 'locale' => $request->getLocale()));
 }
Esempio n. 19
0
 /**
  * @Route("/index", name="admin_export_index")
  */
 public function indexAction(Request $request)
 {
     $repository = $this->get(self::REPOSITORY_NAME);
     $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(), 'insertPage' => $this->crudInfo->getInsertPage(), 'ajaxListPage' => 'admin_export_ajax_list'));
 }
 /**
  * @Route("/index", name="area_course_results")
  */
 public function resultsAction(Request $request)
 {
     $repository = $this->get(self::REPOSITORY_NAME);
     $text = $this->getTextRepository()->getText(CourseTexts::AREA_COURSE_LIST_TEXT, $request);
     return $this->render($this->crudInfo->getTemplateLocation() . 'area-individual-results.html.twig', array('pageTitle' => $this->crudInfo->getPageTitle(), 'pageSubtitle' => $this->crudInfo->getPageSubtitle(), 'courseInfoPage' => 'area_course_info', 'userProfilePage' => 'area_memberlist_profile', 'items' => $repository->findTotalIndividualResultsForArea($this->getMembership()->getItem())));
 }