add method setDate()

This commit is contained in:
Uwe Steinmann 2015-08-04 07:39:14 +02:00
parent bc1eecc08c
commit 150e5445df

View File

@ -133,6 +133,30 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
return $this->_date;
} /* }}} */
/**
* Set creation date of the document
*
* @param integer $date timestamp of creation date. If false then set it
* to the current timestamp
* @return boolean true on success
*/
function setDate($date) { /* {{{ */
$db = $this->_dms->getDB();
if(!$date)
$date = time();
else {
if(!is_numeric($date))
return false;
}
$queryStr = "UPDATE tblFolders SET date = " . (int) $date . " WHERE id = ". $this->_id;
if (!$db->getResult($queryStr))
return false;
$this->_date = $date;
return true;
} /* }}} */
/**
* Returns the parent
*