- adjust constructor of LetoDMS_Folder after adding new database field

'date' into tblFolders
This commit is contained in:
steinm 2010-12-10 13:39:28 +00:00
parent 5650c23595
commit 778f198515
2 changed files with 50 additions and 5 deletions

View File

@ -481,7 +481,7 @@ class LetoDMS_DMS {
return false; return false;
$resArr = $resArr[0]; $resArr = $resArr[0];
$folder = new LetoDMS_Folder($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]); $folder = new LetoDMS_Folder($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["date"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]);
$folder->setDMS($this); $folder->setDMS($this);
return $folder; return $folder;
} /* }}} */ } /* }}} */
@ -511,7 +511,7 @@ class LetoDMS_DMS {
return false; return false;
$resArr = $resArr[0]; $resArr = $resArr[0];
$folder = new LetoDMS_Folder($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]); $folder = new LetoDMS_Folder($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["date"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]);
$folder->setDMS($this); $folder->setDMS($this);
return $folder; return $folder;
} /* }}} */ } /* }}} */

View File

@ -24,21 +24,57 @@
* @version Release: @package_version@ * @version Release: @package_version@
*/ */
class LetoDMS_Folder { class LetoDMS_Folder {
/**
* @var integer unique id of folder
*/
var $_id; var $_id;
/**
* @var string name of folder
*/
var $_name; var $_name;
/**
* @var integer id of parent folder
*/
var $_parentID; var $_parentID;
/**
* @var string comment of document
*/
var $_comment; var $_comment;
/**
* @var integer id of user who is the owner
*/
var $_ownerID; var $_ownerID;
/**
* @var boolean true if access is inherited, otherwise false
*/
var $_inheritAccess; var $_inheritAccess;
/**
* @var integer default access if access rights are not inherited
*/
var $_defaultAccess; var $_defaultAccess;
/**
* @var integer position of folder within the parent folder
*/
var $_sequence; var $_sequence;
/**
* @var object back reference to document management system
*/
var $_dms; var $_dms;
function LetoDMS_Folder($id, $name, $parentID, $comment, $ownerID, $inheritAccess, $defaultAccess, $sequence) { /* {{{ */ function LetoDMS_Folder($id, $name, $parentID, $comment, $date, $ownerID, $inheritAccess, $defaultAccess, $sequence) { /* {{{ */
$this->_id = $id; $this->_id = $id;
$this->_name = $name; $this->_name = $name;
$this->_parentID = $parentID; $this->_parentID = $parentID;
$this->_comment = $comment; $this->_comment = $comment;
$this->_date = $date;
$this->_ownerID = $ownerID; $this->_ownerID = $ownerID;
$this->_inheritAccess = $inheritAccess; $this->_inheritAccess = $inheritAccess;
$this->_defaultAccess = $defaultAccess; $this->_defaultAccess = $defaultAccess;
@ -103,6 +139,15 @@ class LetoDMS_Folder {
return true; return true;
} /* }}} */ } /* }}} */
/**
* Return creation date of document
*
* @return integer unix timestamp of creation date
*/
function getDate() { /* {{{ */
return $this->_date;
} /* }}} */
function getParent() { /* {{{ */ function getParent() { /* {{{ */
if ($this->_id == $this->_dms->rootFolderID || !isset($this->_parentID) || ($this->_parentID == null) || ($this->_parentID == "") || ($this->_parentID == 0)) { if ($this->_id == $this->_dms->rootFolderID || !isset($this->_parentID) || ($this->_parentID == null) || ($this->_parentID == "") || ($this->_parentID == 0)) {
return false; return false;
@ -271,8 +316,8 @@ class LetoDMS_Folder {
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
//inheritAccess = true, defaultAccess = M_READ //inheritAccess = true, defaultAccess = M_READ
$queryStr = "INSERT INTO tblFolders (name, parent, comment, owner, inheritAccess, defaultAccess, sequence) ". $queryStr = "INSERT INTO tblFolders (name, parent, comment, date, owner, inheritAccess, defaultAccess, sequence) ".
"VALUES ('".$name."', ".$this->_id.", '".$comment."', ".$owner->getID().", 1, ".M_READ.", ".$sequence.")"; "VALUES ('".$name."', ".$this->_id.", '".$comment."', ".mktime().", ".$owner->getID().", 1, ".M_READ.", ".$sequence.")";
if (!$db->getResult($queryStr)) if (!$db->getResult($queryStr))
return false; return false;
$newFolder = $this->_dms->getFolder($db->getInsertID()); $newFolder = $this->_dms->getFolder($db->getInsertID());