/**
  * @Route("/index", name="project_app_text_index")
  */
 public function indexAction(Request $request)
 {
     $repository = $this->get(self::REPOSITORY_NAME);
     $repository->setProject($this->getActiveProject());
     $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' => 'project_app_text_ajax_list'));
 }
Esempio n. 2
0
 /**
  * @Route("/index", name="project_area_index")
  */
 public function indexAction(Request $request)
 {
     $repository = $this->get(self::REPOSITORY_NAME);
     $filter = $this->get(self::FILTER_NAME);
     $filter->setTargetProject($this->getActiveProject());
     $filterForm = $filter->createForm($this->createFormBuilder($filter));
     $filterForm->handleRequest($request);
     $dataTable = $repository->createDataTable();
     $dataTable->filter($filter);
     return $this->render($this->crudInfo->getTemplateLocation() . 'index.html.twig', array('pageTitle' => $this->crudInfo->getPageTitle(), 'pageSubtitle' => $this->crudInfo->getPageSubtitle(), 'dataTable' => $dataTable, 'locale' => $request->getLocale(), 'ajaxListPage' => 'project_area_ajax_list', 'filterForm' => $filterForm->createView(), 'filter' => $filter));
 }
Esempio n. 3
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()]);
     }
 }
Esempio n. 4
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. 5
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()));
 }
 /**
  * @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());
     }
 }
Esempio n. 9
0
 /**
  * @Route("/index", name="area_course_index")
  */
 public function indexAction(Request $request)
 {
     $repository = $this->get(self::REPOSITORY_NAME);
     $text = $this->getTextRepository()->getText(CourseTexts::AREA_COURSE_LIST_TEXT, $request, $this->getActiveProject());
     return $this->render($this->crudInfo->getTemplateLocation() . 'index.html.twig', array('pageTitle' => $this->crudInfo->getPageTitle(), 'pageSubtitle' => $this->crudInfo->getPageSubtitle(), 'courseListText' => $text, 'infoPage' => $this->crudInfo->getInfoPage(), 'items' => $repository->findAvailableCourses($this->getUser())));
 }
Esempio n. 10
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()));
 }
 /**
  * @Route("/index", name="project_milestone_status_rule_index")
  */
 public function indexAction(Request $request)
 {
     $dataTable = $this->crudInfo->getRepository()->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' => 'project_milestone_status_rule_ajax_list'));
 }
Esempio n. 12
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. 13
0
 /**
  * @Route("/index", name="area_edk_participant_index")
  */
 public function indexAction(Request $request)
 {
     $text = $this->getTextRepository()->getTextOrFalse(EdkTexts::PARTICIPANT_TEXT, $request, $this->getActiveProject());
     $dataTable = $this->crudInfo->getRepository()->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' => 'area_edk_participant_ajax_list', 'exportCsvPage' => 'area_edk_participant_export_all', 'text' => $text));
 }
 /**
  * @Route("/index", name="project_territory_index")
  */
 public function indexAction(Request $request)
 {
     $dataTable = $this->crudInfo->getRepository()->createDataTable();
     return $this->render($this->crudInfo->getTemplateLocation() . 'index.html.twig', array('pageTitle' => $this->crudInfo->getPageTitle(), 'pageSubtitle' => $this->crudInfo->getPageSubtitle(), 'dataTable' => $dataTable, 'locale' => $request->getLocale()));
 }
 /**
  * @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())));
 }