class_mcPUIX.inc.php
4.39 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
<?php
class mcPUIX extends mcClass {
const DBUIConfig = 'DBUIConfig';
const PDOValues = 'PDOValues';
const PDOToSaveValues = 'PDOToSaveValues';
const DOMmcPUIX = 'mcPUIX';
const DOMRow = 'DBUIRow';
const DOMList = 'DBUIList';
const DOMElement = 'DBUIElement';
const DOMValues = 'DOMValues';
##
// DBUIArray evt überprüfen
const DBUIArray = 'DBUIArray';
// const FORMValues = 'DBUIFormValues'; mcPUIX::FORM_DO_ROW
const FORM_DO_ROW = 'FORM_DO_ROW'; // mcPUIX::FORM_DO_ROW
const FORM_DO_SAVE = 'FORM_DO_SAVE'; // mcPUIX::FORM_DO_SAVE
const FORM_DO_DELETE = 'FORM_DO_DELETE'; // mcPUIX::FORM_DO_DELETE
const FORM_DO_NEW = 'FORM_DO_NEW'; // mcPUIX::FORM_DO_NEW
const FORM_DO_SELECT = 'FORM_DO_SELECT'; // mcPUIX::FORM_DO_SELECT
const FORM_TYPE_SEOLINK = 'FORM_TYPE_SEOLINK';
const STATE_LOADED = 'loaded';
const STATE_CHANGED = 'changed';
const STATE_SAVED = 'saved';
private $DBTab_State = array();
/**
*
* @var array('tablename' => array(mcPUIX::DBUIArray => array()))
*/
private $DBTab = array();
/**
*
* @var aBasisElementAddon
*/
protected $BasisElementAddon = null;
public function __construct(aBasisElementAddon $BasisElementAddon) {
$this->mcID = mcObjectStatistic::getCount__construct($this);
$this->BasisElementAddon = $BasisElementAddon;
}
private function setTableValues($param_tablename, $param_tablevalues) {
$this->DBTab[$param_tablename] = $param_tablevalues;
}
public function getTableValues($param_tablename) {
return $this->DBTab[$param_tablename];
}
public function loadPDOTable(Account &$param_HostAccount, iStorable &$param_iStorable, $param_tablename, $param_SQLWhere='', $param_depth=0) {
$DBTable = mcPUIX_PDO::getTableAsDBUIArray($param_HostAccount, $param_iStorable, $param_tablename, $param_SQLWhere, $param_depth);
// D::show($DBTable, '$DBTable '.$this->BasisElementAddon);
$this->setTableValues($param_tablename, $DBTable);
$this->DBTab_State[$param_tablename] = mcPUIX::STATE_LOADED;
}
public function setData($param_tablename, $param_values) {
D::ulli(__CLASS__.'::'.__FUNCTION__.': ' . $param_tablename.' ## '.mcPUIX::STATE_CHANGED);
$this->setTableValues($param_tablename, $param_values);
$this->DBTab_State[$param_tablename] = mcPUIX::STATE_CHANGED;
}
public function savePDOTable(Account &$param_HostAccount, iStorable &$param_iStorable, $param_tablename) {
$DBUIArray_Values = $this->getTableValues($param_tablename);
// D::show($this->DBTab , '$this->DBTab');
$ManipulateTableConfig = null;
$DBUIConfig = mcPUIX_CONFIG::getTableConfig($param_tablename, $ManipulateTableConfig);
// D::show($DBUIConfig, '$DBUIConfig');
if(mcArray::checkKeyHasFullArray($DBUIConfig, mcPUIX::DBUIArray, mcPUIX::DBUIConfig, $param_tablename, 'TABLE', 'LIST_TABLE', 'TABLENAME')) {
$Tablename_LIST = mcPUIX_CONFIG::getReferenceTableName($param_tablename);
$ManipulateTableConfig = null;
$DBUIConfig_LIST = mcPUIX_CONFIG::getTableConfig($Tablename_LIST, $ManipulateTableConfig);
$DBUIConfig[mcPUIX::DBUIArray][mcPUIX::DBUIConfig][$Tablename_LIST] = $DBUIConfig_LIST[mcPUIX::DBUIArray][mcPUIX::DBUIConfig][$Tablename_LIST];
}
$PreparedArray = mcPUIX_PDO::prepareArrayForDBOperation($param_tablename, $DBUIConfig, $DBUIArray_Values);
// D::show($PreparedArray, '$PreparedArray = mcPUIX_PDO::prepareArrayForDBOperation');
$DBUIArrayNew = mcPUIX_PDO::updateDatabaseTable($param_HostAccount, $param_iStorable, $DBUIConfig, $PreparedArray);
$this->setTableValues($param_tablename, $DBUIArrayNew);
$this->DBTab_State[$param_tablename] = mcPUIX::STATE_SAVED;
}
public function getObjDOMElement(Account &$param_HostAccount, iStorable &$param_iStorable, DOMDocument $param_DOMDocument, $param_KindOf=null, array $param_DOMElemente=null) {
$DOMElement = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX);
$DOMElement->setAttribute('class', get_class($this));
$DOMElement->setAttribute('label', Language::getWord(get_class($this)));
if($param_KindOf=='form') {
$DOMElement->setAttribute('edit', true);
}
return $DOMElement;
}
protected static $unsetCONFIG = true;
public static function setmcPUIX_CONFIG(array $param_Configs) {
if(mcPUIX::$unsetCONFIG) {
foreach($param_Configs as $tablename => $values) {
// D::show($values, $tablename);
mcPUIX_CONFIG::setTableConfig($tablename, $values);
}
mcPUIX::$unsetCONFIG = false;
}
}
protected static $Tables = array ();
}
?>