1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Wgevents; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
You may not change or alter any portion of this comment or credits |
7
|
|
|
of supporting developers from this source code or any supporting source code |
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
9
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful, |
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* wgEvents module for xoops |
17
|
|
|
* |
18
|
|
|
* @copyright 2021 XOOPS Project (https://xoops.org) |
19
|
|
|
* @license GPL 2.0 or later |
20
|
|
|
* @package wgevents |
21
|
|
|
* @since 1.0.0 |
22
|
|
|
* @min_xoops 2.5.11 Beta1 |
23
|
|
|
* @author Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
use XoopsModules\Wgevents; |
27
|
|
|
|
28
|
|
|
\defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Class Object Log |
32
|
|
|
*/ |
33
|
|
|
class Log extends \XoopsObject |
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* @var int |
37
|
|
|
*/ |
38
|
|
|
public $start = 0; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var int |
42
|
|
|
*/ |
43
|
|
|
public $limit = 0; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Constructor |
47
|
|
|
* |
48
|
|
|
*/ |
49
|
|
|
public function __construct() |
50
|
|
|
{ |
51
|
|
|
$this->initVar('id', \XOBJ_DTYPE_INT); |
52
|
|
|
$this->initVar('text', \XOBJ_DTYPE_TXTBOX); |
53
|
|
|
$this->initVar('datecreated', \XOBJ_DTYPE_INT); |
54
|
|
|
$this->initVar('submitter', \XOBJ_DTYPE_INT); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @static function &getInstance |
59
|
|
|
* |
60
|
|
|
*/ |
61
|
|
|
public static function getInstance() |
62
|
|
|
{ |
63
|
|
|
static $instance = false; |
64
|
|
|
if (!$instance) { |
65
|
|
|
$instance = new self(); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* The new inserted $Id |
71
|
|
|
* @return inserted id |
|
|
|
|
72
|
|
|
*/ |
73
|
|
|
public function getNewInsertedId() |
74
|
|
|
{ |
75
|
|
|
return $GLOBALS['xoopsDB']->getInsertId(); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @public function getForm |
80
|
|
|
* @param bool $action |
81
|
|
|
* @return \XoopsThemeForm |
82
|
|
|
*/ |
83
|
|
|
public function getForm($action = false) |
84
|
|
|
{ |
85
|
|
|
$helper = \XoopsModules\Wgevents\Helper::getInstance(); |
|
|
|
|
86
|
|
|
if (!$action) { |
87
|
|
|
$action = $_SERVER['REQUEST_URI']; |
88
|
|
|
} |
89
|
|
|
$isAdmin = (\is_object($GLOBALS['xoopsUser']) && \is_object($GLOBALS['xoopsModule'])) ? $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()) : false; |
|
|
|
|
90
|
|
|
// Title |
91
|
|
|
$title = $this->isNew() ? \_AM_WGEVENTS_ADD_LOG : \_AM_WGEVENTS_EDIT_LOG; |
92
|
|
|
// Get Theme Form |
93
|
|
|
\xoops_load('XoopsFormLoader'); |
94
|
|
|
$form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
95
|
|
|
$form->setExtra('enctype="multipart/form-data"'); |
96
|
|
|
// Form Text logText |
97
|
|
|
$form->addElement(new \XoopsFormText(\_AM_WGEVENTS_LOG_TEXT, 'text', 50, 255, $this->getVar('text')), true); |
|
|
|
|
98
|
|
|
// Form Text Date Select logDatecreated |
99
|
|
|
$logDatecreated = $this->isNew() ? \time() : $this->getVar('datecreated'); |
100
|
|
|
$form->addElement(new \XoopsFormTextDateSelect(\_MA_WGEVENTS_DATECREATED, 'datecreated', '', $logDatecreated)); |
|
|
|
|
101
|
|
|
// Form Select User logSubmitter |
102
|
|
|
$uidCurrent = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0; |
103
|
|
|
$logSubmitter = $this->isNew() ? $uidCurrent : $this->getVar('submitter'); |
104
|
|
|
$form->addElement(new \XoopsFormSelectUser(\_MA_WGEVENTS_SUBMITTER, 'submitter', false, $logSubmitter)); |
105
|
|
|
// To Save |
106
|
|
|
$form->addElement(new \XoopsFormHidden('op', 'save')); |
107
|
|
|
$form->addElement(new \XoopsFormHidden('start', $this->start)); |
108
|
|
|
$form->addElement(new \XoopsFormHidden('limit', $this->limit)); |
109
|
|
|
$form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)); |
110
|
|
|
return $form; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Get Values |
115
|
|
|
* @param null $keys |
|
|
|
|
116
|
|
|
* @param null $format |
|
|
|
|
117
|
|
|
* @param null $maxDepth |
|
|
|
|
118
|
|
|
* @return array |
119
|
|
|
*/ |
120
|
|
|
public function getValuesLogs($keys = null, $format = null, $maxDepth = null) |
121
|
|
|
{ |
122
|
|
|
$ret = $this->getValues($keys, $format, $maxDepth); |
123
|
|
|
$ret['datecreated_text'] = \formatTimestamp($this->getVar('datecreated'), 'm'); |
124
|
|
|
$ret['submitter_text'] = \XoopsUser::getUnameFromId($this->getVar('submitter')); |
125
|
|
|
return $ret; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Returns an array representation of the object |
130
|
|
|
* |
131
|
|
|
* @return array |
132
|
|
|
*/ |
133
|
|
|
/* |
134
|
|
|
public function toArray() |
135
|
|
|
{ |
136
|
|
|
$ret = []; |
137
|
|
|
$vars = $this->getVars(); |
138
|
|
|
foreach (\array_keys($vars) as $var) { |
139
|
|
|
$ret[$var] = $this->getVar($var); |
140
|
|
|
} |
141
|
|
|
return $ret; |
142
|
|
|
} |
143
|
|
|
*/ |
144
|
|
|
} |
145
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths