mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-12 04:31:32 +00:00
date passed to setDate() can be string with format Y-m-d H:i:s
This commit is contained in:
parent
bca394176e
commit
fbf86b0fe6
|
@ -3091,17 +3091,28 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
*/
|
*/
|
||||||
function getPath() { return $this->_document->getDir() . $this->_version . $this->_fileType; }
|
function getPath() { return $this->_document->getDir() . $this->_version . $this->_fileType; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set upload date of document content
|
||||||
|
*
|
||||||
|
* @param string $date date must be a timestamp or in the format 'Y-m-d H:i:s'
|
||||||
|
*
|
||||||
|
* @return boolean true on success, otherwise false
|
||||||
|
*/
|
||||||
function setDate($date = false) { /* {{{ */
|
function setDate($date = false) { /* {{{ */
|
||||||
$db = $this->_document->getDMS()->getDB();
|
$db = $this->_document->getDMS()->getDB();
|
||||||
|
|
||||||
if(!$date)
|
if(!$date)
|
||||||
$date = time();
|
$date = time();
|
||||||
else {
|
else {
|
||||||
if(!is_numeric($date))
|
if(is_string($date) && SeedDMS_Core_DMS::checkDate($date, 'Y-m-d H:i:s')) {
|
||||||
|
$date = strtotime($date);
|
||||||
|
} elseif(is_numeric($date))
|
||||||
|
$date = (int) $date;
|
||||||
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$queryStr = "UPDATE `tblDocumentContent` SET `date` = ".(int) $date." WHERE `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version;
|
$queryStr = "UPDATE `tblDocumentContent` SET `date` = ". $date." WHERE `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version;
|
||||||
if (!$db->getResult($queryStr))
|
if (!$db->getResult($queryStr))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user