XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
SmilesEditAction.class.php
1<?php
11
12if (!defined('XOOPS_ROOT_PATH')) {
13 exit();
14}
15
16require_once XOOPS_MODULE_PATH . '/legacy/class/AbstractEditAction.class.php';
17require_once XOOPS_MODULE_PATH . '/legacy/admin/forms/SmilesAdminEditForm.class.php';
18
20{
21 public function _getId()
22 {
23 return isset($_REQUEST['id']) ? xoops_getrequest('id') : 0;
24 }
25
26 public function &_getHandler()
27 {
28 $handler =& xoops_getmodulehandler('smiles');
29 return $handler;
30 }
31
32 public function _setupActionForm()
33 {
34 $this->mActionForm =new Legacy_SmilesAdminEditForm();
35 $this->mActionForm->prepare();
36 }
37
38
39 public function _doExecute()
40 {
41 if (null !== $this->mActionForm->mFormFile) {
42 if (!$this->mActionForm->mFormFile->saveAs(XOOPS_UPLOAD_PATH)) {
43 return false;
44 }
45 }
46
47 //
48 // Delete old file, if the file exists.
49 //
50 if (null !== $this->mActionForm->mOldFilename && 'blank.gif' != $this->mActionForm->mOldFilename) {
51 @unlink(XOOPS_UPLOAD_PATH . '/' . $this->mActionForm->mOldFilename);
52 }
53
54 return parent::_doExecute();
55 }
56
57 public function executeViewInput(&$controller, &$xoopsUser, &$render)
58 {
59 $render->setTemplateName('smiles_edit.html');
60 $render->setAttribute('actionForm', $this->mActionForm);
61 $render->setAttribute('object', $this->mObject);
62 }
63
64 public function executeViewSuccess(&$controller, &$xoopsUser, &$render)
65 {
66 $controller->executeForward('./index.php?action=SmilesList');
67 }
68
69 public function executeViewError(&$controller, &$xoopsUser, &$render)
70 {
71 $controller->executeRedirect('./index.php?action=SmilesList', 1, _MD_LEGACY_ERROR_DBUPDATE_FAILED);
72 }
73
74 public function executeViewCancel(&$controller, &$xoopsUser, &$render)
75 {
76 $controller->executeForward('./index.php?action=SmilesList');
77 }
78}