XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
DataEditAction.class.php
1<?php
9
10if (!defined('XOOPS_ROOT_PATH')) {
11 exit();
12}
13
14require_once XOOPS_MODULE_PATH . '/profile/class/AbstractEditAction.class.php';
15
17{
18 public $mFields = [];
19 public $mOptions = [];
20
24 public function _getId()
25 {
26 if ($this->mRoot->mContext->mXoopsUser) {
27 return $this->mRoot->mContext->mXoopsUser->get('uid');
28 } else {
29 $this->mRoot->mController->executeRedirect(XOOPS_URL . '/user.php', 1, _MD_PROFILE_ERROR_REGISTER_REQUIRED);
30 }
31 }
32
36 public function &_getHandler()
37 {
38 $handler =& $this->mAsset->load('handler', 'data');
39 return $handler;
40 }
41
45 public function _setupActionForm()
46 {
47 // $this->mActionForm =new Profile_DataEditForm();
48 $this->mActionForm =& $this->mAsset->create('form', 'edit_data');
49 $this->mActionForm->prepare();
50 }
51
55 public function prepare()
56 {
57 parent::prepare();
58 $this->mObject->set('uid', $this->_getId());
59
60 $defHandler =& xoops_getmodulehandler('definitions');
61 $this->mFields =& $defHandler->getFields4DataEdit();
62 }
63
68 public function executeViewInput(&$render)
69 {
70 $render->setTemplateName('profile_data_edit.html');
71 $render->setAttribute('actionForm', $this->mActionForm);
72 $render->setAttribute('object', $this->mObject);
73 $render->setAttribute('fields', $this->mFields);
74 $headerScript = $this->mRoot->mContext->getAttribute('headerScript');
75 $headerScript->addScript('$(".datepicker").each(function(){$(this).datepicker({dateFormat: "'._JSDATEPICKSTRING.'"});});');
76 }
77
82 public function executeViewSuccess(&$render)
83 {
84 $this->mRoot->mController->executeForward('./index.php?action=DataList');
85 }
86
91 public function executeViewError(&$render)
92 {
93 $this->mRoot->mController->executeRedirect('./index.php?action=DataList', 1, _MD_PROFILE_ERROR_DBUPDATE_FAILED);
94 }
95
100 public function executeViewCancel(&$render)
101 {
102 $this->mRoot->mController->executeForward('./index.php?action=DataList');
103 }
104}