setDateTimeValue() public method

Sets the datetime value of a column.
public setDateTimeValue ( string $colName, integer | null $timestamp )
$colName string Name of the column
$timestamp integer | null Unix timestamp (if `null` is given, the current time is used)
示例#1
0
文件: form.php 项目: skerbis/redaxo
 /**
  * Callbackfunktion, damit in subklassen der Value noch beeinflusst werden kann
  * kurz vorm speichern.
  */
 protected function preSave($fieldsetName, $fieldName, $fieldValue, rex_sql $saveSql)
 {
     static $setOnce = false;
     if (!$setOnce) {
         $fieldnames = $this->sql->getFieldnames();
         if (in_array('updateuser', $fieldnames)) {
             $saveSql->setValue('updateuser', rex::getUser()->getValue('login'));
         }
         if (in_array('updatedate', $fieldnames)) {
             $saveSql->setDateTimeValue('updatedate', time());
         }
         if (!$this->isEditMode()) {
             if (in_array('createuser', $fieldnames)) {
                 $saveSql->setValue('createuser', rex::getUser()->getValue('login'));
             }
             if (in_array('createdate', $fieldnames)) {
                 $saveSql->setDateTimeValue('createdate', time());
             }
         }
         $setOnce = true;
     }
     return $fieldValue;
 }