XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
settingsAction.class.php
1<?php
12
13if (!defined('XOOPS_ROOT_PATH')) {
14 exit();
15}
16
17require _MY_MODULE_PATH.'forms/MessageSettingsForm.class.php';
18
20{
21 private \MessageSettingsForm $mActionForm;
22 private $mService;
23
24 public function __construct()
25 {
26 parent::__construct();
27 $this->mActionForm = new MessageSettingsForm();
28 $this->mActionForm->prepare();
29 }
30
31 public function execute()
32 {
33 $modHand = xoops_getmodulehandler('settings', _MY_DIRNAME);
34 $modObj = $modHand->get($this->root->mContext->mXoopsUser->get('uid'));
35 if (!is_object($modObj)) {
36 $modObj = $modHand->create();
37 }
38 $this->mActionForm->load($modObj);
39 if ('POST' == $_SERVER['REQUEST_METHOD']) {
40 $this->mActionForm->fetch();
41 $this->mActionForm->validate();
42 if ($this->mActionForm->hasError()) {
43 $this->setErr($this->mActionForm->getErrorMessages());
44 } else {
45 $this->setUrl('index.php?action=settings');
46 $this->mActionForm->update($modObj);
47 if (!$modHand->insert($modObj)) {
48 $this->setErr(_MD_MESSAGE_SETTINGS_MSG4);
49 } else {
50 $this->setErr(_MD_MESSAGE_SETTINGS_MSG3);
51 }
52 }
53 }
54 // service UserSearch
55 $this->mService = $this->root->mServiceManager->getService('UserSearch');
56 }
57
58 public function executeView(&$render)
59 {
60 $render->setTemplateName('message_settings.html');
61 $render->setAttribute('mActionForm', $this->mActionForm);
62 $render->setAttribute('purgedays', $this->root->mContext->mModuleConfig['savedays']);
63 $render->setAttribute('purgetype', $this->root->mContext->mModuleConfig['dletype']);
64 $render->setAttribute('UserSearch', $this->mService);
65 $render->setAttribute('message_url', XOOPS_URL.'/modules/message/index.php');
66 }
67}