XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
TplfileCloneAction.class.php
1<?php
7
8if (!defined('XOOPS_ROOT_PATH')) {
9 exit();
10}
11
12require_once XOOPS_MODULE_PATH . '/legacyRender/class/AbstractEditAction.class.php';
13require_once XOOPS_MODULE_PATH . '/legacyRender/admin/forms/TplfileCloneForm.class.php';
14
16{
17 public $mTargetObject = null;
18
19 public function _getId()
20 {
21 return xoops_getrequest('tpl_id');
22 }
23
24 public function &_getHandler()
25 {
26 $handler =& xoops_getmodulehandler('tplfile');
27 return $handler;
28 }
29
30 public function _setupObject()
31 {
32 $id = $this->_getId();
33
34 $this->mObjectHandler =& $this->_getHandler();
35 $obj =& $this->mObjectHandler->get($id);
36
37 //
38 // The following code uses 'tpl_tplset' directly. This input value will
39 // be checked by ActionForm.
40 //
41 if (is_object($obj) && 'default' == $obj->get('tpl_tplset')) {
42 $this->mObject =& $obj->createClone(xoops_getrequest('tpl_tplset'));
43 }
44 }
45
46 public function isEnableCreate()
47 {
48 return false;
49 }
50
51 public function _setupActionForm()
52 {
53 $this->mActionForm =new LegacyRender_TplfileCloneForm();
54 $this->mActionForm->prepare();
55 }
56
57 public function executeViewInput(&$controller, &$xoopsUser, &$render)
58 {
59 $render->setTemplateName('tplfile_clone.html');
60 $render->setAttribute('actionForm', $this->mActionForm);
61 $render->setAttribute('object', $this->mObject);
62 $render->setAttribute('tpl_id', xoops_getrequest('tpl_id'));
63 }
64
65 public function executeViewSuccess(&$controller, &$xoopsUser, &$render)
66 {
67 $tplset = $this->mObject->get('tpl_tplset');
68 $module = $this->mObject->get('tpl_module');
69 $controller->executeForward("./index.php?action=TplfileList&tpl_tplset={$tplset}&tpl_module={$module}");
70 }
71
72 public function executeViewError(&$controller, &$xoopsUser, &$render)
73 {
74 $controller->executeRedirect('./index.php?action=TplsetList', 1, _AD_LEGACYRENDER_ERROR_DBUPDATE_FAILED);
75 }
76}