Esempio n. 1
0
 protected function performResults($courseInfoPage, $profilePage, Area $area, Request $request)
 {
     $repository = $this->get(self::REPOSITORY_NAME);
     $text = $this->getTextRepository()->getText(CourseTexts::AREA_COURSE_LIST_TEXT, $request);
     $this->breadcrumbs()->link($area->getName(), $this->crudInfo->getInfoPage(), ['id' => $area->getId(), 'slug' => $this->getSlug()]);
     return $this->render($this->crudInfo->getTemplateLocation() . 'other-individual-results.html.twig', array('pageSubtitle' => $this->crudInfo->getPageSubtitle(), 'courseInfoPage' => $courseInfoPage, 'userProfilePage' => $profilePage, 'area' => $area, 'items' => $repository->findTotalIndividualResultsForArea($area), 'indexPage' => $this->crudInfo->getIndexPage()));
 }
 /**
  * @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())));
 }
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)));
 }
Esempio n. 4
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. 5
0
 /**
  * @Route("/ajax-list", name="area_edk_message_ajax_list")
  */
 public function ajaxListAction(Request $request)
 {
     $routes = $this->dataRoutes()->link('info_link', $this->crudInfo->getInfoPage(), ['id' => '::id', 'slug' => $this->getSlug()])->linkGenerator('assignee_link', function (RouterInterface $router, array $row) {
         if (!empty($row['responderId'])) {
             return $router->generate('area_memberlist_profile', ['id' => $row['responderId'], 'slug' => $this->getSlug()]);
         }
         return null;
     });
     $repository = $this->crudInfo->getRepository();
     $dataTable = $repository->createDataTable();
     $dataTable->process($request);
     return new JsonResponse($routes->process($repository->listData($dataTable, $this->getTranslator())));
 }
Esempio n. 6
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. 7
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. 8
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()]);
     }
 }
 /**
  * @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. 10
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());
     }
 }