$this->data_array['trashid'] = $arr['doc_group'];
return $this->data_array['trashid'];
} else {
- $this->setError('DocumentManager:: trash not found');
- return -1;
+ $dg = new DocumentGroup($this->Group);
+ $dg->create('.trash');
+ $dg->setStateID('2');
+ return $dg->getID();
}
+ return false;
}
/**
/**
* getTree - display recursively the content of the doc_group. Only doc_groups within doc_groups.
*
+ * @param integer the selected directory
* @param string the type of link in the menu
- * @param int the doc_group to start: default 0
+ * @param integer the doc_group to start: default 0
*/
- function getTree($linkmenu, $docGroupId = 0) {
+ function getTree($selecteddir, $linkmenu, $docGroupId = 0) {
+ global $g; // the master group of all the groups .... anyway.
$dg = new DocumentGroup($this->Group);
switch ($linkmenu) {
case "listtrashfile": {
}
}
$subGroupIdArr = $dg->getSubgroup($docGroupId, $stateId);
- echo '<ul>';
- foreach ($subGroupIdArr as $subGroupIdValue) {
- $localDg = new DocumentGroup($this->Group, $subGroupIdValue);
- echo '<li><a href="?group_id='.$this->Group->getID().'&view='.$linkmenu.'&dirid='.$localDg->getID().'">'.$localDg->getName().'</a></il>';
- $this->getTree($linkmenu, $subGroupIdValue);
+ if (sizeof($subGroupIdArr)) {
+ echo '<ul>';
+ foreach ($subGroupIdArr as $subGroupIdValue) {
+ $localDg = new DocumentGroup($this->Group, $subGroupIdValue);
+ $liclass = 'docman_li_treecontent';
+ if ($selecteddir == $localDg->getID()) {
+ $liclass = 'docman_li_treecontent_selected';
+ }
+ if ($this->Group->getID() != $g->getID()) {
+ $link = '/docman/?group_id='.$g->getID().'&view='.$linkmenu.'&dirid='.$localDg->getID().'&childgroup_id='.$this->Group->getID();
+ } else {
+ $link = '/docman/?group_id='.$this->Group->getID().'&view='.$linkmenu.'&dirid='.$localDg->getID();
+ }
+ $nbDocsLabel = '';
+ $nbDocs = $localDg->getNumberOfDocuments($stateId);
+ if ($stateId == 1 && forge_check_perm('docman', $this->Group->getID(), 'approve')) {
+ $nbDocsPending = $localDg->getNumberOfDocuments(3);
+ $nbDocsHidden = $localDg->getNumberOfDocuments(4);
+ $nbDocsPrivate = $localDg->getNumberOfDocuments(5);
+ }
+
+ if ($nbDocs && (!isset($nbDocsPending) || $nbDocsPending == 0) && (!isset($nbDocsHidden) || $nbDocsHidden == 0) && (!isset($nbDocsPrivate) || $nbDocsPrivate)) {
+ $nbDocsLabel = '<span class="tabtitle" title="'._('Number of documents in this folder').'" >('.$nbDocs.')</span>';
+ }
+ if (isset($nbDocsPending) && isset($nbDocsHidden) && isset($nbDocsPrivate)) {
+ $nbDocsLabel = '<span class="tabtitle" title="'._('Number of documents in this folder per status. active/pending/hidden/private').'" >('.$nbDocs.'/'.$nbDocsPending.'/'.$nbDocsHidden.'/'.$nbDocsPrivate.')';
+ }
+ echo '<li class="'.$liclass.'">'.util_make_link($link, $localDg->getName()).$nbDocsLabel.'</li>';
+ $this->getTree($selecteddir, $linkmenu, $subGroupIdValue);
+ }
+ echo '</ul>';
}
- echo '</ul>';
}
}