XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
ModuleListForm.class.php
1<?php
11
12if (!defined('XOOPS_ROOT_PATH')) {
13 exit();
14}
15
16require_once XOOPS_ROOT_PATH . '/core/XCube_ActionForm.class.php';
17
19{
20 /***
21 * If the request is GET, never return token name.
22 * By this logic, an action can have three pages in one action.
23 */
24 public function getTokenName()
25 {
26 if ('POST' == $_SERVER['REQUEST_METHOD']) {
27 return 'module.legacy.ModuleSettingsForm.TOKEN';
28 } else {
29 return null;
30 }
31 }
32
33 /***
34 * For displaying the confirm-page, don't show CSRF error.
35 * Always return null.
36 */
37 public function getTokenErrorMessage()
38 {
39 return null;
40 }
41
42 public function prepare()
43 {
44 // set properties
45 $this->mFormProperties['name']=new XCube_StringArrayProperty('name');
46 $this->mFormProperties['weight']=new XCube_IntArrayProperty('weight');
47 $this->mFormProperties['isactive']=new XCube_BoolArrayProperty('isactive');
48
49 // set fields
50 $this->mFieldProperties['name']=new XCube_FieldProperty($this);
51 $this->mFieldProperties['name']->setDependsByArray(['required', 'maxlength']);
52 $this->mFieldProperties['name']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _AD_LEGACY_LANG_NAME, '140');
53 $this->mFieldProperties['name']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _AD_LEGACY_LANG_NAME, '140');
54 $this->mFieldProperties['name']->addVar('maxlength', 140);
55
56 $this->mFieldProperties['weight']=new XCube_FieldProperty($this);
57 $this->mFieldProperties['weight']->setDependsByArray(['required', 'min']);
58 $this->mFieldProperties['weight']->addMessage('min', _AD_LEGACY_ERROR_MIN, _AD_LEGACY_LANG_WEIGHT, '0');
59 $this->mFieldProperties['weight']->addVar('min', 0);
60 }
61}
getTokenName()
Gets the token name of this actionform's token.
prepare()
[Abstract] Set up form properties and field properties.
getTokenErrorMessage()
Gets a message about the failure of the token validation.
Represents bool[] property. XCube_GenericArrayProperty<XCube_BoolProperty>.
[Abstract] Used for validating member property values of XCube_ActionForm.
Represents int[] property. XCube_GenericArrayProperty<XCube_IntProperty>.
Represents string[] property. XCube_GenericArrayProperty<XCube_StringProperty>.