Source for file DBMS_FIELD_GLOBALARRSELECTLIST.phpclass
Documentation is available at DBMS_FIELD_GLOBALARRSELECTLIST.phpclass
* Class file DBMS_FIELD_GLOBALARRSELECTLIST.phpclass
* @project Open CSP-Management
* @author Peter Krebs <p.krebs@lvus.at>
* @copyright (c) 2002-2005 by LVUS <http://www.lvus.at>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
require_once dirname(__FILE__
).
"/DBMS_FIELD_SELECTLIST.phpclass";
$GLOBALS['DBMS']['GLOBALARRMODULES']=
array("PROJECT","CMS","DBMS"); // pk-05-07-18
* Class DBMS_FIELD_GLOBALARRSELECTLIST
* @project Open CSP-Management
* @author Peter Krebs <p.krebs@lvus.at>
* @copyright (c) 2002-2005 by LVUS <http://www.lvus.at>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* source file of the class
* @var string $classSrcFile
* @var boolean $allowNullSelect
// ###########################################################
// OBJECT (CONST) VAR DECLARATION
// ###########################################################
* @var boolean $valueIsKey the value of the array is the key and shown as option text
// ###########################################################
// OBJECT SETTINGS METHODS
// ###########################################################
// ###########################################################
// FIELD DEFINITION DATA METHODS
// ###########################################################
* returns an array of field to bie shown in the edit form
* by using editTbl_echoForm
* the array is in the form:
* [FLDLAB] (complete html code with <td></td>)
* [FLDVAL] (complete html code with <td></td>)
unset
($a_ret['SELECT']['FLD_LSTVALS']); // unset parent field as it is of no use here
$a_ret['GLOBALARR']=
array(
'TITLE'=>
"Array Einstellungen",
<input type=\"radio\" name=\"valueIsKey\" value=\"1\" ".
($this->valueIsKey ?
"checked" :
"").
">Array Wert auch als DB Wert speichern<br />
<input type=\"radio\" name=\"valueIsKey\" value=\"0\" ".
($this->valueIsKey ?
"" :
"checked").
"> Array Index als DB Wert speichern
'FLDLAB'=>
"Anzeige Index: (Arrays)",
'FLDVAL'=>
"<input name=\"subKey\" value=\"".
$this->subKey.
"\" size=\"40\">"
'FLD_LSTINDEX'=>
array( // <pk-06-09-08 />
'FLDLAB'=>
"List Index: (Arrays)",
'FLDVAL'=>
"<input name=\"lstKey\" value=\"".
$this->lstKey.
"\" size=\"40\">"
$a_ret['GLOBALARR']['FLD_GLOBALARR']['FLDVAL']="
<select name=\"SEL_GLOBALARRAY\" onchange=\"document.frmEdit.GLOBALARRAY.value=this.value;\">
<option value=\"\">Eingabe: </option>
foreach($GLOBALS['DBMS']['GLOBALARRMODULES'] as $key) {
if (is_array($GLOBALS[$key])) {
$a_ret['GLOBALARR']['FLD_GLOBALARR']['FLDVAL']="";
foreach($GLOBALS[$key] as $subKey => $subVal) {
$a_ret['GLOBALARR']['FLD_GLOBALARR']['FLDVAL'].="\t\t<option value=\"$key|$subKey\"";
if ($key."|".$subKey == $this->arrName) $a_ret['GLOBALARR']['FLD_GLOBALARR']['FLDVAL'].= " selected";
if ($subKey == $this->arrName) $a_ret['SELECT']['FLD_GLOBALARR']['FLDVAL'].= " selected"; // old style
$a_ret['GLOBALARR']['FLD_GLOBALARR']['FLDVAL'].= ">$key $subKey</option>\n";
$a_ret['GLOBALARR']['FLD_GLOBALARR']['FLDVAL'].= "
$a_ret['GLOBALARR']['FLD_GLOBALARR']['FLDVAL'] .=
"
<input name=\"GLOBALARRAY\" value=\"".
$this->arrName.
"\" size=\"40\">
* echos the field edit form field cols
* @param boolean $showSize show size fields
* @param boolean $showNull show List Null-Option
* @param boolean $showValueList show a textfield to input a value list
* @deprecated since pk-06-07-23
function editTblForm($showSize=
FALSE,$showNull=
TRUE,$showValueList=
FALSE) {
parent::editTblForm($showSize,$showNull,$showValueList);
* save the field definiton from $_POST
$this->arrName =
$_POST['GLOBALARRAY'];
$this->subKey =
$_POST['subKey'];
$this->lstKey =
$_POST['lstKey']; // <pk-06-09-08 />
###################################
* returns the global array
if ($debug) echo
"<p><b>DBMS_FIELD_GLOBALARRSELECTLIST::getGlobalValArr()</b></p>";
$a_keys[0]=
"PROJECT";$a_keys[1]=
$this->arrName;
foreach($a_keys as $s_key) {
$s_gVar.=
"['".
$s_key.
"']";
@eval
("\$this->myValues=".
$s_gVar.
";");
if ($debug) echo
"<p><b>DBMS_FIELD_GLOBALARRSELECTLIST::setMyValues($arrName,...,$mode)</b></p><blockquote>";
foreach($arr as $key =>
$val) {
if ($this->valueIsKey) $key=
$val; /* <pk-05-02-17> */
if ($this->valueIsKey) $key=
$val; /* <pk-05-02-17> */
if ($debug) echo
"<pre style=\"font-size:75%\">myValues:\n".
print_r($this->myValues,TRUE).
"</pre>";
if ($debug) echo
"</blockquote>";
* returns a string with the options
* calls setMyValues to be sure $this->myValues is set correkt
* @param array $aValArr array of selected values
* @param bool $addNULL add the null option (for search)
function getOptionList($aValArr,$addNULL=FALSE,$debug=FALSE) {
$debug=($debug || $this->fldDebug); // <pk-04-08-31>
if ($debug) echo "<p><b>DBMS_FIELD_GLOBALARRSELECTLIST::getOptionList(\$aValArr,$addNULL,...)</b> (".get_class($this)."/".$this->myName.")</p><blockquote>";
$ret=parent::getOptionList($aValArr,$addNULL,$debug);
foreach($aValArr as $val) {
if (!strstr($ret,"value=\"$val\"")) {
$ret.="\t<option value=\"$val\" selected>$val</option>\n";
if ($debug) echo "</blockquote>";
* returns the html representation of the field
* @param mixed $aValue the falue
* @param string $arrName name of the global array holding data values
* @param bool $debug show debug info
* @returns mixed the html representation of the field
if ($debug) echo
"<hr /><p><b>DBMS_FIELD_GLOBALARRSELECTLIST::getScreenValue($aValue,$arrName,...)</b></p>";
// we only have to return the values
foreach($a_valArr as $s_val) {
if (isset
($a_gValArr[$s_val]) &&
(!empty($a_gValArr[$s_val]))) {
$s_ret.=
"<li>".
$a_gValArr[$s_val].
"</li>";
$s_ret.=
"<li>".
$s_val.
"</li>";
if (isset
($a_gValArr[$aValue]) &&
(!empty($a_gValArr[$aValue]))) {
return $a_gValArr[$aValue];
if ($debug) return "ERROR: global array net set (".
$this->myName.
")";
foreach ($a_valArr as $s_val) {
$ret.=
"<li>".
(!empty($a_gValArr[$s_val][$this->subKey]) ?
$a_gValArr[$s_val][$this->subKey] :
$s_val).
"</li>";
return (!empty($a_gValArr[$a_valArr[0]][$this->subKey]) ?
$a_gValArr[$a_valArr[0]][$this->subKey] :
$a_valArr[0]);
* returns the html representation of the field in a list (table col)
* @param mixed $aValue the falue
* @param string $arrName name of the global array holding data values
* @param bool $debug show debug info
* @returns mixed the html representation of the field
function getListValue($aValue=
NULL,$arrName=
"DBVAL",$debug=
FALSE) {
if ($debug) echo
"<hr /><p><b>DBMS_FIELD_GLOBALARRSELECTLIST::getListValue($aValue,$arrName,...)</b></p>";
if ($debug) return "ERROR: global array net set (".
$this->myName.
")";
echo
"<hr /><p><b>\$a_valArr:</b></p><pre>".
print_r($a_valArr,TRUE).
"</pre>";
echo
"<p><b>\$a_gValArr:</b></p><pre>".
print_r($a_gValArr,TRUE).
"</pre><hr />";
foreach ($a_valArr as $s_val) {
$ret.=
"<li>".
(!empty($a_gValArr[$s_val][$this->lstKey]) ?
$a_gValArr[$s_val][$this->lstKey] :
$s_val).
"</li>";
return (!empty($a_gValArr[$a_valArr[0]][$this->lstKey]) ?
$a_gValArr[$a_valArr[0]][$this->lstKey] :
$a_valArr[0]);
} // end class DBMS_FIELD_GLOBALARRSELECTLIST
Documentation generated on Thu, 08 Jan 2009 17:41:44 +0100 by phpDocumentor 1.4.0a2