getDocumentList() accepts parameter for direction of order

This commit is contained in:
Uwe Steinmann 2016-08-09 15:14:17 +02:00
parent 148088f42a
commit eef3b28270

View File

@ -733,7 +733,7 @@ class SeedDMS_Core_DMS {
* І have already taken care of. * І have already taken care of.
* @return array list of documents * @return array list of documents
*/ */
function getDocumentList($listtype, $param1=null, $param2='') { /* {{{ */ function getDocumentList($listtype, $param1=null, $param2='', $param3='') { /* {{{ */
/* The following query will get all documents and lots of additional /* The following query will get all documents and lots of additional
* information. It requires the two temporary tables ttcontentid and * information. It requires the two temporary tables ttcontentid and
* ttstatid. * ttstatid.
@ -919,11 +919,16 @@ class SeedDMS_Core_DMS {
case 'MyDocs': // Documents owned by me case 'MyDocs': // Documents owned by me
$user = $param1; $user = $param1;
$orderby = $param2; $orderby = $param2;
if($param3 == 'desc')
$orderdir = 'DESC';
else
$orderdir = 'ASC';
$queryStr .= "AND `tblDocuments`.`owner` = '".$user->getID()."' "; $queryStr .= "AND `tblDocuments`.`owner` = '".$user->getID()."' ";
if ($orderby=='e') $queryStr .= "ORDER BY `expires`"; if ($orderby=='e') $queryStr .= "ORDER BY `expires`";
else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`"; else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`";
else if ($orderby=='s') $queryStr .= "ORDER BY `status`"; else if ($orderby=='s') $queryStr .= "ORDER BY `status`";
else $queryStr .= "ORDER BY `name`"; else $queryStr .= "ORDER BY `name`";
$queryStr .= " ".$orderdir;
break; break;
case 'CheckedOutByMe': // Documents I have checked out case 'CheckedOutByMe': // Documents I have checked out
$user = $param1; $user = $param1;