XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
TplfileCloneForm.class.php
1<?php
6
7if (!defined('XOOPS_ROOT_PATH')) {
8 exit();
9}
10
11require_once XOOPS_MODULE_PATH . '/legacyRender/admin/forms/TplfileEditForm.class.php';
12require_once XOOPS_MODULE_PATH . '/legacy/class/Legacy_Validator.class.php';
13
15{
16 public function getTokenName()
17 {
18 return 'module.legacyRender.TplfileCloneForm.TOKEN';
19 }
20
21 public function prepare()
22 {
23 parent::prepare();
24
25 //
26 // Set form properties
27 //
28 $this->mFormProperties['tpl_tplset'] =new XCube_StringProperty('tpl_tplset');
29
30 //
31 // Set field properties
32 //
33 $this->mFieldProperties['tpl_tplset'] =new XCube_FieldProperty($this);
34 $this->mFieldProperties['tpl_tplset']->setDependsByArray(['required']);
35 $this->mFieldProperties['tpl_tplset']->addMessage('required', _AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_TPL_TPLSET);
36 }
37
38 public function validateTpl_tplset()
39 {
40 $tplset = $this->get('tpl_tplset');
41
42 $handler =& xoops_getmodulehandler('tplset', 'legacyRender');
43 $criteria =new Criteria('tplset_name', $this->get('tpl_tplset'));
44 $objs =& $handler->getObjects($criteria);
45
46 if (0 == (is_countable($objs) ? count($objs) : 0)) {
47 $this->addErrorMessage(_AD_LEGACYRENDER_ERROR_TPLSET_WRONG);
48 }
49 }
50
51 public function load(&$obj)
52 {
53 parent::load($obj);
54 $this->set('tpl_tplset', $obj->get('tpl_tplset'));
55 }
56
57 public function update(&$obj)
58 {
59 $obj->loadSource();
60
61 $obj->set('tpl_desc', $this->get('tpl_desc'));
62 $obj->set('tpl_lastmodified', time());
63
64 $obj->Source->set('tpl_source', $this->get('tpl_source'));
65 }
66}
update(&$obj)
[Abstract] Updates an object with properties values.
getTokenName()
Gets the token name of this actionform's token.
prepare()
[Abstract] Set up form properties and field properties.
load(&$obj)
[Abstract] Initializes properties' values from an object.
addErrorMessage( $message)
Adds a message to the form's error message buffer.
[Abstract] Used for validating member property values of XCube_ActionForm.
Represents string property.