From: <tr...@us...> - 2011-10-30 19:17:40
|
Revision: 8004 http://xoops.svn.sourceforge.net/xoops/?rev=8004&view=rev Author: trabis Date: 2011-10-30 19:17:33 +0000 (Sun, 30 Oct 2011) Log Message: ----------- Updating config and tplset class methods Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/createconfigform.php XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/config.php XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/configcategory.php XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/configitem.php XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/configoption.php XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/tplset.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/preferences/main.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/tplsets/main.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/createconfigform.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/createconfigform.php 2011-10-30 18:56:36 UTC (rev 8003) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/createconfigform.php 2011-10-30 19:17:33 UTC (rev 8004) @@ -107,7 +107,7 @@ case 'tplset': $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); $tplset_handler =& xoops_gethandler('tplset'); - $tplsetlist =& $tplset_handler->getList(); + $tplsetlist = $tplset_handler->getNameList(); asort($tplsetlist); foreach ($tplsetlist as $key => $name) { $ele->addOption($key, $name); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/config.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/config.php 2011-10-30 18:56:36 UTC (rev 8003) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/config.php 2011-10-30 19:17:33 UTC (rev 8004) @@ -165,7 +165,18 @@ */ public function getConfigs(CriteriaElement $criteria = null, $id_as_key = false) { - return $this->_cHandler->getObjects($criteria, $id_as_key); + $criteria2 = new CriteriaCompo(); + if ($criteria) { + $criteria2->add($criteria); + if (!$criteria->getSort()) { + $criteria2->setSort('conf_order'); + $criteria2->setOrder('ASC'); + } + } else { + $criteria2->setSort('conf_order'); + $criteria2->setOrder('ASC'); + } + return $this->_cHandler->getObjects($criteria2, $id_as_key); } /** @@ -276,6 +287,8 @@ if (empty($conf_catid)) { $criteria->add(new Criteria('conf_catid', $conf_catid)); } + $criteria->setSort('conf_order'); + $criteria->setOrder('ASC'); $configs = $this->_cHandler->getObjects($criteria); $confcount = count($configs); $ret = array(); @@ -287,6 +300,4 @@ } } -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/configcategory.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/configcategory.php 2011-10-30 18:56:36 UTC (rev 8003) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/configcategory.php 2011-10-30 19:17:33 UTC (rev 8004) @@ -109,7 +109,7 @@ * * @return array Array of {@link XoopsConfigCategory}s */ - public function getObjects(CriteriaElement $criteria = null, $id_as_key = false) + public function getCategoryObjects(CriteriaElement $criteria = null, $id_as_key = false) { $ret = array(); $limit = $start = 0; @@ -141,6 +141,4 @@ return $ret; } -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/configitem.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/configitem.php 2011-10-30 18:56:36 UTC (rev 8003) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/configitem.php 2011-10-30 19:17:33 UTC (rev 8004) @@ -272,41 +272,4 @@ { parent::__construct($db, 'config', 'XoopsConfigItem', 'conf_id', 'conf_name'); } - - /** - * Get configs from the database - * - * @param CriteriaElement|null $criteria {@link CriteriaElement} - * @param bool $id_as_key return the config's id as key? - * @return array Array of {@link XoopsConfigItem} objects - */ - public function getObjects(CriteriaElement$criteria = null, $id_as_key = false) - { - $ret = array(); - $limit = $start = 0; - $sql = 'SELECT * FROM ' . $this->db->prefix('config'); - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { - $sql .= ' ' . $criteria->renderWhere(); - $sql .= ' ORDER BY conf_order ASC'; - $limit = $criteria->getLimit(); - $start = $criteria->getStart(); - } - $result = $this->db->query($sql, $limit, $start); - if (!$result) { - return false; - } - while ($myrow = $this->db->fetchArray($result)) { - $config = new XoopsConfigItem(); - $config->assignVars($myrow); - if (!$id_as_key) { - $ret[] = $config; - } else { - $ret[$myrow['conf_id']] = $config; - } - unset($config); - } - return $ret; - } -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/configoption.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/configoption.php 2011-10-30 18:56:36 UTC (rev 8003) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/configoption.php 2011-10-30 19:17:33 UTC (rev 8004) @@ -109,6 +109,4 @@ { parent::__construct($db, 'configoption', 'XoopsConfigOption', 'confop_id', 'confop_name'); } -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/tplset.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/tplset.php 2011-10-30 18:56:36 UTC (rev 8003) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/tplset.php 2011-10-30 19:17:33 UTC (rev 8004) @@ -146,7 +146,7 @@ * @param CriteriaElement|null $criteria conditions to match * @return array array of tplsets matching the conditions **/ - public function getList(CriteriaElement$criteria = null) + public function getNameList(CriteriaElement $criteria = null) { $ret = array(); $tplsets = $this->getObjects($criteria, true); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/preferences/main.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/preferences/main.php 2011-10-30 18:56:36 UTC (rev 8003) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/preferences/main.php 2011-10-30 19:17:33 UTC (rev 8004) @@ -145,7 +145,7 @@ case 'tplset': $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); $tplset_handler = $xoops->getTplsetHandler(); - $tplsetlist = $tplset_handler->getList(); + $tplsetlist = $tplset_handler->getNameList(); asort($tplsetlist); foreach ($tplsetlist as $key => $name) { $ele->addOption($key, $name); @@ -544,7 +544,7 @@ $xoBreadCrumb->render(); $confcat_handler = $xoops->getConfigcategoryHandler(); - $confcats = $confcat_handler->getObjects(); + $confcats = $confcat_handler->getCategoryObjects(); $image = system_adminVersion('preferences', 'configcat'); $count_prefs = 1; $nbcolonnes_pref = 5; Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/tplsets/main.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/tplsets/main.php 2011-10-30 18:56:36 UTC (rev 8003) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/tplsets/main.php 2011-10-30 19:17:33 UTC (rev 8004) @@ -71,7 +71,7 @@ $ele = new XoopsFormSelect(_AM_SYSTEM_TEMPLATES_SET, 'tplset', $GLOBALS['xoopsConfig']['tplset']); $tplset_handler = $xoops->getTplsetHandler(); - $tplsetlist = $tplset_handler->getList(); + $tplsetlist = $tplset_handler->getNameList(); asort($tplsetlist); foreach ($tplsetlist as $key => $name) { $ele->addOption($key, $name); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |