Exemplo n.º 1
0
 public function __construct()
 {
     // define the Named Application
     if (!defined('NAMED_APPLICATION')) {
         define('NAMED_APPLICATION', 'backend');
     }
     // set the module
     $this->setModule(SpoonFilter::getGetValue('module', null, ''));
     // set the requested file
     $this->setFile(SpoonFilter::getGetValue('file', null, ''));
     // set the language
     $this->setLanguage(SpoonFilter::getGetValue('language', array_keys(BackendLanguage::getWorkingLanguages()), SITE_DEFAULT_LANGUAGE));
     // build the path
     if ($this->module == 'core') {
         $path = BACKEND_CORE_PATH . '/js/' . $this->getFile();
     } else {
         $path = BACKEND_MODULES_PATH . '/' . $this->getModule() . '/js/' . $this->getFile();
     }
     // set correct headers
     SpoonHTTP::setHeaders('content-type: application/javascript');
     // create a new template instance (this will handle all stuff for us)
     $tpl = new BackendTemplate();
     // enable addslashes on each locale
     $tpl->setAddSlashes(true);
     // display
     $tpl->display($path, true);
 }
Exemplo n.º 2
0
 /**
  * Display, this wil output the template to the browser
  * If no template is specified we build the path form the current module and action
  *
  * @return	void
  * @param	string[optional] $template	The template to use, if not provided it will be based on the action.
  */
 public function display($template = null)
 {
     // parse header
     $this->header->parse();
     // if no template is specified, we have to build the path ourself
     // the default template is based on the name of the current action
     if ($template === null) {
         $template = BACKEND_MODULE_PATH . '/layout/templates/' . $this->URL->getAction() . '.tpl';
     }
     // display
     $this->tpl->display($template);
 }