class_InfoboxBEADB.inc.php
6.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
* @file class_InfoboxBEADB.inc.php
* @category freeSN
* @mailto code [at] netz.coop
* @version 0.4.200901
* @link http://netz.coop
*
* @copyright Copyright by netz.coop e.G. 2015
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class InfoboxBEADB extends aBasisElementAddonDataBase {
protected function loadObjectLight(Account &$param_HostAccount, iStorable &$param_iStorable, aBasisElementAddon & $param_Object, $param_Parameter=null) {
}
protected function loadObjectFull(Account &$param_HostAccount, iStorable &$param_iStorable, aBasisElementAddon & $param_Object, $param_Parameter=null) {
if(is_subclass_of($param_Object->getObjVar('Obj'), 'BasisElement')) {
$param_Object->setObjVar('BEInfoData', self::getBEInfoData($param_iStorable->getObjVar('SRequest'), $param_Object->getObjVar('Obj')));
$param_Object->setObjVar('BEHistory', self::getBEHistory($param_iStorable, $param_Object->getObjVar('Obj')));
$param_Object->setObjVar('BELastEdits', self::getBELastEdits($param_iStorable, $param_Object->getObjVar('Obj')));
$var_InfoboxConfig = CONFIG::getAddonPreferencs('Infobox', 'Config');
/**
* load the last BasisElement objects which was add on this BasisElement (not from the CONFIG Special NoInfo BasisClipboards)
*/
{
$var_ConditionArray= array(
'direction' => 'desc',
'column' => 'CDate',
'limit' =>'5',
);
if(is_array($var_InfoboxConfig) && array_key_exists('Special', $var_InfoboxConfig) && array_key_exists('NoInfo', $var_InfoboxConfig['Special'])) {
$var_ConditionArray['secConditionArrays'] = array();
foreach($var_InfoboxConfig['Special']['NoInfo'] as $var_NoBC => $var_null) {
$FncVar_BasisClipboardnameArray = CONFIG::transformStringToArray($var_NoBC, 'category');
$var_ConditionArray['secConditionArrays'][] = array(
'column' => array('PartOfObjVar',),
'operator' => '!=',
'from' => array($FncVar_BasisClipboardnameArray[0], ),
'nexus' => 'AND',
);
if( array_key_exists(1, $FncVar_BasisClipboardnameArray) && $FncVar_BasisClipboardnameArray[1]) {
$var_count = count($var_ConditionArray['secConditionArrays'])-1;
$var_ConditionArray['secConditionArrays'][$var_count]['column'][] = 'CategoryName';
$var_ConditionArray['secConditionArrays'][$var_count]['from'][] = $FncVar_BasisClipboardnameArray[1];
$var_ConditionArray['secConditionArrays'][$var_count]['innerNexus'] = 'AND';
}
}
}
$var_LastBasisElementBC = &BasisClipboard::load($param_HostAccount, $param_iStorable, 'LinkList::SPECIAL:NoPartOfVar', $param_Object->getObjVar('Obj')->getObjVar('ID'), $param_State=null, $var_ConditionArray, $param_PartOfBasisClipboard=false);
$param_Object->setObjVar('LastBasisElementBC',$var_LastBasisElementBC);
}
/**
* load this last BasisElement Objects which was linked from this profil
*/
if($param_Object->getObjVar('Obj')->getObjVar('ThisClassName') =='Profile' ){
$var_ConditionArray['secConditionArrays'][] = array(
'column' => 'LinkerProfileID',
'operator' => '=',
'from' => $param_Object->getObjVar('Obj')->getObjVar('ID'),
'nexus' => 'AND',
);
$var_ConditionArray['secConditionArrays'][] = array(
'column' => 'PartOfID',
'operator' => '!=',
'from' => $param_Object->getObjVar('Obj')->getObjVar('ID'),
'nexus' => 'AND',
);
$var_LastLinkerBC= &BasisClipboard::load($param_HostAccount, $param_iStorable, 'LinkList::SPECIAL:NoPartOfVar:NoPartOfID', $param_Object->getObjVar('Obj')->getObjVar('ID'), $param_State=null, $var_ConditionArray, $param_PartOfBasisClipboard=false);
$param_Object->setObjVar('LastLinkerBC',$var_LastLinkerBC);
}
} else if (is_subclass_of($param_Object->getObjVar('Obj'), 'BasisClipboard')) {
}
}
public function saveObject(Account &$param_HostAccount, iStorable &$param_iStorable, aBasisElementAddon & $param_Object) {
}
private static function getBEInfoData(iBasicSql &$param_DB, BasisElement &$param_Object){
$var_query = 'select * from losp_BE_SREQUEST_visited where MTextID=\''.$param_Object->getObjVar('ID').'\'';
$var_result = array();
$Resource = $param_DB->PDO_query($var_query);
foreach($param_DB->PDO_fetchAll($Resource) as $row) {
$var_result[] = $row;
}
return $var_result;
}
private static function getBELastEdits(iBasicSql &$param_DB, BasisElement &$param_Object) {
$var_query = 'select * from losp_BE_SREQUEST_history where MTextID=\''.$param_Object->getObjVar('ID').'\' and Action=\'Edit\' order by CDate desc limit 5';
$var_result = array();
$Resource = $param_DB->getObjVar('SRequest')->PDO_query($var_query);
foreach($param_DB->getObjVar('SRequest')->PDO_fetchAll($Resource) as $row) {
if(array_key_exists('ProfileID',$row)){
$row['NickName']=Profile::IDToNickName($param_DB, $row['ProfileID']);
}
$var_result[] = $row;
}
return $var_result;
}
private static function getBEHistory(iBasicSql &$param_DB, BasisElement &$param_Object) {
// $var_query = 'select * from losp_BE_SREQUEST_history where MTextID=\''.$param_Object->getObjVar('ID').'\' order by CDate desc limit 10;';
$var_query = 'select ProfileID, MTextID, Action, max(NumberOfAction) as NumberOfAction, Url, CDate from losp_BE_SREQUEST_history where MTextID=\''.$param_Object->getObjVar('ID').'\' group by Action, ProfileID order by CDate desc limit 10';
$var_result = array();
$Resource = $param_DB->getObjVar('SRequest')->PDO_query($var_query);
foreach($param_DB->getObjVar('SRequest')->PDO_fetchAll($Resource) as $row) {
if(array_key_exists('ProfileID',$row)){
$row['NickName']=Profile::IDToNickName($param_DB, $row['ProfileID']);
}
$var_result[] = $row;
}
return $var_result;
}
}
?>