|
1
|
|
|
<?php namespace XoopsModules\Tdmcreate\Files\User; |
|
2
|
|
|
|
|
3
|
|
|
use XoopsModules\Tdmcreate; |
|
4
|
|
|
use XoopsModules\Tdmcreate\Files; |
|
5
|
|
|
|
|
6
|
|
|
/* |
|
7
|
|
|
You may not change or alter any portion of this comment or credits |
|
8
|
|
|
of supporting developers from this source code or any supporting source code |
|
9
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
10
|
|
|
|
|
11
|
|
|
This program is distributed in the hope that it will be useful, |
|
12
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
14
|
|
|
*/ |
|
15
|
|
|
/** |
|
16
|
|
|
* tdmcreate module. |
|
17
|
|
|
* |
|
18
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
|
19
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
|
20
|
|
|
* |
|
21
|
|
|
* @since 2.5.0 |
|
22
|
|
|
* |
|
23
|
|
|
* @author Txmod Xoops http://www.txmodxoops.org |
|
24
|
|
|
* |
|
25
|
|
|
* @version $Id: UserVisit.php 12258 2014-01-02 09:33:29Z timgno \$ |
|
26
|
|
|
*/ |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Class UserVisit. |
|
30
|
|
|
*/ |
|
31
|
|
|
class UserVisit extends Files\CreateFile |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* @var mixed |
|
35
|
|
|
*/ |
|
36
|
|
|
private $uc = null; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var string |
|
40
|
|
|
*/ |
|
41
|
|
|
private $xc = null; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @public function constructor |
|
45
|
|
|
* @param null |
|
46
|
|
|
*/ |
|
47
|
|
|
|
|
48
|
|
|
public function __construct() |
|
49
|
|
|
{ |
|
50
|
|
|
parent::__construct(); |
|
51
|
|
|
$this->xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); |
|
|
|
|
|
|
52
|
|
|
$this->phpcode = Tdmcreate\Files\CreatePhpCode::getInstance(); |
|
|
|
|
|
|
53
|
|
|
$this->uc = UserXoopsCode::getInstance(); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @static function getInstance |
|
58
|
|
|
* @param null |
|
59
|
|
|
* @return UserVisit |
|
60
|
|
|
*/ |
|
61
|
|
|
public static function getInstance() |
|
62
|
|
|
{ |
|
63
|
|
|
static $instance = false; |
|
64
|
|
|
if (!$instance) { |
|
65
|
|
|
$instance = new self(); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
return $instance; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @public function write |
|
73
|
|
|
* @param string $module |
|
74
|
|
|
* @param mixed $table |
|
75
|
|
|
* @param string $filename |
|
76
|
|
|
*/ |
|
77
|
|
|
public function write($module, $table, $filename) |
|
78
|
|
|
{ |
|
79
|
|
|
$this->setModule($module); |
|
80
|
|
|
$this->setTable($table); |
|
81
|
|
|
$this->setFileName($filename); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @private function getUserVisitHeader |
|
86
|
|
|
* |
|
87
|
|
|
* @param $table |
|
88
|
|
|
* |
|
89
|
|
|
* @param $fields |
|
90
|
|
|
* @return string |
|
91
|
|
|
*/ |
|
92
|
|
|
private function getUserVisitHeader($table, $fields) |
|
93
|
|
|
{ |
|
94
|
|
|
$ret = $this->getInclude(); |
|
95
|
|
|
foreach (array_keys($fields) as $f) { |
|
96
|
|
|
$fieldName = $fields[$f]->getVar('field_name'); |
|
97
|
|
|
if (0 == $f) { |
|
98
|
|
|
$fieldId = $fieldName; |
|
99
|
|
|
} |
|
100
|
|
|
if (1 == $fields[$f]->getVar('field_parent')) { |
|
101
|
|
|
$fieldPid = $fieldName; |
|
102
|
|
|
} |
|
103
|
|
|
} |
|
104
|
|
|
if (1 == $table->getVar('table_category')) { |
|
105
|
|
|
$ccFieldPid = $this->getCamelCase($fieldPid, false, true); |
|
|
|
|
|
|
106
|
|
|
$ret .= $this->xc->getXcXoopsRequest($ccFieldPid, (string)$fieldPid, '0', 'Int'); |
|
107
|
|
|
} |
|
108
|
|
|
$ccFieldId = $this->getCamelCase($fieldId, false, true); |
|
|
|
|
|
|
109
|
|
|
$ret .= $this->xc->getXcXoopsRequest($ccFieldId, (string)$fieldId, '0', 'Int'); |
|
110
|
|
|
|
|
111
|
|
|
return $ret; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @private function getUserVisitCheckPermissions |
|
116
|
|
|
* |
|
117
|
|
|
* @param null |
|
118
|
|
|
* |
|
119
|
|
|
* @return string |
|
120
|
|
|
*/ |
|
121
|
|
|
private function getUserVisitCheckPermissions() |
|
122
|
|
|
{ |
|
123
|
|
|
$ret = ''; |
|
124
|
|
|
|
|
125
|
|
|
return $ret; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @private function getUserVisitCheckLimit |
|
130
|
|
|
* |
|
131
|
|
|
* @param null |
|
132
|
|
|
* |
|
133
|
|
|
* @return string |
|
134
|
|
|
*/ |
|
135
|
|
|
private function getUserVisitCheckLimit() |
|
136
|
|
|
{ |
|
137
|
|
|
$ret = ''; |
|
138
|
|
|
|
|
139
|
|
|
return $ret; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* @private function getUserVisitCheckHost |
|
144
|
|
|
* |
|
145
|
|
|
* @param null |
|
146
|
|
|
* |
|
147
|
|
|
* @return string |
|
148
|
|
|
*/ |
|
149
|
|
|
private function getUserVisitCheckHost() |
|
150
|
|
|
{ |
|
151
|
|
|
$ret = ''; |
|
152
|
|
|
|
|
153
|
|
|
return $ret; |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
/** |
|
157
|
|
|
* @public function render |
|
158
|
|
|
* @param null |
|
159
|
|
|
* @return bool|string |
|
160
|
|
|
*/ |
|
161
|
|
|
public function render() |
|
162
|
|
|
{ |
|
163
|
|
|
$module = $this->getModule(); |
|
164
|
|
|
$table = $this->getTable(); |
|
165
|
|
|
$filename = $this->getFileName(); |
|
166
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
|
167
|
|
|
$tableId = $table->getVar('table_id'); |
|
168
|
|
|
$tableMid = $table->getVar('table_mid'); |
|
169
|
|
|
$tableName = $table->getVar('table_name'); |
|
|
|
|
|
|
170
|
|
|
$tableSoleName = $table->getVar('table_solename'); |
|
|
|
|
|
|
171
|
|
|
$fields = $this->getTableFields($tableMid, $tableId); |
|
172
|
|
|
$language = $this->getLanguage($moduleDirname, 'MA'); |
|
|
|
|
|
|
173
|
|
|
$content = $this->getHeaderFilesComments($module, $filename); |
|
174
|
|
|
$content .= $this->getUserVisitHeader($table, $fields); |
|
175
|
|
|
$content .= $this->getUserVisitCheckPermissions(); |
|
176
|
|
|
$content .= $this->getUserVisitCheckLimit(); |
|
177
|
|
|
$content .= $this->getUserVisitCheckHost(); |
|
178
|
|
|
|
|
179
|
|
|
$this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); |
|
180
|
|
|
|
|
181
|
|
|
return $this->renderFile(); |
|
182
|
|
|
} |
|
183
|
|
|
} |
|
184
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..