view and item
@throws common_exception_BadRequest
@throws common_exception_Error
@throws tao_models_classes_MissingRequestParameterException
@return void
339845
public function viewItem()
    {
        $this->loadStandaloneMode();

		if (!$this->isXmlHttpRequest()) {
			throw new common_exception_BadRequest('wrong request mode');
		}

		$itemClass = $this->getCurrentClass();
		$item = $this->getCurrentInstance();

		$lang = null;
		if($this->hasRequestParameter('target_lang')){
			$lang = $this->getRequestParameter('target_lang');
		}

		$hiddenProperties = array(
			taoItems_models_classes_ItemsService::PROPERTY_ITEM_CONTENT
		);

		$properties = array();
		foreach($this->getClassService()->getClazzProperties($itemClass) as $property){
			if(in_array($property->getUri(), $hiddenProperties)){
				continue;
			}
			$range = $property->getRange();

			if(is_null($lang)){
				$propValues = $item->getPropertyValues($property);
			} else {
				$propContainer = $item->getPropertyValuesByLg($property, $lang);
				$propValues = $propContainer->getIterator();
			}
			foreach($propValues as $propValue){
				if($range->getUri() == OntologyRdfs::RDFS_LITERAL){
					$value = (string)$propValue;
				} else {
					$resource = new core_kernel_classes_Resource($propValue);
					$value = $resource->getLabel();
				}
				$properties[] = array(
					'name'	=> $property->getLabel(),
					'value'	=> $value
				);
			}
		}

		$previewData = $this->initPreview($item, $itemClass);
		if(count($previewData) == 0){
			$this->setData('preview', false);
			$this->setData('previewMsg', __('Not yet available'));
		}
		else{
			$this->setData('preview', true);
			$this->setData('instanceUri', tao_helpers_Uri::encode($item->getUri(), false));
			foreach($previewData as $key => $value){
				$this->setData($key, $value);
			}
		}

		$this->setData('uri', tao_helpers_Uri::encode($item->getUri()));
		$this->setData('classUri', tao_helpers_Uri::encode($itemClass->getUri()));

		$this->setData('label', $item->getLabel());
		$this->setData('itemProperties', $properties);
		$this->setView('view.tpl');
	}
977912
public function load() {

        if (!$this->hasRequestParameter('uri')) {
            throw new common_exception_MissingParameter('uri', __METHOD__);
        }
        if (!$this->hasRequestParameter('stylesheetUri')) {
            throw new common_exception_MissingParameter('stylesheetUri', __METHOD__);
        }
        if (!$this->hasRequestParameter('lang')) {
            throw new common_exception_MissingParameter('lang', __METHOD__);
        }
        
        $item = new \core_kernel_classes_Resource($this->getRequestParameter('uri'));
        $lang = $this->getRequestParameter('lang');
        $styleSheet = $this->getRequestParameter('stylesheetUri');
        if (!\tao_helpers_File::securityCheck($styleSheet, true)) {
            throw new \common_exception_Error('invalid stylesheet path "'.$styleSheet.'"');
        }



        $cssArray = CssHelper::loadCssFile($item, $lang, $styleSheet);
        echo json_encode($cssArray);
    }
740602
public static function requireView() : void
  {
    $medusa = new Medusa(self::$viewsEngine);

    $medusa->setCacheDirectory(self::$viewsCache);
    $medusa->setViewsDirectory(self::$viewsDirectory);
    $medusa->setViewsExtension(self::$viewsExtension);

    $medusa->register(Partial::class);
    $medusa->register(Using::class);
    $medusa->register(Csrf::class);
    $medusa->register(ConfigToJsonString::class);

    if (class_exists(DirectivesResolver::class)) {
      (new DirectivesResolver)->start([
        'view' => $medusa
      ]);
    }

    self::$viewComponent = $medusa;
  }
388110
protected function getPostsListView()
    {
        if (! isset($this->viewsData['postsListView'])) {
            throw new \Exception('The postsListView config value is missing.');
        }

        if (! $this->viewFactory->exists($this->viewsData['postsListView'])) {
            throw new \Exception(sprintf('The "%s" view is not found. Make sure the postsListView configuration key is correct.', $this->viewsData['postsListView']));
        }

        return $this->viewsData['postsListView'];
    }
237675
public function setViewParams($view)
    {
        
        foreach ($this->url as $url) {
            if(isset($view->params['urls']) && is_array($view->params['urls'])){
                $view->params['urls'] = $this->MenuMerge($view->params['urls'],$url);
            }else{
                $view->params['urls'] = $url;
            }
            
        }
        
        if($module = $this->getModule()){
            $view->params['urls'][$module]['active']=true;
        }
    }
