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