Commit 1d210739 by Frederick d. Maus

local - not interesting

1 parent bc356bfb
...@@ -83,8 +83,8 @@ class D { ...@@ -83,8 +83,8 @@ class D {
if(trim($param_string)) { if(trim($param_string)) {
if($param_htmlentities) // if($param_htmlentities)
$param_string=htmlentities($param_string); // $param_string=htmlentities($param_string);
self::$echo_lines[self::$echo_count] = array( self::$echo_lines[self::$echo_count] = array(
'line' => $param_string, 'line' => $param_string,
'print' => $param_print, 'print' => $param_print,
......
...@@ -93,4 +93,12 @@ class mcErrorEvent extends mcEvent { ...@@ -93,4 +93,12 @@ class mcErrorEvent extends mcEvent {
self::add(new mcErrorEvent($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext)); self::add(new mcErrorEvent($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext));
mcErrorEvent::$count++; 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,63 +10,72 @@ ...@@ -10,63 +10,72 @@
*/ */
function mcErrorHandler($param_typ, $param_notice, $param_file, $param_row, $param_More) { function mcErrorHandler($param_typ, $param_notice, $param_file, $param_row, $param_More) {
switch ($param_typ) {
case E_ERROR: // 1 if(strpos($param_notice, 'XSLTProcessor') !== false) {
mcErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); mcXSLErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
die();
break; } else {
case E_WARNING: // 2 switch ($param_typ) {
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); case E_ERROR: // 1
break; mcErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
case E_PARSE: // 4 die();
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_WARNING: // 2
case E_NOTICE: // 8 mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_PARSE: // 4
case E_CORE_ERROR: // 16 mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_NOTICE: // 8
case E_CORE_WARNING: // 32 mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_CORE_ERROR: // 16
case E_COMPILE_ERROR: // 64 mcErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_CORE_WARNING: // 32
case E_COMPILE_WARNING: // 128 mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_COMPILE_ERROR: // 64
case E_USER_ERROR: // 256 mcErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_COMPILE_WARNING: // 128
case E_USER_WARNING: // 512 mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_USER_ERROR: // 256
case E_USER_NOTICE: // 1024 since PHP 4 mcErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_USER_WARNING: // 512
case E_STRICT: // 2048 since PHP 5 mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_USER_NOTICE: // 1024 since PHP 4
case E_RECOVERABLE_ERROR : // 4096 since PHP 5.2.0 mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_STRICT: // 2048 since PHP 5
case E_DEPRECATED: // 8192 since PHP 5.3.0 mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_RECOVERABLE_ERROR : // 4096 since PHP 5.2.0
case E_USER_DEPRECATED: // 16384 since PHP 5.3.0 mcErrorEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_DEPRECATED: // 8192 since PHP 5.3.0
case E_ALL: // 30719 in PHP 5.3.x, 6143 in PHP 5.2.x, 2047 previously mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More); break;
break; case E_USER_DEPRECATED: // 16384 since PHP 5.3.0
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
break;
case E_ALL: // 30719 in PHP 5.3.x, 6143 in PHP 5.2.x, 2047 previously
mcNoticeEvent::handle($param_typ, $param_notice, $param_file, $param_row, $param_More);
break;
default: default:
D::li('___Typ: '.$param_typ.' (E_NOTICE = '.E_NOTICE.' E_WARNING = '.E_WARNING.' E_ERROR = '.E_ERROR.') <b>[anscheinend ein neuer Typ .. da muss doch gleich mal auf der <a href="http://php.net/manual/en/errorfunc.constants.php">Predefined Constants</a> seite nachgeschaut werden]</b>'); D::li('___Typ: '.$param_typ.' (E_NOTICE = '.E_NOTICE.' E_WARNING = '.E_WARNING.' E_ERROR = '.E_ERROR.') <b>[anscheinend ein neuer Typ .. da muss doch gleich mal auf der <a href="http://php.net/manual/en/errorfunc.constants.php">Predefined Constants</a> seite nachgeschaut werden]</b>');
D::ulli('Notiz: '.$param_notice); D::ulli('Notiz: '.$param_notice);
D::ulli('Datei: '.$param_file); D::ulli('Datei: '.$param_file);
D::ulli('Zeile: '.$param_row); D::ulli('Zeile: '.$param_row);
}
} }
// return FALSE; // return FALSE;
......
...@@ -88,7 +88,8 @@ class mcArray { ...@@ -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) { 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(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]) && is_array($param_Array[$param_key])
&& !empty($param_Array[$param_key]) && !empty($param_Array[$param_key])
) { ) {
......
...@@ -7,8 +7,14 @@ if(!isset($_LOSP_DEV)) { ...@@ -7,8 +7,14 @@ if(!isset($_LOSP_DEV)) {
* @var boolean -- activate the dev modus * @var boolean -- activate the dev modus
*/ */
$_LOSP_DEV = true; $_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 * @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)) { ...@@ -24,7 +30,7 @@ if(!isset($__mc_D_LOGFILE)) {
/** /**
* @var string -- file for the D Output * @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)) { if(!isset($__mc_D_LOGFILE_RESET)) {
/** /**
...@@ -48,7 +54,7 @@ if(!isset($__mc_INPUT_LOGFILE)) { ...@@ -48,7 +54,7 @@ if(!isset($__mc_INPUT_LOGFILE)) {
/** /**
* @var string -- file for the D Output * @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)) { if(!isset($__mc_INPUT_LOGFILE_RESET)) {
/** /**
...@@ -64,7 +70,7 @@ if(!isset($__mc_PDO_LOGFILE)) { ...@@ -64,7 +70,7 @@ if(!isset($__mc_PDO_LOGFILE)) {
/** /**
* @var string -- file for the D Output * @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)) { if(!isset($__mc_PDO_LOGFILE_RESET)) {
/** /**
...@@ -110,12 +116,12 @@ if(!isset($__mc_Report)) { ...@@ -110,12 +116,12 @@ if(!isset($__mc_Report)) {
$__mc_Report = array( $__mc_Report = array(
'mcNoticeEvent' => array( 'mcNoticeEvent' => array(
'toScreen' => array(), 'toScreen' => array(),
'toFile' => array('file' => 'log/NoticeEvent.log') 'toFile' => array('file' => 'log/NoticeEvent.'.$__THIS_SCRIPT_INFO['filename'].'.log')
), ),
'mcErrorEvent' => array( 'mcErrorEvent' => array(
'toScreen' => array(), 'toScreen' => array(),
'toFile' => array( 'toFile' => array(
'file' => 'log/ErrorEvent.log', 'file' => 'log/ErrorEvent.'.$__THIS_SCRIPT_INFO['filename'].'.log',
'writemode' => 'a', 'writemode' => 'a',
'reset' => false, 'reset' => false,
), ),
...@@ -124,10 +130,22 @@ if(!isset($__mc_Report)) { ...@@ -124,10 +130,22 @@ if(!isset($__mc_Report)) {
// 'subject' => 'Error:' // 'subject' => 'Error:'
// ) // )
), ),
'mcXSLErrorEvent' => array(
'toScreen' => array(),
'toFile' => array(
'file' => 'log/XSLErrorEvent.'.$__THIS_SCRIPT_INFO['filename'].'.log',
'writemode' => 'a',
'reset' => false,
),
// 'toMail' => array(
// 'mail' => 'mail@localhost.tld',
// 'subject' => 'Error:'
// )
),
'mcException' => array( 'mcException' => array(
'toScreen' => array(), 'toScreen' => array(),
'toFile' => array( 'toFile' => array(
'file' => 'log/Exception.log', 'file' => 'log/Exception.'.$__THIS_SCRIPT_INFO['filename'].'.log',
'writemode' => 'a', 'writemode' => 'a',
'reset' => false, 'reset' => false,
), ),
...@@ -139,7 +157,7 @@ if(!isset($__mc_Report)) { ...@@ -139,7 +157,7 @@ if(!isset($__mc_Report)) {
'Error' => array( 'Error' => array(
'toScreen' => array('text' => 'ERROR Error ERROR Error ERROR'), 'toScreen' => array('text' => 'ERROR Error ERROR Error ERROR'),
'toFile' => array( 'toFile' => array(
'file' => 'log/Error.config.log', 'file' => 'log/Error.'.$__THIS_SCRIPT_INFO['filename'].'.config.log',
'writemode' => 'a', 'writemode' => 'a',
'reset' => false, 'reset' => false,
), ),
......
...@@ -80,7 +80,9 @@ if($_LOSP_DEV) { ...@@ -80,7 +80,9 @@ if($_LOSP_DEV) {
foreach($Report as $kindofDistribute => $params) { foreach($Report as $kindofDistribute => $params) {
if($kindofDistribute == 'toFile') { if($kindofDistribute == 'toFile') {
if(array_key_exists('reset', $params) && $params['reset']) { 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'); mcFile::write($params['file'], $var_message, 'w');
} }
} }
......
...@@ -40,25 +40,26 @@ class Converter{ ...@@ -40,25 +40,26 @@ class Converter{
* @return string * @return string
*/ */
public static function encodeString($param_string, $param_encode = true){ public static function encodeString($param_string, $param_encode = true){
// $param_string = strip_tags($param_string); if(is_string($param_string)) {
// $param_string = htmlentities($param_string, 1,"UTF-8"); // $param_string = strip_tags($param_string);
// $param_string = trim($param_string); // $param_string = htmlentities($param_string, 1,"UTF-8");
$param_string = stripslashes($param_string); // $param_string = trim($param_string);
// D::show($param_string,"encode",1);
$param_string = stripslashes($param_string);
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)){ // if(!is_numeric($param_string)){
// $param_string = "'" . mysql_real_escape_string($param_string) . "'"; // $param_string = "'" . mysql_real_escape_string($param_string) . "'";
// } // }
if($param_encode){
return htmlspecialchars($param_string, 2,"UTF-8");
}
else{ return $param_string;
return $param_string;
}
} }
public static function StringToUrl($param_Url) { public static function StringToUrl($param_Url) {
......
...@@ -3,22 +3,37 @@ interface imcPUIX { ...@@ -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_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 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 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(); public function setRootTable();
} }
abstract class mcPUIX extends mcClass implements imcPUIX { abstract class mcPUIX extends mcClass implements imcPUIX {
const DBUIConfig = 'DBUIConfig'; 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 PDOValues = 'PDOValues';
const PDOToSaveValues = 'PDOToSaveValues'; 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 = 'PDOLoadDepth';
const PDOLoadDepth_OnlyNew = 'PDOLoadDepth_OnlyNew';
const ERRORMESSAGE ='ERRORMESSAGE';
const DOMmcPUIX = 'mcPUIX'; const DOMmcPUIX = 'mcPUIX';
const DOMmcPUIX_edit = 'DOMmcPUIX_edit'; const DOMmcPUIX_edit = 'DOMmcPUIX_edit';
const DOMmcPUIX_edit_special = 'DOMmcPUIX_edit_special';
const DOMmcPUIX_show = 'DOMmcPUIX_show'; const DOMmcPUIX_show = 'DOMmcPUIX_show';
const DOMRow = 'DBUIRow'; const DOMRow = 'DBUIRow';
const DOMList = 'DBUIList'; const DOMList = 'DBUIList';
...@@ -87,41 +102,39 @@ abstract class mcPUIX extends mcClass implements imcPUIX { ...@@ -87,41 +102,39 @@ abstract class mcPUIX extends mcClass implements imcPUIX {
return $this->DBTab[$param_tablename]; return $this->DBTab[$param_tablename];
} }
public function loadPDOTable(Account &$param_HostAccount, iStorable &$param_iStorable, $param_SQLWhere='', $param_depth=null) { public function loadPDOTable(Account &$param_HostAccount, iStorable &$param_iStorable, $param_SQLWhere='', $param_depth=null) {
$param_tablename = $this->RootTable; $DBTable = mcPUIX_PDO::getTableAsDBUIArray($param_HostAccount, $param_iStorable, $this->RootTable, $this->SearchAttributes, $param_SQLWhere, $param_depth);
if(is_array($DBTable)) {
if($param_SQLWhere==='' && !is_null($this->SearchAttributes)) { // D::show($DBTable, '$DBTable');
$param_SQLWhere = ' where '; $this->setTableValues($this->RootTable, $DBTable);
$bool_AND = false; $this->DBTab_State[$this->RootTable] = mcPUIX::STATE_LOADED;
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.'" ';
}
}
}
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 setData(Account &$param_HostAccount, iStorable &$param_iStorable, $param_values) { public function __toString() {
$var_string = parent::__toString();
$var_string .= '-['.$this->PUIXHostObject.']';
return $var_string;
}
/**
*
* @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; $param_tablename = $this->RootTable;
D::ulli(__CLASS__.'::'.__FUNCTION__.': ' . $param_tablename.' ## '.mcPUIX::STATE_CHANGED);
if(is_object($this->PUIXHostObject)) { if(is_object($this->PUIXHostObject)) {
if(mcArray::checkKeyHasFullArray($param_values, get_class($this->PUIXHostObject))) { if(mcArray::checkKeyHasFullArray($param_values, get_class($this->PUIXHostObject))) {
$values = $param_values[get_class($this->PUIXHostObject)]; $values = $param_values[get_class($this->PUIXHostObject)];
...@@ -142,6 +155,7 @@ abstract class mcPUIX extends mcClass implements imcPUIX { ...@@ -142,6 +155,7 @@ abstract class mcPUIX extends mcClass implements imcPUIX {
} }
public function savePDOTable(Account &$param_HostAccount, iStorable &$param_iStorable) { public function savePDOTable(Account &$param_HostAccount, iStorable &$param_iStorable) {
D::cf(get_class($this).' '.$this->RootTable);
$param_tablename = $this->RootTable; $param_tablename = $this->RootTable;
$DBUIArray_Values = $this->getTableValues($param_tablename); $DBUIArray_Values = $this->getTableValues($param_tablename);
...@@ -187,13 +201,17 @@ abstract class mcPUIX extends mcClass implements imcPUIX { ...@@ -187,13 +201,17 @@ abstract class mcPUIX extends mcClass implements imcPUIX {
$DOMElement->setAttribute('class', get_class($this)); $DOMElement->setAttribute('class', get_class($this));
$DOMElement->setAttribute('label', Language::getWord(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 = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX_edit);
$DOMElement_edit->setAttribute('edit', true); $DOMElement_edit->setAttribute('edit', true);
$DOMElement_edit->setAttribute('formpath', $this->getFormPathToThis()); $DOMElement_edit->setAttribute('formpath', $this->getFormPathToThis());
$DOMElement->appendChild($DOMElement_edit); $DOMElement->appendChild($DOMElement_edit);
$this->getDOMElement_edit($param_HostAccount, $param_iStorable, $param_DOMDocument, $DOMElement_edit, $param_KindOf, $param_DOMElemente); $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); $DOMElement_show = $param_DOMDocument->createElement(mcPUIX::DOMmcPUIX_show);
...@@ -218,7 +236,7 @@ abstract class mcPUIX extends mcClass implements imcPUIX { ...@@ -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) { 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) ) { if(mcArray::checkKeyHasFullArray($this->DBTab, $param_tablename, mcPUIX::PUIXArray, mcPUIX::PDOValues) ) {
//D::show($this->DBTab[$param_tablename][mcPUIX::PUIXArray][mcPUIX::PDOValues], $this);
$callbackfncForList = false; $callbackfncForList = false;
if(is_array($param_callbackfncForList) && !empty ($param_callbackfncForList)) { if(is_array($param_callbackfncForList) && !empty ($param_callbackfncForList)) {
$callbackfncForList = true; $callbackfncForList = true;
......
...@@ -7,7 +7,7 @@ class mcPUIX_DOM { ...@@ -7,7 +7,7 @@ class mcPUIX_DOM {
self::$double[] = $param_key; self::$double[] = $param_key;
return false; return false;
} else { } else {
D::cf('dobule key: '.$param_key); // D::cf('dobule key: '.$param_key);
return true; return true;
} }
} }
...@@ -33,6 +33,9 @@ class mcPUIX_DOM { ...@@ -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) { 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); // 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_ConfigArray, mcPUIX::PUIXArray, mcPUIX::DBUIConfig, $param_tablename)) {
if(mcArray::checkKeyHasFullArray($param_ValueArray, mcPUIX::PUIXArray, mcPUIX::PDOValues)) { if(mcArray::checkKeyHasFullArray($param_ValueArray, mcPUIX::PUIXArray, mcPUIX::PDOValues)) {
/** /**
...@@ -91,15 +94,30 @@ class mcPUIX_DOM { ...@@ -91,15 +94,30 @@ class mcPUIX_DOM {
); );
if(mcArray::checkKeyHasFullArray($value_row, mcPUIX::PUIXArray, mcPUIX::PDOValues)) { 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); $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]; // $value_row[mcPUIX::PUIXArray][mcPUIX::DOMValues] = $Reference_DOMValues[mcPUIX::PUIXArray][mcPUIX::DOMValues];
unset($value_row[mcPUIX::PUIXArray]); unset($value_row[mcPUIX::PUIXArray]);
} else { } else {
if(mcArray::checkKeyHasFullArray($value_row, mcPUIX::PUIXArray, mcPUIX::PDO_Special)) {
$Reference_DOMValues = mcPUIX_DOM::prepareArrayForDOMElement($Reference_TableName, $Reference_Config, null, $Reference_formpath, $Reference_SetDefault); $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])) { 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]; $row_val = $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename][$row_key];
...@@ -193,46 +211,33 @@ class mcPUIX_DOM { ...@@ -193,46 +211,33 @@ class mcPUIX_DOM {
&& array_key_exists(mcPUIX::FORM_NEW_ROW, $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename]['TABLE']) && 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] && $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;
}
}
}
}
$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]; if($BOOL_NEW_ROW) {
// $formpath = $param_formpath.'['.mcPUIX::FORM_NEW_ROW.']'; $return_NEW_ROW = mcPUIX_DOM::prepareArrayNEWROWForDOMElement($param_tablename, $param_ConfigArray, $param_formpath, $param_SetDefault);
// foreach($return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW] as $NEW_key => &$NEW_values) { $return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW] = $return_NEW_ROW[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW];
// 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 $return;
} }
return false; return false;
...@@ -254,7 +259,7 @@ class mcPUIX_DOM { ...@@ -254,7 +259,7 @@ class mcPUIX_DOM {
$return = array(mcPUIX::PUIXArray => array(mcPUIX::DOMValues => array())); $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]; $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) { 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) { if(array_key_exists('type', $NEW_values) && $NEW_values['type'] === mcPUIX::PUIXArray) {
unset($return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW][$NEW_key]); unset($return[mcPUIX::PUIXArray][mcPUIX::DOMValues][mcPUIX::FORM_NEW_ROW][$NEW_key]);
...@@ -263,7 +268,8 @@ class mcPUIX_DOM { ...@@ -263,7 +268,8 @@ class mcPUIX_DOM {
if(array_key_exists('edit', $NEW_values) && $NEW_values['edit']) { if(array_key_exists('edit', $NEW_values) && $NEW_values['edit']) {
$NEW_values['formpath'] = $formpath.'['.$NEW_key.']'; $NEW_values['formpath'] = $formpath.'['.$NEW_key.']';
if(self::checkDouble($NEW_values['formpath'])) { 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 { ...@@ -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; $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 $return;
} }
...@@ -394,9 +404,9 @@ class mcPUIX_DOM { ...@@ -394,9 +404,9 @@ class mcPUIX_DOM {
$DOMElement =$param_DOMDocument->createElement($param_ElementName); $DOMElement =$param_DOMDocument->createElement($param_ElementName);
if(is_string($value)) {
$DOMElement->nodeValue = Converter::encodeString($value); $DOMElement->nodeValue = Converter::encodeString($value);
}
if(array_key_exists('type', $param_ValuesAttributes)) { if(array_key_exists('type', $param_ValuesAttributes)) {
if($param_ValuesAttributes['type'] == mcPUIX::PUIXArray) { if($param_ValuesAttributes['type'] == mcPUIX::PUIXArray) {
...@@ -411,8 +421,12 @@ class mcPUIX_DOM { ...@@ -411,8 +421,12 @@ class mcPUIX_DOM {
// D::show($value, '$param_ValuesAttributes') ; // D::show($value, '$param_ValuesAttributes') ;
// $var_BCLink = SEOLink::getSEOLink($param_HostAccount, $param_iStorable, $PartOfObj, null, $param_EdgeName); // $var_BCLink = SEOLink::getSEOLink($param_HostAccount, $param_iStorable, $PartOfObj, null, $param_EdgeName);
// $var_labelarray = Language::getClassLinks($param_EdgeName, CONSTKindOf::LINK_SHOWBASISCLIPBOARD); // $var_labelarray = Language::getClassLinks($param_EdgeName, CONSTKindOf::LINK_SHOWBASISCLIPBOARD);
$DOMSEOLink = DOMElementHelper::getSEOLinkDOMElement($param_DOMDocument, $value['Host'], $value['SEOLink'], $value['Language'], $value['OptionalValues']);
$DOMElement->appendChild($DOMSEOLink); 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') { } else if($param_ValuesAttributes['type'] == 'text') {
$DOMElement->nodeValue = Converter::encodeString($value); $DOMElement->nodeValue = Converter::encodeString($value);
......
...@@ -12,6 +12,50 @@ class mcPUIX_PDO { ...@@ -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 string $param_tablename
* @param array $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename] * @param array $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename]
...@@ -27,15 +71,15 @@ class mcPUIX_PDO { ...@@ -27,15 +71,15 @@ class mcPUIX_PDO {
$ConfigArray = $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename]; $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(); $DeleteRows = $NewRows = $UpdateRows = $ErrorRows = array();
if(array_key_exists('TABLE', $ConfigArray)) { if(array_key_exists('TABLE', $ConfigArray)) {
$BoolRequired = $BoolPrimary = $BoolActiveRow = false; $BoolRequired = $BoolPrimary = $BoolActiveRow = $BoolDeleted = false;
if(mcArray::checkKeyHasFullArray($ConfigArray, mcPUIX::FORM_DO_ROW)) { if(mcArray::checkKeyHasFullArray($ConfigArray, mcPUIX::FORM_DO_ROW)) {
$BoolActiveRow = true; $BoolActiveRow = true;
...@@ -49,88 +93,132 @@ class mcPUIX_PDO { ...@@ -49,88 +93,132 @@ class mcPUIX_PDO {
} }
foreach($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES] as $NewKey => &$NewData) { foreach($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES] as $NewKey => &$NewData) {
// D::show($NewData, $NewKey. ' for ');
$BoolDeleted = false;
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;
}
}
}
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];
}
// D::show($NewData, 'NEW_ROW '.$NewKey);
}
if($BoolActiveRow === true) { if($NewKey===mcPUIX::FORM_NEW_ROW) {
// if(!array_key_exists(mcPUIX::FORM_DO_ROW, $NewData) || !$NewData[mcPUIX::FORM_DO_ROW]) { // D::show($NewData, '$NewData '.$NewKey);
if($NewData[mcPUIX::FORM_DO_ROW][mcPUIX::FORM_DO_VAR] === mcPUIX::FORM_DO_DELETE) { foreach($NewData as $NewFormRowKey => &$NewFormRow) {
$DeleteRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey]; if(is_array($NewFormRow)) {
unset($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey]);
// D::show($NewFormRow, $NewKey.' $NewFormRow '.$NewFormRowKey);
// } else if(array_key_exists($NewKey, $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES])) { $BoolDeleted = $BoolErrorRow = false;
} else if($NewData[mcPUIX::FORM_DO_ROW][mcPUIX::FORM_DO_VAR] === mcPUIX::FORM_DO_SAVE) { if(!mcPUIX_PDO::checkArrayIfIsRequired($ConfigArray, $NewFormRow)) {
$BoolErrorRow = false; $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey][$NewFormRowKey][mcPUIX::ERRORMESSAGE] = 'deleted after checkArrayIfIsRequired';
foreach($ConfigArray['TABLE']['PRIMARY'] as $PrimaryKey) { $ErrorRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey][$NewFormRowKey];
if(!array_key_exists($PrimaryKey, $NewData)) { unset($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey][$NewFormRowKey]);
$ErrorRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey]; $BoolDeleted = true;
$BoolErrorRow = true; $BoolErrorRow = true;
break;
} }
} // D::show($NewFormRow, '$NewFormRow after checkArrayIfIsRequired');
if($BoolErrorRow == false) {
$UpdateRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey];
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, $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) {
// 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;
}
} 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);
} }
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) { // D::show($ErrorRows, '$ErrorRows');
$UpdateRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey]; } else {
// break; // 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($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($NewData[mcPUIX::FORM_DO_ROW][mcPUIX::FORM_DO_VAR] === mcPUIX::FORM_DO_SAVE) {
$BoolErrorRow = false;
foreach($ConfigArray['TABLE']['PRIMARY'] as $PrimaryKey) {
if(!array_key_exists($PrimaryKey, $NewData)) {
$ErrorRows[] = $param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES][$NewKey];
$BoolErrorRow = true;
break;
}
}
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);
$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);
$result = array_merge_recursive ($result, $result_List);
}
}
} 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];
}
// }
}
} }
} }
} }
$result[mcPUIX::PUIXArray][mcPUIX::PDOToSaveValues][$param_tablename]['DeleteRows'] = $DeleteRows; $result[mcPUIX::PUIXArray][mcPUIX::PDOToSaveValues][$param_tablename]['DeleteRows'] = $DeleteRows;
$result[mcPUIX::PUIXArray][mcPUIX::PDOToSaveValues][$param_tablename]['UpdateRows'] = $UpdateRows; $result[mcPUIX::PUIXArray][mcPUIX::PDOToSaveValues][$param_tablename]['UpdateRows'] = $UpdateRows;
...@@ -139,6 +227,7 @@ class mcPUIX_PDO { ...@@ -139,6 +227,7 @@ class mcPUIX_PDO {
//D::show($result, '$result'); //D::show($result, '$result');
return $result; return $result;
} else { } else {
D::backtrace('prepareArrayForDBOperation');
D::cf('ERROR wrong format D::cf('ERROR wrong format
if(mcArray::checkKeyHasFullArray($param_ConfigArray, mcPUIX::PUIXArray, mcPUIX::DBUIConfig, '.$param_tablename.') if(mcArray::checkKeyHasFullArray($param_ConfigArray, mcPUIX::PUIXArray, mcPUIX::DBUIConfig, '.$param_tablename.')
=> '.mcArray::checkKeyHasFullArray($param_ConfigArray, mcPUIX::PUIXArray, mcPUIX::DBUIConfig, $param_tablename).' => '.mcArray::checkKeyHasFullArray($param_ConfigArray, mcPUIX::PUIXArray, mcPUIX::DBUIConfig, $param_tablename).'
...@@ -146,10 +235,119 @@ class mcPUIX_PDO { ...@@ -146,10 +235,119 @@ class mcPUIX_PDO {
=> '.mcArray::checkKeyHasFullArray($param_NewArray, mcPUIX::PUIXArray, mcPUIX::FORM_POST_VALUES).' => '.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;
}
/** /**
* return loaded PDO Table as PUIXArray * return loaded PDO Table as PUIXArray
...@@ -165,93 +363,165 @@ class mcPUIX_PDO { ...@@ -165,93 +363,165 @@ 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 = mcPUIX_CONFIG::getTableConfig($param_tablename);
$ConfigArray = $ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename]; $ConfigArray = $ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename];
$BOOL_Load=true;
if(mcArray::checkKeyHasFullArray($ConfigArray, 'TABLE') if($param_SQLWhere==='' && !is_null($param_SearchAttributes)) {
&& array_key_exists('TABLENAME', $ConfigArray['TABLE']) && $ConfigArray['TABLE']['TABLENAME']
) { if(array_key_exists(mcPUIX::PDOLoadDepth, $param_SearchAttributes)) {
$var_query = 'select * from '.$ConfigArray['TABLE']['TABLENAME'].' '.$param_SQLWhere; if($param_SearchAttributes[mcPUIX::PDOLoadDepth]===mcPUIX::PDOLoadDepth_OnlyNew) {
// where SNIfProfileID = 0 or SNIfProfileID = :SNIfProfileID '; $BOOL_Load=false;
// $var_bindValueArray = array(':SNIfProfileID' => $param_Object->getObjVar('Profile')->getObjVar('SNIfProfileID'), ); } else {
// D::cf(''.$var_query); $param_depth = $param_SearchAttributes[mcPUIX::PDOLoadDepth];
$stmt = $param_iStorable->PDO_query($var_query, $var_bindValueArray); }
unset($param_SearchAttributes[mcPUIX::PDOLoadDepth]);
if($stmt){ }
$PDOTable = $param_iStorable->PDO_fetchAll($stmt); if($BOOL_Load) {
// D::show($param_SearchAttributes, '$param_SearchAttributes');
if($param_depth>0) { $var_bindValueArray = array();
/** $returnFromSearchAttributes = mcPUIX_PDO::generateWhereFromSearchAttributes($param_SQLWhere, $var_bindValueArray, $param_SearchAttributes);
* is this a List_table and has a reference table $param_SQLWhere = ' where '.$param_SQLWhere;
*/ }
if(mcArray::checkKeyHasFullArray($ConfigArray['TABLE'], mcPUIX::PUIX_SUB_REFERENCELIST)) {
if($ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['TABLENAME'] && $ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['REFERENCE_KEY']) {
// $param_SQLWhere = ' where ';
foreach($PDOTable as &$PDORow) { // $bool_AND = false;
if($PDORow[$ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['REFERENCE_KEY']]) { // foreach($param_SearchAttributes as $col => $val) {
// D::show($PDORow, '$PDORow'); // if($col === mcPUIX::PDOLoadDepth) {
// D::show($ConfigArray, '$ConfigArray'); // if($val===mcPUIX::PDOLoadDepth_OnlyNew) {
$SQLWhere = ' where '.$ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['REFERENCE_KEY'].'='.$PDORow[$ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['REFERENCE_KEY']]; // $BOOL_Load=false;
$PDOTableList = mcPUIX_PDO::getTableAsDBUIArray($param_HostAccount, $param_iStorable, $ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['TABLENAME'], $SQLWhere, $param_depth-1); // } else {
if(mcArray::checkKeyHasFullArray($PDOTableList, mcPUIX::PUIXArray, mcPUIX::PDOValues)) { // $param_depth = $val;
$PDORow[mcPUIX::PUIXArray] = $PDOTableList[mcPUIX::PUIXArray]; // }
//
// }
// 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::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){
$PDOTable = $param_iStorable->PDO_fetchAll($stmt);
if($param_depth>0) {
/**
* is this a List_table and has a reference table
*/
if(mcArray::checkKeyHasFullArray($ConfigArray['TABLE'], mcPUIX::PUIX_SUB_REFERENCELIST)) {
if($ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['TABLENAME'] && $ConfigArray['TABLE'][mcPUIX::PUIX_SUB_REFERENCELIST]['REFERENCE_KEY']) {
foreach($PDOTable as &$PDORow) {
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']];
$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);
} }
// D::show($PDOTableList, '$PDOTableList: '.$SQLWhere);
} }
}
} }
} }
/** /**
* is this a element reference table from a list table * is this a element reference table from a list table
*/ */
ELSE IF(mcPUIX_CONFIG::getReferenceListTableName($param_tablename)) { ELSE IF(mcPUIX_CONFIG::getReferenceListTableName($param_tablename)) {
if(mcArray::checkKeyHasFullArray($ConfigArray['TABLE'], 'LISTID')) { if(mcArray::checkKeyHasFullArray($ConfigArray['TABLE'], 'LISTID')) {
$ReferenceListTableName = mcPUIX_CONFIG::getReferenceListTableName($param_tablename); $ReferenceListTableName = mcPUIX_CONFIG::getReferenceListTableName($param_tablename);
foreach($PDOTable as &$PDORow) { 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);
$SQLWhere = ' where '; $SearchAttributes=array();
$bool_AND = false; $SQLWhere = ' where ';
foreach($ConfigArray['TABLE']['LISTID'] as $ListIDKey) { $bool_AND = false;
if($bool_AND) { // mcPUIX::PDO_OR
$SQLWhere .= ' AND '; foreach($ConfigArray['TABLE']['LISTID'] as $ListIDKey) {
} else { if($bool_AND) {
$bool_AND = true; $SQLWhere .= ' AND ';
} else {
$bool_AND = true;
}
$SQLWhere .= ' '.$ListIDKey.'='.$PDORow[$ListIDKey];
$SearchAttributes[$ListIDKey] = $PDORow[$ListIDKey];
} }
$SQLWhere .= ' '.$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);
if(mcArray::checkKeyHasFullArray($PDOTableList, mcPUIX::PUIXArray, mcPUIX::PDOValues)) {
$PDORow[mcPUIX::PUIXArray] = $PDOTableList[mcPUIX::PUIXArray];
}
$PDOTableList = mcPUIX_PDO::getTableAsDBUIArray($param_HostAccount, $param_iStorable, $ReferenceListTableName, $SearchAttributes);
if(mcArray::checkKeyHasFullArray($PDOTableList, mcPUIX::PUIXArray, mcPUIX::PDOValues)) {
$PDORow[mcPUIX::PUIXArray] = $PDOTableList[mcPUIX::PUIXArray];
}
}
} }
} }
} }
}
$result = array(
mcPUIX::PUIXArray => array( $result = array(
mcPUIX::PDOValues => $PDOTable mcPUIX::PUIXArray => array(
) mcPUIX::PDOValues => $PDOTable
); )
// D::show($result, $var_query); );
return $result;
} else { if(mcArray::checkKeyHasFullArray($returnFromSearchAttributes, mcPUIX::PDO_Special)) {
return false; $result[mcPUIX::PUIXArray][mcPUIX::PDO_Special] = $returnFromSearchAttributes[mcPUIX::PDO_Special];
} }
// D::show($result, $var_query);
return $result;
} else {
return false;
}
}
} }
} }
...@@ -343,10 +613,10 @@ class mcPUIX_PDO { ...@@ -343,10 +613,10 @@ class mcPUIX_PDO {
unset($TableConfig['TABLENAME']); unset($TableConfig['TABLENAME']);
/** /**
* delete the rows * ErrorRows
*/ */
if(mcArray::checkKeyHasFullArray($preparedArray, 'ErrorRows')) { if(mcArray::checkKeyHasFullArray($preparedArray, 'ErrorRows')) {
D::show($preparedArray['ErrorRows'], 'ErrorRows'); // D::show($preparedArray['ErrorRows'], 'ErrorRows');
} }
/** /**
* delete the rows * delete the rows
...@@ -423,7 +693,9 @@ class mcPUIX_PDO { ...@@ -423,7 +693,9 @@ class mcPUIX_PDO {
if($NewRowSet) { if($NewRowSet) {
$newID = $param_iStorable->PDO_insertRow($ConfigArray['TABLE']['TABLENAME'], $ConfigArray['TABLE']['LISTID'], $ConfigArray['TABLE']['ELEMENTID'], $NewRowSet, true); $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) if(mcArray::checkKeyHasFullArray($NewRow, mcPUIX::PUIX_SUB_REFERENCELIST, mcPUIX::PUIXArray, mcPUIX::FORM_NEW_ROW)
&& mcArray::checkKeyHasFullArray($TableConfig, mcPUIX::PUIX_SUB_REFERENCELIST) && mcArray::checkKeyHasFullArray($TableConfig, mcPUIX::PUIX_SUB_REFERENCELIST)
&& $TableConfig[mcPUIX::PUIX_SUB_REFERENCELIST]['TABLENAME'] && $TableConfig[mcPUIX::PUIX_SUB_REFERENCELIST]['TABLENAME']
...@@ -431,8 +703,13 @@ class mcPUIX_PDO { ...@@ -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][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]'); // 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])); $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); $preparedNewSubRow = mcPUIX_PDO::prepareArrayForDBOperation($TableConfig[mcPUIX::PUIX_SUB_REFERENCELIST]['TABLENAME'], $param_ConfigArray, $NewSubArray);
// D::Show($preparedNewSubRow, '$preparedNewSubRow'); // D::Show($preparedNewSubRow, '$preparedNewSubRow');
mcPUIX_PDO::updateDatabaseTable($param_HostAccount, $param_iStorable, $param_ConfigArray, $preparedNewSubRow); mcPUIX_PDO::updateDatabaseTable($param_HostAccount, $param_iStorable, $param_ConfigArray, $preparedNewSubRow);
...@@ -475,9 +752,19 @@ class mcPUIX_PDO { ...@@ -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)) { if(is_array($param_UpdateRow) && !empty ($param_UpdateRow)) {
$return = array(); $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 * delete the mcPUIX::FORM_DO_VAR key
......
...@@ -17,29 +17,43 @@ ...@@ -17,29 +17,43 @@
<xsl:template match="mcPUIX" mode="dev"> <xsl:template match="mcPUIX" mode="dev">
<xsl:param name="param_inputBE">0</xsl:param> <xsl:param name="param_inputBE">0</xsl:param>
<h2><xsl:value-of select="@label" /></h2> <h2><xsl:value-of select="@label" /></h2>
<!-- <b><xsl:value-of select="$param_inputBE" /></b>-->
<table border="1">
<!-- <tr><td>show</td></tr>-->
<tr>
<td>
<xsl:apply-templates select="DOMmcPUIX_show/PUIXArray" mode="dev">
<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
</xsl:apply-templates>
<br/>
</td>
</tr>
<!-- <tr><td>edit</td></tr>-->
<tr>
<td>
<xsl:apply-templates select="DOMmcPUIX_edit/PUIXArray" mode="dev">
<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
</xsl:apply-templates>
<br/>
</td>
</tr>
</table>
</xsl:template>
<table border="1">
<xsl:if test="DOMmcPUIX_show/PUIXArray">
<tr>
<td>
<xsl:apply-templates select="DOMmcPUIX_show/PUIXArray" mode="dev">
<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
</xsl:apply-templates>
<br/>
</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">
<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
</xsl:apply-templates>
<br/>
</td>
</tr>
</xsl:if>
<tr><td><xsl:value-of select="$space"/></td></tr>
</table>
</xsl:template>
<xsl:template match="PUIXArray" mode="dev"> <xsl:template match="PUIXArray" mode="dev">
<xsl:param name="param_inputBE">0</xsl:param> <xsl:param name="param_inputBE">0</xsl:param>
...@@ -48,9 +62,9 @@ ...@@ -48,9 +62,9 @@
<xsl:choose> <xsl:choose>
<xsl:when test="@edit=1 and $param_noform=0"> <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"> <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:apply-templates select="DBUIElement" mode="dev">
<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param> <xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
</xsl:apply-templates> </xsl:apply-templates>
...@@ -59,26 +73,67 @@ ...@@ -59,26 +73,67 @@
<xsl:otherwise> <xsl:otherwise>
<!--<xsl:value-of select="count(DBUIRow[@i=mcPUIX::FORM_NEW_ROW])" />/<xsl:value-of select="count(DBUIRow)" />--> <!--<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="count(DBUIRow[@i='FORM_NEW_ROW'])!=count(DBUIRow)">
<table border="1"> <xsl:if test="DBUIRow">
<xsl:for-each select="DBUIRow"> <table border="1">
<xsl:for-each select="DBUIRow">
<xsl:choose>
<xsl:when test="position()=1">
<tr valign="top">
<xsl:for-each select="DBUIElement">
<xsl:if test="@show=1">
<td><b><xsl:value-of select="@label" /></b></td>
</xsl:if>
</xsl:for-each>
</tr>
</xsl:when>
</xsl:choose>
<xsl:choose> <xsl:choose>
<xsl:when test="position()=1"> <xsl:when test="@i='FORM_NEW_ROW'">
</xsl:when>
<xsl:otherwise>
<tr valign="top"> <tr valign="top">
<xsl:for-each select="DBUIElement"> <xsl:for-each select="DBUIElement">
<xsl:if test="@show=1"> <xsl:choose>
<td><b><xsl:value-of select="@label" /></b></td> <xsl:when test="@show=1">
</xsl:if> <td>
<!-- <xsl:value-of select="position()" />-->
<xsl:apply-templates select="." mode="dev">
<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
<xsl:with-param name="param_withoutLabel" >1</xsl:with-param>
</xsl:apply-templates>
</td>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="dev">
<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
<xsl:with-param name="param_withoutLabel" >1</xsl:with-param>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each> </xsl:for-each>
</tr> </tr>
</xsl:when> </xsl:otherwise>
</xsl:choose> </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> <xsl:choose>
<xsl:when test="@i='FORM_NEW_ROW'"> <xsl:when test="position()=1">
<tr valign="top">
</xsl:when> <xsl:for-each select="DBUIElement">
<xsl:otherwise> <xsl:if test="@show=1">
<td><b><xsl:value-of select="@label" /></b></td>
</xsl:if>
</xsl:for-each>
</tr>
<tr valign="top"> <tr valign="top">
<xsl:for-each select="DBUIElement"> <xsl:for-each select="DBUIElement">
<xsl:choose> <xsl:choose>
...@@ -99,51 +154,15 @@ ...@@ -99,51 +154,15 @@
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:for-each> </xsl:for-each>
</tr> </tr>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:for-each> </xsl:for-each>
</table> <xsl:value-of select="$space"/>
</table>
</xsl:if> </xsl:if>
<table border="1">
<xsl:for-each select="DBUIRow[@i='FORM_NEW_ROW']">
<xsl:choose>
<xsl:when test="position()=1">
<tr valign="top">
<xsl:for-each select="DBUIElement">
<xsl:if test="@show=1">
<td><b><xsl:value-of select="@label" /></b></td>
</xsl:if>
</xsl:for-each>
</tr>
<tr valign="top">
<xsl:for-each select="DBUIElement">
<xsl:choose>
<xsl:when test="@show=1">
<td>
<!-- <xsl:value-of select="position()" />-->
<xsl:apply-templates select="." mode="dev">
<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
<xsl:with-param name="param_withoutLabel" >1</xsl:with-param>
</xsl:apply-templates>
</td>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="dev">
<xsl:with-param name="param_inputBE" ><xsl:value-of select="$param_inputBE" /></xsl:with-param>
<xsl:with-param name="param_withoutLabel" >1</xsl:with-param>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</table>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
...@@ -309,6 +328,7 @@ ...@@ -309,6 +328,7 @@
</xsl:choose> </xsl:choose>
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
<xsl:value-of select="$space"/>
</span> </span>
</div> </div>
</span> </span>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!