예제 #1
0
 /**
  * Create response for particular Controller.
  *
  * @access   public
  * @param    View $oContent
  * @return   Response
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function createResponse(View $oContent = NULL)
 {
     if (is_null($oContent)) {
         $oContent = $this->{Router::getActionName()}();
         $this->afterAction();
     }
     $sContent = '';
     if ($oContent !== NULL) {
         $this->oView->bind('oContent', $oContent);
         // developers toolbar - CSS
         if (Router::hasModule('dev_toolbar') && \UserPermissions::hasPerm('dev_toolbar')) {
             $this->addJs('/themes/_common/js/dev_toolbar.js');
             $this->addCss('/themes/backend/css/dev_toolbar.css');
             $this->addBodyClass('dev_toolbar');
         }
         // render page View
         $sContent = $this->oViewMain->render();
         // add last benchmark
         Benchmark::mark('end');
         // developers toolbar
         if (Router::hasModule('dev_toolbar') && \UserPermissions::hasPerm('dev_toolbar')) {
             $sToolbar = \DevToolbar\Toolbar::factory()->render();
             $sContent = str_replace('</body>', $sToolbar . '</body>', $sContent);
         }
     }
     // create response
     $oResponse = new Response();
     $oResponse->setContent($sContent);
     // clear temp data after response creation
     Session::clearTempData();
     // return response
     return $oResponse;
 }