XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
TplsetCloneAction.class.php
1<?php
6
7if (!defined('XOOPS_ROOT_PATH')) {
8 exit();
9}
10
11require_once XOOPS_MODULE_PATH . '/legacyRender/admin/actions/TplsetEditAction.class.php';
12require_once XOOPS_MODULE_PATH . '/legacyRender/admin/forms/TplsetCloneForm.class.php';
13
15{
16 public $mCloneObject = null;
17
18 public function _setupObject()
19 {
20 parent::_setupObject();
21 $this->mCloneObject =& $this->mObjectHandler->create();
22 }
23
24 public function _setupActionForm()
25 {
26 $this->mActionForm =new LegacyRender_TplsetCloneForm();
27 $this->mActionForm->prepare();
28 }
29
30 public function isAllowDefault()
31 {
32 return true;
33 }
34
35 public function execute(&$controller, &$xoopsUser)
36 {
37 if (null == $this->mObject) {
38 return LEGACYRENDER_FRAME_VIEW_ERROR;
39 }
40
41 if (null != xoops_getrequest('_form_control_cancel')) {
42 return LEGACYRENDER_FRAME_VIEW_CANCEL;
43 }
44
45 //
46 // If image is no, the data has to continue to keep his value.
47 //
48 $this->mActionForm->load($this->mCloneObject);
49
50 $this->mActionForm->fetch();
51 $this->mActionForm->validate();
52
53 if ($this->mActionForm->hasError()) {
54 return LEGACYRENDER_FRAME_VIEW_INPUT;
55 }
56
57 $this->mActionForm->update($this->mCloneObject);
58
59 return $this->mObjectHandler->insertClone($this->mObject, $this->mCloneObject) ? LEGACYRENDER_FRAME_VIEW_SUCCESS
60 : LEGACYRENDER_FRAME_VIEW_ERROR;
61 }
62
63 public function executeViewInput(&$controller, &$xoopsUser, &$render)
64 {
65 $render->setTemplateName('tplset_clone.html');
66 $render->setAttribute('actionForm', $this->mActionForm);
67 $render->setAttribute('object', $this->mObject);
68 }
69
70 public function executeViewSuccess(&$controller, &$xoopsUser, &$render)
71 {
72 $controller->executeForward('./index.php?action=TplsetList');
73 }
74
75 public function executeViewError(&$controller, &$xoopsUser, &$render)
76 {
77 $controller->executeRedirect('./index.php?action=TplsetList', 1, _AD_LEGACYRENDER_ERROR_DBUPDATE_FAILED);
78 }
79
80 public function executeViewCancel(&$controller, &$xoopsUser, &$render)
81 {
82 $controller->executeForward('./index.php?action=TplsetList');
83 }
84}