Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ncphp
/
mcClasses
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 18ce4b7f
authored
Mar 30, 2012
by
Frederick d. Maus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mcPUIX
1 parent
abd01318
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
658 additions
and
217 deletions
D/class_D.inc.php
config.php
doOnTheStart.php
mcPUIX/Element.xsd
mcPUIX/class_mcPUIX.inc.php
mcPUIX/class_mcPUIX_CONFIG.inc.php
mcPUIX/class_mcPUIX_DOM.inc.php
mcPUIX/class_mcPUIX_PDO.inc.php
mcPUIX/mcPUIX.xsl
mcPUIX/phpunit/DBUIHelpers_PHPTest.php
mcPUIX/phpunit/basepath.inc.php
D/class_D.inc.php
View file @
18ce4b7
...
...
@@ -74,7 +74,8 @@ class D {
foreach
(
$param_bindValueArray
as
$string
=>
$value
)
{
$param_query
=
str_replace
(
$string
,
$value
,
$param_query
);
}
D
::
li
(
highlight_string
(
$param_query
,
true
));
// D::li(highlight_string($param_query, true));
D
::
li
(
$param_query
,
$param_print
,
$param_force
);
D
::
show
(
$param_bindValueArray
,
$param_query
);
}
...
...
config.php
View file @
18ce4b7
...
...
@@ -9,61 +9,77 @@ if(!isset($_LOSP_DEV)) {
$_LOSP_DEV
=
true
;
}
if
(
!
isset
(
$__mc_D_LOGFILE
))
{
/**
/**
* @todo @since 20110325 die vars müssen eigentlich hier aus __mc raus ... da sie freeSN abhängig sind @author f@mensch.coop
*/
if
(
isset
(
$_TREE
)
&&
$_TREE
)
{
if
(
isset
(
$_TREE
)
&&
$_TREE
)
{
$string
=
$_TREE
;
}
else
if
(
isset
(
$_PAGE_NAME
)
&&
$_PAGE_NAME
)
{
}
else
if
(
isset
(
$_PAGE_NAME
)
&&
$_PAGE_NAME
)
{
$string
=
$_PAGE_NAME
;
}
else
{
}
else
{
$string
=
'no'
;
}
}
if
(
!
isset
(
$__mc_D_LOGFILE
))
{
/**
* @var string -- file for the D Output
*/
$__mc_D_LOGFILE
=
$__BASEPATH_EX
.
'log/mc.'
.
$string
.
'.DEV_D.log'
;
//
}
if
(
!
isset
(
$__mc_D_LOGFILE_RESET
))
{
if
(
!
isset
(
$__mc_D_LOGFILE_RESET
))
{
/**
* @var bool
* remove every time the file and start a new file
* @author f@mensch.coop @since 20120301
*/
$__mc_D_LOGFILE_RESET
=
true
;
}
}
if
(
!
isset
(
$__mc_D_SCREENOUTPUT
))
{
/**
* @var boolean -- activate the D Output on screen
*/
$__mc_D_SCREENOUTPUT
=
false
;
}
if
(
!
isset
(
$__mc_PDO_LOGFILE
))
{
if
(
!
isset
(
$__mc_INPUT_LOGFILE
))
{
/**
* @var string -- file for the D Output
*/
$__mc_PDO_LOGFILE
=
$__BASEPATH_EX
.
'log/mc.'
.
$string
.
'.DEV_PDO.sql'
;
}
$__mc_INPUT_LOGFILE
=
$__BASEPATH_EX
.
'log/mc.'
.
$string
.
'.DEV_INPUT.log'
;
if
(
!
isset
(
$__mc_PDO
_LOGFILE_RESET
))
{
if
(
!
isset
(
$__mc_INPUT
_LOGFILE_RESET
))
{
/**
* @var bool
* remove every time the file and start a new file
* @author f@mensch.coop @since 20120301
*/
$__mc_PDO_LOGFILE_RESET
=
true
;
$__mc_INPUT_LOGFILE_RESET
=
true
;
}
}
if
(
!
isset
(
$__mc_PDO_LOGFILE
))
{
/**
* @var string -- file for the D Output
*/
$__mc_PDO_LOGFILE
=
$__BASEPATH_EX
.
'log/mc.'
.
$string
.
'.DEV_PDO.sql'
;
if
(
!
isset
(
$__mc_D_SCREENOUTPUT
))
{
if
(
!
isset
(
$__mc_PDO_LOGFILE_RESET
))
{
/**
* @var boolean -- activate the D Output on screen
* @var bool
* remove every time the file and start a new file
* @author f@mensch.coop @since 20120301
*/
$__mc_D_SCREENOUTPUT
=
false
;
$__mc_PDO_LOGFILE_RESET
=
true
;
}
}
if
(
!
isset
(
$__mcPerformance_backtrace
))
{
/**
* @var boolean -- activate the D Output on screen
...
...
doOnTheStart.php
View file @
18ce4b7
...
...
@@ -53,6 +53,27 @@ if($_LOSP_DEV) {
}
}
if
(
$__mc_INPUT_LOGFILE
)
{
$INPUTtext
=
print_r
(
array
(
'_GET'
=>
$_GET
,
'_POST'
=>
$_POST
),
true
);
if
(
$__mc_INPUT_LOGFILE_RESET
)
{
$var_message
=
'-- ['
.
date
(
'd. m. Y G:i'
)
.
'] DEVMODE: logfile wurde zurvor geloescht'
;
unlink
(
$__mc_INPUT_LOGFILE
);
mcFile
::
write
(
$__mc_INPUT_LOGFILE
,
$var_message
.
mcCONST
::
LINEBREAK
.
$INPUTtext
,
'w'
);
}
else
{
$var_message
=
mcCONST
::
LINEBREAK
.
mcCONST
::
LINEBREAK
.
mcCONST
::
LINEBREAK
.
mcCONST
::
LINEBREAK
.
mcCONST
::
LINEBREAK
.
mcCONST
::
LINEBREAK
.
'-- ################################################'
.
mcCONST
::
LINEBREAK
.
'-- ################################################'
.
mcCONST
::
LINEBREAK
.
'-- ################################################'
.
mcCONST
::
LINEBREAK
.
'-- # ['
.
date
(
'd. m. Y G:i'
)
.
'] DEVMODE #'
.
mcCONST
::
LINEBREAK
.
'-- ################################################'
.
mcCONST
::
LINEBREAK
;
mcFile
::
write
(
$__mc_INPUT_LOGFILE
,
$var_message
.
mcCONST
::
LINEBREAK
.
$INPUTtext
,
'a'
);
}
}
//mcFile::write('log/tmp.bla', date('d.m.Y G:i:s').': '.$_SERVER['SCRIPT_NAME'].' -- '.$_SERVER['REQUEST_URI'].mcCONST::TAB.($_SERVER['SCRIPT_NAME']==$_SERVER['REQUEST_URI']).mcCONST::LINEBREAK, 'a');
if
(
is_array
(
$__mc_Report
))
{
foreach
(
$__mc_Report
as
$Report
)
{
...
...
mcPUIX/Element.xsd
View file @
18ce4b7
...
...
@@ -56,7 +56,7 @@
</xsd:element>
<xsd:element
name=
"
DBUI
Array"
>
<xsd:element
name=
"
PUIX
Array"
>
<xsd:complexType
mixed=
"true"
>
<xsd:sequence>
<xsd:element
ref=
"DBUIRow"
minOccurs=
"0"
maxOccurs=
"unbounded"
/>
...
...
mcPUIX/class_mcPUIX.inc.php
View file @
18ce4b7
<?php
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
);
class
mcPUIX
extends
mcClass
{
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
PDOValues
=
'PDOValues'
;
const
PDOToSaveValues
=
'PDOToSaveValues'
;
const
PDOLoadDepth
=
'PDOLoadDepth'
;
const
DOMmcPUIX
=
'mcPUIX'
;
const
DOMmcPUIX_edit
=
'DOMmcPUIX_edit'
;
const
DOMmcPUIX_show
=
'DOMmcPUIX_show'
;
const
DOMRow
=
'DBUIRow'
;
const
DOMList
=
'DBUIList'
;
const
DOMElement
=
'DBUIElement'
;
const
DOMValues
=
'DOMValues'
;
##
// DBUIArray evt überprüfen
const
DBUIArray
=
'DBUIArray'
;
// PUIXArray evt überprüfen
const
PUIXArray
=
'PUIXArray'
;
// const FORMValues = 'DBUIFormValues'; mcPUIX::FORM_DO_ROW
const
FORM_POST_VALUES
=
'FORM_POST_VALUES'
;
const
FORM_REQUIRED
=
'FORM_REQUIRED'
;
// mcPUIX::FORM_REQUIRED
const
FORM_NEW_ROW
=
'FORM_NEW_ROW'
;
// mcPUIX::FORM_NEW_ROW
const
FORM_DO_VAR
=
'FORM_DO_VAR'
;
// mcPUIX::FORM_DO_VAR
const
FORM_DO_ROW
=
'FORM_DO_ROW'
;
// mcPUIX::FORM_DO_ROW
const
FORM_DO_SAVE
=
'FORM_DO_SAVE'
;
// mcPUIX::FORM_DO_SAVE
const
FORM_DO_DELETE
=
'FORM_DO_DELETE'
;
// mcPUIX::FORM_DO_DELETE
...
...
@@ -25,32 +46,39 @@ class mcPUIX extends mcClass {
const
FORM_DO_SELECT
=
'FORM_DO_SELECT'
;
// mcPUIX::FORM_DO_SELECT
const
FORM_TYPE_SEOLINK
=
'FORM_TYPE_SEOLINK'
;
const
FORM_TYPE_BASISELEMENT_SHORT
=
'FORM_TYPE_BASISELEMENT_SHORT'
;
const
STATE_LOADED
=
'loaded'
;
const
STATE_CHANGED
=
'changed'
;
const
STATE_SAVED
=
'saved'
;
private
$DBTab_State
=
array
();
protected
$RootTable
;
/**
*
* @var array('tablename' => array(mcPUIX::
DBUI
Array => array()))
* @var array('tablename' => array(mcPUIX::
PUIX
Array => array()))
*/
private
$DBTab
=
array
();
/**
*
* @var aBasisElementAddon
*/
protected
$
BasisElementAddon
=
null
;
protected
$
PUIXHostObject
=
null
;
public
$ThisClassName
;
public
function
__construct
(
aBasisElementAddon
$BasisElementAddon
)
{
public
function
__construct
(
$PUIXHostObject
)
{
$this
->
mcID
=
mcObjectStatistic
::
getCount__construct
(
$this
);
$this
->
BasisElementAddon
=
$BasisElementAddon
;
$this
->
PUIXHostObject
=
$PUIXHostObject
;
$this
->
ThisClassName
=
get_class
(
$this
);
$this
->
setRootTable
();
}
protected
$SearchAttributes
=
null
;
public
function
setSearchAttributes
(
array
$param_SearchAttributes
)
{
$this
->
SearchAttributes
=
$param_SearchAttributes
;
}
private
function
setTableValues
(
$param_tablename
,
$param_tablevalues
)
{
$this
->
DBTab
[
$param_tablename
]
=
$param_tablevalues
;
...
...
@@ -58,22 +86,63 @@ class mcPUIX extends mcClass {
public
function
getTableValues
(
$param_tablename
)
{
return
$this
->
DBTab
[
$param_tablename
];
}
public
function
loadPDOTable
(
Account
&
$param_HostAccount
,
iStorable
&
$param_iStorable
,
$param_tablename
,
$param_SQLWhere
=
''
,
$param_depth
=
0
)
{
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
.
'" '
;
}
}
}
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->
BasisElementAddon
);
// D::show($DBTable, '$DBTable '.$this->
PUIXHostObject
);
$this
->
setTableValues
(
$param_tablename
,
$DBTable
);
$this
->
DBTab_State
[
$param_tablename
]
=
mcPUIX
::
STATE_LOADED
;
}
public
function
setData
(
$param_tablename
,
$param_values
)
{
public
function
setData
(
Account
&
$param_HostAccount
,
iStorable
&
$param_iStorable
,
$param_values
)
{
$param_tablename
=
$this
->
RootTable
;
D
::
ulli
(
__CLASS__
.
'::'
.
__FUNCTION__
.
': '
.
$param_tablename
.
' ## '
.
mcPUIX
::
STATE_CHANGED
);
$this
->
setTableValues
(
$param_tablename
,
$param_values
);
$this
->
DBTab_State
[
$param_tablename
]
=
mcPUIX
::
STATE_CHANGED
;
if
(
is_object
(
$this
->
PUIXHostObject
))
{
if
(
mcArray
::
checkKeyHasFullArray
(
$param_values
,
get_class
(
$this
->
PUIXHostObject
)))
{
$values
=
$param_values
[
get_class
(
$this
->
PUIXHostObject
)];
}
else
{
return
false
;
}
}
else
{
$values
=
$param_values
;
}
if
(
mcArray
::
checkKeyHasFullArray
(
$values
,
$this
->
ThisClassName
,
mcPUIX
::
PUIXArray
,
mcPUIX
::
FORM_POST_VALUES
))
{
$this
->
manipulatePost_Data
(
$param_HostAccount
,
$param_iStorable
,
$values
[
$this
->
ThisClassName
][
mcPUIX
::
PUIXArray
][
mcPUIX
::
FORM_POST_VALUES
]);
}
public
function
savePDOTable
(
Account
&
$param_HostAccount
,
iStorable
&
$param_iStorable
,
$param_tablename
)
{
$this
->
setTableValues
(
$param_tablename
,
$values
[
$this
->
ThisClassName
]);
$this
->
DBTab_State
[
$param_tablename
]
=
mcPUIX
::
STATE_CHANGED
;
}
public
function
savePDOTable
(
Account
&
$param_HostAccount
,
iStorable
&
$param_iStorable
)
{
$param_tablename
=
$this
->
RootTable
;
$DBUIArray_Values
=
$this
->
getTableValues
(
$param_tablename
);
// D::show($this->DBTab , '$this->DBTab');
...
...
@@ -81,15 +150,15 @@ class mcPUIX extends mcClass {
$ManipulateTableConfig
=
null
;
$DBUIConfig
=
mcPUIX_CONFIG
::
getTableConfig
(
$param_tablename
,
$ManipulateTableConfig
);
// D::show($DBUIConfig, '$DBUIConfig');
if
(
mcArray
::
checkKeyHasFullArray
(
$DBUIConfig
,
mcPUIX
::
DBUIArray
,
mcPUIX
::
DBUIConfig
,
$param_tablename
,
'TABLE'
,
'LIST_TABLE'
,
'TABLENAME'
))
{
if
(
mcArray
::
checkKeyHasFullArray
(
$DBUIConfig
,
mcPUIX
::
PUIXArray
,
mcPUIX
::
DBUIConfig
,
$param_tablename
,
'TABLE'
,
mcPUIX
::
PUIX_SUB_REFERENCELIST
,
'TABLENAME'
))
{
$Tablename_LIST
=
mcPUIX_CONFIG
::
getReferenceTableName
(
$param_tablename
);
$ManipulateTableConfig
=
null
;
$DBUIConfig_LIST
=
mcPUIX_CONFIG
::
getTableConfig
(
$Tablename_LIST
,
$ManipulateTableConfig
);
$DBUIConfig
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$Tablename_LIST
]
=
$DBUIConfig_LIST
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
DBUIConfig
][
$Tablename_LIST
];
$DBUIConfig
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
][
$Tablename_LIST
]
=
$DBUIConfig_LIST
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
DBUIConfig
][
$Tablename_LIST
];
}
// D::show($DBUIArray_Values, $param_tablename);
$PreparedArray
=
mcPUIX_PDO
::
prepareArrayForDBOperation
(
$param_tablename
,
$DBUIConfig
,
$DBUIArray_Values
);
// D::show($PreparedArray, '$PreparedArray = mcPUIX_PDO::prepareArrayForDBOperation');
...
...
@@ -97,6 +166,19 @@ class mcPUIX extends mcClass {
$DBUIArrayNew
=
mcPUIX_PDO
::
updateDatabaseTable
(
$param_HostAccount
,
$param_iStorable
,
$DBUIConfig
,
$PreparedArray
);
$this
->
setTableValues
(
$param_tablename
,
$DBUIArrayNew
);
$this
->
DBTab_State
[
$param_tablename
]
=
mcPUIX
::
STATE_SAVED
;
if
(
is_array
(
$this
->
SearchAttributes
))
{
$this
->
loadPDOTable
(
$param_HostAccount
,
$param_iStorable
);
}
}
protected
function
getFormPathToThis
()
{
$formpath
=
''
;
if
(
is_object
(
$this
->
PUIXHostObject
))
{
$formpath
.=
'['
.
get_class
(
$this
->
PUIXHostObject
)
.
']'
;
}
$formpath
.=
'['
.
$this
->
ThisClassName
.
']['
.
mcPUIX
::
PUIXArray
.
']['
.
mcPUIX
::
FORM_POST_VALUES
.
']'
;
return
$formpath
;
}
public
function
getObjDOMElement
(
Account
&
$param_HostAccount
,
iStorable
&
$param_iStorable
,
DOMDocument
$param_DOMDocument
,
$param_KindOf
=
null
,
array
$param_DOMElemente
=
null
)
{
...
...
@@ -106,8 +188,18 @@ class mcPUIX extends mcClass {
$DOMElement
->
setAttribute
(
'label'
,
Language
::
getWord
(
get_class
(
$this
)));
if
(
$param_KindOf
==
'form'
)
{
$DOMElement
->
setAttribute
(
'edit'
,
true
);
$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_show
=
$param_DOMDocument
->
createElement
(
mcPUIX
::
DOMmcPUIX_show
);
$DOMElement
->
appendChild
(
$DOMElement_show
);
$this
->
getDOMElement_show
(
$param_HostAccount
,
$param_iStorable
,
$param_DOMDocument
,
$DOMElement_show
,
$param_KindOf
,
$param_DOMElemente
);
return
$DOMElement
;
}
...
...
@@ -125,7 +217,7 @@ class mcPUIX extends mcClass {
protected
static
$Tables
=
array
();
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
::
DBUI
Array
,
mcPUIX
::
PDOValues
)
)
{
if
(
mcArray
::
checkKeyHasFullArray
(
$this
->
DBTab
,
$param_tablename
,
mcPUIX
::
PUIX
Array
,
mcPUIX
::
PDOValues
)
)
{
$callbackfncForList
=
false
;
if
(
is_array
(
$param_callbackfncForList
)
&&
!
empty
(
$param_callbackfncForList
))
{
...
...
@@ -137,7 +229,7 @@ class mcPUIX extends mcClass {
$callbackfncForListElements
=
true
;
}
foreach
(
$this
->
DBTab
[
$param_tablename
][
mcPUIX
::
DBUI
Array
][
mcPUIX
::
PDOValues
]
as
&
$ListData
)
{
foreach
(
$this
->
DBTab
[
$param_tablename
][
mcPUIX
::
PUIX
Array
][
mcPUIX
::
PDOValues
]
as
&
$ListData
)
{
if
(
$callbackfncForList
)
{
foreach
(
$param_callbackfncForList
as
$fncForList
)
{
$this
->
$fncForList
(
$param_HostAccount
,
$param_iStorable
,
$ListData
);
...
...
@@ -155,5 +247,8 @@ class mcPUIX extends mcClass {
}
}
}
}
?>
\ No newline at end of file
mcPUIX/class_mcPUIX_CONFIG.inc.php
View file @
18ce4b7
...
...
@@ -12,7 +12,7 @@ class mcPUIX_CONFIG {
*
* @param string $param_tablename
* @param array $param_ManipulateTableConfig
* @return array( mcPUIX::
DBUI
Array => array( mcPUIX::DBUIConfig => array( $param_tablename => array()) ) ) || FALSE
* @return array( mcPUIX::
PUIX
Array => array( mcPUIX::DBUIConfig => array( $param_tablename => array()) ) ) || FALSE
*/
public
static
function
getTableConfig
(
$param_tablename
,
array
$param_ManipulateTableConfig
=
null
)
{
if
(
array_key_exists
(
$param_tablename
,
mcPUIX_CONFIG
::
$Tables
)
&&
is_array
(
mcPUIX_CONFIG
::
$Tables
[
$param_tablename
]))
{
...
...
@@ -28,7 +28,7 @@ class mcPUIX_CONFIG {
}
$result
=
array
(
mcPUIX
::
DBUI
Array
=>
array
(
mcPUIX
::
DBUIConfig
=>
array
(
$param_tablename
=>
$Config
)
)
mcPUIX
::
PUIX
Array
=>
array
(
mcPUIX
::
DBUIConfig
=>
array
(
$param_tablename
=>
$Config
)
)
);
return
$result
;
...
...
@@ -40,9 +40,9 @@ class mcPUIX_CONFIG {
}
public
static
function
getReferenceTableName
(
$param_tablename
)
{
if
(
mcArray
::
checkKeyHasFullArray
(
mcPUIX_CONFIG
::
$Tables
[
$param_tablename
],
'TABLE'
,
'LIST_TABLE'
))
{
if
(
mcPUIX_CONFIG
::
$Tables
[
$param_tablename
][
'TABLE'
][
'LIST_TABLE'
][
'TABLENAME'
])
{
$Tablename_LIST
=
mcPUIX_CONFIG
::
$Tables
[
$param_tablename
][
'TABLE'
][
'LIST_TABLE'
][
'TABLENAME'
];
if
(
mcArray
::
checkKeyHasFullArray
(
mcPUIX_CONFIG
::
$Tables
[
$param_tablename
],
'TABLE'
,
mcPUIX
::
PUIX_SUB_REFERENCELIST
))
{
if
(
mcPUIX_CONFIG
::
$Tables
[
$param_tablename
][
'TABLE'
][
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
'TABLENAME'
])
{
$Tablename_LIST
=
mcPUIX_CONFIG
::
$Tables
[
$param_tablename
][
'TABLE'
][
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
'TABLENAME'
];
}
else
{
return
false
;
}
...
...
@@ -53,5 +53,15 @@ class mcPUIX_CONFIG {
return
$Tablename_LIST
;
}
PUBLIC
STATIC
FUNCTION
getReferenceListTableName
(
$param_tablename
)
{
foreach
(
mcPUIX_CONFIG
::
$Tables
as
$tablename
=>
$tableValues
)
{
if
(
mcArray
::
checkKeyHasFullArray
(
$tableValues
,
'TABLE'
,
mcPUIX
::
PUIX_SUB_REFERENCELIST
)
&&
$tableValues
[
'TABLE'
][
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
'TABLENAME'
]
&&
$tableValues
[
'TABLE'
][
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
'TABLENAME'
]
===
$param_tablename
)
{
return
$tableValues
[
'TABLE'
][
'TABLENAME'
];
}
}
}
}
?>
\ No newline at end of file
mcPUIX/class_mcPUIX_DOM.inc.php
View file @
18ce4b7
<?
class
mcPUIX_DOM
{
private
static
$double
=
array
();
private
static
function
checkDouble
(
$param_key
)
{
if
(
false
===
array_search
(
$param_key
,
self
::
$double
))
{
self
::
$double
[]
=
$param_key
;
return
false
;
}
else
{
D
::
cf
(
'dobule key: '
.
$param_key
);
return
true
;
}
}
/**
* copy the param_ConfigArray into the value param_ValueArray
...
...
@@ -9,12 +18,12 @@ class mcPUIX_DOM {
* function prepare Array for @see mcPUIX_DOM::getDOMElement_DBUIArray
*
* @param string $param_tablename
* @param array $param_ConfigArray -- $param_ConfigArray[mcPUIX::
DBUI
Array][mcPUIX::DBUIConfig][$param_tablename] = array()
* @param array $param_ConfigArray -- $param_ConfigArray[mcPUIX::
PUIX
Array][mcPUIX::DBUIConfig][$param_tablename] = array()
* -- return from mcPUIX_CONFIG::getTableConfig
* @param array $param_ValueArray -- $param_ValueArray[mcPUIX::
DBUI
Array][mcPUIX::PDOValues] = array(0=>val1, 1=>val2)
* @param array $param_ValueArray -- $param_ValueArray[mcPUIX::
PUIX
Array][mcPUIX::PDOValues] = array(0=>val1, 1=>val2)
* @param array $param_SetDefault -- array( columnName1 => array( type=>, value=>, edit=>, show=>, ...), ... )
* @return array -- array(
* mcPUIX::
DBUI
Array => array(
* mcPUIX::
PUIX
Array => array(
* mcPUIX::DOMValues => array()
* )
* );
...
...
@@ -22,66 +31,79 @@ class mcPUIX_DOM {
* @since 20120307
* @author f
*/
public
static
function
prepareArrayForDOMElement
(
$param_tablename
,
array
$param_ConfigArray
,
array
$param_ValueArray
=
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);
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
,
mcPUIX
::
DBUI
Array
,
mcPUIX
::
DBUIConfig
,
$param_tablename
))
{
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ValueArray
,
mcPUIX
::
DBUI
Array
,
mcPUIX
::
PDOValues
))
{
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
,
mcPUIX
::
PUIX
Array
,
mcPUIX
::
DBUIConfig
,
$param_tablename
))
{
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ValueArray
,
mcPUIX
::
PUIX
Array
,
mcPUIX
::
PDOValues
))
{
/**
* condition: check if there is a reference table as list
*/
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
],
'TABLE'
,
'LIST_TABLE'
)
&&
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'LIST_TABLE'
][
'TABLENAME'
]
&&
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'LIST_TABLE'
][
'REFERENCE_KEY'
]
&&
$param_ConfigArray
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'ELEMENTID'
]
&&
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
],
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'LIST_TABLE'
][
'TABLENAME'
])
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
],
'TABLE'
,
mcPUIX
::
PUIX_SUB_REFERENCELIST
)
&&
$param_ConfigArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
'TABLENAME'
]
&&
$param_ConfigArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
'REFERENCE_KEY'
]
&&
$param_ConfigArray
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'ELEMENTID'
]
&&
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
],
$param_ConfigArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
'TABLENAME'
])
)
{
$Reference_Config
=
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'LIST_TABLE'
][
'TABLENAME'
]];
$Reference_TableName
=
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'LIST_TABLE'
][
'TABLENAME'
];
$Reference_Config
=
array
(
mcPUIX
::
DBUI
Array
=>
array
(
mcPUIX
::
DBUIConfig
=>
array
(
$Reference_TableName
=>
$Reference_Config
)
)
);
$Reference_ElementID
=
$param_ConfigArray
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'ELEMENTID'
];
$Reference_REFERENCE_KEY
=
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'LIST_TABLE'
][
'REFERENCE_KEY'
];
$Reference_Config
=
$param_ConfigArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
][
$param_ConfigArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
'TABLENAME'
]];
$Reference_TableName
=
$param_ConfigArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
'TABLENAME'
];
$Reference_Config
=
array
(
mcPUIX
::
PUIX
Array
=>
array
(
mcPUIX
::
DBUIConfig
=>
array
(
$Reference_TableName
=>
$Reference_Config
)
)
);
$Reference_ElementID
=
$param_ConfigArray
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'ELEMENTID'
];
$Reference_REFERENCE_KEY
=
$param_ConfigArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
'REFERENCE_KEY'
];
// D::show($Reference_Config, '$Reference_Config $Reference_ElementID:'.$Reference_ElementID.' ## $Reference_REFERENCE_KEY:'.$Reference_REFERENCE_KEY);
$Reference
=
true
;
}
else
{
$Reference
=
false
;
}
$copy_ConfigArray
=
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
];
//D::show(array($copy_ConfigArray, $param_ConfigArray) ,$param_tablename);
foreach
(
$param_ValueArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
PDOValues
]
as
&
$value_row
)
{
$formpath_index
=
0
;
/**
* Datenbankzeile vorbereiten
*/
foreach
(
$param_ValueArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
PDOValues
]
as
&
$value_row
)
{
$copy_ConfigArray
=
$param_ConfigArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
];
$formpath
=
$param_formpath
.
'['
.
$formpath_index
.
']'
;
$formpath_index
++
;
/**
* einzelne Spalten Elemente vorbereiten
*/
foreach
(
$value_row
as
$row_key
=>
&
$row_val
)
{
/**
* reference
*/
if
(
$row_key
===
mcPUIX
::
DBUIArray
)
{
if
(
$row_key
===
mcPUIX
::
PUIXArray
)
{
}
/**
* Reference List
*/
else
if
(
$row_val
===
mcPUIX
::
DBUI
Array
)
{
else
if
(
$row_val
===
mcPUIX
::
PUIX
Array
)
{
if
(
$Reference
)
{
$Reference_formpath
=
$formpath
.
'['
.
mcPUIX
::
PUIX_SUB_REFERENCELIST
.
']['
.
mcPUIX
::
PUIXArray
.
']'
;
$Reference_SetDefault
=
array
(
$Reference_REFERENCE_KEY
=>
array
(
'value'
=>
$value_row
[
$Reference_REFERENCE_KEY
][
'value'
]
)
);
// D::show(array($Reference_SetDefault, $value_row), '$Reference_SetDefault');
if
(
mcArray
::
checkKeyHasFullArray
(
$value_row
,
mcPUIX
::
DBUIArray
,
mcPUIX
::
PDOValues
))
{
$ReferenceValues
=
array
(
mcPUIX
::
DBUIArray
=>
array
(
mcPUIX
::
PDOValues
=>
$value_row
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
PDOValues
]));
$Reference_DOMValues
=
mcPUIX_DOM
::
prepareArrayForDOMElement
(
$Reference_TableName
,
$Reference_Config
,
$ReferenceValues
,
$Reference_SetDefault
);
// $value_row[mcPUIX::DBUIArray][mcPUIX::DOMValues] = $Reference_DOMValues[mcPUIX::DBUIArray][mcPUIX::DOMValues];
unset
(
$value_row
[
mcPUIX
::
DBUIArray
]);
if
(
mcArray
::
checkKeyHasFullArray
(
$value_row
,
mcPUIX
::
PUIXArray
,
mcPUIX
::
PDOValues
))
{
$ReferenceValues
=
array
(
mcPUIX
::
PUIXArray
=>
array
(
mcPUIX
::
PDOValues
=>
$value_row
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
PDOValues
]));
$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_SetDefault
);
$Reference_DOMValues
=
mcPUIX_DOM
::
prepareArrayForDOMElement
(
$Reference_TableName
,
$Reference_Config
,
null
,
$Reference_formpath
,
$Reference_SetDefault
);
}
if
(
array_key_exists
(
$row_key
,
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
]))
{
$row_val
=
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
$row_key
];
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
];
unset
(
$copy_ConfigArray
[
$row_key
]);
}
else
{
$row_val
=
array
();
...
...
@@ -95,9 +117,10 @@ class mcPUIX_DOM {
*/
else
{
$value
=
$row_val
;
//D::show($value, '$value '.$row_key);
if
(
array_key_exists
(
$row_key
,
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
]))
{
$row_val
=
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
$row_key
];
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
];
unset
(
$copy_ConfigArray
[
$row_key
]);
}
else
{
$row_val
=
array
();
...
...
@@ -117,7 +140,10 @@ class mcPUIX_DOM {
}
$row_val
[
'value'
]
=
$value
;
//D::show($row_val, '$row_val '.$row_key);
if
(
array_key_exists
(
'edit'
,
$row_val
)
&&
$row_val
[
'edit'
])
{
$row_val
[
'formpath'
]
=
$formpath
.
'['
.
$row_key
.
']'
;
self
::
checkDouble
(
$row_val
[
'formpath'
]);
}
}
}
...
...
@@ -136,18 +162,20 @@ class mcPUIX_DOM {
}
}
/**
* mcPUIX::FORM_DO_ROW -- Bestätigungs dropdown
* alle Datensätze sollen erstmal makiert sein -- da sie sonst gelöscht werden
*/
if
(
array_key_exists
(
mcPUIX
::
FORM_DO_ROW
,
$copy_ConfigArray
))
{
$copy_ConfigArray
[
mcPUIX
::
FORM_DO_ROW
][
'value'
]
=
mcPUIX
::
FORM_DO_SAVE
;
$copy_ConfigArray
[
mcPUIX
::
FORM_DO_ROW
][
'formpath'
]
=
$formpath
.
'['
.
mcPUIX
::
FORM_DO_ROW
.
']'
;
self
::
checkDouble
(
$copy_ConfigArray
[
mcPUIX
::
FORM_DO_ROW
][
'formpath'
]);
}
// D::show(array('array_merge' => array($value_row, $copy_ConfigArray)), '$value_row, $copy_ConfigArray');
$value_row
=
array_merge
(
$value_row
,
$copy_ConfigArray
);
// D::show($value_row, '$value_row');
}
$return
=
array
(
mcPUIX
::
DBUI
Array
=>
array
(
mcPUIX
::
DOMValues
=>
$param_ValueArray
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
PDOValues
]
mcPUIX
::
PUIX
Array
=>
array
(
mcPUIX
::
DOMValues
=>
$param_ValueArray
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
PDOValues
]
)
);
...
...
@@ -155,74 +183,138 @@ class mcPUIX_DOM {
}
else
{
$return
=
array
(
mcPUIX
::
DBUI
Array
=>
array
(
mcPUIX
::
PUIX
Array
=>
array
(
mcPUIX
::
DOMValues
=>
array
()
)
);
}
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
],
'TABLE'
)
&&
array_key_exists
(
'NEW_ROW'
,
$param_ConfigArray
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
])
&&
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'NEW_ROW'
]
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
],
'TABLE'
)
&&
array_key_exists
(
mcPUIX
::
FORM_NEW_ROW
,
$param_ConfigArray
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
])
&&
$param_ConfigArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
mcPUIX
::
FORM_NEW_ROW
]
)
{
$return
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DOMValues
][
'NEW_ROW'
]
=
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
];
foreach
(
$return
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DOMValues
][
'NEW_ROW'
]
as
$NEW_key
=>
&
$NEW_values
)
{
if
(
array_key_exists
(
'type'
,
$NEW_values
)
&&
$NEW_values
[
'type'
]
===
mcPUIX
::
DBUIArray
)
{
unset
(
$return
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DOMValues
][
'NEW_ROW'
][
$NEW_key
]);
$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
;
}
/**
*
* @param string $param_tablename
* @param array $param_ConfigArray
* @param string $param_formpath
* @param array $param_SetDefault -- array( columnName1 => array( type=>, value=>, edit=>, show=>, ...), ... )
* @return type
*/
public
static
function
prepareArrayNEWROWForDOMElement
(
$param_tablename
,
array
$param_ConfigArray
,
$param_formpath
=
null
,
array
$param_SetDefault
=
null
)
{
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
,
mcPUIX
::
PUIXArray
,
mcPUIX
::
DBUIConfig
,
$param_tablename
))
{
$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
.
']'
;
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
,
'self::checkDouble $NEW_values'
);
}
}
/**
* copy default values into
NEW_ROW
* 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
]);
$NEW_values
=
array_merge
(
$NEW_values
,
$param_SetDefault
[
$NEW_key
]);
}
}
}
if
(
$param_ConfigArray
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'ELEMENTID'
])
{
if
(
$param_ConfigArray
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'KINDOF'
]
===
'LIST'
)
{
unset
(
$return
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DOMValues
][
'NEW_ROW'
][
$param_ConfigArray
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'ELEMENTID'
]]);
if
(
$param_ConfigArray
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'ELEMENTID'
])
{
if
(
$param_ConfigArray
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'KINDOF'
]
===
'LIST'
)
{
unset
(
$return
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DOMValues
][
mcPUIX
::
FORM_NEW_ROW
][
$param_ConfigArray
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'ELEMENTID'
]]);
}
else
if
(
$param_ConfigArray
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'KINDOF'
]
===
'RELATION'
)
{
}
else
if
(
$param_ConfigArray
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
][
'TABLE'
][
'KINDOF'
]
===
'RELATION'
)
{
}
}
$return
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DOMValues
][
'NEW_ROW'
][
mcPUIX
::
FORM_DO_ROW
][
'value'
]
=
mcPUIX
::
FORM_DO_NEW
;
}
// D::show($return, '$return');
$return
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DOMValues
][
mcPUIX
::
FORM_NEW_ROW
][
mcPUIX
::
FORM_DO_ROW
][
'value'
]
=
mcPUIX
::
FORM_DO_NEW
;
return
$return
;
}
return
false
;
}
}
/**
* return DOMElement with
DBUI
Array
* return DOMElement with
PUIX
Array
*
* @param DOMDocument $param_DOMDocument
* @param array $param_Array -- $param_Array[mcPUIX::
DBUI
Array][mcPUIX::DOMValues] = array()
* @param array $param_Array -- $param_Array[mcPUIX::
PUIX
Array][mcPUIX::DOMValues] = array()
* -- return from mcPUIX_DOM::prepareArrayForDOMElement
* @return type
*/
public
static
function
getDOMElement_DBUIArray
(
DOMDocument
$param_DOMDocument
,
array
$param_Array
)
{
public
static
function
getDOMElement_DBUIArray
(
DOMDocument
$param_DOMDocument
,
array
$param_Array
,
$param_formpath
=
null
)
{
// D::show($param_Array, 'getDOMElement_DBUIArray');
$DOMElement
=
$param_DOMDocument
->
createElement
(
mcPUIX
::
DBUI
Array
);
$DOMElement
=
$param_DOMDocument
->
createElement
(
mcPUIX
::
PUIX
Array
);
if
(
mcArray
::
checkKeyHasFullArray
(
$param_Array
,
mcPUIX
::
DBUI
Array
,
mcPUIX
::
DOMValues
))
{
if
(
mcArray
::
checkKeyHasFullArray
(
$param_Array
,
mcPUIX
::
PUIX
Array
,
mcPUIX
::
DOMValues
))
{
$DOMElement
->
setAttribute
(
'count'
,
count
(
$param_Array
));
foreach
(
$param_Array
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
DOMValues
]
as
$i
=>
$row
)
{
foreach
(
$param_Array
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
DOMValues
]
as
$i
=>
$row
)
{
$DOMElement_Row
=
$DOMElement
->
appendChild
(
$param_DOMDocument
->
createElement
(
mcPUIX
::
DOMRow
));
$DOMElement_Row
->
setAttribute
(
'i'
,
$i
);
if
(
is_array
(
$row
))
{
// D::show($row, 'getDOMElement_DBUIArray'.$i);
foreach
(
$row
as
$column_name
=>
$column_value
)
{
// if(mcArray::checkKeyHasFullArray($column_value, 'value', mcPUIX::
DBUI
Array)) {
// if(mcArray::checkKeyHasFullArray($column_value, 'value', mcPUIX::
PUIX
Array)) {
// $DOM_Reference = mcPUIX_DOM::getDOMElement_DBUIArray($param_DOMDocument, $row);
// $DOMElement_Row->appendChild($DOM_Reference);
// // D::show($row,' JETZT NE NEUE TABELLE');
...
...
@@ -280,7 +372,7 @@ class mcPUIX_DOM {
if
(
array_key_exists
(
'value'
,
$param_ValuesAttributes
))
{
$value
=
$param_ValuesAttributes
[
'value'
];
unset
(
$param_ValuesAttributes
[
'value'
]);
if
(
mcArray
::
checkKeyHasFullArray
(
$value
,
mcPUIX
::
DBUI
Array
,
mcPUIX
::
DOMValues
))
{
if
(
mcArray
::
checkKeyHasFullArray
(
$value
,
mcPUIX
::
PUIX
Array
,
mcPUIX
::
DOMValues
))
{
$values_DBUArray
=
$value
;
$value
=
null
;
}
...
...
@@ -307,10 +399,14 @@ class mcPUIX_DOM {
if
(
array_key_exists
(
'type'
,
$param_ValuesAttributes
))
{
if
(
$param_ValuesAttributes
[
'type'
]
==
mcPUIX
::
DBUI
Array
)
{
if
(
$param_ValuesAttributes
[
'type'
]
==
mcPUIX
::
PUIX
Array
)
{
$DOM_Reference
=
mcPUIX_DOM
::
getDOMElement_DBUIArray
(
$param_DOMDocument
,
$values_DBUArray
);
$DOMElement
->
appendChild
(
$DOM_Reference
);
}
else
if
(
$param_ValuesAttributes
[
'type'
]
==
mcPUIX
::
FORM_TYPE_BASISELEMENT_SHORT
&&
is_subclass_of
(
$value
,
'BasisElement'
))
{
$DOMBE
=
$value
->
getShortObjDOMElement
(
$param_HostAccount
,
$param_iStorable
,
$param_DOMDocument
,
$param_DOMElementName
)
;
$DOMElement
->
appendChild
(
$DOMBE
);
}
else
if
(
$param_ValuesAttributes
[
'type'
]
==
mcPUIX
::
FORM_TYPE_SEOLINK
)
{
// D::show($value, '$param_ValuesAttributes') ;
// $var_BCLink = SEOLink::getSEOLink($param_HostAccount, $param_iStorable, $PartOfObj, null, $param_EdgeName);
...
...
mcPUIX/class_mcPUIX_PDO.inc.php
View file @
18ce4b7
<?
class
mcPUIX_PDO
{
public
static
function
getConfigColumnKeys
(
$param_Config
)
{
$ConfigArray_keys
=
array_keys
(
$param_Config
);
unset
(
$ConfigArray_keys
[
array_search
(
'TABLE'
,
$ConfigArray_keys
)]);
unset
(
$ConfigArray_keys
[
array_search
(
mcPUIX
::
FORM_DO_ROW
,
$ConfigArray_keys
)]);
return
$ConfigArray_keys
;
}
public
static
function
cleanDBRowData
(
$param_
)
{
}
/**
* @param string $param_tablename
* @param array $param_ConfigArray[mcPUIX::
DBUI
Array][mcPUIX::DBUIConfig][$param_tablename]
* @param array $param_NewArray => $param_NewArray[mcPUIX::
DBUIArray
] = array()
* @param array $param_ConfigArray[mcPUIX::
PUIX
Array][mcPUIX::DBUIConfig][$param_tablename]
* @param array $param_NewArray => $param_NewArray[mcPUIX::
PUIXArray][mcPUIX::FORM_POST_VALUES
] = array()
* @return array
*/
public
static
function
prepareArrayForDBOperation
(
$param_tablename
,
array
$param_ConfigArray
,
array
$param_NewArray
=
null
/*, array $param_OriginalArray=null*/
)
{
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
,
mcPUIX
::
DBUIArray
,
mcPUIX
::
DBUIConfig
,
$param_tablename
)
&&
mcArray
::
checkKeyHasFullArray
(
$param_NewArray
,
mcPUIX
::
DBUIArray
)
)
{
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
,
mcPUIX
::
PUIXArray
,
mcPUIX
::
DBUIConfig
,
$param_tablename
)
&&
mcArray
::
checkKeyHasFullArray
(
$param_NewArray
,
mcPUIX
::
PUIXArray
,
mcPUIX
::
FORM_POST_VALUES
)
)
{
//D::show($param_NewArray, '$param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES]');
// D::show(array($param_NewArray[mcPUIX::PUIXArray][mcPUIX::FORM_POST_VALUES], $param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$param_tablename]), $param_tablename. ' for ');
// D::show(array($param_NewArray[mcPUIX::DBUIArray], $param_ConfigArray[mcPUIX::DBUIArray][mcPUIX::DBUIConfig][$param_tablename]), $param_tablename. ' for ')
;
$ConfigArray
=
$param_ConfigArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
]
;
$ConfigArray
=
$param_ConfigArray
[
mcPUIX
::
DBUIArray
][
mcPUIX
::
DBUIConfig
][
$param_tablename
];
$result
=
array
(
mcPUIX
::
DBUIArray
=>
array
(
mcPUIX
::
PDOToSaveValues
=>
array
(
$param_tablename
=>
$result
)));
$ConfigArray_keys
=
mcPUIX_PDO
::
getConfigColumnKeys
(
$ConfigArray
);
$result
=
array
(
mcPUIX
::
PUIXArray
=>
array
(
mcPUIX
::
PDOToSaveValues
=>
array
(
$param_tablename
=>
$result
)));
$DeleteRows
=
$NewRows
=
$UpdateRows
=
$ErrorRows
=
array
();
...
...
@@ -27,37 +41,38 @@ class mcPUIX_PDO {
$BoolActiveRow
=
true
;
}
if
(
array_key_exists
(
'REQUIRED'
,
$ConfigArray
[
'TABLE'
])
&&
is_array
(
$ConfigArray
[
'TABLE'
][
'REQUIRED'
]))
{
if
(
array_key_exists
(
mcPUIX
::
FORM_REQUIRED
,
$ConfigArray
[
'TABLE'
])
&&
is_array
(
$ConfigArray
[
'TABLE'
][
mcPUIX
::
FORM_REQUIRED
]))
{
$BoolRequired
=
true
;
}
if
(
array_key_exists
(
'PRIMARY'
,
$ConfigArray
[
'TABLE'
])
&&
is_array
(
$ConfigArray
[
'TABLE'
][
'PRIMARY'
]))
{
$BoolPrimary
=
true
;
}
foreach
(
$param_NewArray
[
mcPUIX
::
DBUIArray
]
as
$NewKey
=>
&
$NewData
)
{
foreach
(
$param_NewArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
FORM_POST_VALUES
]
as
$NewKey
=>
&
$NewData
)
{
// D::show($NewData, $NewKey. ' for ');
if
(
$BoolRequired
===
true
)
{
foreach
(
$ConfigArray
[
'TABLE'
][
'REQUIRED'
]
as
$RequiredKey
)
{
if
(
!
array_key_exists
(
$RequiredKey
,
$NewData
)
||
!
$NewData
[
$RequiredKey
])
{
$ErrorRows
[]
=
$param_NewArray
[
mcPUIX
::
DBUIArray
][
$NewKey
];
unset
(
$param_NewArray
[
mcPUIX
::
DBUIArray
][
$NewKey
]);
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( 'NEW_ROW' === $NewKey) {
if
(
$NewData
[
mcPUIX
::
FORM_DO_ROW
]
===
mcPUIX
::
FORM_DO_NEW
)
{
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
::
DBUIArray
][
$NewKey
];
$ErrorRows
[]
=
$param_NewArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
FORM_POST_VALUES
][
$NewKey
];
$BoolErrorRow
=
true
;
break
;
}
}
if
(
$BoolErrorRow
===
false
)
{
$NewRows
[]
=
$param_NewArray
[
mcPUIX
::
DBUIArray
][
$NewKey
];
$NewRows
[]
=
$param_NewArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
FORM_POST_VALUES
][
$NewKey
];
}
// D::show($NewData, 'NEW_ROW '.$NewKey);
...
...
@@ -66,26 +81,26 @@ class mcPUIX_PDO {
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_DELETE
)
{
$DeleteRows
[]
=
$param_NewArray
[
mcPUIX
::
DBUIArray
][
$NewKey
];
unset
(
$param_NewArray
[
mcPUIX
::
DBUIArray
][
$NewKey
]);
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::
DBUIArray
])) {
}
else
if
(
$NewData
[
mcPUIX
::
FORM_DO_ROW
]
===
mcPUIX
::
FORM_DO_SAVE
)
{
// } 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
)
{
if
(
!
array_key_exists
(
$PrimaryKey
,
$NewData
))
{
$ErrorRows
[]
=
$param_NewArray
[
mcPUIX
::
DBUIArray
][
$NewKey
];
$ErrorRows
[]
=
$param_NewArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
FORM_POST_VALUES
][
$NewKey
];
$BoolErrorRow
=
true
;
break
;
}
}
if
(
$BoolErrorRow
==
false
)
{
$UpdateRows
[]
=
$param_NewArray
[
mcPUIX
::
DBUIArray
][
$NewKey
];
$UpdateRows
[]
=
$param_NewArray
[
mcPUIX
::
PUIXArray
][
mcPUIX
::
FORM_POST_VALUES
][
$NewKey
];
}
if
(
mcArray
::
checkKeyHasFullArray
(
$NewData
,
mcPUIX
::
DBUI
Array
))
{
if
(
mcArray
::
checkKeyHasFullArray
(
$NewData
,
mcPUIX
::
PUIX_SUB_REFERENCELIST
,
mcPUIX
::
PUIX
Array
))
{
$Tablename_LIST
=
mcPUIX_CONFIG
::
getReferenceTableName
(
$param_tablename
);
/**
...
...
@@ -93,18 +108,23 @@ class mcPUIX_PDO {
*
* QQQQQQQQQQQQQQ hier muss code hin
*/
// D::show($param_ConfigArray[mcPUIX::
DBUI
Array][mcPUIX::DBUIConfig][$Tablename_LIST], $Tablename_LIST.' CONFIG');
// D::show($NewData[mcPUIX::
DBUI
Array], '1 '.$Tablename_LIST);
// D::show($param_ConfigArray[mcPUIX::
PUIX
Array][mcPUIX::DBUIConfig][$Tablename_LIST], $Tablename_LIST.' CONFIG');
// D::show($NewData[mcPUIX::
PUIX_SUB_REFERENCELIST][mcPUIX::PUIX
Array], '1 '.$Tablename_LIST);
// D::cf('1 '.$Tablename_LIST);
$result_List
=
mcPUIX_PDO
::
prepareArrayForDBOperation
(
$Tablename_LIST
,
$param_ConfigArray
,
$NewData
);
$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::
DBUIArray][mcPUIX::PDOToSaveValues][$Tablename_LIST] = $result_List[mcPUIX::DBUI
Array][mcPUIX::PDOToSaveValues][$Tablename_LIST];
// $result[mcPUIX::
PUIXArray][mcPUIX::PDOToSaveValues][$Tablename_LIST] = $result_List[mcPUIX::PUIX
Array][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_SAVE
)
{
$UpdateRows
[]
=
$param_NewArray
[
mcPUIX
::
DBUIArray
][
$NewKey
];
}
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;
}
}
...
...
@@ -112,33 +132,42 @@ class mcPUIX_PDO {
}
$result
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
PDOToSaveValues
][
$param_tablename
][
'DeleteRows'
]
=
$DeleteRows
;
$result
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
PDOToSaveValues
][
$param_tablename
][
'UpdateRows'
]
=
$UpdateRows
;
$result
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
PDOToSaveValues
][
$param_tablename
][
'ErrorRows'
]
=
$ErrorRows
;
$result
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
PDOToSaveValues
][
$param_tablename
][
'NewRows'
]
=
$NewRows
;
$result
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
PDOToSaveValues
][
$param_tablename
][
'DeleteRows'
]
=
$DeleteRows
;
$result
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
PDOToSaveValues
][
$param_tablename
][
'UpdateRows'
]
=
$UpdateRows
;
$result
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
PDOToSaveValues
][
$param_tablename
][
'ErrorRows'
]
=
$ErrorRows
;
$result
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
PDOToSaveValues
][
$param_tablename
][
'NewRows'
]
=
$NewRows
;
//D::show($result, '$result');
return
$result
;
}
else
{
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
)
.
'
&& mcArray::checkKeyHasFullArray($param_NewArray, mcPUIX::PUIXArray, mcPUIX::FORM_POST_VALUES)
=> '
.
mcArray
::
checkKeyHasFullArray
(
$param_NewArray
,
mcPUIX
::
PUIXArray
,
mcPUIX
::
FORM_POST_VALUES
)
.
'
) {
'
);
}
}
/**
* return loaded PDO Table as
DBUI
Array
* return loaded PDO Table as
PUIX
Array
*
* @param Account $param_HostAccount
* @param PDOLevel $param_iStorable
* @param string $param_tablename
* @param array $param_SelectArray
* @param string $param_SQLWhere
* @param int $param_depth
* @return array(
* mcPUIX::
DBUI
Array => array(
* mcPUIX::
PUIX
Array => array(
* mcPUIX::PDOValues => array(0=>val1, 1=>val2)
* )
* )
*/
public
static
function
getTableAsDBUIArray
(
Account
&
$param_HostAccount
,
PDOLevel
&
$param_iStorable
,
$param_tablename
,
$param_SQLWhere
=
''
,
$param_depth
=
0
)
{
$ConfigArray
=
mcPUIX_CONFIG
::
getTableConfig
(
$param_tablename
);
$ConfigArray
=
$ConfigArray
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
];
$ConfigArray
=
$ConfigArray
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
DBUIConfig
][
$param_tablename
];
if
(
mcArray
::
checkKeyHasFullArray
(
$ConfigArray
,
'TABLE'
)
&&
array_key_exists
(
'TABLENAME'
,
$ConfigArray
[
'TABLE'
])
&&
$ConfigArray
[
'TABLE'
][
'TABLENAME'
]
...
...
@@ -153,17 +182,20 @@ class mcPUIX_PDO {
$PDOTable
=
$param_iStorable
->
PDO_fetchAll
(
$stmt
);
if
(
$param_depth
>
0
)
{
if
(
mcArray
::
checkKeyHasFullArray
(
$ConfigArray
[
'TABLE'
],
'LIST_TABLE'
))
{
if
(
$ConfigArray
[
'TABLE'
][
'LIST_TABLE'
][
'TABLENAME'
]
&&
$ConfigArray
[
'TABLE'
][
'LIST_TABLE'
][
'REFERENCE_KEY'
])
{
/**
* 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'
][
'LIST_TABLE'
][
'REFERENCE_KEY'
]])
{
if
(
$PDORow
[
$ConfigArray
[
'TABLE'
][
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
'REFERENCE_KEY'
]])
{
// D::show($PDORow, '$PDORow');
// D::show($ConfigArray, '$ConfigArray');
$SQLWhere
=
' where '
.
$ConfigArray
[
'TABLE'
][
'LIST_TABLE'
][
'REFERENCE_KEY'
]
.
'='
.
$PDORow
[
$ConfigArray
[
'TABLE'
][
'LIST_TABLE'
][
'REFERENCE_KEY'
]];
$PDOTableList
=
mcPUIX_PDO
::
getTableAsDBUIArray
(
$param_HostAccount
,
$param_iStorable
,
$ConfigArray
[
'TABLE'
][
'LIST_TABLE'
][
'TABLENAME'
],
$SQLWhere
,
$param_depth
-
1
);
if
(
mcArray
::
checkKeyHasFullArray
(
$PDOTableList
,
mcPUIX
::
DBUI
Array
,
mcPUIX
::
PDOValues
))
{
$PDORow
[
mcPUIX
::
DBUIArray
]
=
$PDOTableList
[
mcPUIX
::
DBUI
Array
];
$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
::
PUIX
Array
,
mcPUIX
::
PDOValues
))
{
$PDORow
[
mcPUIX
::
PUIXArray
]
=
$PDOTableList
[
mcPUIX
::
PUIX
Array
];
}
// D::show($PDOTableList, '$PDOTableList: '.$SQLWhere);
...
...
@@ -173,13 +205,45 @@ class mcPUIX_PDO {
}
}
/**
* is this a element reference table from a list table
*/
ELSE
IF
(
mcPUIX_CONFIG
::
getReferenceListTableName
(
$param_tablename
))
{
if
(
mcArray
::
checkKeyHasFullArray
(
$ConfigArray
[
'TABLE'
],
'LISTID'
))
{
$ReferenceListTableName
=
mcPUIX_CONFIG
::
getReferenceListTableName
(
$param_tablename
);
foreach
(
$PDOTable
as
&
$PDORow
)
{
// D::show($ConfigArray['TABLE']['LISTID'], '$ReferenceListTableName = '.$ReferenceListTableName.' '.$ConfigArray['TABLE']['LISTID'].' ---- '.$SQLWhere);
$SQLWhere
=
' where '
;
$bool_AND
=
false
;
foreach
(
$ConfigArray
[
'TABLE'
][
'LISTID'
]
as
$ListIDKey
)
{
if
(
$bool_AND
)
{
$SQLWhere
.=
' AND '
;
}
else
{
$bool_AND
=
true
;
}
$SQLWhere
.=
' '
.
$ListIDKey
.
'='
.
$PDORow
[
$ListIDKey
];
}
// 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
];
}
}
}
}
}
$result
=
array
(
mcPUIX
::
DBUI
Array
=>
array
(
mcPUIX
::
PUIX
Array
=>
array
(
mcPUIX
::
PDOValues
=>
$PDOTable
)
);
...
...
@@ -191,15 +255,26 @@ class mcPUIX_PDO {
}
}
p
ublic
static
function
getDatabaseTable_where
(
$param_PrimaryKeys
,
$param_PrimaryValues
,
&
$param_query
,
array
&
$param_bindValueArray
)
{
p
rivate
static
function
getDatabaseTable_where
(
$param_PrimaryKeys
,
$param_PrimaryValues
,
&
$param_query
,
array
&
$param_bindValueArray
)
{
$param_query
.=
' where '
;
foreach
(
$param_PrimaryKeys
as
$Pkey
=>
$PrimaryKey
)
{
if
(
array_key_exists
(
$PrimaryKey
,
$param_PrimaryValues
)){
if
(
$Pkey
>
0
)
{
$param_query
.=
' and '
;
}
$param_query
.=
' '
.
$PrimaryKey
.
'=:'
.
$PrimaryKey
.
'_'
.
$param_PrimaryValues
[
$PrimaryKey
];
$param_bindValueArray
[
':'
.
$PrimaryKey
.
'_'
.
$param_PrimaryValues
[
$PrimaryKey
]]
=
$param_PrimaryValues
[
$PrimaryKey
];
if
(
array_key_exists
(
mcPUIX
::
FORM_DO_VAR
,
$param_PrimaryValues
[
$PrimaryKey
]))
{
$PValue
=
$param_PrimaryValues
[
$PrimaryKey
][
mcPUIX
::
FORM_DO_VAR
];
}
else
{
$PValue
=
$param_PrimaryValues
[
$PrimaryKey
];
}
//D::show($param_PrimaryValues[$PrimaryKey], $PrimaryKey.' = '.$PValue. ' -- '.$param_PrimaryValues[$PrimaryKey][mcPUIX::FORM_DO_VAR]);
$param_query
.=
' '
.
$PrimaryKey
.
'=:'
.
$PrimaryKey
.
'_'
.
$PValue
;
$param_bindValueArray
[
':'
.
$PrimaryKey
.
'_'
.
$PValue
]
=
$PValue
;
// $param_query .= ' '.$PrimaryKey.'=:'.$PrimaryKey.'_'.$param_PrimaryValues[$PrimaryKey];
// $param_bindValueArray[':'.$PrimaryKey.'_'.$param_PrimaryValues[$PrimaryKey]] = $param_PrimaryValues[$PrimaryKey];
}
else
{
return
Error
::
newError
(
'DevError'
,
"not enough primary values for keys "
,
$param_query
);
}
...
...
@@ -207,20 +282,45 @@ class mcPUIX_PDO {
return
true
;
}
/**
*
* @param Account $param_HostAccount
* @param PDOLevel $param_iStorable
* @param array $param_ConfigArray -- array(
* mcPUIX::PUIXArray => array(
* mcPUIX::DBUIConfig => array(
* tablename => array()
* )
* )
* )
* @param array $param_PreparedArray -- return from mcPUIX_PDO::prepareArrayForDBOperation()
* array(
* mcPUIX::PUIXArray => array(
* mcPUIX::PDOToSaveValues => array(
* tablename => array(
* 'DeleteRows' => array(),
* 'UpdateRows' => array(),
* 'NewRows' => array(),
* )
* )
* )
* )
* @return type
*/
public
static
function
updateDatabaseTable
(
Account
&
$param_HostAccount
,
PDOLevel
&
$param_iStorable
,
array
$param_ConfigArray
,
array
$param_PreparedArray
=
null
)
{
// [mcPUIX::
DBUI
Array][mcPUIX::PDOToSaveValues][$param_tablename]
// [mcPUIX::
DBUI
Array][mcPUIX::DBUIConfig][$param_tablename]
// D::show($param_PreparedArray,'##########updateDatabaseTable: $param_
Config
Array');
// [mcPUIX::
PUIX
Array][mcPUIX::PDOToSaveValues][$param_tablename]
// [mcPUIX::
PUIX
Array][mcPUIX::DBUIConfig][$param_tablename]
// D::show($param_PreparedArray,'##########updateDatabaseTable: $param_
Prepared
Array');
// D::show($param_ConfigArray, '$param_ConfigArray');
// D::show($param_PreparedArray, '$param_PreparedArray: ');
if
(
mcArray
::
checkKeyHasFullArray
(
$param_PreparedArray
,
mcPUIX
::
DBUI
Array
,
mcPUIX
::
PDOToSaveValues
))
{
if
(
mcArray
::
checkKeyHasFullArray
(
$param_PreparedArray
,
mcPUIX
::
PUIX
Array
,
mcPUIX
::
PDOToSaveValues
))
{
// D::ulli($tablename.' before');
foreach
(
$param_PreparedArray
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
PDOToSaveValues
]
as
$tablename
=>
$preparedArray
)
{
foreach
(
$param_PreparedArray
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
PDOToSaveValues
]
as
$tablename
=>
$preparedArray
)
{
//D::show($preparedArray, '$tablename: '.$tablename);
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
,
mcPUIX
::
DBUI
Array
,
mcPUIX
::
DBUIConfig
,
$tablename
))
{
if
(
mcArray
::
checkKeyHasFullArray
(
$param_ConfigArray
,
mcPUIX
::
PUIX
Array
,
mcPUIX
::
DBUIConfig
,
$tablename
))
{
$ConfigArray
=
$param_ConfigArray
[
mcPUIX
::
DBUI
Array
][
mcPUIX
::
DBUIConfig
][
$tablename
];
$ConfigArray
=
$param_ConfigArray
[
mcPUIX
::
PUIX
Array
][
mcPUIX
::
DBUIConfig
][
$tablename
];
// D::show(array($ConfigArray, $preparedArray), $i++.' updateDatabaseTable: '.$tablename);
...
...
@@ -245,9 +345,16 @@ class mcPUIX_PDO {
/**
* delete the rows
*/
if
(
mcArray
::
checkKeyHasFullArray
(
$preparedArray
,
'ErrorRows'
))
{
D
::
show
(
$preparedArray
[
'ErrorRows'
],
'ErrorRows'
);
}
/**
* delete the rows
*/
if
(
mcArray
::
checkKeyHasFullArray
(
$preparedArray
,
'DeleteRows'
))
{
foreach
(
$preparedArray
[
'DeleteRows'
]
as
$DeleteRow
)
{
$DeleteRow
=
mcPUIX_PDO
::
formatForUpdateRowArray
(
$DeleteRow
);
$var_bindValueArray
=
array
();
$var_query
=
'delete from '
.
$ConfigArray
[
'TABLE'
][
'TABLENAME'
]
.
' '
;
...
...
@@ -268,6 +375,7 @@ class mcPUIX_PDO {
if
(
mcArray
::
checkKeyHasFullArray
(
$preparedArray
,
'UpdateRows'
))
{
foreach
(
$preparedArray
[
'UpdateRows'
]
as
$UpdateRow
)
{
$UpdateRow
=
mcPUIX_PDO
::
formatForUpdateRowArray
(
$UpdateRow
);
//D::show(array($TableConfig,$UpdateRow),'UpdateRows UpdateRows');
$var_bindValueArray
=
array
();
$var_query
=
'update '
.
$ConfigArray
[
'TABLE'
][
'TABLENAME'
]
.
' set '
;
...
...
@@ -275,7 +383,7 @@ class mcPUIX_PDO {
$bool_doUpdate
=
false
;
foreach
(
$UpdateRow
as
$row_key
=>
$row_value
)
{
if
(
$row_key
!==
mcPUIX
::
FORM_DO_ROW
&&
$row_key
!==
mcPUIX
::
DBUI
Array
&&
$row_key
!==
mcPUIX
::
PUIX
Array
&&
false
===
array_search
(
$row_key
,
$TableConfig
[
'PRIMARY'
]))
{
if
(
$i
>
0
)
{
$var_query
.=
', '
;
...
...
@@ -306,23 +414,51 @@ class mcPUIX_PDO {
* insert the new rows
*/
if
(
mcArray
::
checkKeyHasFullArray
(
$preparedArray
,
'NewRows'
))
{
//D::show($preparedArray['NewRows'], 'NewRows2');
foreach
(
$preparedArray
[
'NewRows'
]
as
$NewRow
)
{
unset
(
$NewRow
[
mcPUIX
::
FORM_DO_ROW
]);
//D::show($NewRow, '$NewRow');
$NewRowSet
=
mcPUIX_PDO
::
formatForUpdateRowArray
(
$NewRow
);
unset
(
$NewRowSet
[
mcPUIX
::
FORM_DO_ROW
]);
if
(
$TableConfig
[
'KINDOF'
]
===
'LIST'
)
{
if
(
$NewRow
)
{
// D::show($NewRow,'NewRows');
$param_iStorable
->
PDO_insertRow
(
$ConfigArray
[
'TABLE'
][
'TABLENAME'
],
$ConfigArray
[
'TABLE'
][
'LISTID'
],
$ConfigArray
[
'TABLE'
][
'ELEMENTID'
],
$NewRow
,
true
);
if
(
$NewRowSet
)
{
$newID
=
$param_iStorable
->
PDO_insertRow
(
$ConfigArray
[
'TABLE'
][
'TABLENAME'
],
$ConfigArray
[
'TABLE'
][
'LISTID'
],
$ConfigArray
[
'TABLE'
][
'ELEMENTID'
],
$NewRowSet
,
true
);
if
(
mcArray
::
checkKeyHasFullArray
(
$NewRow
,
mcPUIX
::
PUIX_SUB_REFERENCELIST
,
mcPUIX
::
PUIXArray
,
mcPUIX
::
FORM_NEW_ROW
)
&&
mcArray
::
checkKeyHasFullArray
(
$TableConfig
,
mcPUIX
::
PUIX_SUB_REFERENCELIST
)
&&
$TableConfig
[
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
'TABLENAME'
]
)
{
// 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
;
$NewSubArray
=
array
(
mcPUIX
::
PUIXArray
=>
array
(
mcPUIX
::
FORM_POST_VALUES
=>
$NewRow
[
mcPUIX
::
PUIX_SUB_REFERENCELIST
][
mcPUIX
::
PUIXArray
]));
$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
);
// $NewSubRowSet = mcPUIX_PDO::formatForUpdateRowArray($NewRow[mcPUIX::PUIX_SUB_REFERENCELIST][mcPUIX::PUIXArray][mcPUIX::FORM_NEW_ROW]);
// $NewSubRowSet[$ConfigArray['TABLE']['ELEMENTID']] = $newID;
// if(array_key_exists(mcPUIX::FORM_DO_ROW, $NewSubRowSet) && $NewSubRowSet[mcPUIX::FORM_DO_ROW]===mcPUIX::FORM_DO_NEW) {
// unset($NewSubRowSet[mcPUIX::FORM_DO_ROW]);
// D::show($NewSubRowSet, '$NewSubRowSet');
// D::show($param_ConfigArray[mcPUIX::PUIXArray][mcPUIX::DBUIConfig][$TableConfig[mcPUIX::PUIX_SUB_REFERENCELIST]['TABLENAME']], '$TableConfig');
// }
}
}
}
else
if
(
$TableConfig
[
'KINDOF'
]
==
'DATASET'
)
{
}
else
if
(
$TableConfig
[
'KINDOF'
]
==
=
'DATASET'
)
{
D
::
show
(
$preparedArray
[
'NewRows'
],
'FOR DATASET INSERT NOT IMPLEMENTED'
);
}
else
if
(
$TableConfig
[
'KINDOF'
]
===
'RELATION'
)
{
// D::show($preparedArray['NewRows'], 'FOR RELATION INSERT NOT IMPLEMENTED');
if
(
$NewRow
)
{
// D::show($NewRow,'NewRows');
$param_iStorable
->
PDO_insertRow
(
$ConfigArray
[
'TABLE'
][
'TABLENAME'
],
$ConfigArray
[
'TABLE'
][
'LISTID'
],
null
,
$NewRow
,
true
);
$NewRowSet
=
mcPUIX_PDO
::
formatForUpdateRowArray
(
$NewRow
);
unset
(
$NewRowSet
[
mcPUIX
::
FORM_DO_ROW
]);
$param_iStorable
->
PDO_insertRow
(
$ConfigArray
[
'TABLE'
][
'TABLENAME'
],
$ConfigArray
[
'TABLE'
][
'LISTID'
],
null
,
$NewRowSet
,
true
);
}
}
}
...
...
@@ -338,5 +474,34 @@ class mcPUIX_PDO {
}
}
}
private
static
function
formatForUpdateRowArray
(
array
$param_UpdateRow
)
{
if
(
is_array
(
$param_UpdateRow
)
&&
!
empty
(
$param_UpdateRow
))
{
$return
=
array
();
/**
* delete the mcPUIX::FORM_DO_VAR key
*/
foreach
(
$param_UpdateRow
as
$colkey
=>
$colvalue
)
{
if
(
array_key_exists
(
mcPUIX
::
FORM_DO_VAR
,
$colvalue
))
{
$return
[
$colkey
]
=
$colvalue
[
mcPUIX
::
FORM_DO_VAR
];
}
else
{
$return
[
$colkey
]
=
$colvalue
;
}
}
/**
* delete the mcPUIX config entrys
*/
if
(
array_key_exists
(
mcPUIX
::
PUIX_SUB_REFERENCELIST
,
$return
))
{
unset
(
$return
[
mcPUIX
::
PUIX_SUB_REFERENCELIST
]);
}
return
$return
;
}
else
{
return
false
;
}
}
}
?>
\ No newline at end of file
mcPUIX/mcPUIX.xsl
View file @
18ce4b7
...
...
@@ -11,21 +11,35 @@
<xsl:template
match=
"/"
>
<xsl:apply-templates
select=
"DBUIElement"
/>
<xsl:apply-templates
select=
"
DBUI
Array"
/>
<xsl:apply-templates
select=
"
PUIX
Array"
/>
</xsl:template>
<xsl:template
match=
"mcPUIX"
>
<xsl:param
name=
"param_inputBE"
>
0
</xsl:param>
<xsl:apply-templates
select=
"DBUIElement"
>
<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"
>
<xsl:with-param
name=
"param_inputBE"
><xsl:value-of
select=
"$param_inputBE"
/></xsl:with-param>
</xsl:apply-templates>
<xsl:apply-templates
select=
"DBUIArray"
>
</td>
</tr>
<!-- <tr><td>edit</td></tr>-->
<tr>
<td>
<xsl:apply-templates
select=
"DOMmcPUIX_edit/PUIXArray"
>
<xsl:with-param
name=
"param_inputBE"
><xsl:value-of
select=
"$param_inputBE"
/></xsl:with-param>
</xsl:apply-templates>
</td>
</tr>
</table>
</xsl:template>
<xsl:template
match=
"
DBUI
Array"
>
<xsl:template
match=
"
PUIX
Array"
>
<xsl:param
name=
"param_inputBE"
>
0
</xsl:param>
<xsl:param
name=
"param_noform"
>
0
</xsl:param>
...
...
@@ -36,13 +50,13 @@
<xsl:for-each
select=
"DBUIRow"
>
<div
class=
"row"
><span
class=
"element"
><xsl:value-of
select=
"@label"
/>
i(
<xsl:value-of
select=
"@i"
/>
)
</span>
</div>
<xsl:apply-templates
select=
"DBUIElement"
>
<xsl:with-param
name=
"param_inputBE"
><xsl:value-of
select=
"$param_inputBE"
/>
[
<xsl:value-of
select=
"@i"
/>
]
</xsl:with-param>
<xsl:with-param
name=
"param_inputBE"
><xsl:value-of
select=
"$param_inputBE"
/></xsl:with-param>
</xsl:apply-templates>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<!--<xsl:value-of select="count(DBUIRow[@i=
'NEW_ROW'
])" />/<xsl:value-of select="count(DBUIRow)" />-->
<xsl:if
test=
"count(DBUIRow[@i='NEW_ROW'])!=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)"
>
<table
border=
"1"
>
<xsl:for-each
select=
"DBUIRow"
>
...
...
@@ -59,7 +73,7 @@
</xsl:choose>
<xsl:choose>
<xsl:when
test=
"@i='NEW_ROW'"
>
<xsl:when
test=
"@i='
FORM_
NEW_ROW'"
>
</xsl:when>
<xsl:otherwise>
...
...
@@ -70,14 +84,14 @@
<td>
<!-- <xsl:value-of select="position()" />-->
<xsl:apply-templates
select=
"."
>
<xsl:with-param
name=
"param_inputBE"
><xsl:value-of
select=
"$param_inputBE"
/>
[
<xsl:value-of
select=
"local-name(../..)"
/>
][
<xsl:value-of
select=
"../@i"
/>
]
</xsl:with-param>
<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=
"."
>
<xsl:with-param
name=
"param_inputBE"
><xsl:value-of
select=
"$param_inputBE"
/>
[
<xsl:value-of
select=
"local-name(../..)"
/>
][
<xsl:value-of
select=
"../@i"
/>
]
</xsl:with-param>
<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>
...
...
@@ -91,7 +105,7 @@
</xsl:if>
<table
border=
"1"
>
<xsl:for-each
select=
"DBUIRow[@i='NEW_ROW']"
>
<xsl:for-each
select=
"DBUIRow[@i='
FORM_
NEW_ROW']"
>
<xsl:choose>
<xsl:when
test=
"position()=1"
>
<tr
valign=
"top"
>
...
...
@@ -108,14 +122,14 @@
<td>
<!-- <xsl:value-of select="position()" />-->
<xsl:apply-templates
select=
"."
>
<xsl:with-param
name=
"param_inputBE"
><xsl:value-of
select=
"$param_inputBE"
/>
[
<xsl:value-of
select=
"local-name(../..)"
/>
][
<xsl:value-of
select=
"../@i"
/>
]
</xsl:with-param>
<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=
"."
>
<xsl:with-param
name=
"param_inputBE"
><xsl:value-of
select=
"$param_inputBE"
/>
[
<xsl:value-of
select=
"local-name(../..)"
/>
][
<xsl:value-of
select=
"../@i"
/>
]
</xsl:with-param>
<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>
...
...
@@ -156,33 +170,47 @@
<xsl:if
test=
"@element_classname"
>
<input
type=
"hidden"
name=
"{$param_inputBE}[element_classname]"
value=
"{@element_classname}"
/>
</xsl:if>
<xsl:variable
name=
"var_formpath"
>
<xsl:choose>
<xsl:when
test=
"@formpath"
><xsl:value-of
select=
"$param_inputBE"
/><xsl:value-of
select=
"@formpath"
/>
[FORM_DO_VAR]
</xsl:when>
<xsl:otherwise><xsl:value-of
select=
"$param_inputBE"
/>
[
<xsl:value-of
select=
"@objvar"
/>
]
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when
test=
"@fixed=1"
>
<input
type=
"hidden"
name=
"{$param_inputBE}[{@objvar}]"
value=
"{@value}"
/>
<!-- <input type="hidden" name="{$param_inputBE}[{@objvar}]" value="{@value}" />-->
<input
type=
"hidden"
name=
"{$var_formpath}"
value=
"{@value}"
/>
<xsl:if
test=
"@show=1"
><xsl:value-of
select=
"@value"
/></xsl:if>
</xsl:when>
<xsl:when
test=
"@type='DBUIArray'"
>
<xsl:apply-templates
select=
"DBUIArray"
>
<xsl:when
test=
"@type='PUIXArray'"
>
es wird nicht formpath übernommen!!!
<xsl:apply-templates
select=
"PUIXArray"
>
<xsl:with-param
name=
"param_inputBE"
><xsl:value-of
select=
"$param_inputBE"
/></xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when
test=
"@type='hidden'"
>
<input
type=
"hidden"
name=
"{$param_inputBE}[{@objvar}]"
value=
"{@value}"
/>
<!-- <input type="hidden" name="{$param_inputBE}[{@objvar}]" value="{@value}" />-->
<input
type=
"hidden"
name=
"{$var_formpath}"
value=
"{@value}"
/>
<xsl:if
test=
"@show=1"
><xsl:value-of
select=
"@value"
/></xsl:if>
</xsl:when>
<xsl:when
test=
"@type='text'"
>
<textarea
name=
"{$param_inputBE}[{@objvar}]"
class=
"width"
cols=
"40"
rows=
"20"
>
<!-- <textarea name="{$param_inputBE}[{@objvar}]" class="width" cols="40" rows="20">-->
<textarea
name=
"{$var_formpath}"
class=
"width"
cols=
"40"
rows=
"20"
>
<xsl:value-of
select=
"."
/>
<xsl:text
disable-output-escaping=
"no"
>
 
</xsl:text>
</textarea>
</xsl:when>
<xsl:when
test=
"@type='file'"
>
es wird nicht formpath übernommen!!!
<xsl:call-template
name=
"Function_FileUploadFormular"
>
<xsl:with-param
name=
"param_inputBE"
select=
"$param_inputBE"
/>
</xsl:call-template>
</xsl:when>
<xsl:when
test=
"@type='select'"
>
<select
name=
"{$param_inputBE}[{@objvar}]"
size=
"1"
class=
"width"
>
<!-- <select name="{$param_inputBE}[{@objvar}]" size="1" class="width">-->
<select
name=
"{$var_formpath}"
size=
"1"
class=
"width"
>
<xsl:for-each
select=
"DBUIList/item"
>
<xsl:choose>
<xsl:when
test=
"@key=../../@value"
>
...
...
@@ -197,13 +225,16 @@
</xsl:when>
<xsl:when
test=
"@type='password'"
>
<div
class=
"row"
>
<span
class=
"element"
>
1.
<input
type=
"password"
name=
"{$param_inputBE}[password2]"
class=
"width"
maxlength=
"{@form_Length}"
value=
"{@value}"
/></span>
<!-- <span class="element">1. <input type="password" name="{$param_inputBE}[password2]" class="width" maxlength="{@form_Length}" value="{@value}" /></span>-->
<span
class=
"element"
>
1.
<input
type=
"password"
name=
"{$var_formpath}"
class=
"width"
maxlength=
"{@form_Length}"
value=
"{@value}"
/></span>
</div>
<div
class=
"row"
>
<span
class=
"element"
>
2.
<input
type=
"password"
name=
"{$param_inputBE}[password1]"
class=
"width"
maxlength=
"{@form_Length}"
value=
"{@value}"
/></span>
<!-- <span class="element">2. <input type="password" name="{$param_inputBE}[password1]" class="width" maxlength="{@form_Length}" value="{@value}" /></span>-->
<span
class=
"element"
>
2.
<input
type=
"password"
name=
"{$var_formpath}"
class=
"width"
maxlength=
"{@form_Length}"
value=
"{@value}"
/></span>
</div>
</xsl:when>
<xsl:when
test=
"@type='time'"
>
es wird nicht formpath übernommen!!!
<xsl:call-template
name=
"Function_TimeFormular"
>
<xsl:with-param
name=
"param_prefix"
><xsl:value-of
select=
"@objvar"
/>
_
</xsl:with-param>
<xsl:with-param
name=
"param_time"
><xsl:value-of
select=
"End"
/></xsl:with-param>
...
...
@@ -213,16 +244,18 @@
<xsl:when
test=
"@type='checkbox'"
>
<xsl:choose>
<xsl:when
test=
"@value=1"
>
<input
type=
"checkbox"
name=
"{$param_inputBE}[{@objvar}]"
value=
"1"
checked=
"checked"
/>
<!-- <input type="checkbox" name="{$param_inputBE}[{@objvar}]" value="1" checked="checked" />-->
<input
type=
"checkbox"
name=
"{$var_formpath}"
value=
"1"
checked=
"checked"
/>
</xsl:when>
<xsl:otherwise>
<input
type=
"checkbox"
name=
"{$param_inputBE}[{@objvar}]"
/>
<!-- <input type="checkbox" name="{$param_inputBE}[{@objvar}]" />-->
<input
type=
"checkbox"
name=
"{$var_formpath}"
/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:variable
name=
"var_maxlength"
><xsl:value-of
select=
"@maxlength"
/></xsl:variable>
<input
name=
"{$param_inputBE}[{@objvar}]"
class=
"width"
type=
"text"
size=
"{@size}"
maxlength=
"{@maxlength}"
value=
"{@value}"
/>
<input
class=
"width"
type=
"text"
size=
"{@size}"
maxlength=
"{@maxlength}"
value=
"{@value}"
name=
"{$var_formpath}"
/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
...
...
@@ -243,8 +276,8 @@
<xsl:when
test=
"@ID"
>
<a
href=
"{$param_url}"
><xsl:value-of
select=
"@value"
/><xsl:text
disable-output-escaping=
"no"
>
 
</xsl:text></a>
</xsl:when>
<xsl:when
test=
"@type='
DBUI
Array'"
>
<xsl:apply-templates
select=
"
DBUI
Array"
>
<xsl:when
test=
"@type='
PUIX
Array'"
>
<xsl:apply-templates
select=
"
PUIX
Array"
>
<xsl:with-param
name=
"param_inputBE"
><xsl:value-of
select=
"$param_inputBE"
/></xsl:with-param>
</xsl:apply-templates>
</xsl:when>
...
...
mcPUIX/phpunit/DBUIHelpers_PHPTest.php
View file @
18ce4b7
...
...
@@ -30,7 +30,7 @@ class mcPUIX_PHPTest extends PHPUnit_Framework_TestCase {
public
function
testPrepareArrayForDOMElement
()
{
$ValueArray
=
array
(
mcPUIX
::
DBUI
Array
=>
array
(
mcPUIX
::
PUIX
Array
=>
array
(
array
(
'key1'
=>
'value11'
,
'key2'
=>
'value12'
,
'key3'
=>
'value13'
,
...
...
@@ -115,7 +115,7 @@ class mcPUIX_PHPTest extends PHPUnit_Framework_TestCase {
$ConfigArray
=
array
(
'TABLE'
=>
array
(
'PRIMARY'
=>
array
(
'Primary1ID'
,
'Primary2ID'
),
'REQUIRED'
=>
array
(
'Required1'
,
'Required2'
),
mcPUIX
::
FORM_REQUIRED
=>
array
(
'Required1'
,
'Required2'
),
),
mcPUIX
::
FORM_DO_ROW
=>
array
(),
'Key1'
=>
array
(),
...
...
mcPUIX/phpunit/basepath.inc.php
View file @
18ce4b7
...
...
@@ -4,10 +4,10 @@
*/
$__BASEPATH_EX
=
'../../../../../'
;
/**
* only important for when you inclue 'include/Lib/Tools/mcClasses/include.php,
* in the moment this makes RequireClass.inc.php
*/
$__PATH_to_mcClasses
=
$__BASEPATH_EX
.
'include/Lib/Tools/mcClasses/'
;
// ist in die config gewandert
/
//
**
//
* only important for when you inclue 'include/Lib/Tools/mcClasses/include.php,
//
* in the moment this makes RequireClass.inc.php
//
*/
//
$__PATH_to_mcClasses= $__BASEPATH_EX .'include/Lib/Tools/mcClasses/';
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment