XCL Web Application Platform
2.5.0
The XoopsCube Legacy Project
📘
Loading...
Searching...
No Matches
CustomBlockEditForm.class.php
1
<?php
11
12
if
(!defined(
'XOOPS_ROOT_PATH'
)) {
13
exit();
14
}
15
16
require_once XOOPS_ROOT_PATH .
'/core/XCube_ActionForm.class.php'
;
17
require_once XOOPS_MODULE_PATH .
'/legacy/class/Legacy_Validator.class.php'
;
18
require_once XOOPS_MODULE_PATH .
'/legacy/admin/forms/BlockEditForm.class.php'
;
19
20
class
Legacy_CustomBlockEditForm
extends
Legacy_BlockEditForm
21
{
22
public
function
getTokenName
()
23
{
24
return
'module.legacy.CustomBlockEditForm.TOKEN'
. $this->
get
(
'bid'
);
25
}
26
27
public
function
prepare
()
28
{
29
parent::prepare();
30
31
//
32
// Set form properties
33
//
34
$this->mFormProperties[
'content'
] =
new
XCube_TextProperty
(
'content'
);
35
$this->mFormProperties[
'c_type'
] =
new
XCube_StringProperty
(
'c_type'
);
36
37
//
38
// Set field properties
39
//
40
$this->mFieldProperties[
'content'
] =
new
XCube_FieldProperty
($this);
41
$this->mFieldProperties[
'content'
]->setDependsByArray([
'required'
]);
42
$this->mFieldProperties[
'content'
]->addMessage(
'required'
, _MD_LEGACY_ERROR_REQUIRED, _AD_LEGACY_LANG_CONTENT);
43
44
$this->mFieldProperties[
'c_type'
] =
new
XCube_FieldProperty
($this);
45
$this->mFieldProperties[
'c_type'
]->setDependsByArray([
'required'
,
'maxlength'
]);
46
$this->mFieldProperties[
'c_type'
]->addMessage(
'required'
, _MD_LEGACY_ERROR_REQUIRED, _AD_LEGACY_LANG_C_TYPE,
'1'
);
47
$this->mFieldProperties[
'c_type'
]->addMessage(
'maxlength'
, _MD_LEGACY_ERROR_MAXLENGTH, _AD_LEGACY_LANG_C_TYPE,
'1'
);
48
$this->mFieldProperties[
'c_type'
]->addVar(
'maxlength'
,
'1'
);
49
}
50
51
public
function
load
(&$obj)
52
{
53
parent::load($obj);
54
$this->
set
(
'content'
, $obj->get(
'content'
));
55
$this->
set
(
'c_type'
, $obj->get(
'c_type'
));
56
}
57
58
public
function
update
(&$obj)
59
{
60
parent::update($obj);
61
$obj->set(
'content'
, $this->
get
(
'content'
));
62
$obj->set(
'block_type'
,
'C'
);
63
$obj->set(
'c_type'
, $this->
get
(
'c_type'
));
64
$obj->set(
'visible'
, 1);
65
$obj->set(
'isactive'
, 1);
66
67
switch
($this->
get
(
'c_type'
)) {
68
case
'H'
:
69
$obj->set(
'name'
, _AD_LEGACY_LANG_CUSTOM_HTML);
70
break
;
71
72
case
'P'
:
73
$obj->set(
'name'
, _AD_LEGACY_LANG_CUSTOM_PHP);
74
break
;
75
76
case
'S'
:
77
$obj->set(
'name'
, _AD_LEGACY_LANG_CUSTOM_WITH_SMILIES);
78
break
;
79
80
case
'T'
:
81
$obj->set(
'name'
, _AD_LEGACY_LANG_CUSTOM_WITHOUT_SMILIES);
82
break
;
83
}
84
}
85
}
Legacy_BlockEditForm
Definition
BlockEditForm.class.php:20
Legacy_CustomBlockEditForm
Definition
CustomBlockEditForm.class.php:21
Legacy_CustomBlockEditForm\update
update(&$obj)
[Abstract] Updates an object with properties values.
Definition
CustomBlockEditForm.class.php:58
Legacy_CustomBlockEditForm\getTokenName
getTokenName()
Gets the token name of this actionform's token.
Definition
CustomBlockEditForm.class.php:22
Legacy_CustomBlockEditForm\prepare
prepare()
[Abstract] Set up form properties and field properties.
Definition
CustomBlockEditForm.class.php:27
Legacy_CustomBlockEditForm\load
load(&$obj)
[Abstract] Initializes properties' values from an object.
Definition
CustomBlockEditForm.class.php:51
XCube_FieldProperty
[Abstract] Used for validating member property values of XCube_ActionForm.
Definition
XCube_ActionForm.class.php:438
XCube_StringProperty
Represents string property.
Definition
XCube_Property.class.php:506
XCube_TextProperty
Represents string property which allows CR and LF.
Definition
XCube_Property.class.php:540
html
modules
legacy
admin
forms
CustomBlockEditForm.class.php
Generated by
1.13.2