[Fusionforge-commits] r13991 - trunk/src/common/docman

Franck VILLAUME nerville at fusionforge.org
Thu Jul 28 18:10:49 CEST 2011


Author: nerville
Date: 2011-07-28 18:10:49 +0200 (Thu, 28 Jul 2011)
New Revision: 13991

Modified:
   trunk/src/common/docman/DocumentGroup.class.php
   trunk/src/common/docman/DocumentManager.class.php
Log:
initial support for number of documents information in menu

Modified: trunk/src/common/docman/DocumentGroup.class.php
===================================================================
--- trunk/src/common/docman/DocumentGroup.class.php	2011-07-28 15:49:32 UTC (rev 13990)
+++ trunk/src/common/docman/DocumentGroup.class.php	2011-07-28 16:10:49 UTC (rev 13991)
@@ -407,6 +407,16 @@
 		}
 	}
 
+	function getNumberOfDocuments($stateId = 1) {
+		$res = db_query_params('select count(*) from docdata_vw where doc_group = $1 and group_id = $2 and stateid = $3',
+					array($this->getID(), $this->Group->getID(), $stateId));
+		if (!$res) {
+			return 0;
+		}
+		$arr = db_fetch_array($res);
+		return $arr[0];
+	}
+
 	/**
 	 * hasSubgroup - Checks if this group has a specified subgroup associated to it
 	 *

Modified: trunk/src/common/docman/DocumentManager.class.php
===================================================================
--- trunk/src/common/docman/DocumentManager.class.php	2011-07-28 15:49:32 UTC (rev 13990)
+++ trunk/src/common/docman/DocumentManager.class.php	2011-07-28 16:10:49 UTC (rev 13991)
@@ -157,7 +157,12 @@
 				} else {
 					$link = '/docman/?group_id='.$this->Group->getID().'&view='.$linkmenu.'&dirid='.$localDg->getID();
 				}
-				echo '<li class="'.$liclass.'">'.util_make_link($link, $localDg->getName()).'</li>';
+				$nbDocsLabel = '';
+				$nbDocs = $localDg->getNumberOfDocuments();
+				if ($nbDocs) {
+					$nbDocsLabel = ' ('.$nbDocs.')';
+				}
+				echo '<li class="'.$liclass.'">'.util_make_link($link, $localDg->getName()).$nbDocsLabel.'</li>';
 				$this->getTree($selecteddir, $linkmenu, $subGroupIdValue);
 			}
 			echo '</ul>';




More information about the Fusionforge-commits mailing list