Display job.

@param Request $request
@param Model   $job

@return Response
346929
public function show(JobRequest $request, Job $job)
    {

        if ($job->exists) {
            $view = 'career::job.show';
        } else {
            $view = 'career::job.new';
        }

        return $this->response->title(trans('app.view') . ' ' . trans('career::job.name'))
            ->data(compact('job'))
            ->view($view, true)
            ->output();
    }
620306
public function call(Job $job, array $data)
    {
        $handler = $this->setJobInstanceIfNecessary(
            $job, $this->container->make($data['class'])
        );

        call_user_func_array(
            array($handler, $data['method']), unserialize($data['data'])
        );

        if (! $job->isDeletedOrReleased()) {
            $job->delete();
        }
    }
647988
public function show($id, Request $request)
    {
        $entity = $this->getEntityById($id);

        if (!$entity) {
            return $this->response(null, Response::HTTP_NOT_FOUND);
        }

        return $this->response($this->serialize($entity, $request), Response::HTTP_OK);
    }
1003458
public function listAction(Request $request)
    {
        $query = $this->addOrganizationFilter($request->query->all());

        return new JsonResponse($this->finder->search(
            $this->getClass(),
            $query,
            []
        ));
    }
663126
public function displayTermsOfUse(Request $request)
    {
        $toDisplay = $request->query->get('to_display', []);
        $data = [];

        foreach ($this->getApplicationBox()->get_databoxes() as $databox) {
            if (count($toDisplay) > 0 && !in_array($databox->get_sbas_id(), $toDisplay)) {
                continue;
            }

            $cgus = $databox->get_cgus();

            if (!isset($cgus[$this->app['locale']])) {
                continue;
            }

            $data[$databox->get_label($this->app['locale'])] = $cgus[$this->app['locale']]['value'];
        }

        return $this->renderResponse('/prod/TOU.html.twig', [
            'TOUs'        => $data,
            'local_title' => $this->app->trans('Terms of use'),
        ]);
    }
1282040
public function viewAction(Request $request)
    {
        $id = $request->get('id');

        $taskManager = $this->get('phlexible_task.task_manager');
        $types = $this->get('phlexible_task.types');
        $userManager = $this->get('phlexible_user.user_manager');

        $task = $taskManager->find($id);

        $createUser = $userManager->find($task->getCreateUserId());
        $assignedUser = $userManager->find($task->getAssignedUserId());

        $transitions = [];
        foreach ($task->getTransitions() as $transition) {
            $transitionUser = $userManager->find($transition->getCreateUserId());
            $history[] = [
                'create_date' => $transition->getCreatedAt()->format('Y-m-d H:i:s'),
                'name' => $transitionUser->getDisplayName(),
                'status' => $transition->getNewState(),
                'latest' => 1,
            ];
        }
        $transitions = array_reverse($transitions);

        $comments = [];
        foreach ($task->getComments() as $comment) {
            $commentUser = $userManager->find($comment->getCreateUserId());
            $history[] = [
                'create_date' => $comment->getCreatedAt()->format('Y-m-d H:i:s'),
                'name' => $commentUser->getDisplayName(),
                'status' => $comment->getCurrentState(),
                'comment' => $comment->getComment(),
                'latest' => 1,
            ];
        }

        $type = $types->get($task->getType());

        $data = [
            'id' => $task->getId(),
            'type' => $task->getType(),
            'title' => $type->getTitle($task),
            'text' => $type->getText($task),
            'component' => $type->getComponent(),
            'created' => $task->getCreateUserId() === $this->getUser()->getId() ? 1 : 0,
            'assigned' => $task->getAssignedUserId() === $this->getUser()->getId() ? 1 : 0,
            'assigned_user' => $assignedUser->getDisplayName(),
            'assigned_uid' => $task->getAssignedUserId(),
            'create_user' => $createUser->getDisplayName(),
            'create_uid' => $task->getCreateUserId(),
            'create_date' => $task->getCreatedAt()->format('Y-m-d H:i:s'),
            'latest_status' => $task->getFiniteState(),
            'latest_comment' => '', //$latestStatus->getComment(),
            'latest_user' => '', //$assignedUser->getDisplayName(),
            'latest_uid' => '', //$latestStatus->getCreateUserId(),
            'latest_date' => '', //$latestStatus->getCreatedAt()->format('Y-m-d H:i:s'),
            //'recipient_uid'  => $task->getRecipientUserId(),
            //'latest_id'      => $latestStatus->getId(),
            'transitions' => $transitions,
            'comments' => $comments,
        ];

        return new JsonResponse($data);
    }
251184
protected function doJob(AbstractJob $job)
    {
        $this->validateJobParams($job);

        try {

            $response = $this->sendMail($job);
            $resultData['response'] = $response;

        } catch (\Exception $ex) {
            throw new ResultException(ResultException::RETRY_TRANSPORT_ERROR);
        }

        if(!$resultData['response']['success']){
            throw new ResultException(ResultException::R_FAILURE, $resultData);
        }

        throw new ResultException(ResultException::R_SUCCESS, $resultData);
    }
662476
public function index(Request $request)
    {
        $jobs = $this->service->activeJobs();

        return view('admin.queue.index')
            ->with('jobs', $jobs);
    }
954374
public function showAction(Request $request, $id = 1)
    {

        $resource = $this->findOr404('find', array($id));

        $this->dispatch(Actions::SHOW, $resource);

        return $this->render($this->getFromConfig($request, 'template', true), array(
            $this->name => $resource
        ));
    }
