class_aLosp.inc.php
6.2 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?php
/**
* @file aLosp.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/>.
*
*/
// AbstractLospClass => aLosp
abstract class aLosp implements iLosp {
protected $DB;
protected $VirtualData;
protected $RequestProfileID;
public $ThisClassName;
public function __toString() {
if(is_subclass_of($this, 'BasisElement')) {
$var_string = "obj(".get_class($this)." ID[".$this->ID."]BEN[".$this->BasisElementNumber."])";
// } else if(is_subclass_of($this, 'iBasisElement')) {
// $var_string = "obj(".get_class($this)."";
// if(is_object($this->MText)) {
// $var_string .= " MTextID[".$this->MText->getObjVar('ID')."])";
// } else if (is_object($this->Obj)) {
// $var_string .= " MTextID[".$this->Obj->getObjVar('ID')."])";
// } else {
// $var_string .= " kein MText)";
// }
} else if(is_subclass_of($this, 'iBasisElementAddon')) {
$var_string = 'obj('.get_class($this).') - ';
if(property_exists($this,'BasisClipboard') && is_object($this->BasisClipboard)) {
$var_string .='[BC('.property_exists($this,'BasisClipboard').')';
$var_string .= 'PartOfID('.$this->BasisClipboard->getObjVar('PartOfID').')->'.get_class($this->BasisClipboard).'::'.$this->BasisClipboard->getObjVar('CategoryName');
$var_string .=']';
}
if(property_exists($this,'MText') && is_object($this->MText)) {
$var_string .= ' [BE('.property_exists($this,'MText').')';
$var_string .= 'ID('.$this->MText->getObjVar('ID').')';
$var_string .= ']';
}
} else if(is_subclass_of($this, 'BasisDesign')) {
$var_string = "obj(".$this->BEClassName." ".get_class($this)."['.$this->ID.']) ";
} else if(get_class($this)=== 'RightManagementBC') {
$var_string = "obj(".get_class($this)."['.$this->PartOfObj.']) ";
} else {
$var_string = "obj(".get_class($this)."['.$this->ID.']) komisch";
}
return $var_string;
}
/**
* return the Obj Var param_ObjVar
*
* @param string param_ObjVar
* @return
*/
public function &getObjVar($param_ObjVar) {
$ObjVar = trim($param_ObjVar);
return $this->$ObjVar;
}
public function setObjVar($param_ObjVar, $param_Value) {
// if(get_class($this)=='Category') {
// D::li($this."->setObjVar($param_ObjVar, ".count($param_Value).")");
// }
$ObjVar = trim($param_ObjVar);
if(!is_object($param_Value)){
$this->$ObjVar = Converter::decodeString($param_Value);
} else {
$this->$ObjVar = $param_Value;
}
}
/**
* return Value from Object Var Array
* @param string param_ObjVar Object Var
* @param string param_ObjVarArrayKey description
*/
public function getObjVarArrayValue($param_ObjVar, $param_ObjVarArrayKey) {
if(is_array($this->$param_ObjVar) && array_key_exists($param_ObjVarArrayKey, $this->$param_ObjVar)) {
return $this->$param_ObjVar[$param_ObjVarArrayKey];
} else {
return false;
}
}
/**
* set Value in Object Var Array
* @param array param_ObjVar array( ObjVar => ArrayKey) -> self::ObjVar[ArrayKey]
*/
public function setObjVarArrayValue($param_ObjVar, $param_ObjVarArrayKey, $param_Value) {
if(is_array($this->$param_ObjVar)) {
$this->$param_ObjVar[$param_ObjVarArrayKey] = $param_Value;
}
}
/**
* lädt das Objekt aus der Datenbank
*
*
* @param param_Parameter zusätzliche Parameter
*
* @return object wenn erfolgreich || false wenn fehlgeschlagen
*/
public function loadObject(Account &$param_HostAccount, iStorable &$param_iStorable, $param_Parameter=null){
$this->RequestProfileID = $param_HostAccount->getActiveProfileID();
if($param_iStorable->loadObject($this, $param_HostAccount, $param_Parameter)) {
return $this;
} else {
return false;
}
}
public function saveObject(Account &$param_HostAccount, iStorable &$param_iStorable) {
$param_iStorable->saveObject($this, $param_HostAccount);
return $param_iStorable->loadObject($this, $param_HostAccount);
}
public function setVirtualData(array $param_VirtualData) {
foreach($param_VirtualData as $CallbackFunctionName => $Data) {
$this->VirtualData[$CallbackFunctionName] = $Data['result'];
}
}
/**
* @todo funktion sollte überflüssig sein, da Converter::decodeString nix macht ausser param zurückgeben!!!??? 100615
*/
public function setData(Account &$param_HostAccount, iStorable &$param_iStorable, array $param_Data) {
if($param_Data!=null) {
$keys = array_keys($param_Data);
$count_i = count($param_Data);
for($i=0; $i<$count_i; $i++) {
if(property_exists($this, $keys[$i])) {
if(!is_object($param_Data[$keys[$i]])){
$this->$keys[$i] = Converter::decodeString($param_Data[$keys[$i]]);
} else {
$this->$keys[$i] = $param_Data[$keys[$i]];
}
}
}
return true;
} else {
return false;
}
}
public function getObjDOMElement(Account &$param_HostAccount, iStorable &$param_iStorable, DOMDocument $param_DOMDocument, $param_KindOf=null, array $param_DOMElemente=null) {
if(is_subclass_of($this, 'BasisElement')) {
$DOMElement = $param_DOMDocument->createElement('BasisElement');
} else {
$DOMElement = $param_DOMDocument->createElement(get_class($this));
}
$DOMElement->setAttribute('class', get_class($this));
$DOMElement->setAttribute('label', Language::getWord(get_class($this)));
if($param_KindOf=='form') {
$DOMElement->setAttribute('edit', 'true');
}
if(is_array($this->VirtualData)) {
return DOMElementHelper::arrayToXml($param_DOMDocument, $this->VirtualData, $DOMElement);
} else {
return $DOMElement;
}
// return $DOMElement;
}
}
?>