public function execute(AgaviFilterChain $filterChain, AgaviExecutionContainer $container) { $isGlobal = ++self::$runCount == 1; if ($isGlobal) { // We are called from a global filterchain //trigger datasource event listeners foreach ($this->rq->getAttribute('datasources', self::NS, array()) as $ds) { $ds->beforeExecuteOnce($container); } } else { // This is a action filterchain //trigger datasource event listeners foreach ($this->rq->getAttribute('datasources', self::NS, array()) as $ds) { $ds->beforeExecute($container); } } // Proceed with execution $filterChain->execute($container); if ($isGlobal) { // We are called from a global filterchain //trigger datasource event listeners foreach ($this->rq->getAttribute('datasources', self::NS, array()) as $ds) { $ds->afterExecuteOnce($container); } //log global (i.e. not per action) stuff $this->rq->setAttribute('routes', $this->getMatchedRoutes(), self::NS_DATA); $this->rq->setAttribute('request_data', array('request_parameters' => $this->getContext()->getRequest()->getRequestData()->getParameters(), 'cookies' => $this->getContext()->getRequest()->getRequestData()->getCookies(), 'headers' => $this->getContext()->getRequest()->getRequestData()->getHeaders()), self::NS_DATA); $this->rq->setAttribute('tm', $this->getContext()->getTranslationManager(), self::NS_DATA); // $this->log['environments'] = $this->getAvailableEnvironments(); $this->render($container); } else { //trigger datasource event listeners foreach ($this->rq->getAttribute('datasources', self::NS, array()) as $ds) { $ds->afterExecute($container); } //now the action has been executed and we'll log what can be logged if (true) { //FIXME: options: in_array('actions', $this->options['sections'])) { $this->log($container); } } }
/** * Sets the given data on the given form. This replaces all data that may * exist in the request for that form. * * @see http://mivesto.de/agavi/agavi-faq.html#validation_8 for more info. * * @param string $form_id id of the html form that should be populated * @param array $data data to set for the given form (html input element names and values) * * @return void */ protected function populateForm($form_id, $data) { $populate = $this->request->getAttribute('populate', 'org.agavi.filter.FormPopulationFilter', array()); $populate[$form_id] = new AgaviParameterHolder($data); $this->request->setAttribute('populate', $populate, 'org.agavi.filter.FormPopulationFilter'); }