1151873
protected function viewNotFound()
    {
        $this->response = $this->response->withStatus(404);
        $this->view->setView($this->not_found);
    }
406268
private function _checkViewsExist()
    {
        foreach ( $this->_view_levels as $view_level )
        {
            if ( !$view_level["is_disabled"] )
            {
                if ( !file_exists($this->_views_dir . $view_level["file_name"] . ".phtml") )
                {
                    throw new \Exception( "View '". $view_level["file_name"] .".phtml' does not exist." );
                }
            }
        }
    }
473349
public function init()
	{
		if($this->itemView===null)
			throw new CException(Yii::t('zii','The property "itemView" cannot be empty.'));
		parent::init();

		if(!isset($this->htmlOptions['class']))
			$this->htmlOptions['class']='list-view';

		if($this->baseScriptUrl===null)
			$this->baseScriptUrl=Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('zii.widgets.assets')).'/listview';

		if($this->cssFile!==false)
		{
			if($this->cssFile===null)
				$this->cssFile=$this->baseScriptUrl.'/styles.css';
			Yii::app()->getClientScript()->registerCssFile($this->cssFile);
		}
	}
240536
public function addItem($item) {
		if (is_object($item)) {
			$modelClass = $this->getModel();
			if (! $item instanceof $modelClass) {
				throw new Exception('Model must be an instance of "' . $modelClass . '"');
			}
			
			$item->setCollection($this);
			
			if ($this->_primary === null) {
				$this->_data[]   = &$item->getDataLinked();
				$this->_models[] = $item;
				
				end($this->_data);
				$this->_map[] = key($this->_data);
			} else {
				if (is_array($this->_primaryDefinition)) {
					$idParts = [];
					
					foreach ($this->_primaryDefinition as $primaryPart) {
						if (! isset($item->$primaryPart)) {
							throw new Exception('Primary part "' . $primaryPart . '" not found');
						}
						
						$idParts[] = $item->$primaryPart;
					}
					
					$id = $this->arrayHashFunction($idParts);
				} else {
					if (! isset($item->{$this->_primary})) {
						throw new Exception('Primary "' . $this->_primary . '" not found');
					}
					
					$id = $item->{$this->_primary};
				}
				
				$this->_map[]       = $id;
				$this->_data[$id]   = &$item->getDataLinked();
				$this->_models[$id] = $item;
			}
		} elseif (is_array($item)) {
			if ($this->_primary === null) {
				$this->_data[] = $item;
				
				end($this->_data);
				$this->_map[] = key($this->_data);
				
			} else {
				if (is_array($this->_primaryDefinition)) {
					$idParts = [];
					
					foreach ($this->_primaryDefinition as $primaryPart) {
						if (! isset($item[$primaryPart])) {
							throw new Exception('Primary part "' . $primaryPart . '" not found');
						}
						
						$idParts[] = $item->$primaryPart;
					}
					
					$id = $this->arrayHashFunction($idParts);
				} else {
					if (! isset($item[$this->_primary])) {
						throw new Exception('Primary "' . $this->_primary . '" not found');
					}
					
					$id = $item[$this->_primary];
				}
				
				$this->_map[]     = $id;
				$this->_data[$id] = $item;
			}
		} else {
			throw new Exception('Unknown type of item: "' . gettype($item) . '"');
		}
		
		return $this;
	}
478688
public function delete()
    {
        if (!$this->isXmlHttpRequest()) {
            throw new common_exception_BadRequest('wrong request mode');
        }
        $deliveryExecutionUri = tao_helpers_Uri::decode($this->getRequestParameter('uri'));
        $de = $this->getServiceProxy()->getDeliveryExecution($deliveryExecutionUri);

        try {
            $this->getResultStorage($de->getDelivery());

            $deleted = $this->getResultsService()->deleteResult($deliveryExecutionUri);

            $this->returnJson(array('deleted' => $deleted));
        } catch (\common_exception_Error $e) {
            $this->returnJson(array('error' => $e->getMessage()));
        }
    }
1297910
public function process()
        {
            try {
                $controllerName = $this->getController();
                if(null == $controllerName) {
                    throw new Exception('Method not allowed', 405);
                }
                $controller = new \ReflectionClass($controllerName);
                if(!$controller->isInstantiable()) {
                    throw new Exception('Bad Request', 400);
                }
                try {
                    $method = $controller->getMethod($this->request['method']);
                } catch(ReflectionException $re) {
                    throw new Exception('Unsupported HTTP method ' . $this->request['method'], 405);
                }
                if(!$method->isStatic()) {
                    $controller = $controller->newInstance($this->request);
                    if(!$controller->checkAuth()) {
                        throw new Exception('Unauthorized', 401);
                    }
                    $method->invoke($controller);
                    $this->response = $controller->getResponse();
                    $this->responseStatus = $controller->getResponseStatus();
                } else {
                    throw new Exception('Static methods not supported in Controllers', 500);
                }
                if(is_null($this->response)) {
                    throw new Exception('Method not allowed', 405);
                }
            } catch (Exception $re) {
                $this->responseStatus = $re->getCode();
                $this->response = array('ErrorCode' => $re->getCode(), 'ErrorMessage' => $re->getMessage());
            }
            $this->response()->send();
        }
835977
public function process()
	{
		$view = $this->getView();
		$context = $this->getContext();

		try
		{
			parent::process();
		}
		catch( \Aimeos\Client\Html\Exception $e )
		{
			$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
			$view->standardErrorList = $view->get( 'standardErrorList', [] ) + $error;
		}
		catch( \Aimeos\Controller\Frontend\Exception $e )
		{
			$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
			$view->standardErrorList = $view->get( 'standardErrorList', [] ) + $error;
		}
		catch( \Aimeos\MShop\Plugin\Provider\Exception $e )
		{
			$errors = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
			$errors = array_merge( $errors, $this->translatePluginErrorCodes( $e->getErrorCodes() ) );

			$view->summaryErrorCodes = $e->getErrorCodes();
			$view->standardErrorList = $view->get( 'standardErrorList', [] ) + $errors;
		}
		catch( \Aimeos\MShop\Exception $e )
		{
			$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
			$view->standardErrorList = $view->get( 'standardErrorList', [] ) + $error;
		}
		catch( \Exception $e )
		{
			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
			$view->standardErrorList = $view->get( 'standardErrorList', [] ) + $error;
			$this->logException( $e );
		}
	}
601676
public function initElements()
    {
        $class = $this->data['class'];
        if(!$class instanceof \core_kernel_classes_Class) {
            throw new \common_Exception('missing class in simple delivery creation form');
        }
        
        $classUriElt = \tao_helpers_form_FormFactory::getElement('classUri', 'Hidden');
        $classUriElt->setValue($class->getUri());
        $this->form->addElement($classUriElt);
        
        /** @var \tao_helpers_form_elements_xhtml_Hidden $testElt */
        $testElt = \tao_helpers_form_FormFactory::getElement('test', 'Hidden');
        /** @var ComplexSearchService $search */
        $search = $this->getServiceManager()->get(ComplexSearchService::SERVICE_ID);
        $queryBuilder = $search->query();
        $query = $search->searchType($queryBuilder , TaoOntology::TEST_CLASS_URI, true);
        $queryBuilder->setCriteria($query);

        $count = $search->getGateway()->count($queryBuilder);

        if (0 === $count) {
            throw new NoTestsException();
        }

        $selectElt = \tao_helpers_form_FormFactory::getElement('selectelt', 'Free');
        $selectElt->setValue('<div class="test-select-container"></div>');
        $this->form->addElement($selectElt);

        $testElt->addValidator(\tao_helpers_form_FormFactory::getValidator('NotEmpty'));
        $this->form->addElement($testElt);

        $this->initCustomElements();
    }
924303
public function display()
    {
        if ($this->controller != null) {
            try {
                $this->controller->display();
            } catch (\Exception $ex) {
                throw new \OWeb\manage\exceptions\Controller("The Controller couldn't be shown due to Errors", 0, $ex);
            }
        } else {
            throw new \OWeb\manage\exceptions\Controller("A Controller wasn't loaded to be shown");
        }
    }
104869
public function feedDataTable()
    {
        if (!$this->isXmlHttpRequest()) {
            throw new \Exception('Only ajax call allowed.');
        }

        if (!$this->hasRequestParameter(self::PARAMETER_COLUMNS)) {
            throw new common_Exception('Parameter "'. self::PARAMETER_COLUMNS .'" missing');
        }

        $this->returnJson((new ResultsPayload($this->getExporterService()->getExporter()))->getPayload());
    }
257659
def lostitem_view(request, item_id):
    
    lostitem = get_object_or_404(LostItem, id=item_id)
    return render(request, "itemreg/item_view.html", {"item": lostitem, "type": "lost"})
582422
public function process()
	{
		$view = $this->getView();

		if( $view->param( 'cs-order', null ) === null ) {
			return;
		}

		try
		{
			$controller = Controller_Frontend_Factory::createController( $this->_getContext(), 'basket' );
			$controller->get()->check( MShop_Order_Item_Base_Abstract::PARTS_ALL );

			parent::process();
		}
		catch( Exception $e )
		{
			$view->standardStepActive = 'summary';
			throw $e;
		}
	}