Procházet zdrojové kódy

#31 - Template switcher in Studio Designer.

AntonLV před 12 roky
rodič
revize
82e2c9fa6c

+ 5 - 3
inc/utils.inc.php

@@ -467,10 +467,12 @@ function get_templates_array($bEnabledOnly = true, $bShortInfo = true) {
 	bx_import('BxDolDb');
 	$oDb = BxDolDb::getInstance();
 
-	if($bEnabledOnly)
-		return $oDb->getPairs("SELECT `uri`, `title` FROM `sys_modules` WHERE 1 AND `type`='" . BX_DOL_MODULE_TYPE_TEMPLATE . "'" . ($bEnabledOnly ? " AND `enabled`='1'" : ""), "uri", "title");
+	$sWhereAddon = $bEnabledOnly ? " AND `enabled`='1'" : "";
+	
+	if($bShortInfo)
+		return $oDb->getPairs("SELECT `uri`, `title` FROM `sys_modules` WHERE 1 AND `type`='" . BX_DOL_MODULE_TYPE_TEMPLATE . "'" . $sWhereAddon, "uri", "title");
 	else 
-		return $oDb->getAllWithKey("SELECT * FROM `sys_modules` WHERE 1 AND `type`='" . BX_DOL_MODULE_TYPE_TEMPLATE . "'" . ($bEnabledOnly ? " AND `enabled`='1'" : ""), "uri"); 
+		return $oDb->getAllWithKey("SELECT * FROM `sys_modules` WHERE 1 AND `type`='" . BX_DOL_MODULE_TYPE_TEMPLATE . "'" . $sWhereAddon, "uri"); 
 }
 
 /*

+ 1 - 1
studio/template/scripts/BxBaseStudioDesigner.php

@@ -67,7 +67,7 @@ class BxBaseStudioDesigner extends BxDolStudioDesigner {
         $sResult = '';
 
         $sTemplate = getParam('template');
-        $aTemplates = get_templates_array(false, false);        
+        $aTemplates = get_templates_array(true, false);        
 
 	    $aTmplVarsTemplates = array ();
 	    foreach($aTemplates as $sUri => $aTemplate) {