3if (!defined(
'XOOPS_ROOT_PATH')) {
15 public $mOverride =
null;
17 public function __construct()
20 if (isset($initVars)) {
21 $this->mVars = $initVars;
24 $this->initVar(
'tpl_id', XOBJ_DTYPE_INT,
'',
true);
25 $this->initVar(
'tpl_refid', XOBJ_DTYPE_INT,
'0',
true);
26 $this->initVar(
'tpl_module', XOBJ_DTYPE_STRING,
'',
true, 25);
27 $this->initVar(
'tpl_tplset', XOBJ_DTYPE_STRING,
'',
true, 50);
28 $this->initVar(
'tpl_file', XOBJ_DTYPE_STRING,
'',
true, 50);
29 $this->initVar(
'tpl_desc', XOBJ_DTYPE_STRING,
'',
true, 191);
30 $this->initVar(
'tpl_lastmodified', XOBJ_DTYPE_INT,
'0',
true);
31 $this->initVar(
'tpl_lastimported', XOBJ_DTYPE_INT,
'0',
true);
32 $this->initVar(
'tpl_type', XOBJ_DTYPE_STRING,
'',
true, 20);
33 $initVars=$this->mVars;
36 public function loadSource()
38 if (!is_object($this->Source)) {
39 $handler =& xoops_getmodulehandler(
'tplsource',
'legacyRender');
40 $this->Source =& $handler->get($this->
get(
'tpl_id'));
41 if (!is_object($this->Source)) {
42 $this->Source =& $handler->create();
59 $obj->set(
'tpl_refid', $this->
get(
'tpl_refid'));
60 $obj->set(
'tpl_module', $this->
get(
'tpl_module'));
62 $obj->set(
'tpl_tplset', $tplsetName);
64 $obj->set(
'tpl_file', $this->
get(
'tpl_file'));
65 $obj->set(
'tpl_desc', $this->
get(
'tpl_desc'));
66 $obj->set(
'tpl_lastmodified', $this->
get(
'tpl_lastmodified'));
67 $obj->set(
'tpl_lastimported', $this->
get(
'tpl_lastimported'));
68 $obj->set(
'tpl_type', $this->
get(
'tpl_type'));
70 $handler =& xoops_getmodulehandler(
'tplsource',
'legacyRender');
71 $obj->Source =& $handler->create();
73 $obj->Source->set(
'tpl_source', $this->Source->get(
'tpl_source'));
85 if (
'default' == $tplset ||
null != $this->mOverride) {
89 $handler =& xoops_getmodulehandler(
'tplfile',
'legacyRender');
92 $criteria->add(
new Criteria(
'tpl_tplset', $tplset));
93 $criteria->add(
new Criteria(
'tpl_file', $this->
get(
'tpl_file')));
95 $objs =& $handler->getObjects($criteria);
96 if ((is_countable($objs) ? count($objs) : 0) > 0) {
97 $this->mOverride =& $objs[0];
104 public $mTable =
'tplfile';
105 public $mPrimary =
'tpl_id';
106 public $mClass =
'LegacyRenderTplfileObject';
108 public function insert(&$obj, $force =
false)
110 if (!parent::insert($obj, $force)) {
116 if (!is_object($obj->Source)) {
119 $handler =& xoops_getmodulehandler(
'tplsource',
'legacyRender');
121 if ($obj->Source->isNew()) {
122 $obj->Source->set(
'tpl_id', $obj->get(
'tpl_id'));
125 return $handler->insert($obj->Source, $force);
143 foreach ($objs as $obj) {
144 $set = $obj->get(
'tpl_tplset');
145 if (
'default' == $set) {
148 if ($set == $tplset) {
149 $dobjs[$obj->get(
'tpl_file')] = $obj;
153 foreach ($ret as $obj) {
154 $obj->mOverride = $dobjs[$obj->get(
'tpl_file')];
160 public function delete(&$obj, $force =
false)
164 if (is_object($obj->Source)) {
165 $handler =& xoops_getmodulehandler(
'tplsource',
'legacyRender');
166 if (!$handler->delete($obj->Source, $force)) {
171 return parent::delete($obj, $force);
182 $criteria =
new Criteria(
'tpl_id', 0,
'>');
184 $criteria->setLimit($limit);
186 $criteria->setSort(
'tpl_lastmodified');
187 $criteria->setOrder(
'DESC');
206 public function &
find($tplsetName, $type =
null, $refId =
null, $module =
null, $file =
null)
209 $criteria->add(
new Criteria(
'tpl_tplset', $tplsetName));
211 $criteria->add(
new Criteria(
'tpl_type', $type));
213 if (
null != $refId) {
214 $criteria->add(
new Criteria(
'tpl_refid', $refId));
216 if (
null != $module) {
217 $criteria->add(
new Criteria(
'tpl_module', $module));
220 $criteria->add(
new Criteria(
'tpl_file', $file));
& getObjectsWithOverride($criteria, $tplset)
& getRecentModifyFile($limit=10)
& find($tplsetName, $type=null, $refId=null, $module=null, $file=null)
& createClone($tplsetName)
& getObjects($criteria=null, $limit=null, $start=null, $id_as_key=false)