예제 #1
0
 /**
  * Dispatch the controller
  *
  * @param   object		A command context object
  * @return	mixed
  */
 protected function _actionDispatch(KCommandContext $context)
 {
     //Set the default controller
     if ($context->data) {
         $this->_controller_default = KConfig::toData($context->data);
     }
     //Set the date in the context
     $context->data = $this->getData();
     //Execute the controller
     $result = $this->getController()->execute($this->getAction(), $context);
     //Set the response header
     if ($context->status) {
         header(KHttpResponse::getHeader($context->status));
     }
     return $result;
 }
예제 #2
0
 /**
  * Push the controller data into the document
  *
  * This function divert the standard behavior and will push specific controller data
  * into the document
  *
  * @return	mixed
  */
 protected function _actionRender(KCommandContext $context)
 {
     //Headers
     if ($context->headers) {
         foreach ($context->headers as $name => $value) {
             header($name . ' : ' . $value);
         }
     }
     //Status
     if ($context->status) {
         header(KHttpResponse::getHeader($context->status));
     }
     if (is_string($context->result)) {
         return $context->result;
     }
 }