Displays a single Task model.
@return mixed
@throws NotFoundHttpException
971378
public function actionTaskview()
    {
        $id = $this->getRequestParam('id');
        $model = Project::getTaskModel($id);

        if (!isset($model)) {
            throw new NotFoundHttpException('The Task "' . $id . '" not found.');
        }

        return $this->render('taskview', [
            'model' => $model,
        ]);
    }
641109
public function index()
    {
        // For single-item display only, redirect to the relevant show/edit page
        if ($this->modelInformation->single) {
            return $this->returnViewForSingleDisplay();
        }

        $this->resetStateBeforeIndexAction()
             ->checkListParents()
             ->applyListParentContext()
             ->checkActiveSort()
             ->checkScope()
             ->checkFilters()
             ->checkActivePage();

        $totalCount  = $this->getTotalCount();
        $scopeCounts = $this->getScopeCounts();

        $this->applySort()
             ->applyScope($this->modelRepository);

        $query = $this->getModelRepository()->query();

        $this->applyFilter($query)
             ->applyListParentToQuery($query);

        $records = $query->paginate($this->getActualPageSize(), ['*'], 'page', $this->getActualPage());

        // Check and whether page is out of bounds and adjust
        if ($this->getActualPage() > $records->lastPage()) {
            $records = $query->paginate($this->getActualPageSize(), ['*'], 'page', $records->lastPage());
        }

        $currentCount = method_exists($records, 'total') ? $records->total() : 0;

        return view($this->getIndexView(), [
            'moduleKey'           => $this->moduleKey,
            'routePrefix'         => $this->routePrefix,
            'permissionPrefix'    => $this->permissionPrefix,
            'model'               => $this->modelInformation,
            'records'             => $records,
            'recordReferences'    => $this->getReferenceRepository()->getReferencesForModels($records->items()),
            'totalCount'          => $totalCount,
            'currentCount'        => $currentCount,
            'listStrategies'      => $this->getListColumnStrategyInstances(),
            'sortColumn'          => $this->getActualSort(),
            'sortDirection'       => $this->getActualSortDirection(),
            'pageSize'            => $this->getActualPageSize(),
            'pageSizeOptions'     => $this->getPageSizeOptions(),
            'filterStrategies'    => $this->renderedListFilterStrategies($this->getActiveFilters()),
            'activeScope'         => $this->getActiveScope(),
            'scopeCounts'         => $scopeCounts,
            'unconditionalDelete' => $this->isUnconditionallyDeletable(),
            'defaultRowAction'    => $this->getDefaultRowActionInstance(),
            'hasActiveListParent' => (bool) $this->listParentRelation,
            'listParents'         => $this->listParents,
            'topListParentOnly'   => $this->showsTopParentsOnly(),
            'draggableOrderable'  => $this->isListOrderDraggable($totalCount, $currentCount),
            'availableExportKeys' => $this->getAvailableExportStrategyKeys(),
        ]);
    }
443545
public function cliAction()
    {
        $exitCode = $this->cliApplication->run(new RequestInput($this->getRequest()), $this->output);

        if (is_numeric($exitCode)) {
            $model = new ViewModel();
            $model->setErrorLevel($exitCode);

            return $model;
        }
    }
1147440
public function templateAction()
    {
        try {
            $jobEntity = $this->initializeJob()->get($this->params());
            $jobEntity->setTemplate($this->params('template', 'default'));
            $this->repositoryService->store($jobEntity);
            $this->notification()->success(/* @translate*/ 'Template changed');
        } catch (\Exception $e) {
            $this->notification()->danger(/* @translate */ 'Template not changed');
        }

        return new JsonModel(array());
    }
584710
public function showAction()
    {
        $id = (int) $this->params()->fromRoute('id', null);

        $service = $this->getService();
        $entity  = $service->getById($id);

        $view = new ViewModel(array(
            'entity'  => $entity,
            'options' => $this->getOptions(),
        ));

        if ($this->getOptions()->getDisplayDiagrammInDetailView()) {
            $diagramm = $this->getService()->createUseCaseDiagrammFor($entity);
            $view->setVariable('diagramm', $diagramm);
        }

        return $view;
    }
1137535
public function getViewModel() {
		if ($this->useCache) {
			$viewModel = $this->recacheAgent->getViewModel('add', $this->entityNamespace, '');
			if ($viewModel) {
				return $viewModel;
			}
		}
		
		$this->viewModel = new ViewModel();
		
		$form = $this->formGenerator->getForm();
		$this->viewModel->setVariable('form', $form);
		
		if (RequestHandler::handleAdd($this->objectManager, $this->entityNamespace, $form, $this->request) && $this->redirect != null) {
			return $this->getRedirect();
		}
		
		$this->setupTemplate();
		$this->setupTitle();
		
		if ($this->useCache) {
			$this->recacheAgent->storeViewModel($this->viewModel, 'add', $this->entityNamespace, '');
		}
		
		return $this->viewModel;
	}
