XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
CommentEditForm.class.php
1<?php
10
11if (!defined('XOOPS_ROOT_PATH')) {
12 exit();
13}
14
15require_once XOOPS_ROOT_PATH . '/core/XCube_ActionForm.class.php';
16
18{
19 public function getTokenName()
20 {
21 return 'module.legacy.Legacy_CommentEditForm.TOKEN';
22 }
23
24 public function prepare()
25 {
26 //
27 // Set form properties
28 //
29 $this->mFormProperties['com_id'] =new XCube_IntProperty('com_id');
30 $this->mFormProperties['com_pid'] =new XCube_IntProperty('com_pid');
31 $this->mFormProperties['com_rootid'] =new XCube_IntProperty('com_rootid');
32 $this->mFormProperties['com_modid'] =new XCube_IntProperty('com_modid');
33 $this->mFormProperties['com_itemid'] =new XCube_IntProperty('com_itemid');
34 $this->mFormProperties['com_icon'] =new XCube_StringProperty('com_icon');
35 $this->mFormProperties['com_created'] =new XCube_IntProperty('com_created');
36 $this->mFormProperties['com_modified'] =new XCube_IntProperty('com_modified');
37 $this->mFormProperties['com_ip'] =new XCube_StringProperty('com_ip');
38 $this->mFormProperties['com_title'] =new XCube_StringProperty('com_title');
39 $this->mFormProperties['com_text'] =new XCube_TextProperty('com_text');
40 $this->mFormProperties['com_sig'] =new XCube_BoolProperty('com_sig');
41 $this->mFormProperties['com_status'] =new XCube_IntProperty('com_status');
42 $this->mFormProperties['com_exparams'] =new XCube_StringProperty('com_exparams');
43 $this->mFormProperties['dosmiley'] =new XCube_BoolProperty('dosmiley');
44 $this->mFormProperties['doxcode'] =new XCube_BoolProperty('doxcode');
45 $this->mFormProperties['doimage'] =new XCube_BoolProperty('doimage');
46 $this->mFormProperties['dobr'] =new XCube_BoolProperty('dobr');
47
48 //
49 // Set field properties
50 //
51 $this->mFieldProperties['com_id'] =new XCube_FieldProperty($this);
52 $this->mFieldProperties['com_id']->setDependsByArray(['required']);
53 $this->mFieldProperties['com_id']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_ID);
54
55 $this->mFieldProperties['com_pid'] =new XCube_FieldProperty($this);
56 $this->mFieldProperties['com_pid']->setDependsByArray(['required']);
57 $this->mFieldProperties['com_pid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_PID);
58
59 $this->mFieldProperties['com_rootid'] =new XCube_FieldProperty($this);
60 $this->mFieldProperties['com_rootid']->setDependsByArray(['required']);
61 $this->mFieldProperties['com_rootid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_ROOTID);
62
63 $this->mFieldProperties['com_modid'] =new XCube_FieldProperty($this);
64 $this->mFieldProperties['com_modid']->setDependsByArray(['required']);
65 $this->mFieldProperties['com_modid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_MODID);
66
67 $this->mFieldProperties['com_itemid'] =new XCube_FieldProperty($this);
68 $this->mFieldProperties['com_itemid']->setDependsByArray(['required']);
69 $this->mFieldProperties['com_itemid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_ITEMID);
70
71 $this->mFieldProperties['com_icon'] =new XCube_FieldProperty($this);
72 $this->mFieldProperties['com_icon']->setDependsByArray(['required', 'maxlength']);
73 $this->mFieldProperties['com_icon']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_ICON, '25');
74 $this->mFieldProperties['com_icon']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _MD_LEGACY_LANG_COM_ICON, '25');
75 $this->mFieldProperties['com_icon']->addVar('maxlength', 25);
76
77 $this->mFieldProperties['com_ip'] =new XCube_FieldProperty($this);
78 $this->mFieldProperties['com_ip']->setDependsByArray(['required', 'maxlength']);
79 $this->mFieldProperties['com_ip']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_IP, '15');
80 $this->mFieldProperties['com_ip']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _MD_LEGACY_LANG_COM_IP, '15');
81 $this->mFieldProperties['com_ip']->addVar('maxlength', 15);
82
83 $this->mFieldProperties['com_title'] =new XCube_FieldProperty($this);
84 $this->mFieldProperties['com_title']->setDependsByArray(['required', 'maxlength']);
85 $this->mFieldProperties['com_title']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_TITLE, '191');
86 $this->mFieldProperties['com_title']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _MD_LEGACY_LANG_COM_TITLE, '191');
87 $this->mFieldProperties['com_title']->addVar('maxlength', 191);
88
89 $this->mFieldProperties['com_text'] =new XCube_FieldProperty($this);
90 $this->mFieldProperties['com_text']->setDependsByArray(['required']);
91 $this->mFieldProperties['com_text']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_TEXT);
92
93 $this->mFieldProperties['com_exparams'] =new XCube_FieldProperty($this);
94 $this->mFieldProperties['com_exparams']->setDependsByArray(['required', 'maxlength']);
95 $this->mFieldProperties['com_exparams']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_EXPARAMS, '191');
96 $this->mFieldProperties['com_exparams']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _MD_LEGACY_LANG_COM_EXPARAMS, '191');
97 $this->mFieldProperties['com_exparams']->addVar('maxlength', 191);
98 }
99
100 public function load(&$obj)
101 {
102 $this->set('com_id', $obj->get('com_id'));
103 $this->set('com_pid', $obj->get('com_pid'));
104 $this->set('com_rootid', $obj->get('com_rootid'));
105 $this->set('com_modid', $obj->get('com_modid'));
106 $this->set('com_itemid', $obj->get('com_itemid'));
107 $this->set('com_icon', $obj->get('com_icon'));
108 $this->set('com_created', $obj->get('com_created'));
109 $this->set('com_modified', $obj->get('com_modified'));
110 $this->set('com_ip', $obj->get('com_ip'));
111 $this->set('com_title', $obj->get('com_title'));
112 $this->set('com_text', $obj->get('com_text'));
113 $this->set('com_sig', $obj->get('com_sig'));
114 $this->set('com_status', $obj->get('com_status'));
115 $this->set('com_exparams', $obj->get('com_exparams'));
116 $this->set('dosmiley', $obj->get('dosmiley'));
117 $this->set('doxcode', $obj->get('doxcode'));
118 $this->set('doimage', $obj->get('doimage'));
119 $this->set('dobr', $obj->get('dobr'));
120 }
121
122 public function update(&$obj)
123 {
124 $obj->set('com_id', $this->get('com_id'));
125 $obj->set('com_pid', $this->get('com_pid'));
126 $obj->set('com_rootid', $this->get('com_rootid'));
127 $obj->set('com_modid', $this->get('com_modid'));
128 $obj->set('com_itemid', $this->get('com_itemid'));
129 $obj->set('com_icon', $this->get('com_icon'));
130 $obj->set('com_created', $this->get('com_created'));
131 $obj->set('com_modified', time());
132
133 //
134 // TODO check NONAME form
135 // $obj->set('com_uid', $this->get('com_uid'));
136
137 //
138 // TODO IP will be changed when a administrator will edit or a user will
139 // edit again.
140 //
141 $obj->set('com_ip', $_SERVER['REMOTE_ADDR']);
142 $obj->set('com_title', $this->get('com_title'));
143 $obj->set('com_text', $this->get('com_text'));
144 $obj->set('com_sig', $this->get('com_sig'));
145 $obj->set('com_status', $this->get('com_status'));
146 $obj->set('com_exparams', $this->get('com_exparams'));
147 $obj->set('dosmiley', $this->get('dosmiley'));
148 $obj->set('doxcode', $this->get('doxcode'));
149 $obj->set('doimage', $this->get('doimage'));
150 $obj->set('dobr', $this->get('dobr'));
151 }
152}
153
155{
156 public function prepare()
157 {
158 parent::prepare();
159
160 //
161 // Set form properties
162 //
163 $this->mFormProperties['dohtml'] =new XCube_BoolProperty('dohtml');
164 }
165
166 public function load(&$obj)
167 {
168 parent::load($obj);
169
170 $this->set('dohtml', $obj->get('dohtml'));
171 }
172
173 public function update(&$obj)
174 {
175 update::load($obj);
176
177 $obj->set('dohtml', $this->get('dohtml'));
178 }
179}
update(&$obj)
[Abstract] Updates an object with properties values.
prepare()
[Abstract] Set up form properties and field properties.
load(&$obj)
[Abstract] Initializes properties' values from an object.
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.
Represents bool property.
[Abstract] Used for validating member property values of XCube_ActionForm.
Represents int property.
Represents string property.
Represents string property which allows CR and LF.