Source for file DBMS_FIELD_TIMESTAMP.phpclass
Documentation is available at DBMS_FIELD_TIMESTAMP.phpclass
* Class file DBMS_FIELD_TIMESTAMP.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
* Class DBMS_FIELD_TIMESTAMP
* Handles mySQL Timestamps Columns
* @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
* 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>)
* NOTE as this is not implemented in the whole classTree at the moment ensure all parents use
* editTbl_echoForm() in theire editTblForm otherwise you'll get a mismatch of field order
$a_ret['SHOW']['SHOWDATE']=
array(
'FLDLAB'=>
"Datum/Zeit anzeigen:",
<input name=\"SHOWDATE\" type=\"checkbox\" ".
($this->showDate ?
"checked=\"checked\"" :
"").
" value=\"1\" /> Datum anzeigen
<input name=\"SHOWTIME\" type=\"checkbox\" ".
($this->showTime ?
"checked=\"checked\"" :
"").
" value=\"1\" /> Zeit anzeigen"
$a_ret['LAYOUT']['FLD_DATEFORMAT']=
array(
'FLDLAB'=>
"Datumsformat: <a href=\"http://at.php.net/manual/en/function.date.php\">?</a>",
<input name=\"fldDateformat\" value=\"".
$this->lstDateformat.
"\" size=\"25\" />
<input name=\"hideCalendarBtn\" type=\"checkbox\" value=\"1\" ".
($this->hideCalendarBtn ?
"checked=\"checked\"" :
"").
" /> KalenderPopup ausblenden\n
$a_ret['LAYOUT']['FLD_TIMEFORMAT']=
array(
'FLDLAB'=>
"Zeitformat: <a href=\"http://at.php.net/manual/en/function.date.php\">?</a>",
'FLDVAL'=>
"<input name=\"fldTimeformat\" value=\"".
$this->fldTimeformat.
"\" size=\"25\" />"
$a_ret['LIST']['LST_DATEFORMAT']=
array(
'FLDLAB'=>
"Datumsformat: <a href=\"http://at.php.net/manual/en/function.date.php\">?</a>",
'FLDVAL'=>
"<input name=\"lstDateformat\" value=\"".
$this->lstDateformat.
"\" size=\"25\" />"
$a_ret['LIST']['LST_TIMEFORMAT']=
array(
'FLDLAB'=>
"Zeitformat: <a href=\"http://at.php.net/manual/en/function.date.php\">?</a>",
'FLDVAL'=>
"<input name=\"lstTimeformat\" value=\"".
$this->lstTimeformat.
"\" size=\"25\" />"
* converts a timestamp into a date object
* if $aValue is an array pcf_Date::setFromArray() is called to transform to a date
* if $aValue is doubleval pcf_Date::setMySqlTimeStamp() is called
if ($debug) echo
"<p><b>DBMS_FIELD_TIMESTAMP::getTSDate($aValue,....)</b> (".
get_class($this).
")</p><blockquote>";
if ($debug) echo
"<b>setFromArray</b><br />";
$dateObj->setFromArray($aValue);
} else if (preg_match('/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/',$aValue)) {
if ($debug) echo
"<b>setDateStr</b><br />";
$dateObj->setDateStr($aValue,$debug);
if ($debug) echo
"<b>setMySqlTimeStamp</b><br />";
$dateObj->setMySqlTimeStamp($aValue); /* <pk-04-12-29 /> */
if ($debug) echo
"<b>setDateStr</b><br />";
* returns the html code for the field value input / show
* adds $this->myName to ${$this->myDataArrName}['_DBMS_FIELDS']
function getFieldTag($mode,$aValue=
NULL,$debug=
FALSE) {
if ($debug) echo
"<p><b>DBMS_FIELD_TIMESTAMP::getFieldTag($mode,$aValue,...)</b> (".
get_class($this).
")</p>";
if (!empty($aValue)) { // <pk-06-08-18>
if ($o_dateObj->isNULL()) {
$aValue=
$o_dateObj->dateStr("Y-m-d H:i:s");
if (!empty($aValue)) { // <pk-06-01-09>
return parent::getFieldTag($mode,$aValue,$debug);
* returns the field default value
* if $defaultValue !empty it is returned
* else getDbDefault is return
if ($debug) echo
"<p><b>DBMS_FIELD_TIMESTAMP::getDefaultValue(...)</b> (".
get_class($this).
")</p>";
return $aDate->getMySQLTimestamp();
* returns the field value
* @param string $aValue the value
* @param array $err error array
* @param string $arrName name of the array to access fieldsarray gloabl ${$arrName}
* @todo DBMS_FIELD_TIMESTAMP::getValue() returns MySQL Timestamp format
function getValue($aValue,&$err,$arrName=
"DBVAL",$debug=
FALSE) {
if ($debug) echo
"<hr><p><b>DBMS_FIELD_TIMESTAMP::getValue($aValue,$err,$arrName,$debug)</b> (".
get_class($this).
"/".
$this->myName.
")</p>";
$o_dateObj=
$this->getTSDate($aValue,$debug); // <pk-06-08-18 />
if ($debug) {echo
"<pre>";print_r($o_dateObj);echo
"</pre>";}
return $o_dateObj->getMySQLTimestamp();
* add slashes to the value to add it to a sql command
* NOTE allways returns DB Now statement
* @param string $aValue the value
* @param array $err error array
* @param string $arrName name of the global array to access field gloabl ${$arrName}
function slashedValue($aValue,&$err,$arrName=
"DBVAL",$debug=
FALSE) {
if ($debug) echo
"<hr><p><b>DBMS_FIELD_TIMESTAMP::slashedValue($aValue,$err,$arrName,$debug)</b> (".
get_class($this).
"/".
$this->myName.
")</p>";
return $GLOBALS[$this->getGlobalDBObjIdx()]->qs_getNowStmt();
* get a where clause for the search settings
* $aArr array post values of the serach form
* return string where clause
if ($debug) echo
"<p><b>DMBS_FIELD_TIMESTAMP::searchWhere($aArr,$debug)</b> (".
get_class($this).
")</p>";
if ($debug) {echo
"<blockquote><pre>";print_r($aArr);echo
"</pre></blockquote>";}
if ($debug) { echo
"<pre>"; print_r($aArr); echo
"</pre>"; }
if (!empty($aArr['ANDOR'])) {
$ret=
($aArr['ANDOR'] ==
"OR" ?
" OR " :
" AND ");
switch($aArr['COMPTYPE']) { // only to verify input
global $TEMPDBVAL;$TEMPDBVAL=
$aArr;
$ret.=
parent::slashedValue($TEMPDBVAL,$err,"TEMPDBVAL",$debug);
echo
"COMPTYPE NOT FOUND";
} // end class DBMS_FIELD_INT
Documentation generated on Thu, 08 Jan 2009 17:43:07 +0100 by phpDocumentor 1.4.0a2