Exemplo n.º 1
0
 /**
  * Prefetch blocks to reduce the amount of queries required by Smarty to generate all blocks
  * This function is called exclusively in icms_view_PageBuilder
  *
  * @global	array	$icmsConfig		icms configuration array
  * @param	array	$block_arr		array of blocks to prefetch
  * @return	bool					false if there are no blocks to prefetch, otherwise true
  */
 public function prefetchBlocks(&$block_arr)
 {
     global $icmsConfig;
     if (count($block_arr) == 0) {
         return false;
     }
     $tplNames = array();
     /**
      * @todo As soon as the criteria object is capable of rendering complex conditions,
      * this should be converted into the criteria approach
      */
     $sql = "SELECT f.*, s.tpl_source FROM " . $this->db->prefix("tplfile") . " f " . "LEFT JOIN " . $this->db->prefix("tplsource") . " s ON s.tpl_id=f.tpl_id " . "WHERE (tpl_tplset = '" . $icmsConfig["template_set"] . "' " . "OR tpl_tplset = 'default') AND (";
     foreach ($block_arr as $block) {
         $tplName = ($tplName = $block->getVar("template")) ? "{$tplName}" : "system_block_dummy.html";
         $tplNames[] = "tpl_file = '" . $tplName . "'";
     }
     $sql .= implode(" OR ", $tplNames);
     $sql .= ") ORDER BY tpl_refid";
     $result = $this->db->query($sql);
     if (!$result) {
         return false;
     }
     while ($myrow = $this->db->fetchArray($result)) {
         $tplfile = new icms_view_template_file_Object();
         $tplfile->assignVars($myrow);
         $this->_prefetch_cache[] =& $tplfile;
         unset($tplfile);
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * constructor
  */
 function XoopsTplfile()
 {
     parent::__construct();
     $this->_deprecated = icms_core_Debug::setDeprecated('icms_view_template_file_Object', sprintf(_CORE_REMOVE_IN_VERSION, '1.4'));
 }