1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: if (!defined('XOOPS_ROOT_PATH')) exit();
12:
13: require_once XOOPS_ROOT_PATH . "/core/XCube_ActionForm.class.php";
14: require_once XOOPS_MODULE_PATH . "/legacy/class/Legacy_Validator.class.php";
15: require_once XOOPS_MODULE_PATH . "/legacy/admin/forms/BlockEditForm.class.php";
16:
17: class Legacy_CustomBlockEditForm extends Legacy_BlockEditForm
18: {
19: function getTokenName()
20: {
21: return "module.legacy.CustomBlockEditForm.TOKEN" . $this->get('bid');
22: }
23:
24: function prepare()
25: {
26: parent::prepare();
27:
28:
29:
30:
31: $this->mFormProperties['content'] =new XCube_TextProperty('content');
32: $this->mFormProperties['c_type'] =new XCube_StringProperty('c_type');
33:
34:
35:
36:
37: $this->mFieldProperties['content'] =new XCube_FieldProperty($this);
38: $this->mFieldProperties['content']->setDependsByArray(array('required'));
39: $this->mFieldProperties['content']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _AD_LEGACY_LANG_CONTENT);
40:
41: $this->mFieldProperties['c_type'] =new XCube_FieldProperty($this);
42: $this->mFieldProperties['c_type']->setDependsByArray(array('required','maxlength'));
43: $this->mFieldProperties['c_type']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _AD_LEGACY_LANG_C_TYPE, '1');
44: $this->mFieldProperties['c_type']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _AD_LEGACY_LANG_C_TYPE, '1');
45: $this->mFieldProperties['c_type']->addVar('maxlength', '1');
46: }
47:
48: function load(&$obj)
49: {
50: parent::load($obj);
51: $this->set('content', $obj->get('content'));
52: $this->set('c_type', $obj->get('c_type'));
53: }
54:
55: function update(&$obj)
56: {
57: parent::update($obj);
58: $obj->set('content', $this->get('content'));
59: $obj->set('block_type', 'C');
60: $obj->set('c_type', $this->get('c_type'));
61: $obj->set('visible', 1);
62: $obj->set('isactive', 1);
63:
64: switch ($this->get('c_type')) {
65: case 'H':
66: $obj->set('name', _AD_LEGACY_LANG_CUSTOM_HTML);
67: break;
68:
69: case 'P':
70: $obj->set('name', _AD_LEGACY_LANG_CUSTOM_PHP);
71: break;
72:
73: case 'S':
74: $obj->set('name', _AD_LEGACY_LANG_CUSTOM_WITH_SMILIES);
75: break;
76:
77: case 'T':
78: $obj->set('name', _AD_LEGACY_LANG_CUSTOM_WITHOUT_SMILIES);
79: break;
80: }
81: }
82: }
83:
84: ?>
85: