Commit 1d210739 by Frederick d. Maus

local - not interesting

1 parent bc356bfb
......@@ -83,8 +83,8 @@ class D {
if(trim($param_string)) {
if($param_htmlentities)
$param_string=htmlentities($param_string);
// if($param_htmlentities)
// $param_string=htmlentities($param_string);
self::$echo_lines[self::$echo_count] = array(
'line' => $param_string,
'print' => $param_print,
......
......@@ -94,3 +94,11 @@ class mcErrorEvent extends mcEvent {
mcErrorEvent::$count++;
}
}
class mcXSLErrorEvent extends mcEvent {
public static $count =0;
public static function handle($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext) {
self::add(new mcXSLErrorEvent($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext));
mcXSLErrorEvent::$count++;
}
}
\ No newline at end of file
......@@ -10,6 +10,11 @@
*/
function mcErrorHandler($param_typ, $param_notice, $param_file, $param_row, $param_More) {
if(strpos($param_notice, 'XSLTProcessor') !== false) {
mcXSLErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
} else {
switch ($param_typ) {
case E_ERROR: // 1
mcErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
......@@ -67,6 +72,10 @@ function mcErrorHandler($param_typ, $param_notice, $param_file, $param_row, $par
D::ulli('Datei: '.$param_file);
D::ulli('Zeile: '.$param_row);
}
}
// return FALSE;
......
......@@ -88,7 +88,8 @@ class mcArray {
*/
public static function checkKeyHasFullArray($param_Array, $param_key, $param_key2=null, $param_key3=null, $param_key4=null, $param_key5=null, $param_key6=null) {
if(is_array($param_Array)) {
if(array_key_exists($param_key, $param_Array)
if( (is_string($param_key) || is_integer($param_key))
&& array_key_exists($param_key, $param_Array)
&& is_array($param_Array[$param_key])
&& !empty($param_Array[$param_key])
) {
......
......@@ -7,8 +7,14 @@ if(!isset($_LOSP_DEV)) {
* @var boolean -- activate the dev modus
*/
$_LOSP_DEV = true;
}
}
if($_LOSP_DEV) {
$__THIS_SCRIPT_INFO = pathinfo($_SERVER['SCRIPT_FILENAME']);
// echo $__THIS_SCRIPT_INFO['filename'];
}
/**
* @todo @since 20110325 die vars müssen eigentlich hier aus __mc raus ... da sie freeSN abhängig sind @author f@mensch.coop
*/
......@@ -24,7 +30,7 @@ if(!isset($__mc_D_LOGFILE)) {
/**
* @var string -- file for the D Output
*/
$__mc_D_LOGFILE = $__BASEPATH_EX.'log/mc.'.$string.'.DEV_D.log';
$__mc_D_LOGFILE = $__BASEPATH_EX.'log/mc.'.$__THIS_SCRIPT_INFO['filename'].'.'.$string.'.DEV_D.log';
if(!isset($__mc_D_LOGFILE_RESET)) {
/**
......@@ -48,7 +54,7 @@ if(!isset($__mc_INPUT_LOGFILE)) {
/**
* @var string -- file for the D Output
*/
$__mc_INPUT_LOGFILE = $__BASEPATH_EX.'log/mc.'.$string.'.DEV_INPUT.log';
$__mc_INPUT_LOGFILE = $__BASEPATH_EX.'log/mc.'.$__THIS_SCRIPT_INFO['filename'].'.'.$string.'.DEV_INPUT.log';
if(!isset($__mc_INPUT_LOGFILE_RESET)) {
/**
......@@ -64,7 +70,7 @@ if(!isset($__mc_PDO_LOGFILE)) {
/**
* @var string -- file for the D Output
*/
$__mc_PDO_LOGFILE = $__BASEPATH_EX.'log/mc.'.$string.'.DEV_PDO.sql';
$__mc_PDO_LOGFILE = $__BASEPATH_EX.'log/mc.'.$__THIS_SCRIPT_INFO['filename'].'.'.$string.'.DEV_PDO.sql';
if(!isset($__mc_PDO_LOGFILE_RESET)) {
/**
......@@ -110,12 +116,24 @@ if(!isset($__mc_Report)) {
$__mc_Report = array(
'mcNoticeEvent' => array(
'toScreen' => array(),
'toFile' => array('file' => 'log/NoticeEvent.log')
'toFile' => array('file' => 'log/NoticeEvent.'.$__THIS_SCRIPT_INFO['filename'].'.log')
),
'mcErrorEvent' => array(
'toScreen' => array(),
'toFile' => array(
'file' => 'log/ErrorEvent.log',
'file' => 'log/ErrorEvent.'.$__THIS_SCRIPT_INFO['filename'].'.log',
'writemode' => 'a',
'reset' => false,
),
// 'toMail' => array(
// 'mail' => 'mail@localhost.tld',
// 'subject' => 'Error:'
// )
),
'mcXSLErrorEvent' => array(
'toScreen' => array(),
'toFile' => array(
'file' => 'log/XSLErrorEvent.'.$__THIS_SCRIPT_INFO['filename'].'.log',
'writemode' => 'a',
'reset' => false,
),
......@@ -127,7 +145,7 @@ if(!isset($__mc_Report)) {
'mcException' => array(
'toScreen' => array(),
'toFile' => array(
'file' => 'log/Exception.log',
'file' => 'log/Exception.'.$__THIS_SCRIPT_INFO['filename'].'.log',
'writemode' => 'a',
'reset' => false,
),
......@@ -139,7 +157,7 @@ if(!isset($__mc_Report)) {
'Error' => array(
'toScreen' => array('text' => 'ERROR Error ERROR Error ERROR'),
'toFile' => array(
'file' => 'log/Error.config.log',
'file' => 'log/Error.'.$__THIS_SCRIPT_INFO['filename'].'.config.log',
'writemode' => 'a',
'reset' => false,
),
......
......@@ -80,7 +80,9 @@ if($_LOSP_DEV) {
foreach($Report as $kindofDistribute => $params) {
if($kindofDistribute == 'toFile') {
if(array_key_exists('reset', $params) && $params['reset']) {
unlink ( $params['file'] );
if(is_file($params['file'])) {
unlink($params['file']);
}
mcFile::write($params['file'], $var_message, 'w');
}
}
......
......@@ -40,26 +40,27 @@ class Converter{
* @return string
*/
public static function encodeString($param_string, $param_encode = true){
if(is_string($param_string)) {
// $param_string = strip_tags($param_string);
// $param_string = htmlentities($param_string, 1,"UTF-8");
// $param_string = trim($param_string);
$param_string = stripslashes($param_string);
// D::show($param_string,"encode",1);
if($param_encode){
$param_string = htmlspecialchars($param_string, 2,"UTF-8");
}
} else {
D::li('$param_string has to be string and is '. gettype($param_string));
}
// if(!is_numeric($param_string)){
// $param_string = "'" . mysql_real_escape_string($param_string) . "'";
// }
if($param_encode){
return htmlspecialchars($param_string, 2,"UTF-8");
}
else{
return $param_string;
}
}
public static function StringToUrl($param_Url) {
return htmlentities($param_Url);
......
......@@ -3,22 +3,37 @@ interface imcPUIX {
public function getDOMElement_edit(Account &$param_HostAccount, iStorable &$param_iStorable, DOMDocument $param_DOMDocument, DOMElement &$param_DOMElement, $param_KindOf=null, array $param_DOMElemente=null);
public function getDOMElement_show(Account &$param_HostAccount, iStorable &$param_iStorable, DOMDocument $param_DOMDocument, DOMElement &$param_DOMElement, $param_KindOf=null, array $param_DOMElemente=null);
public function manipulatePost_Data(Account &$param_HostAccount, iStorable &$param_iStorable, array &$param_Data);
public function getDOMElement_editSpecial(Account &$param_HostAccount, iStorable &$param_iStorable, DOMDocument $param_DOMDocument, DOMElement &$param_DOMElement, $param_KindOf=null, array $param_DOMElemente=null);
public function setRootTable();
}
abstract class mcPUIX extends mcClass implements imcPUIX {
const DBUIConfig = 'DBUIConfig';
const PUIX_SUB_REFERENCELIST = 'PUIX_SUB_REFERENCELIST'; // mcPUIX::PUIX_SUB_REFERENCELIST
const PUIX_SUB_REFERENCELIST = 'PUIX_SUB_REFERENCELIST';
const PDOValues = 'PDOValues';
const PDOToSaveValues = 'PDOToSaveValues';
const PDO_OR = 'OR';
const PDO_AND = 'AND';
const PDO_XOR = 'XOR';
const PDO_NEW = 'PDO_NEW';
const PDO_NEWID = 'PDO_NEWID';
const PDO_Operator = 'PDO_Operator';
const PDO_Special = 'PDO_Special';
const PDO_Operand = 'PDO_Operand';
const PDO_bindValueArray = 'PDO_bindValueArray';
const PDOLoadDepth = 'PDOLoadDepth';
const PDOLoadDepth_OnlyNew = 'PDOLoadDepth_OnlyNew';
const ERRORMESSAGE ='ERRORMESSAGE';
const DOMmcPUIX = 'mcPUIX';
const DOMmcPUIX_edit = 'DOMmcPUIX_edit';
const DOMmcPUIX_edit_special = 'DOMmcPUIX_edit_special';
const DOMmcPUIX_show = 'DOMmcPUIX_show';
const DOMRow = 'DBUIRow';
const DOMList = 'DBUIList';
......@@ -87,40 +102,38 @@ abstract class mcPUIX extends mcClass implements imcPUIX {
return $this->DBTab[$param_tablename];
}
public function loadPDOTable(Account &$param_HostAccount, iStorable &$param_iStorable, $param_SQLWhere='', $param_depth=null) {
$param_tablename = $this->RootTable;
if($param_SQLWhere==='' && !is_null($this->SearchAttributes)) {
$param_SQLWhere = ' where ';
$bool_AND = false;
foreach($this->SearchAttributes as $col => $val) {
if($col === mcPUIX::PDOLoadDepth) {
$param_depth = $val;
}
else if($col !== mcPUIX::PUIX_SUB_REFERENCELIST) {
if($bool_AND) {
$param_SQLWhere .= ' AND ';
} else {
$bool_AND = true;
}
$param_SQLWhere .= ' '.$col.'="'.$val.'" ';
}
$DBTable = mcPUIX_PDO::getTableAsDBUIArray($param_HostAccount, $param_iStorable, $this->RootTable, $this->SearchAttributes, $param_SQLWhere, $param_depth);
if(is_array($DBTable)) {
// D::show($DBTable, '$DBTable');
$this->setTableValues($this->RootTable, $DBTable);
$this->DBTab_State[$this->RootTable] = mcPUIX::STATE_LOADED;
}
}
if(is_null($param_depth)) {
$param_depth = 0;
}
$DBTable = mcPUIX_PDO::getTableAsDBUIArray($param_HostAccount, $param_iStorable, $param_tablename, $param_SQLWhere, $param_depth);
// D::show($DBTable, '$DBTable '.$this->PUIXHostObject);
$this->setTableValues($param_tablename, $DBTable);
$this->DBTab_State[$param_tablename] = mcPUIX::STATE_LOADED;
public function __toString() {
$var_string = parent::__toString();
$var_string .= '-['.$this->PUIXHostObject.']';
return $var_string;
}
public function setData(Account &$param_HostAccount, iStorable &$param_iStorable, $param_values) {
/**
*
* @param Account $param_HostAccount
* @param iStorable $param_iStorable
* @param array $param_values -- array(
* get_class($this->PUIXHostObject) => array( // not necessary if $this->PUIXHostObject not exists
* get_class($this) => array(
* mcPUIX::PUIXArray => array(
* mcPUIX::FORM_POST_VALUES => array()
* )
* )
* )
* )
* @return boolean
*/
public function setData(Account &$param_HostAccount, iStorable &$param_iStorable, array $param_values) {
$param_tablename = $this->RootTable;
D::ulli(__CLASS__.'::'.__FUNCTION__.': ' . $param_tablename.' ## '.mcPUIX::STATE_CHANGED);
if(is_object($this->PUIXHostObject)) {
if(mcArray::checkKeyHasFullArray($param_values, get_class($this->PUIXHostObject))) {
......@@ -142,6 +155,7 @@ abstract class mcPUIX extends mcClass implements imcPUIX {
}
public function savePDOTable(Account &$param_HostAccount, iStorable &$param_iStorable) {
D::cf(get_class($this).' '.$this->RootTable);
$param_tablename = $this->RootTable;
$DBUIArray_Values = $this->getTableValues($param_tablename);
......@@ -187,13 +201,17 @@ abstract class mcPUIX extends mcClass implements imcPUIX {
$DOMElement->setAttribute('class', get_class($this));
$DOMElement->setAttribute('label', Language::getWord(get_class($this)));
if($param_KindOf=='form') {
if($param_KindOf==='form') {
$DOMElement_edit = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX_edit);
$DOMElement_edit->setAttribute('edit', true);
$DOMElement_edit->setAttribute('formpath', $this->getFormPathToThis());
$DOMElement->appendChild($DOMElement_edit);
$this->getDOMElement_edit($param_HostAccount, $param_iStorable, $param_DOMDocument, $DOMElement_edit, $param_KindOf, $param_DOMElemente);
$DOMElement_edit_special = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX_edit_special);
$this->getDOMElement_editSpecial($param_HostAccount, $param_iStorable, $param_DOMDocument, $DOMElement_edit_special, $param_KindOf, $param_DOMElemente);
$DOMElement_edit->appendChild($DOMElement_edit_special);
}
$DOMElement_show = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX_show);
......@@ -218,7 +236,7 @@ abstract class mcPUIX extends mcClass implements imcPUIX {
public function walk_ListElements(Account &$param_HostAccount, iStorable &$param_iStorable, $param_tablename, array $param_callbackfncForList=null, array $param_callbackfncForListElements=null) {
if(mcArray::checkKeyHasFullArray($this->DBTab, $param_tablename, mcPUIX::PUIXArray, mcPUIX::PDOValues) ) {
//D::show($this->DBTab[$param_tablename][mcPUIX::PUIXArray][mcPUIX::PDOValues], $this);
$callbackfncForList = false;
if(is_array($param_callbackfncForList) && !empty ($param_callbackfncForList)) {
$callbackfncForList = true;
......
......@@ -7,7 +7,7 @@ class mcPUIX_DOM {
self::$double[] = $param_key;
return false;
} else {
D::cf('dobule key: '.$param_key);
// D::cf('dobule key: '.$param_key);
return true;
}
}
......@@ -33,6 +33,9 @@ class mcPUIX_DOM {
*/
public static function prepareArrayForDOMElement($param_tablename, array $param_ConfigArray, array $param_ValueArray=null, $param_formpath=null, array $param_SetDefault=null) {
// D::show(array($param_ConfigArray, $param_ValueArray ) ,$param_tablename);
$copy_ValueArray = $param_ValueArray;
if(mcArray::checkKeyHasFullArray($param_ConfigArray, mcPUIX::PUIXArray, mcPUIX::DBUIConfig, $param_tablename)) {
if(mcArray::checkKeyHasFullArray($param_ValueArray, mcPUIX::PUIXArray, mcPUIX::PDOValues)) {
/**
......@@ -91,15 +94,30 @@ class mcPUIX_DOM {
);
if(mcArray::checkKeyHasFullArray($value_row, mcPUIX::PUIXArray, mcPUIX::PDOValues)) {
$ReferenceValues = array(mcPUIX::PUIXArray => array(mcPUIX::PDOValues => $value_row[mcPUIX::PUIXArray][mcPUIX::PDOValues]));
$ReferenceValues = array(
mcPUIX::PUIXArray => array(
mcPUIX::PDOValues => $value_row[mcPUIX::PUIXArray][mcPUIX::PDOValues]
)
);
if(mcArray::checkKeyHasFullArray($value_row[mcPUIX::PUIXArray], mcPUIX::PDO_Special)) {
$ReferenceValues[mcPUIX::PUIXArray][mcPUIX::PDO_Special] = $value_row[mcPUIX::PUIXArray][mcPUIX::PDO_Special];
}
$Reference_DOMValues = mcPUIX_DOM::prepareArrayForDOMElement($Reference_TableName, $Reference_Config, $ReferenceValues, $Reference_formpath, $Reference_SetDefault);
// $value_row[mcPUIX::PUIXArray][mcPUIX::DOMValues] = $Reference_DOMValues[mcPUIX::PUIXArray][mcPUIX::DOMValues];
unset($value_row[mcPUIX::PUIXArray]);
} else {
$Reference_DOMValues = mcPUIX_DOM::prepareArrayForDOMElement($Reference_TableName, $Reference_Config, null, $Reference_formpath, $Reference_SetDefault);
if(mcArray::checkKeyHasFullArray($value_row, mcPUIX::PUIXArray, mcPUIX::PDO_Special)) {
$ReferenceValues = array(
mcPUIX::PUIXArray => array(
mcPUIX::PDO_Special => $value_row[mcPUIX::PUIXArray][mcPUIX::PDO_Special]
)
);
} else {
$ReferenceValues = null;
}
$Reference_DOMValues = mcPUIX_DOM::prepareArrayForDOMElement($Reference_TableName, $Reference_Config, $ReferenceValues, $Reference_formpath, $Reference_SetDefault);
}
if(array_key_exists($row_key, $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename])) {
$row_val = $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename][$row_key];
......@@ -193,46 +211,33 @@ class mcPUIX_DOM {
&& array_key_exists(mcPUIX::FORM_NEW_ROW, $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename]['TABLE'])
&& $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename]['TABLE'][mcPUIX::FORM_NEW_ROW]
) {
$BOOL_NEW_ROW=true;
if(mcArray::checkKeyHasFullArray($copy_ValueArray, mcPUIX::PUIXArray, mcPUIX::PDO_Special)) {
if(mcArray::checkKeyHasFullArray($copy_ValueArray[mcPUIX::PUIXArray][mcPUIX::PDO_Special], mcPUIX::PDO_NEW)) {
if($copy_ValueArray[mcPUIX::PUIXArray][mcPUIX::PDO_Special][mcPUIX::PDO_NEW][mcPUIX::PDO_Operator] === mcPUIX::PDO_XOR) {
if(mcArray::checkKeyHasFullArray($return, mcPUIX::PUIXArray, mcPUIX::DOMValues)) {
$BOOL_NEW_ROW = false;
}
} else if($copy_ValueArray[mcPUIX::PUIXArray][mcPUIX::PDO_Special][mcPUIX::PDO_NEW][mcPUIX::PDO_Operator] === mcPUIX::PDO_OR) {
} else if($copy_ValueArray[mcPUIX::PUIXArray][mcPUIX::PDO_Special][mcPUIX::PDO_NEW][mcPUIX::PDO_Operator] === mcPUIX::PDO_AND) {
if(!mcArray::checkKeyHasFullArray($return, mcPUIX::PUIXArray, mcPUIX::DOMValues)) {
$BOOL_NEW_ROW = false;
}
}
}
}
if($BOOL_NEW_ROW) {
$return_NEW_ROW = mcPUIX_DOM::prepareArrayNEWROWForDOMElement($param_tablename, $param_ConfigArray, $param_formpath, $param_SetDefault);
// D::show($return_NEW_ROW, '$return_NEW_ROW');
$return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW] = $return_NEW_ROW[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW];
}
}
// $return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW] = $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename];
// $formpath = $param_formpath.'['.mcPUIX::FORM_NEW_ROW.']';
// foreach($return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW] as $NEW_key => &$NEW_values) {
// if(array_key_exists('type', $NEW_values) && $NEW_values['type'] === mcPUIX::PUIXArray) {
// unset($return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW][$NEW_key]);
// }
//
// if(array_key_exists('edit', $NEW_values) && $NEW_values['edit']) {
// $NEW_values['formpath'] = $formpath.'['.$NEW_key.']';
// if(self::checkDouble($NEW_values['formpath'])) {
// D::show($NEW_values, '$NEW_values');
// }
// }
// /**
// * copy default values into mcPUIX::FORM_NEW_ROW
// */
// if(is_array($param_SetDefault)) {
// if(mcArray::checkKeyHasFullArray($param_SetDefault, $NEW_key)) {
// $NEW_values = array_merge ( $NEW_values, $param_SetDefault[$NEW_key]);
// }
// }
// }
// if($param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename]['TABLE']['ELEMENTID']) {
// if($param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename]['TABLE']['KINDOF'] === 'LIST') {
// unset($return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW][$param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename]['TABLE']['ELEMENTID']]);
//
// } else if($param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename]['TABLE']['KINDOF'] === 'RELATION') {
//
// }
//
// }
//
// $return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW][mcPUIX::FORM_DO_ROW]['value'] = mcPUIX::FORM_DO_NEW;
}
// D::show($return, '$return');
return $return;
}
return false;
......@@ -254,7 +259,7 @@ class mcPUIX_DOM {
$return = array(mcPUIX::PUIXArray => array(mcPUIX::DOMValues => array()));
$return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW] = $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename];
$formpath = $param_formpath.'['.mcPUIX::FORM_NEW_ROW.']';
$formpath = $param_formpath.'['.mcPUIX::FORM_NEW_ROW.'][0]';
foreach($return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW] as $NEW_key => &$NEW_values) {
if(array_key_exists('type', $NEW_values) && $NEW_values['type'] === mcPUIX::PUIXArray) {
unset($return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW][$NEW_key]);
......@@ -263,7 +268,8 @@ class mcPUIX_DOM {
if(array_key_exists('edit', $NEW_values) && $NEW_values['edit']) {
$NEW_values['formpath'] = $formpath.'['.$NEW_key.']';
if(self::checkDouble($NEW_values['formpath'])) {
D::show($NEW_values, 'self::checkDouble $NEW_values');
// D::show($NEW_values, 'self::checkDouble $NEW_values');
// D::cf('self::checkDouble $NEW_values');
}
}
/**
......@@ -285,8 +291,12 @@ class mcPUIX_DOM {
}
unset($return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW][mcPUIX::FORM_DO_ROW]['values']);
$return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW][mcPUIX::FORM_DO_ROW]['values'] = array(
mcPUIX::FORM_DO_NEW => mcPUIX::FORM_DO_NEW
);
$return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW][mcPUIX::FORM_DO_ROW]['value'] = mcPUIX::FORM_DO_NEW;
//D::show($return, '$return');
return $return;
}
......@@ -394,9 +404,9 @@ class mcPUIX_DOM {
$DOMElement =$param_DOMDocument->createElement($param_ElementName);
if(is_string($value)) {
$DOMElement->nodeValue = Converter::encodeString($value);
}
if(array_key_exists('type', $param_ValuesAttributes)) {
if($param_ValuesAttributes['type'] == mcPUIX::PUIXArray) {
......@@ -411,8 +421,12 @@ class mcPUIX_DOM {
// D::show($value, '$param_ValuesAttributes') ;
// $var_BCLink = SEOLink::getSEOLink($param_HostAccount, $param_iStorable, $PartOfObj, null, $param_EdgeName);
// $var_labelarray = Language::getClassLinks($param_EdgeName, CONSTKindOf::LINK_SHOWBASISCLIPBOARD);
if(is_array($value)) {
$DOMSEOLink = DOMElementHelper::getSEOLinkDOMElement($param_DOMDocument, $value['Host'], $value['SEOLink'], $value['Language'], $value['OptionalValues']);
$DOMElement->appendChild($DOMSEOLink);
}
} else if($param_ValuesAttributes['type'] == 'text') {
$DOMElement->nodeValue = Converter::encodeString($value);
......
......@@ -12,6 +12,50 @@ class mcPUIX_PDO {
}
private static function checkArrayIfIsRequired(array $param_Config_TABLE, array &$param_Values) {
// D::show($param_Values, '$param_Values');
if(mcArray::checkKeyHasFullArray($param_Config_TABLE, 'TABLE')) {
if(mcArray::checkKeyHasFullArray($param_Config_TABLE['TABLE'], mcPUIX::FORM_REQUIRED)) {
// D::show(array( '$param_Config_TABLE' => $param_Config_TABLE['TABLE'][mcPUIX::FORM_REQUIRED], '$param_Values' => $param_Values), '####');
foreach($param_Config_TABLE['TABLE'][mcPUIX::FORM_REQUIRED] as $RequiredKey) {
// D::ulli($RequiredKey);
if(!array_key_exists($RequiredKey, $param_Values)) {
if(mcArray::checkKeyHasFullArray($param_Values, mcPUIX::PDO_OR) && array_key_exists($RequiredKey, $param_Values[mcPUIX::PDO_OR])) {
$param_Values[$RequiredKey] = $param_Values[mcPUIX::PDO_OR][$RequiredKey];
unset($param_Values[mcPUIX::PDO_OR]);
} else if(mcArray::checkKeyHasFullArray($param_Values, mcPUIX::PDO_XOR) && array_key_exists($RequiredKey, $param_Values[mcPUIX::PDO_XOR])) {
$param_Values[$RequiredKey] = $param_Values[mcPUIX::PDO_XOR][$RequiredKey];
unset($param_Values[mcPUIX::PDO_XOR]);
} else if(mcArray::checkKeyHasFullArray($param_Values, mcPUIX::PDO_AND) && array_key_exists($RequiredKey, $param_Values[mcPUIX::PDO_AND])) {
$param_Values[$RequiredKey] = $param_Values[mcPUIX::PDO_AND][$RequiredKey];
unset($param_Values[mcPUIX::PDO_AND]);
} else {
return false;
}
}
if(is_array($param_Values[$RequiredKey])
&& array_key_exists(mcPUIX::FORM_DO_VAR, $param_Values[$RequiredKey])
&& !$param_Values[$RequiredKey][mcPUIX::FORM_DO_VAR]
) {
return false;
} else if(!$param_Values[$RequiredKey]) {
return false;
}
// if(!array_key_exists($RequiredKey, $param_Values) || ( !$param_Values[$RequiredKey] && !$param_Values[$RequiredKey][mcPUIX::FORM_DO_VAR])) {
// return false;
// }
}
}
return true;
} else {
D::cf('ERROR Parameter falsch');
}
}
/**
* @param string $param_tablename
* @param array $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename]
......@@ -27,15 +71,15 @@ class mcPUIX_PDO {
$ConfigArray = $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename];
$ConfigArray_keys = mcPUIX_PDO::getConfigColumnKeys($ConfigArray);
// $ConfigArray_keys = mcPUIX_PDO::getConfigColumnKeys($ConfigArray);
$result = array(mcPUIX::PUIXArray => array(mcPUIX::PDOToSaveValues => array($param_tablename => $result)));
$result = array(mcPUIX::PUIXArray => array(mcPUIX::PDOToSaveValues => array()));
$DeleteRows = $NewRows = $UpdateRows = $ErrorRows = array();
if(array_key_exists('TABLE', $ConfigArray)) {
$BoolRequired = $BoolPrimary = $BoolActiveRow = false;
$BoolRequired = $BoolPrimary = $BoolActiveRow = $BoolDeleted = false;
if(mcArray::checkKeyHasFullArray($ConfigArray, mcPUIX::FORM_DO_ROW)) {
$BoolActiveRow = true;
......@@ -49,43 +93,99 @@ class mcPUIX_PDO {
}
foreach($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES] as $NewKey => &$NewData) {
// D::show($NewData, $NewKey. ' for ');
if($BoolRequired === true) {
foreach($ConfigArray['TABLE'][mcPUIX::FORM_REQUIRED] as $RequiredKey) {
// D::ulli($RequiredKey.' : ');
if(!array_key_exists($RequiredKey, $NewData) || !$NewData[$RequiredKey][mcPUIX::FORM_DO_VAR]) {
$ErrorRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey];
unset($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey]);
break;
}
}
$BoolDeleted = false;
if($NewKey===mcPUIX::FORM_NEW_ROW) {
// D::show($NewData, '$NewData '.$NewKey);
foreach($NewData as $NewFormRowKey => &$NewFormRow) {
if(is_array($NewFormRow)) {
// D::show($NewFormRow, $NewKey.' $NewFormRow '.$NewFormRowKey);
$BoolDeleted = $BoolErrorRow = false;
if(!mcPUIX_PDO::checkArrayIfIsRequired($ConfigArray, $NewFormRow)) {
$param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey][$NewFormRowKey][mcPUIX::ERRORMESSAGE] = 'deleted after checkArrayIfIsRequired';
$ErrorRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey][$NewFormRowKey];
unset($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey][$NewFormRowKey]);
$BoolDeleted = true;
$BoolErrorRow = true;
}
// D::show($NewFormRow, '$NewFormRow after checkArrayIfIsRequired');
if($NewData[mcPUIX::FORM_DO_ROW][mcPUIX::FORM_DO_VAR] === mcPUIX::FORM_DO_NEW) {
$BoolErrorRow = false;
if($NewFormRow[mcPUIX::FORM_DO_ROW][mcPUIX::FORM_DO_VAR] === mcPUIX::FORM_DO_NEW
|| $NewFormRow[mcPUIX::FORM_DO_ROW] === mcPUIX::FORM_DO_NEW) {
// $BoolErrorRow = false;
foreach($ConfigArray['TABLE']['LISTID'] as $LISTID) {
if(!array_key_exists($LISTID, $NewData)) {
$ErrorRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey];
if(!array_key_exists($LISTID, $NewFormRow)) {
$param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey][$NewFormRowKey][mcPUIX::ERRORMESSAGE] = 'deleted after LISTID';
$ErrorRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey][$NewFormRowKey];
$BoolErrorRow = true;
break;
}
}
if($BoolErrorRow === false) {
$NewRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey];
// D::show($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey][$NewFormRowKey], "teaasdf[$NewFormRowKey]",1,1);
// D::show($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey], "[$NewFormRowKey]",1,1);
$NewRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey][$NewFormRowKey];
// $NewRows[] = $NewFormRow;
}
// D::show($NewData, 'NEW_ROW '.$NewKey);
} else {
$param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey][$NewFormRowKey][mcPUIX::ERRORMESSAGE] ='deleted because not FORM_DO_NEW marked';
$ErrorRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey][$NewFormRowKey];
}
} else {
D::show($NewFormRow, '$NewFormRowKey ='.$NewFormRowKey,1,1);
}
}
// D::show($ErrorRows, '$ErrorRows');
} else {
// D::show($NewData, '$NewKey: '. $NewKey);
if(!mcPUIX_PDO::checkArrayIfIsRequired($ConfigArray, $NewData)) {
$ErrorRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey];
unset($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey]);
$BoolDeleted = true;
// D::show($ErrorRows, '$ErrorRows');
}
// D::show($NewData, '$NewFormRow after checkArrayIfIsRequired');
// if($BoolRequired === true) {
// foreach($ConfigArray['TABLE'][mcPUIX::FORM_REQUIRED] as $RequiredKey) {
//// D::ulli($RequiredKey.' : ');
// if(!array_key_exists($RequiredKey, $NewData) || !$NewData[$RequiredKey][mcPUIX::FORM_DO_VAR]) {
// $ErrorRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey];
// unset($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey]);
// $BoolDeleted = true;
// break;
// }
// }
// }
if(!$BoolDeleted) {
// if($NewData[mcPUIX::FORM_DO_ROW][mcPUIX::FORM_DO_VAR] === mcPUIX::FORM_DO_NEW) {
// $BoolErrorRow = false;
// foreach($ConfigArray['TABLE']['LISTID'] as $LISTID) {
// if(!array_key_exists($LISTID, $NewData)) {
// $ErrorRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey];
// $BoolErrorRow = true;
// break;
// }
// }
// if($BoolErrorRow === false) {
// $NewRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey];
//
// }
// } else {
if($BoolActiveRow === true) {
// if(!array_key_exists(mcPUIX::FORM_DO_ROW, $NewData) || !$NewData[mcPUIX::FORM_DO_ROW]) {
if($NewData[mcPUIX::FORM_DO_ROW][mcPUIX::FORM_DO_VAR] === mcPUIX::FORM_DO_DELETE) {
$DeleteRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey];
unset($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey]);
// } else if(array_key_exists($NewKey, $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES])) {
} else if($NewData[mcPUIX::FORM_DO_ROW][mcPUIX::FORM_DO_VAR] === mcPUIX::FORM_DO_SAVE) {
$BoolErrorRow = false;
foreach($ConfigArray['TABLE']['PRIMARY'] as $PrimaryKey) {
......@@ -97,40 +197,28 @@ class mcPUIX_PDO {
}
if($BoolErrorRow == false) {
$UpdateRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey];
}
if(mcArray::checkKeyHasFullArray($NewData, mcPUIX::PUIX_SUB_REFERENCELIST, mcPUIX::PUIXArray)) {
$Tablename_LIST = mcPUIX_CONFIG::getReferenceTableName($param_tablename);
/**
*
*
* QQQQQQQQQQQQQQ hier muss code hin
*/
// D::show($param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$Tablename_LIST], $Tablename_LIST.' CONFIG');
// D::show($NewData[mcPUIX::PUIX_SUB_REFERENCELIST][mcPUIX::PUIXArray], '1 '.$Tablename_LIST);
// D::cf('1 '.$Tablename_LIST);
$ReferenceNewArray = array(
mcPUIX::PUIXArray => array(
mcPUIX::FORM_POST_VALUES => $NewData[mcPUIX::PUIX_SUB_REFERENCELIST][mcPUIX::PUIXArray]
)
);
$result_List = mcPUIX_PDO::prepareArrayForDBOperation($Tablename_LIST, $param_ConfigArray, $ReferenceNewArray);
// D::show($result_List, '2 '.$Tablename_LIST);
// $result[mcPUIX::PUIXArray][mcPUIX::PDOToSaveValues][$Tablename_LIST] = $result_List[mcPUIX::PUIXArray][mcPUIX::PDOToSaveValues][$Tablename_LIST];
$result = array_merge_recursive ($result, $result_List);
// D::show($result_List, $Tablename_LIST. '##dddddddddddddddddddd ddddddd');
}
}
} else if($NewData[mcPUIX::FORM_DO_ROW][mcPUIX::FORM_DO_VAR] === mcPUIX::FORM_DO_SAVE) {
$UpdateRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey];
// break;
}
// }
}
}
}
}
$result[mcPUIX::PUIXArray][mcPUIX::PDOToSaveValues][$param_tablename]['DeleteRows'] = $DeleteRows;
$result[mcPUIX::PUIXArray][mcPUIX::PDOToSaveValues][$param_tablename]['UpdateRows'] = $UpdateRows;
......@@ -139,6 +227,7 @@ class mcPUIX_PDO {
//D::show($result, '$result');
return $result;
} else {
D::backtrace('prepareArrayForDBOperation');
D::cf('ERROR wrong format
if(mcArray::checkKeyHasFullArray($param_ConfigArray, mcPUIX::PUIXArray, mcPUIX::DBUIConfig, '.$param_tablename.')
=> '.mcArray::checkKeyHasFullArray($param_ConfigArray, mcPUIX::PUIXArray, mcPUIX::DBUIConfig, $param_tablename).'
......@@ -146,9 +235,118 @@ class mcPUIX_PDO {
=> '.mcArray::checkKeyHasFullArray($param_NewArray, mcPUIX::PUIXArray, mcPUIX::FORM_POST_VALUES).'
) {
');
D::show($param_NewArray, $param_tablename);
}
}
/**
*
* @param string $param_SQLWhere
* @param array $param_SearchAttributes -- array (
* mcPUIX::PDO_AND => array(x1, x2, x3 ),
* mcPUIX::PDO_OR => array(),
* mcPUIX::PDO_XOR => array(),
*
* )
*/
private static function generateWhereFromSearchAttributes(&$param_SQLWhere, array &$param_bindValueArray, array $param_SearchAttributes, $param_Operator=mcPUIX::PDO_AND) {
$return = array();
$Operator_SQL_Array = array();
if(array_key_exists(mcPUIX::PDO_AND, $param_SearchAttributes)) {
$AND_operator = mcPUIX::PDO_AND;
$AND_Operands = $param_SearchAttributes[mcPUIX::PDO_AND];
$AND_SQL = '';
unset($param_SearchAttributes[mcPUIX::PDO_AND]);
$AND_Return = mcPUIX_PDO::generateWhereFromSearchAttributes($AND_SQL, $param_bindValueArray, $AND_Operands, $AND_operator);
$return = array_merge_recursive($return, $AND_Return);
$Operator_SQL_Array[] = $AND_SQL;
}
if(array_key_exists(mcPUIX::PDO_OR, $param_SearchAttributes)) {
$OR_operator = mcPUIX::PDO_OR;
$OR_Operands = $param_SearchAttributes[mcPUIX::PDO_OR];
$OR_SQL = '';
unset($param_SearchAttributes[mcPUIX::PDO_OR]);
$OR_Return = mcPUIX_PDO::generateWhereFromSearchAttributes($OR_SQL, $param_bindValueArray, $OR_Operands, $OR_operator);
$return = array_merge_recursive($return, $OR_Return);
$Operator_SQL_Array[] = $OR_SQL;
}
if(array_key_exists(mcPUIX::PDO_XOR, $param_SearchAttributes)) {
$XOR_operator = mcPUIX::PDO_XOR;
$XOR_Operands = $param_SearchAttributes[mcPUIX::PDO_XOR];
$XOR_SQL = '';
unset($param_SearchAttributes[mcPUIX::PDO_XOR]);
$XOR_Return = mcPUIX_PDO::generateWhereFromSearchAttributes($XOR_SQL, $param_bindValueArray, $XOR_Operands, $XOR_operator);
$return = array_merge_recursive($return, $XOR_Return);
$Operator_SQL_Array[] = $XOR_SQL;
}
if(array_key_exists(mcPUIX::PUIX_SUB_REFERENCELIST, $param_SearchAttributes)) {
unset($param_SearchAttributes[mcPUIX::PUIX_SUB_REFERENCELIST]);
}
$bool_operator = false;
if(!empty($param_SearchAttributes)) {
foreach($param_SearchAttributes as $col => $val) {
if($col===mcPUIX::PDO_NEW) {
// D::show($val, '$param_SearchAttributes mcPUIX::PDO_NEW');
if(!array_key_exists(mcPUIX::PDO_Special, $return)) {
$return[mcPUIX::PDO_Special] = array();
}
$return[mcPUIX::PDO_Special][mcPUIX::PDO_NEW] = array(
mcPUIX::PDO_Operator => $param_Operator,
mcPUIX::PDO_Operand => $val,
);
// $col = key($val);
// $val = 0;
} else {
if($bool_operator) {
$param_SQLWhere .= ' '.$param_Operator.' ';
} else {
$bool_operator = true;
}
if(is_numeric($val)) {
$bindKey = ':'.$col.'_'.$val;
} else {
$bindKey = ':'.$col;
}
if(array_key_exists($bindKey, $param_bindValueArray)) {
$bindKey .= '_'.md5($bindKey);
if(array_key_exists($bindKey, $param_bindValueArray)) {
$bindKey .= '_'.mcString::generateAlphaNumericRandumString();
if(array_key_exists($bindKey, $param_bindValueArray)) {
D::li('@todo: och mensch .. schon echt unwahrscheinlich $bindKey('.$bindKey.')');
}
}
}
$param_SQLWhere .= ' '.$col.'='.$bindKey.' ';
$param_bindValueArray[$bindKey] = $val;
}
}
}
if(!empty($Operator_SQL_Array)) {
foreach($Operator_SQL_Array as $SQL_String) {
if(trim($SQL_String)!=='') {
if($bool_operator) {
$param_SQLWhere .= ' '.$param_Operator.' ';
} else {
$bool_operator = true;
}
$param_SQLWhere .= ' ('.$SQL_String.') ';
}
}
}
return $return;
}
/**
......@@ -165,17 +363,62 @@ class mcPUIX_PDO {
* )
* )
*/
public static function getTableAsDBUIArray(Account &$param_HostAccount, PDOLevel &$param_iStorable, $param_tablename, $param_SQLWhere='', $param_depth=0) {
public static function getTableAsDBUIArray(Account &$param_HostAccount, PDOLevel &$param_iStorable, $param_tablename, array $param_SearchAttributes=null, $param_SQLWhere='', $param_depth=0) {
$ConfigArray = mcPUIX_CONFIG::getTableConfig($param_tablename);
$ConfigArray = $ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename];
$BOOL_Load=true;
if($param_SQLWhere==='' && !is_null($param_SearchAttributes)) {
if(array_key_exists(mcPUIX::PDOLoadDepth, $param_SearchAttributes)) {
if($param_SearchAttributes[mcPUIX::PDOLoadDepth]===mcPUIX::PDOLoadDepth_OnlyNew) {
$BOOL_Load=false;
} else {
$param_depth = $param_SearchAttributes[mcPUIX::PDOLoadDepth];
}
unset($param_SearchAttributes[mcPUIX::PDOLoadDepth]);
}
if($BOOL_Load) {
// D::show($param_SearchAttributes, '$param_SearchAttributes');
$var_bindValueArray = array();
$returnFromSearchAttributes = mcPUIX_PDO::generateWhereFromSearchAttributes($param_SQLWhere, $var_bindValueArray, $param_SearchAttributes);
$param_SQLWhere = ' where '.$param_SQLWhere;
}
// $param_SQLWhere = ' where ';
// $bool_AND = false;
// foreach($param_SearchAttributes as $col => $val) {
// if($col === mcPUIX::PDOLoadDepth) {
// if($val===mcPUIX::PDOLoadDepth_OnlyNew) {
// $BOOL_Load=false;
// } else {
// $param_depth = $val;
// }
//
// }
// else if($col !== mcPUIX::PUIX_SUB_REFERENCELIST) {
// if($bool_AND) {
// $param_SQLWhere .= ' AND ';
// } else {
// $bool_AND = true;
// }
// $param_SQLWhere .= ' '.$col.'="'.$val.'" ';
// }
// }
}
// D::show($param_SearchAttributes, "param_depth=$param_depth: ".$param_SQLWhere);
if($BOOL_Load) {
if(mcArray::checkKeyHasFullArray($ConfigArray, 'TABLE')
&& array_key_exists('TABLENAME', $ConfigArray['TABLE']) && $ConfigArray['TABLE']['TABLENAME']
) {
$var_query = 'select * from '.$ConfigArray['TABLE']['TABLENAME'].' '.$param_SQLWhere;
// where SNIfProfileID = 0 or SNIfProfileID = :SNIfProfileID ';
// $var_bindValueArray = array(':SNIfProfileID' => $param_Object->getObjVar('Profile')->getObjVar('SNIfProfileID'), );
// D::cf(''.$var_query);
// where SNIfProfileID = 0 or SNIfProfileID = :SNIfProfileID ';
// $var_bindValueArray = array(':SNIfProfileID' => $param_Object->getObjVar('Profile')->getObjVar('SNIfProfileID'), );
// D::show(array('$var_bindValueArray' => $var_bindValueArray, '$param_SearchAttributes' => $param_SearchAttributes, '$returnFromSearchAttributes'=> $returnFromSearchAttributes), $var_query);
// $var_bindValueArray=null;
$stmt = $param_iStorable->PDO_query($var_query, $var_bindValueArray);
if($stmt){
......@@ -192,11 +435,30 @@ class mcPUIX_PDO {
if($PDORow[$ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['REFERENCE_KEY']]) {
// D::show($PDORow, '$PDORow');
// D::show($ConfigArray, '$ConfigArray');
$SQLWhere = ' where '.$ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['REFERENCE_KEY'].'='.$PDORow[$ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['REFERENCE_KEY']];
$PDOTableList = mcPUIX_PDO::getTableAsDBUIArray($param_HostAccount, $param_iStorable, $ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['TABLENAME'], $SQLWhere, $param_depth-1);
if(mcArray::checkKeyHasFullArray($PDOTableList, mcPUIX::PUIXArray, mcPUIX::PDOValues)) {
// $SQLWhere = ' where '.$ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['REFERENCE_KEY'].'='.$PDORow[$ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['REFERENCE_KEY']];
$SearchAttributes=array(
$ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['REFERENCE_KEY'] => $PDORow[$ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['REFERENCE_KEY']],
mcPUIX::PDOLoadDepth => $param_depth-1,
);
if(mcArray::checkKeyHasFullArray($param_SearchAttributes, mcPUIX::PUIX_SUB_REFERENCELIST)) {
// $SearchAttributes = $param_SearchAttributes[mcPUIX::PUIX_SUB_REFERENCELIST];
$SearchAttributes = array_merge($SearchAttributes, $param_SearchAttributes[mcPUIX::PUIX_SUB_REFERENCELIST]);
// D::show(array('$param_SearchAttributes' => $param_SearchAttributes, '$SearchAttributes' => $SearchAttributes),'hier gehts dann morgen weiter ;) ;(');
}
$PDOTableList = mcPUIX_PDO::getTableAsDBUIArray($param_HostAccount, $param_iStorable, $ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['TABLENAME'], $SearchAttributes);
//D::show($PDOTableList, '$PDOTableList');
// if(mcArray::checkKeyHasFullArray($PDOTableList, mcPUIX::PUIXArray, mcPUIX::PDOValues)) {
if(mcArray::checkKeyHasFullArray($PDOTableList, mcPUIX::PUIXArray)) {
$PDORow[mcPUIX::PUIXArray] = $PDOTableList[mcPUIX::PUIXArray];
}
// if(mcArray::checkKeyHasFullArray($PDOTableList, mcPUIX::PDO_Special)) {
// if(mcArray::checkKeyHasFullArray($PDORow, mcPUIX::PUIXArray)) {
//
// }
// $PDORow[mcPUIX::PDO_Special] = $PDOTableList[mcPUIX::PDO_Special];
// }
// D::show($PDOTableList, '$PDOTableList: '.$SQLWhere);
}
......@@ -215,9 +477,11 @@ class mcPUIX_PDO {
$ReferenceListTableName = mcPUIX_CONFIG::getReferenceListTableName($param_tablename);
foreach($PDOTable as &$PDORow) {
// D::show($ConfigArray['TABLE']['LISTID'], '$ReferenceListTableName = '.$ReferenceListTableName.' '.$ConfigArray['TABLE']['LISTID'].' ---- '.$SQLWhere);
// D::show($ConfigArray['TABLE']['LISTID'], '$ReferenceListTableName = '.$ReferenceListTableName.' '.$ConfigArray['TABLE']['LISTID'].' ---- '.$SQLWhere);
$SearchAttributes=array();
$SQLWhere = ' where ';
$bool_AND = false;
// mcPUIX::PDO_OR
foreach($ConfigArray['TABLE']['LISTID'] as $ListIDKey) {
if($bool_AND) {
$SQLWhere .= ' AND ';
......@@ -225,11 +489,11 @@ class mcPUIX_PDO {
$bool_AND = true;
}
$SQLWhere .= ' '.$ListIDKey.'='.$PDORow[$ListIDKey];
$SearchAttributes[$ListIDKey] = $PDORow[$ListIDKey];
}
$SearchAttributes[mcPUIX::PDOLoadDepth] = $param_depth-1;
// D::cf($ReferenceListTableName.' -- '.$SQLWhere);
$PDOTableList = mcPUIX_PDO::getTableAsDBUIArray($param_HostAccount, $param_iStorable, $ReferenceListTableName, $SQLWhere, $param_depth-1);
$PDOTableList = mcPUIX_PDO::getTableAsDBUIArray($param_HostAccount, $param_iStorable, $ReferenceListTableName, $SearchAttributes);
if(mcArray::checkKeyHasFullArray($PDOTableList, mcPUIX::PUIXArray, mcPUIX::PDOValues)) {
$PDORow[mcPUIX::PUIXArray] = $PDOTableList[mcPUIX::PUIXArray];
}
......@@ -247,12 +511,18 @@ class mcPUIX_PDO {
mcPUIX::PDOValues => $PDOTable
)
);
if(mcArray::checkKeyHasFullArray($returnFromSearchAttributes, mcPUIX::PDO_Special)) {
$result[mcPUIX::PUIXArray][mcPUIX::PDO_Special] = $returnFromSearchAttributes[mcPUIX::PDO_Special];
}
// D::show($result, $var_query);
return $result;
} else {
return false;
}
}
}
}
private static function getDatabaseTable_where($param_PrimaryKeys, $param_PrimaryValues, &$param_query, array &$param_bindValueArray) {
......@@ -343,10 +613,10 @@ class mcPUIX_PDO {
unset($TableConfig['TABLENAME']);
/**
* delete the rows
* ErrorRows
*/
if(mcArray::checkKeyHasFullArray($preparedArray, 'ErrorRows')) {
D::show($preparedArray['ErrorRows'], 'ErrorRows');
// D::show($preparedArray['ErrorRows'], 'ErrorRows');
}
/**
* delete the rows
......@@ -423,6 +693,8 @@ class mcPUIX_PDO {
if($NewRowSet) {
$newID = $param_iStorable->PDO_insertRow($ConfigArray['TABLE']['TABLENAME'], $ConfigArray['TABLE']['LISTID'], $ConfigArray['TABLE']['ELEMENTID'], $NewRowSet, true);
//D::show($NewRow, '$newID = '.$newID);
// D::cf($ConfigArray['TABLE']['ELEMENTID'].' ===== '.$newID);
if(mcArray::checkKeyHasFullArray($NewRow, mcPUIX::PUIX_SUB_REFERENCELIST, mcPUIX::PUIXArray, mcPUIX::FORM_NEW_ROW)
&& mcArray::checkKeyHasFullArray($TableConfig, mcPUIX::PUIX_SUB_REFERENCELIST)
......@@ -431,8 +703,13 @@ class mcPUIX_PDO {
// D::show($NewRow[mcPUIX::PUIX_SUB_REFERENCELIST][mcPUIX::PUIXArray][mcPUIX::FORM_NEW_ROW],'NewRows '.$ConfigArray['TABLE']['ELEMENTID'].' => '.$newID);
// D::show($NewRow[mcPUIX::PUIX_SUB_REFERENCELIST][mcPUIX::PUIXArray], '$NewRow[mcPUIX::PUIX_SUB_REFERENCELIST][mcPUIX::PUIXArray]');
$NewRow[mcPUIX::PUIX_SUB_REFERENCELIST][mcPUIX::PUIXArray][mcPUIX::FORM_NEW_ROW][$ConfigArray['TABLE']['ELEMENTID']] = $newID;
foreach($NewRow[mcPUIX::PUIX_SUB_REFERENCELIST][mcPUIX::PUIXArray][mcPUIX::FORM_NEW_ROW] as $NewSubRowKey => &$NewSubRow) {
$NewSubRow[$ConfigArray['TABLE']['ELEMENTID']] = $newID;
}
// $NewRow[mcPUIX::PUIX_SUB_REFERENCELIST][mcPUIX::PUIXArray][mcPUIX::FORM_NEW_ROW][$ConfigArray['TABLE']['ELEMENTID']] = $newID;
$NewSubArray = array(mcPUIX::PUIXArray => array(mcPUIX::FORM_POST_VALUES => $NewRow[mcPUIX::PUIX_SUB_REFERENCELIST][mcPUIX::PUIXArray]));
// D::show($NewSubArray, '$NewSubArray');
$preparedNewSubRow = mcPUIX_PDO::prepareArrayForDBOperation($TableConfig[mcPUIX::PUIX_SUB_REFERENCELIST]['TABLENAME'], $param_ConfigArray, $NewSubArray);
// D::Show($preparedNewSubRow, '$preparedNewSubRow');
mcPUIX_PDO::updateDatabaseTable($param_HostAccount, $param_iStorable, $param_ConfigArray, $preparedNewSubRow);
......@@ -475,9 +752,19 @@ class mcPUIX_PDO {
}
}
private static function formatForUpdateRowArray(array $param_UpdateRow) {
public static function formatForUpdateRowArray(array $param_UpdateRow) {
if(is_array($param_UpdateRow) && !empty ($param_UpdateRow)) {
$return = array();
// D::show($param_UpdateRow, '$param_UpdateRow');
if(mcArray::checkKeyHasFullArray($param_UpdateRow, mcPUIX::PDO_AND)) {
} else if(mcArray::checkKeyHasFullArray($param_UpdateRow, mcPUIX::PDO_OR)) {
} else if(mcArray::checkKeyHasFullArray($param_UpdateRow, mcPUIX::PDO_XOR)) {
}
/**
* delete the mcPUIX::FORM_DO_VAR key
......
......@@ -17,9 +17,9 @@
<xsl:template match="mcPUIX" mode="dev">
<xsl:param name="param_inputBE">0</xsl:param>
<h2><xsl:value-of select="@label" /></h2>
<!-- <b><xsl:value-of select="$param_inputBE" /></b>-->
<table border="1">
<!-- <tr><td>show</td></tr>-->
<xsl:if test="DOMmcPUIX_show/PUIXArray">
<tr>
<td>
<xsl:apply-templates select="DOMmcPUIX_show/PUIXArray" mode="dev">
......@@ -28,7 +28,17 @@
<br/>
</td>
</tr>
<!-- <tr><td>edit</td></tr>-->
</xsl:if>
<xsl:if test="DOMmcPUIX_edit/PUIXArray">
<xsl:if test="DOMmcPUIX_edit/DOMmcPUIX_edit_special">
<tr>
<td>
<xsl:apply-templates select="DOMmcPUIX_edit/DOMmcPUIX_edit_special/." mode="dev">
<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
</xsl:apply-templates>
</td>
</tr>
</xsl:if>
<tr>
<td>
<xsl:apply-templates select="DOMmcPUIX_edit/PUIXArray" mode="dev">
......@@ -37,7 +47,11 @@
<br/>
</td>
</tr>
</xsl:if>
<tr><td><xsl:value-of select="$space"/></td></tr>
</table>
</xsl:template>
......@@ -48,9 +62,9 @@
<xsl:choose>
<xsl:when test="@edit=1 and $param_noform=0">
<div class="row"><span class="element"><xsl:value-of select="@label" /> count(<xsl:value-of select="@count" />) </span> </div>
<div class="row"><span class="element"><xsl:value-of select="@label" /> count(<xsl:value-of select="@count" />) </span></div>
<xsl:for-each select="DBUIRow">
<div class="row"><span class="element"><xsl:value-of select="@label" /> i(<xsl:value-of select="@i" />) </span> </div>
<div class="row"><span class="element"><xsl:value-of select="@label" /> i(<xsl:value-of select="@i" />) </span></div>
<xsl:apply-templates select="DBUIElement" mode="dev">
<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
</xsl:apply-templates>
......@@ -59,6 +73,7 @@
<xsl:otherwise>
<!--<xsl:value-of select="count(DBUIRow[@i=mcPUIX::FORM_NEW_ROW])" />/<xsl:value-of select="count(DBUIRow)" />-->
<xsl:if test="count(DBUIRow[@i='FORM_NEW_ROW'])!=count(DBUIRow)">
<xsl:if test="DBUIRow">
<table border="1">
<xsl:for-each select="DBUIRow">
......@@ -103,9 +118,11 @@
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:value-of select="$space"/>
</table>
</xsl:if>
</xsl:if>
<xsl:if test="DBUIRow">
<table border="1">
<xsl:for-each select="DBUIRow[@i='FORM_NEW_ROW']">
<xsl:choose>
......@@ -143,7 +160,9 @@
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:value-of select="$space"/>
</table>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
......@@ -309,6 +328,7 @@
</xsl:choose>
</xsl:when>
</xsl:choose>
<xsl:value-of select="$space"/>
</span>
</div>
</span>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!