mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-08 20:46:05 +00:00
new methods getFolders(), getDocumentLinks(), getDocumentFiles(), getDocumentContents()
This commit is contained in:
parent
14b1cd34cd
commit
d955f07b7a
|
@ -1189,6 +1189,106 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return $documents;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Returns all document links of a given user
|
||||
* @return SeedDMS_Core_DocumentLink[]|bool list of document links
|
||||
*/
|
||||
function getDocumentLinks() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "SELECT * FROM `tblDocumentLinks` ".
|
||||
"WHERE `userID` = " . $this->_id;
|
||||
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
||||
$links = array();
|
||||
$classname = 'SeedDMS_Core_DocumentLink';
|
||||
foreach ($resArr as $row) {
|
||||
$document = $this->_dms->getDocument($row["document"]);
|
||||
$target = $this->_dms->getDocument($row["target"]);
|
||||
/** @var SeedDMS_Core_Document $document */
|
||||
$link = new $classname((int) $row["id"], $document, $target, $row["userID"], $row["public"]);
|
||||
$links[] = $link;
|
||||
}
|
||||
return $links;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Returns all document files of a given user
|
||||
* @return SeedDMS_Core_DocumentFile[]|bool list of document files
|
||||
*/
|
||||
function getDocumentFiles() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "SELECT * FROM `tblDocumentFiles` ".
|
||||
"WHERE `userID` = " . $this->_id;
|
||||
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
||||
$files = array();
|
||||
$classname = 'SeedDMS_Core_DocumentFile';
|
||||
foreach ($resArr as $row) {
|
||||
$document = $this->_dms->getDocument($row["document"]);
|
||||
/** @var SeedDMS_Core_DocumentFile $file */
|
||||
$file = new $classname((int) $row["id"], $document, $row["userID"], $row["comment"], $row["date"], $row["dir"], $row["fileType"], $row["mimeType"], $row["orgFileName"], $row["name"],$row["version"],$row["public"]);
|
||||
$files[] = $file;
|
||||
}
|
||||
return $files;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Returns all document contents of a given user
|
||||
* @return SeedDMS_Core_DocumentContent[]|bool list of document contents
|
||||
*/
|
||||
function getDocumentContents() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `createdBy` = " . $this->_id;
|
||||
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
||||
$contents = array();
|
||||
$classname = $this->_dms->getClassname('documentcontent');
|
||||
foreach ($resArr as $row) {
|
||||
$document = $this->_dms->getDocument($row["document"]);
|
||||
/** @var SeedDMS_Core_DocumentContent $content */
|
||||
$content = new $classname((int) $row["id"], $this, $row["version"], $row["comment"], $row["date"], $row["createdBy"], $row["dir"], $row["orgFileName"], $row["fileType"], $row["mimeType"], $row['fileSize'], $row['checksum']);
|
||||
$contents[] = $content;
|
||||
}
|
||||
return $contents;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Returns all folders of a given user
|
||||
* @return SeedDMS_Core_Folder[]|bool list of folders
|
||||
*/
|
||||
function getFolders() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "SELECT * FROM `tblFolders` ".
|
||||
"WHERE `owner` = " . $this->_id . " ORDER BY `sequence`";
|
||||
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
||||
$folders = array();
|
||||
$classname = $this->_dms->getClassname('folder');
|
||||
foreach ($resArr as $row) {
|
||||
/** @var SeedDMS_Core_Folder $folder */
|
||||
$folder = new $classname((int) $row["id"], $row["name"], $row['parent'], $row["comment"], $row["date"], $row["owner"], $row["inheritAccess"], $row["defaultAccess"], $row["sequence"]);
|
||||
$folder->setDMS($this->_dms);
|
||||
$folders[] = $folder;
|
||||
}
|
||||
return $folders;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Get a list of reviews
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user