957933
public function render()
    {
        if ($this->showAs->isNotEmpty()) {
            $this->showAs->each(function ($callable) {
                $this->value = $callable->call(
                    $this->parent->getModel(),
                    $this->value
                );
            });
        }

        return view($this->view, $this->variables());
    }
183874
public function findModel($id)
    {
        $model = call_user_func_array([$this->MainModel, 'findOne'], [$id]);
        if ($model !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
266541
public function listAction()
    {
        $params     = $this->params();
        $request    = $this->getRequest();
        $bodyOnly   = $request->isXmlHttpRequest();
        $page       = $params->fromRoute( 'page',
            $request->getPost( 'page',
                $request->getQuery( 'page', 1 )
            )
        );

        $view = new ViewModel( array(
            'paginator' => $this->getPaginator(),
            'page'      => ( (int) $page ) ?: 1,
            'format'    => $bodyOnly,
        ) );

        if ( $bodyOnly )
        {
            $view->setTerminal( true );
        }

        return $view;
    }
785665
public function get()
    {
        $modelResult = $this->getRequest()->request(
            'GET',
            $this->getRequestUrl('models')
        );

        return $this->getModelsFromResult($modelResult);
    }
410583
public function getModel()
    {
        if ($this->batch) {
            $model = $this->batch->getVariable('model');
        } else {
            $model = $this->_session->model;
        }
        if (is_array($model)) {
            if ($this->modelId && isset($model['surveys'][$this->modelId])) {
                $currentFilter = $model['filter'];
                $currentFilter['gto_id_survey'] = $this->modelId;
                $data = $model['data'];
                $sort = $model['sort'];
                $model = $this->getAnswerModel($currentFilter, $data, $sort);
            } else {
                return false;
                //$model = false;
            }
        }

        $this->model = $model;

        if ($this->model->getMeta('exportPreprocess') === null) {
            $this->preprocessModel();
            $this->model->setMeta('exportPreprocess', true);
        }

        return $this->model;
    }
445445
public function getStatus()
    {
        try {
            if (!$this->hasRequestParameter(self::TASK_ID_PARAM)) {
                throw new \common_exception_MissingParameter(self::TASK_ID_PARAM, $this->getRequestURI());
            }

            $data = $this->getTaskLogReturnData(
                $this->getRequestParameter(self::TASK_ID_PARAM),
                CompileDelivery::class
            );
            $children = $this->getStatusesForChildren($this->getRequestParameter(self::TASK_ID_PARAM));
            $data['children'] = $children;
            $this->returnSuccess($data);
        } catch (\Exception $e) {
            $this->returnFailure($e);
        }
    }
536972
public function indexTask()
	{
		// var to hold output
		$output = new stdClass();
		$output->component = substr($this->_option, 4);
		$bits = explode('v', get_class($this));
		$output->version   = str_replace('_', '.', end($bits));
		$output->tasks     = array();
		$output->errors    = array();

		// create reflection class of file
		$classReflector = new ReflectionClass($this);

		if ($this->isDynamic)
		{
			$model = $this->resolveModel();
			$properties = $model->getStructure()->getTableColumns($model->getTableName());
			$properties = $this->normalizeProperties($properties);

			$output->version = 1;
		}

		// loop through each method and process doc
		foreach ($classReflector->getMethods() as $method)
		{
			// create docblock object & make sure we have something
			$phpdoc = new \phpDocumentor\Reflection\DocBlock($method);

			// skip constructor
			if (substr($method->getName(), -4) != 'Task' || in_array($method->getName(), array('registerTask', 'unregisterTask')))
			{
				continue;
			}

			// skip method in the parent class (already processed), 
			/*if ($className != $method->getDeclaringClass()->getName())
			{
				//continue;
			}*/

			// skip if we dont have a short desc
			// but put in error
			if (!$phpdoc->getShortDescription())
			{
				$output->errors[] = Lang::txt(
					'JLIB_APPLICATION_ERROR_DOCBLOCK_MISSING',
					$method->getName(),
					str_replace(PATH_ROOT, '', $classReflector->getFileName())
				);
				continue;
			}

			// create endpoint data array
			$endpoint = array(
				'name'        => substr($method->getName(), 0, -4),
				'description' => preg_replace('/\s+/', ' ', $phpdoc->getShortDescription()),
				'method'      => '',
				'uri'         => '',
				'parameters'  => array()
			);

			// loop through each tag
			foreach ($phpdoc->getTags() as $tag)
			{
				// get tag name and content
				$name    = strtolower(str_replace('api', '', $tag->getName()));
				$content = $tag->getContent();

				// handle parameters separately
				// json decode param input
				if ($name == 'parameter')
				{
					$parameter = json_decode($content);

					if (json_last_error() != JSON_ERROR_NONE)
					{
						$output->errors[] = Lang::txt(
							'JLIB_APPLICATION_ERROR_DOCLBOCK_PARSING',
							$method->getName(),
							str_replace(PATH_ROOT, '', $classReflector->getFileName())
						);
						continue;
					}

					$endpoint['parameters'][] = (array) $parameter;
					continue;
				}

				if ($name == 'uri' && $method->getName() == 'indexTask')
				{
					$content .= $output->component;

					if ($this->isDynamic)
					{
						$content .= '/' . $this->_controller;
					}
				}

				// add data to endpoint data
				$endpoint[$name] = $content;
			}

			if ($this->isDynamic && $endpoint['name'] != 'index')
			{
				$endpoint['uri'] = str_replace('{component}', $output->component, $endpoint['uri']);
				$endpoint['uri'] = str_replace('{controller}', $this->_controller, $endpoint['uri']);
				$endpoint['uri'] = str_replace('{primary key}', '{' . $model->getPrimaryKey() . '}', $endpoint['uri']);

				foreach ($properties as $prop => $type)
				{
					$parameter = array(
						'name'        => $prop,
						'description' => '',
						'type'        => $type,
						'required'    => false,
						'default'     => null
					);

					if ($prop == $model->getPrimaryKey() && in_array($endpoint['name'], array('read', 'update', 'delete')))
					{
						$parameter['required'] = true;

						if (in_array($endpoint['name'], array('read', 'delete')))
						{
							$endpoint['parameters'] = array($parameter);
							break;
						}
					}

					$endpoint['parameters'][] = $parameter;
				}
			}

			// add endpoint to output
			$output->tasks[] = $endpoint;
		}

		if (count($output->errors) <= 0)
		{
			unset($output->errors);
		}

		$this->send($output);
	}
467640
public function getModelDisplayName()
    {
        $instance = $this->getModelInstance();
        $display = isset($instance->display) ? $instance->display : ucfirst($this->model);

        return $display;
    }
888415
public function paginate()
    {
        $model = $this->model;

        if (property_exists($model, 'order')) {
            $paginator = $model::orderBy($model::$order, $model::$sort)->paginate($model::$paginate, $model::$index);
        } else {
            $paginator = $model::paginate($model::$paginate, $model::$index);
        }

        if (!$this->isPageInRange($paginator) && !$this->isFirstPage($paginator)) {
            throw new NotFoundHttpException();
        }

        if (count($paginator)) {
            $this->paginateLinks = $paginator->render();
        }

        return $paginator;
    }
1345679
public function indexAction()
    {
        /* @todo: move this into a listener.
         *
         * The following lines allow to override get param[q] with the
         * param from route. This feature is needed for a landing-page feature, where
         * human readable urls like http://yawik.org/demo/de/jobs/sales.html
         *
         * move the Logic into a Listener, which can be activated, if needed
         */
        $request = $this->getRequest();
        $getParams = $request->getQuery();
        $routeParams = $this->params()->fromRoute();
        if (isset($routeParams['q']) && !isset($getParams['q'])) {
            $getParams['q']=$routeParams['q'];
        }

        $result = $this->pagination([
                'params' => ['Jobs_Board', [
                    'q',
                    'count' => $this->options['count'],
                    'page' => 1,
                    'l',
                    'd' => 10]
                ],
                'form' => ['as' => 'filterForm', 'Jobs/JobboardSearch'],
                'paginator' => ['as' => 'jobs', 'Jobs/Board']
            ]);

        $organizationImageCache = $this->imageFileCacheManager;

        $result['organizationImageCache'] = $organizationImageCache;

        return new ViewModel($result);
    }
1297094
public function displayAction()
    {
        $id = $this->params()->fromRoute('id', null);
        $filter = $this->params()->fromRoute('filter', null);
        if (!$id) {
            return $this->notFoundAction();
        }
        $user = $this->getUserMapper()->findById($id);
        if (!$user) {
            return $this->notFoundAction();
        }
        $image = $this->profileImageService->getUserImage($user, $filter);

        return new ImageModel($image);
    }