public function display($supress_output = false)
 {
     if (!array_key_exists('HTTP_HOST', $_SERVER)) {
         exit("No command line usage for this page");
     }
     if (!$this->get_exists('delay_index')) {
         I2CE::raiseError("Invalid tree data request:  'request' is missing");
         return false;
     }
     $delay_index = $this->get('delay_index');
     if (!array_key_exists('tree_data', $_SESSION) || !is_array($_SESSION['tree_data']) || !array_key_exists($delay_index, $_SESSION['tree_data'])) {
         return false;
     }
     $data = $_SESSION['tree_data'][$delay_index];
     unset($_SESSION['tree_data'][$delay_index]);
     if (!is_array($data)) {
         return false;
     }
     $template = new I2CE_Template();
     $template->loadRootText("<span id='root'>");
     $root = $template->getElementById('root');
     $doc = $template->getDoc();
     I2CE_Module_TreeSelect::createTreeData($template, $root, $data);
     $tdoc = new DOMDocument();
     $tdoc->appendChild($tdoc->importNode($root, true));
     echo $tdoc->saveHTML();
     die;
 }
示例#2
0
 /**
  * Handles creating hte I2CE_TemplateMeister templates and loading any default templates
  * @returns boolean true on success
  */
 protected function initializeTemplate()
 {
     if (array_key_exists('defaultHTMLFile', $this->args) && $this->args['defaultHTMLFile']) {
         $this->defaultHTMLFile = $this->args['defaultHTMLFile'];
     } else {
         $this->defaultHTMLFile = false;
     }
     if (!isset($this->args['templates'])) {
         $this->args['templates'] = array('');
     }
     if (is_scalar($this->args['templates'])) {
         $this->args['templates'] = array($this->args['templates']);
     }
     if (isset($this->args['template'])) {
         $template = $this->args['template'];
     } else {
         $template = 'I2CE_Template';
     }
     $this->template = new $template();
     if (!$this->template instanceof I2CE_TemplateMeister) {
         I2CE::raiseError("Could not make template {$template}");
         return false;
     }
     $this->template->setUser($this->user);
     if (array_key_exists(0, $this->args['templates']) && $this->args['templates'][0]) {
         $this->template->loadRootFile($this->args['templates'][0]);
     } else {
         $this->template->loadRootText('');
     }
     for ($i = 1; $i < count($this->args['templates']); $i++) {
         $this->template->addFile($this->args['templates'][$i]);
     }
     $this->template->processArgs($this->args);
     return true;
 }