예제 #1
0
 /**
  * Function render
  *
  * @author David S. Callizaya S. <*****@*****.**>
  * @access public
  * @param string template
  * @param string scriptContent
  * @return string
  */
 public function render($template, &$scriptContent)
 {
     /**
      * *
      * This section was added for store the current used template.
      */
     $tmp_var = explode('/', $template);
     if (is_array($tmp_var)) {
         $tmp_var = $tmp_var[sizeof($tmp_var) - 1];
         $this->using_template = $tmp_var;
     }
     /**
      */
     $this->template = $template;
     $o = new xmlformTemplate($this, $template);
     $values = $this->values;
     $aValuekeys = array_keys($values);
     if (isset($aValuekeys[0]) && (int) $aValuekeys[0] == 1) {
         $values = XmlForm_Field_Grid::flipValues($values);
     }
     //TODO: Review when $values of a grid has only one row it is converted as a $values for a list (when template="grid" at addContent())
     if (is_array(reset($values))) {
         $this->rows = count(reset($values));
     }
     if ($this->enableTemplate) {
         $filename = substr($this->fileName, 0, -3) . 'html';
         if (!file_exists($filename)) {
             $o->template = $o->printTemplate($this);
             $f = fopen($filename, 'w+');
             fwrite($f, $o->template);
             fclose($f);
         }
         $o->template = implode('', file($filename));
     } else {
         $o->template = $o->printTemplate($this);
     }
     $scriptContent = $o->printJavaScript($this);
     $content = $o->printObject($this);
     return $content;
 }
예제 #2
0
 /**
  * Generic function to print the current object.
  *
  * @param $template
  * @param &$scriptContent
  * @return string
  */
 public function render($template, &$scriptContent)
 {
     $o = new xmlformTemplate($this, $template);
     if (is_array(reset($this->values))) {
         $this->rows = count(reset($this->values));
     }
     $o->template = $o->printTemplate($this);
     $scriptContent = $o->printJavaScript($this);
     return $o->printObject($this);
 }