Пример #1
0
 /**
  * Adds an javascript objectto the content.
  *
  * @param Javascript $script
  *
  * @return JavascriptObject
  */
 public function &add(JavascriptObject $js)
 {
     if ($this->router->isAjax()) {
         /* @var $ajax \Core\Ajax\Ajax */
         $ajax = $this->di->get('core.ajax');
         switch ($js->getType()) {
             case 'file':
                 $cmd = $ajax->createActCommand();
                 $cmd->getScript($js->getScript());
                 break;
         }
         $return = null;
         return $return;
     }
     $area = $js->getDefer() ? 'below' : 'top';
     if ($this->mode == 'core') {
         $this->core_js[$area][] = $js;
     } else {
         $this->app_js[$area][] = $js;
     }
     return $js;
 }
Пример #2
0
 /**
  * @TODO Bad code. :/
  *
  * @param string $stage
  */
 private function send404($stage = 'not set')
 {
     $msg = $stage . ' - Page not found';
     if ($this->router->isAjax()) {
         $cmd = new \Core\Ajax\Commands\Dom\HtmlCommand('#content', $msg);
         $ajax = $this->di->get('core.ajax');
         $ajax->addCommand($cmd);
         $result = $ajax->process();
         return $result;
     }
     $this->http->header->sendHttpError(404);
     return $msg;
 }