Minahito
minah****@users*****
2006年 5月 17日 (水) 18:35:39 JST
Index: xoops2jp/html/modules/legacyRender/admin/forms/TplfileSetFilterForm.class.php diff -u /dev/null xoops2jp/html/modules/legacyRender/admin/forms/TplfileSetFilterForm.class.php:1.1.2.1 --- /dev/null Wed May 17 18:35:39 2006 +++ xoops2jp/html/modules/legacyRender/admin/forms/TplfileSetFilterForm.class.php Wed May 17 18:35:39 2006 @@ -0,0 +1,70 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_MODULE_PATH . "/legacyRender/admin/forms/TplfileFilterForm.class.php"; + +/** + * This class is a filter form for list up tplfile object *with* override. + */ +class LegacyRender_TplfileSetFilterForm extends LegacyRender_TplfileFilterForm +{ + function LegacyRender_TplfileFilterForm(&$navi) + { + $this->_mNavi =& $navi; + $this->_mCriteria =& new CriteriaCompo(); + } + + function fetch() + { + $this->mSort = isset($_REQUEST['sort']) ? intval($_REQUEST['sort']) : TPLFILE_SORT_KEY_DEFAULT; + + if (abs($this->mSort) > TPLFILE_SORT_KEY_MAXVALUE) { + $this->mSort = TPLFILE_SORT_KEY_DEFAULT; + } + + if (isset($_REQUEST['tpl_module'])) { + $this->_mNavi->addExtra('tpl_module', xoops_getrequest('tpl_module')); + $this->_mCriteria->add(new Criteria('tpl_module', array(XOBJ_DTYPE_STRING, xoops_getrequest('tpl_module')))); + + $handler =& xoops_gethandler('module'); + $this->mModule =& $handler->getByDirname(xoops_getrequest('tpl_module')); + } + + if (isset($_REQUEST['tpl_tplset'])) { + $this->_mNavi->addExtra('tpl_tplset', xoops_getrequest('tpl_tplset')); + + // + // For the procedure of override, must load 'default' template-set here. + // The template of the specified template-set will be loaded in Tplset Object. + // See business-logic. + // + $subCriteria =& new CriteriaCompo(); + $subCriteria->add(new Criteria('tpl_tplset', 'default'), 'OR'); + + $handler =& xoops_getmodulehandler('tplset'); + $tplsets =& $handler->getObjects(new Criteria('tplset_name', xoops_getrequest('tpl_tplset'))); + if (count($tplsets) > 0) { + $subCriteria->add(new Criteria('tpl_tplset', xoops_getrequest('tpl_tplset'))); + $this->mTplset =& $tplsets[0]; + } + } + + if (isset($_REQUEST['tpl_type'])) { + $this->_mNavi->addExtra('tpl_type', xoops_getrequest('tpl_type')); + $this->_mCriteria->add(new Criteria('tpl_type', array(XOBJ_DTYPE_STRING, xoops_getrequest('tpl_type')))); + } + + $this->_mNavi->addExtra('sort', $this->mSort); + + // + // check filtering criterion and if module & tplset specified mode, then remove paging function. + // + if ($this->mModule != null && $this->mTplset != null) { + $this->_mNavi->setPerpage(0); + $this->_mNavi->freezePerpage(); + } + } +} + +?>