..)
상속: extends Backend\Core\Engine\Base\Object
예제 #1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // add jquery, we will need this in every action, so add it globally
     $this->header->addJS('jquery/jquery.js', 'Core', false);
     $this->header->addJS('jquery/jquery.ui.js', 'Core', false);
     $this->header->addJS('jquery/jquery.ui.dialog.patch.js', 'Core');
     $this->header->addJS('jquery/jquery.tools.js', 'Core', false);
     $this->header->addJS('jquery/jquery.backend.js', 'Core');
     // add items that always need to be loaded
     $this->header->addJS('utils.js', 'Core');
     $this->header->addJS('backend.js', 'Core');
     // add module js
     if (is_file($this->getBackendModulePath() . '/Js/' . $this->getModule() . '.js')) {
         $this->header->addJS($this->getModule() . '.js');
     }
     // add action js
     if (is_file($this->getBackendModulePath() . '/Js/' . $this->getAction() . '.js')) {
         $this->header->addJS($this->getAction() . '.js');
     }
     // add core css files
     $this->header->addCSS('reset.css', 'Core');
     $this->header->addCSS('jquery_ui/fork/jquery_ui.css', 'Core', false, false);
     $this->header->addCSS('screen.css', 'Core');
     $this->header->addCSS('debug.css', 'Core');
     // add module specific css
     if (is_file($this->getBackendModulePath() . '/Layout/Css/' . $this->getModule() . '.css')) {
         $this->header->addCSS($this->getModule() . '.css');
     }
     // store var so we don't have to call this function twice
     $var = array_map('strip_tags', $this->getParameter('var', 'array', array()));
     // is there a report to show?
     if ($this->getParameter('report') !== null) {
         // show the report
         $this->tpl->assign('report', true);
         // camelcase the string
         $messageName = strip_tags(\SpoonFilter::toCamelCase($this->getParameter('report'), '-'));
         // if we have data to use it will be passed as the var parameter
         if (!empty($var)) {
             $this->tpl->assign('reportMessage', vsprintf(BL::msg($messageName), $var));
         } else {
             $this->tpl->assign('reportMessage', BL::msg($messageName));
         }
         // highlight an element with the given id if needed
         if ($this->getParameter('highlight')) {
             $this->tpl->assign('highlight', strip_tags($this->getParameter('highlight')));
         }
     }
     // is there an error to show?
     if ($this->getParameter('error') !== null) {
         // camelcase the string
         $errorName = strip_tags(\SpoonFilter::toCamelCase($this->getParameter('error'), '-'));
         // if we have data to use it will be passed as the var parameter
         if (!empty($var)) {
             $this->tpl->assign('errorMessage', vsprintf(BL::err($errorName), $var));
         } else {
             $this->tpl->assign('errorMessage', BL::err($errorName));
         }
     }
 }