474275
public function show(TaskRequest $request, Task $task)
    {

        if ($task->exists) {
            $view = 'task::task.show';
        } else {
            $view = 'task::task.new';
        }

        return $this->response->title(trans('app.view') . ' ' . trans('task::task.name'))
            ->data(compact('task'))
            ->view($view, true)
            ->output();
    }
740371
public function showAction(Request $request)
    {
        $gridSource = $this->get('dtc_grid.manager.source')->get($request->get('id'));
        $id = $request->get('identifier');
        $result = $gridSource->find($id);

        $responseResult = [];
        if (!$result) {
            return new Response('Not Found', 404);
        }
        if (is_array($result)) {
            foreach ($result as $key => $value) {
                $responseResult[$this->fromCamelCase($key)] = $value;
            }
        } elseif (method_exists($gridSource, 'getClassMetadata')) {
            $classMetadata = $gridSource->getClassMetadata();
            $fieldNames = $classMetadata->getFieldNames();
            foreach ($fieldNames as $fieldName) {
                $method = 'get'.ucfirst($fieldName);
                if (method_exists($result, $method)) {
                    $responseResult[$this->fromCamelCase($fieldName)] = $result->$method();
                }
            }
        }

        return new JsonResponse($responseResult);
    }
809992
public function getAction(Request $request, $id)
    {
        $document = $this->getModel()->getSerialised($id, $request);

        $response = $this->getResponse()
            ->setStatusCode(Response::HTTP_OK)
            ->setContent($document);

        return $response;
    }
347566
public function showAction(Request $request)
    {
        /** @var Article $article */
        $article = $this->getDoctrine()->getRepository($this->container->getParameter('vince_cms.class.article'))->find($request->attributes->get('_id'));
        if (!$article || (!$article->isPublished() && !$this->get('security.context')->isGranted('ROLE_ADMIN'))) {
            throw $this->createNotFoundException();
        }

        // Need to inject request as option because of scope limit on listeners
        $options = $this->get('event_dispatcher')->dispatch('vince_cms.event.load', new CmsEvent($article, array('request' => $request)))->getOptions();
        $options = $this->get('event_dispatcher')->dispatch(sprintf('vince_cms.event.load.%s', $article->getSlug()), new CmsEvent($article, $options))->getOptions();
        $options = $this->get('event_dispatcher')->dispatch(sprintf('vince_cms.event.load.template.%s', $article->getTemplate()->getSlug()), new CmsEvent($article, $options))->getOptions();
        if ($response = $this->get('vince_cms.form.handler')->process($request, $options)) {
            return $response;
        }

        return $this->render($article->getTemplate()->getPath(), $options)->setStatusCode($request->isMethod('post') ? 400 : 200);
    }
746334
public function update(JobRequest $request, Job $job)
    {
        try {
            $attributes = $request->all();

            $job->update($attributes);
            return $this->response->message(trans('messages.success.updated', ['Module' => trans('career::job.name')]))
                ->code(204)
                ->status('success')
                ->url(guard_url('career/job/' . $job->getRouteKey()))
                ->redirect();
        } catch (Exception $e) {
            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('career/job/' . $job->getRouteKey()))
                ->redirect();
        }

    }
1093775
public function indexAction(Request $request)
    {
        $response = $this->getCacheTimeKeeper()->getResponse('AnimeDbAppBundle:Notice');
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        $rep = $this->getRepository();
        $change_form = $this->createForm(new ChangeNotice())->handleRequest($request);
        if ($change_form->isValid() && ($notices = $change_form->getData()['notices'])) {
            switch ($change_form->getData()['action']) {
                case ChangeNotice::ACTION_SET_STATUS_SHOWN:
                    $rep->setStatus($notices->toArray(), Notice::STATUS_SHOWN);
                    break;
                case ChangeNotice::ACTION_SET_STATUS_CLOSED:
                    $rep->setStatus($notices->toArray(), Notice::STATUS_CLOSED);
                    break;
                case ChangeNotice::ACTION_REMOVE:
                    $rep->remove($notices->toArray());
            }

            return $this->redirect($this->generateUrl('notice_list'));
        }

        return $this->render('AnimeDbCatalogBundle:Notice:index.html.twig', [
            'has_notices' => $rep->count(),
        ], $response);
    }
1373584
private function display($element, Request $request, Response $response) {
        $loops = $this->getLoops();
        $renderer = $loops->getService("renderer");

        $appearance = [];

        if($request->isAjax()) {
            $renderer->addExtraAppearance("ajax");
        }

        $renderer->addExtraAppearance((string)$response->status_code);

        return $renderer->render($element, $appearance);
    }
694518
public function perform(Job $job)
    {
        // Set timeout so as to stop any hanged jobs
        // and turn off displaying errors as it fills
        // up the console
        set_time_limit($this->timeout);
        ini_set('display_errors', 0);

        $job->perform();

        $status = $job->getStatus();

        switch ($status) {
            case Job::STATUS_COMPLETE:
                $this->log('Done job <pop>'.$job.'</pop> in <pop>'.$job->execTimeStr().'</pop>', Logger::INFO);
                break;
            case Job::STATUS_CANCELLED:
                $this->log('Cancelled job <pop>'.$job.'</pop>', Logger::INFO);
                break;

            case Job::STATUS_FAILED:
                $this->log('Job '.$job.' failed: "'.$job->failError().'" in '.$job->execTimeStr(), Logger::ERROR);
                break;
            default:
                $this->log('Unknown job status "('.gettype($status).')'.$status.'" for <pop>'.$job.'</pop>', Logger::WARNING);
                break;
        }
    }