XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
DefinitionsEditAction.class.php
1<?php
10
11if (!defined('XOOPS_ROOT_PATH')) {
12 exit();
13}
14
15require_once XOOPS_MODULE_PATH . '/profile/class/AbstractEditAction.class.php';
16
18{
19 public array $mTypeArr = [];
20 public array $mValidationArr = [];
21
25 public function _getId()
26 {
27 return (int)xoops_getrequest('field_id');
28 }
29
33 public function &_getHandler()
34 {
35 $handler =& $this->mAsset->load('handler', 'definitions');
36 return $handler;
37 }
38
42 public function _setupActionForm()
43 {
44 // $this->mActionForm =new Profile_Admin_DefinitionsEditForm();
45 $this->mActionForm =& $this->mAsset->create('form', 'admin.edit_definitions');
46 $this->mActionForm->prepare();
47 }
48
56 protected function _setHeaderScript()
57 {
58 $headerScript = $this->mRoot->mContext->getAttribute('headerScript');
59 $type = $this->mActionForm->get('type');
60 $headerScript->addStylesheet('/modules/profile/style.css');
61 $headerScript->addScript('
62 $(".optionField input, .optionField select, .optionField textarea").attr("disabled", "disabled");
63 $(".optionField").addClass("hideOption");
64 $("#fieldtype_'. $type .'").removeClass("hideOption");
65 $("#fieldtype_'. $type .' input, #fieldtype_'. $type .' select, #fieldtype_'. $type .' textarea").removeAttr("disabled");
66 $("#legacy_xoopsform_type").change(function(){
67 $(".optionField").addClass("hideOption");
68 $("#fieldtype_"+$(this).val()).removeClass("hideOption");
69 $("#fieldtype_"+$(this).val()+" input, #fieldtype_"+$(this).val()+" select, #fieldtype_"+$(this).val()+" textarea").removeAttr("disabled");
70});'
71 );
72 }
73
77 public function prepare()
78 {
79 parent::prepare();
80 $handler =& $this->_getHandler();
81 $this->mTypeArr = $handler->getTypeList();
82 $this->mValidationArr = $handler->getValidationList();
83 }
84
89 public function executeViewInput(&$render)
90 {
91 $gHandler =& xoops_gethandler('group');
92
93 $render->setTemplateName('definitions_edit.html');
94 $render->setAttribute('actionForm', $this->mActionForm);
95 $render->setAttribute('object', $this->mObject);
96 $render->setAttribute('groupArr', $gHandler->getObjects());
97 $render->setAttribute('accessArr', explode(',', $this->mObject->get('access')));
98 $render->setAttribute('typeArr', $this->mTypeArr);
99 $render->setAttribute('validationArr', $this->mValidationArr);
100 $this->_setHeaderScript();
101 }
102
108 public function executeViewSuccess(&$controller, &$render)
109 {
110 $this->mRoot->mController->executeForward('./index.php?action=DefinitionsList');
111 }
112
117 public function executeViewError(&$render)
118 {
119 $this->mRoot->mController->executeRedirect('./index.php?action=DefinitionsList', 1, _MD_PROFILE_ERROR_DBUPDATE_FAILED);
120 }
121
126 public function executeViewCancel(&$render)
127 {
128 $this->mRoot->mController->executeForward('./index.php?action=DefinitionsList');
129 }
130}