run before

@access public
@param  array $aParams parameters
@return \Apollina\Template\HtmlOptions
2390
public function replaceBy($aParams = array()) 
	{
		$aOptions = array();
		$mSelected = '';

		if (isset($aParams['options'])) { $aOptions = $aParams['options']; }
		else { new \Exception('HtmlOptions: options obligatory');}

		if (isset($aParams['selected'])) { $mSelected = $aParams['selected']; }

		$sOption = '';

		foreach ($aOptions as $mOne) {

			$sOption .= '<option value="'.$mOne.'">'.$mOne.'</option>';
		}

		return $sOption;
	}
257187
public function replaceBy($aParams = array()) 
	{
		$sFile = '';

		if (isset($aParams['file'])) { $sFile = $aParams['file']; }
		else { new \Exception('ConfigLoad: file obligatory');}

		$sViewDirectory = str_replace('lib'.DIRECTORY_SEPARATOR.'Template'.DIRECTORY_SEPARATOR.'Function',
			'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR, __DIR__);

		$aConfVars = parse_ini_file($sViewDirectory.$sFile);

		$sContent = '';
		$sContent = $this->_constructVar($sContent, $aConfVars, '$_aProtectedVar[\'app\'][\'config\']');

		return '<?php '.$sContent.'; ?>';
	}
541274
public static function render($xml, array $params = [])
	{
		$renderer = static::getCachedRenderer();

		if (!empty($params))
		{
			$renderer->setParameters($params);
		}

		if (isset(static::$beforeRender))
		{
			$xml = call_user_func(static::$beforeRender, $xml);
		}

		$output = $renderer->render($xml);

		if (isset(static::$afterRender))
		{
			$output = call_user_func(static::$afterRender, $output);
		}

		return $output;
	}
707395
public function params($params = null)
    {
        if (null !== $params) {
            $this->params = $params;

            return $this;
        }

        return $this->params;
    }
930026
public function setParams($params)
    {
        if (!is_array($params) && !is_object($params)) {
            throw new Exception\InvalidArgumentException(
                sprintf('Event parameters must be an array or object; received "%s"', gettype($params))
            );
        }

        foreach ($params as $name => $value) {
            $this->setParam($name, $value);
        }

        return $this;
    }
458597
public function loadParams(array $params)
    {
        $this->arguments = array();
        $this->options = array();

        foreach ($params as $param) {
            if (strpos($param, '-') !== false) {
                $this->options[] = $this->extractOption($param);
            } else {
                $this->arguments[] = $param;
            }
        }

        return $this;
    }
726073
public function setParams(array $params = [])
    {

        //Process Params
        $params = $this->processParams($params);

        //Set the params
        $this->params = $params;

        return $this;
    }
560751
public function paginate(array $params)
    {

        // page
        if (isset($params[$this->getParamPage()])) {
            $this->setPage($params[$this->getParamPage()]);
        }

        return $this;
    }
512903
public function render($params = null)
    {
        $template = $this->getViewer($this->getAction());

        // if the object is already customised (e.g. through Controller->run()), use it
        $obj = $this->getCustomisedObj() ?: $this;

        if ($params) {
            $obj = $this->customise($params);
        }

        return $template->process($obj);
    }
695448
public function run($params = null)
    {
        $this->parser = new Parser($this->paths);

        try {
            $argc = ($params === null) ? null : count($params);
            $this->result = $this->parser->parse($argc, $params);
        } catch (\Exception $e) {
            $this->parser->displayError($e->getMessage());
        }

        $this->parse();
    }
1060156
public function replaceBy($aParams = array()) 
	{
		if (isset($aParams['var'])) { $sVar = '$_aProtectedVar['.$aParams['var'].']'; }
		else { new \Exception('Append: var obligatory');}

		if (isset($aParams['value'])) { $sValue = $aParams['value']; }
		else { new \Exception('Append: value obligatory');}

		if (isset($aParams['index'])) { $sIndex = $aParams['index']; }
		else { $sIndex = null; }

		if (isset($aParams['scope'])) { $sScope = $aParams['scope']; }
		else { $sScope = 'local'; }

		if (isset($sIndex)) {

			return '<?php if (!isset('.$sVar.')) { '.$sVar.' = array(); } '.$sVar.'['.$sIndex.'] = '.$sValue.'; ?>';
		}
		else {

			return '<?php if (!isset('.$sVar.')) { '.$sVar.' = array(); } '.$sVar.'[] = '.$sValue.'; ?>';
		}
	}
1239721
protected function setParams($params)
    {
        $this->params = $this->default_params;
        foreach ($params as $name => $value) {
            $method = 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($name))));
            if (!method_exists($this, $method)) {
                throw new Exception\InvalidArgumentException(__METHOD__ . " Parameter '$name' does not exists.");
            }
            $this->$method($value);
        }
    }
825948
public function proceed($params = [])
    {
        // before
        if (isset($this->advice['before']) && !empty($this->advice['before'])) {
            list($aspectClass, $aspectMethod) = $this->advice['before'];
            $aspect = App::getBean($aspectClass);
            $aspect->$aspectMethod();
        }

        if (empty($this->advices)) {
            // execute
            $methodParams = !empty($params) ? $params : $this->args;
            $result       = $this->target->{$this->method}(...$methodParams);
        } else {
            /* @var \Swoft\Aop\Aop $aop */
            $aop    = App::getBean(Aop::class);
            $result = $aop->doAdvice($this->target, $this->method, $this->args, $this->advices);
        }

        return $result;
    }
96254
public function actionCreate($aParams = array())
    {
        $aConfig = $this->config('Create');
        
        $mResult = false;

        if ($aConfig) {
            if (!isset($aConfig['View']) || (isset($aConfig['View']) && $aConfig['View'] != false)) {
                $mResult = $this->view(array(), $aConfig['View']);
            } else if (isset($aConfig['Component'])) {
                $sComponentModule = $aConfig['Component']['Component'][0];
                $sComponentAlias  = $aConfig['Component']['Component'][1];
                $aComponentParams = isset($aConfig['Component']['Params']) ? $aConfig['Component']['Params'] : array();
                
                $model = $this->getCreateObject();
                
                // Проверка доступа
                $this->checkActionAccess('Create', $model);
                
                if ($this->sMapperAlias && count($aParams)) 
                {
                    foreach ($aParams as $key=> $param)
                    {
                        $field = $this->mapper()->getFieldByRealName($key);
                        call_user_func_array(array($model, 'set'), array($field, $param));
                    }
                }
                
                $aComponentParams['Data'] = $model;
                
                if(!empty($_POST))
                {
                    //echo print_r($_POST, true);die();
                    $aResult = array();
                    
                    //echo print_r($model->save(), true);die();
                    $model = $this->saveCreateObject();
                    if (!$model->isDirty() || !($model instanceof Object)) 
                    {
                        $this->afterCreateEvent($model);
                        
                        $aResult['update_url'] = $this->getUpdateUrlForObject($model);
                        $aResult['success'] = true;
                    } else {
                        $aResult['success'] = false;
                        $aResult['errors'] = $model->getErrors();
                    }
                    
                    
                    header("Content-type: application/json");
                    echo json_encode($aResult);
                    Core::app()->hardEnd();
                    
                    
                } else {
                    $mResult = $this->component($sComponentModule, $sComponentAlias, $aComponentParams);
                }

            } else {
                $mResult = false;
            }
        } else {
            $mResult = $this->view('Create');
        }

        return $mResult;
    }
1226161
public function actionList($aParams = array())
    {
        $aConfig = $this->config('List');
        $limit = 10;
        
        $aFindParams = array();
        
        if (count($aParams) && $this->sMapperAlias) 
        {
            foreach ($aParams as $key=> $param)
            {
                if ($this->mapper()->isRealFieldExists($key))
                {
                    $aFindParams['Criteria'][$key] = $param;
                }
            }
        }
        
        $page = isset($_GET['page']) ? intval($_GET['page']) - 1 : 0;
        
        $aFindParams['Limit'] = $limit;
        $aFindParams['Offset'] = $page * $limit;
        
        $sort_field = isset($_GET['sort_field']) ? $_GET['sort_field'] : 'Id';
        $sort_direction = isset($_GET['sort_direction']) ? $_GET['sort_direction'] : 'ASC';
        
        $aFindParams['Order'] = array();
        //echo '<pre>', print_r($aFindParams, true), '</pre>'; die();
        
        if (isset($aConfig['Component']['FindParams'])) {
            $aFindParams = ArrayHelper::merge($aFindParams, $aConfig['Component']['FindParams']);
        }
        
        if (!count($aFindParams['Order']))
        {
            $aFindParams['Order'] = array($sort_field => $sort_direction);
        }
        
        $mResult = false;

        if ($aConfig) {
            if (!isset($aConfig['View']) || (isset($aConfig['View']) && $aConfig['View'] != false)) {
                $mResult = $this->view(array(), $aConfig['View']);
            } else if (isset($aConfig['Component'])) {
                $sComponentModule = $aConfig['Component']['Component'][0];
                $sComponentAlias  = $aConfig['Component']['Component'][1];
                $aComponentParams = isset($aConfig['Component']['Params']) ? $aConfig['Component']['Params'] : array();
                
                // Проверка доступа
                $this->checkActionAccess('List');
                
                $aComponentParams['Data'] = $this->getListData($aFindParams);
                $count = $this->getListDataCount($aFindParams);
                
                $oPagination = new Pagination($count);
                $oPagination->setPageSize($aFindParams['Limit']);
                $oPagination->applyLimit(@$aFindParams['Criteria']);
                $aComponentParams['Pagination'] = $oPagination;
                        
                $mResult = $this->component($sComponentModule, $sComponentAlias, $aComponentParams);

            } else {
                $mResult = false;
            }
        } else {
            $mResult = $this->view('List');
        }

        return $mResult;
    }
456435
public function setParams(array $params = array())
    {
        if (empty($params)) {
            throw new Exception('Unable to send exception. Invalid data provided.');
        }
        $this->description = isset($params['description']) ? $params['description'] : null;
        $this->url         = isset($params['url']) ? $params['url'] : null;
        $this->src         = isset($params['src']) ? $params['src'] : null;
        return $this;
    }
177074
public function setUp(array $params)
    {
        if (!isset($params['endpoint'])) {
            throw new \RuntimeException('Parameter "endpoint" missing.');
        }

        if (!isset($params['api_access_key'])) {
            throw new \RuntimeException('Parameter "api_access_key" missing.');
        }

        $this->params = $params;
    }