1: <?php
2: 3: 4: 5: 6:
7:
8: if (!defined('XOOPS_ROOT_PATH')) exit();
9:
10: require_once XOOPS_MODULE_PATH . "/profile/class/AbstractEditAction.class.php";
11:
12: class Profile_DataEditAction extends Profile_AbstractEditAction
13: {
14: var $mFields = array();
15: var $mOptions = array();
16:
17: 18: 19:
20: function _getId()
21: {
22: if($this->mRoot->mContext->mXoopsUser){
23: return $this->mRoot->mContext->mXoopsUser->get('uid');
24: }
25: else{
26: $this->mRoot->mController->executeRedirect(XOOPS_URL ."/user.php", 1, _MD_PROFILE_ERROR_REGISTER_REQUIRED);
27: }
28: }
29:
30: 31: 32:
33: function &_getHandler()
34: {
35: $handler =& $this->mAsset->load('handler', "data");
36: return $handler;
37: }
38:
39: 40: 41:
42: function _setupActionForm()
43: {
44:
45: $this->mActionForm =& $this->mAsset->create('form', "edit_data");
46: $this->mActionForm->prepare();
47: }
48:
49: 50: 51:
52: function prepare()
53: {
54: parent::prepare();
55: $this->mObject->set('uid', $this->_getId());
56:
57: $defHandler =& xoops_getmodulehandler('definitions');
58: $this->mFields =& $defHandler->getFields4DataEdit();
59: }
60:
61: 62: 63:
64: function executeViewInput(&$render)
65: {
66: $render->setTemplateName("profile_data_edit.html");
67: $render->setAttribute('actionForm', $this->mActionForm);
68: $render->setAttribute('object', $this->mObject);
69: $render->setAttribute('fields', $this->mFields);
70: $headerScript = $this->mRoot->mContext->getAttribute('headerScript');
71: $headerScript->addScript('$(".datepicker").each(function(){$(this).datepicker({dateFormat: "'._JSDATEPICKSTRING.'"});});');
72: }
73:
74: 75: 76:
77: function executeViewSuccess(&$render)
78: {
79: $this->mRoot->mController->executeForward("./index.php?action=DataList");
80: }
81:
82: 83: 84:
85: function executeViewError(&$render)
86: {
87: $this->mRoot->mController->executeRedirect("./index.php?action=DataList", 1, _MD_PROFILE_ERROR_DBUPDATE_FAILED);
88: }
89:
90: 91: 92:
93: function executeViewCancel(&$render)
94: {
95: $this->mRoot->mController->executeForward("./index.php?action=DataList");
96: }
97: }
98:
99: ?>
100: