Пример #1
0
 public function getTaskEditForm($action)
 {
     $form = new Form('task_edit_form', $action);
     $dictionary = new Dictionary();
     $form->addField((new FieldText('theme', 'Тема'))->addRule(new NotEmpty()))->addField((new FieldTextArea('body', 'Задание'))->addRule(new NotEmpty()))->addField(new FieldTextArea('users', ''))->addField((new FieldTextArea('users_widget', 'Исполнители', array('readonly' => true)))->addRule(new NotEmpty()))->addField(new FieldDateTime('dateLimit', 'Крайний срок'))->addField(new FieldDropDawnList('hardLevel', 'Сложность', $dictionary->taskLevels()->getList()))->addField(new FieldDropDawnList('speedLevel', 'Срочность', $dictionary->taskSpeeds()->getList()))->addField(new FieldSubmit('submit', 'Сохранить', array(), 'Сохранить'));
     return $form;
 }
 public function showAction($id)
 {
     $manager = new TaskManager($this->dataProvider->getEntityManager());
     $roles = array();
     $task = $manager->getTaskForShow($this->authentication->getCurrentUser(), $id, $roles);
     $dictionary = new Dictionary();
     if (!$manager->accessHasOpened()) {
         return $this->acceptSolutionRedirectToRoute('403', array());
     }
     return $this->acceptSolutionRenderView('task_tracker::show.html.twig', array('task' => $task, 'roles' => $dictionary->taskRoles()->getList(), 'states' => $dictionary->taskStates()->getList(), 'hard' => $dictionary->taskLevels()->getList(), 'speed' => $dictionary->taskSpeeds()->getList(), 'currentRoles' => $roles, 'buttons' => $this->buildControlsModel($roles, $dictionary, $task, $manager)));
 }