public function getTask(Request $request, Task $task)
 {
     if (false === $this->app['phraseanet.configuration']['main']['task-manager']['enabled']) {
         throw new RuntimeException('The use of the task manager is disabled on this instance.');
     }
     if ('json' === $request->getContentType()) {
         return $this->app->json(array_replace(['id' => $task->getId(), 'name' => $task->getName(), 'urls' => $this->getTaskResourceUrls($task->getId())], $this->getLiveInformationRequest()->getTask($task)));
     }
     $editor = $this->getJobFactory()->create($task->getJobId())->getEditor();
     $form = $this->app->form(new TaskForm());
     $form->setData($task);
     return $this->render($editor->getTemplatePath(), ['task' => $task, 'form' => $form->createView(), 'view' => 'XML']);
 }
 /**
  * {@inheritDoc}
  */
 public function getName()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getName', array());
     return parent::getName();
 }
示例#3
0
 public function getTask(Application $app, Request $request, Task $task)
 {
     if ('json' === $request->getContentType()) {
         return $app->json(array_replace(['id' => $task->getId(), 'name' => $task->getName(), 'urls' => $this->getTaskResourceUrls($app, $task->getId())], $app['task-manager.live-information']->getTask($task)));
     }
     $editor = $app['task-manager.job-factory']->create($task->getJobId())->getEditor();
     $form = $app->form(new TaskForm());
     $form->setData($task);
     return $app['twig']->render($editor->getTemplatePath(), ['task' => $task, 'form' => $form->createView(), 'view' => 'XML']);
 }