[Fusionforge-commits] r15995 - in trunk/src: . common/docman common/docman/views

Franck VILLAUME nerville at fusionforge.org
Mon Jul 16 20:13:39 CEST 2012


Author: nerville
Date: 2012-07-16 20:13:39 +0200 (Mon, 16 Jul 2012)
New Revision: 15995

Modified:
   trunk/src/CHANGES
   trunk/src/common/docman/Document.class.php
   trunk/src/common/docman/views/listfile.php
Log:
docman new feature : number of download per file

Modified: trunk/src/CHANGES
===================================================================
--- trunk/src/CHANGES	2012-07-16 18:08:13 UTC (rev 15994)
+++ trunk/src/CHANGES	2012-07-16 18:13:39 UTC (rev 15995)
@@ -8,6 +8,7 @@
         fingerprint, deploy flag, easy delete (TrivialDev)
 * Docman: Directory monitoring (TrivialDev)
 * Activity: New Directory appears now in activity (TrivialDev)
+* Docman: Number of download per file (TrivialDev)
 
 Plugins:
 * headermenu: new plugin to add links in login/logout menu link (TrivialDev)

Modified: trunk/src/common/docman/Document.class.php
===================================================================
--- trunk/src/common/docman/Document.class.php	2012-07-16 18:08:13 UTC (rev 15994)
+++ trunk/src/common/docman/Document.class.php	2012-07-16 18:13:39 UTC (rev 15995)
@@ -415,6 +415,7 @@
 	 * @return	string	The filedata.
 	 */
 	function getFileData() {
+		$this->downloadUp();
 		return file_get_contents(DocumentStorage::instance()->get($this->getID()));
 	}
 
@@ -437,6 +438,15 @@
 	}
 
 	/**
+	 * getDownload - get the number of views of this document.
+	 *
+	 * @return	int	the number of views
+	 */
+	function getDownload() {
+		return $this->data_array['download'];
+	}
+
+	/**
 	 * getCreated - get the time this document was created.
 	 *
 	 * @return	int	The epoch date this document was created.
@@ -950,6 +960,14 @@
 	}
 
 	/**
+	 * downloadUp - +1 on download column
+	 *
+	 */
+	private function downloadUp() {
+		$this->setValueinDB('download', ++$this->data_array['download']);
+	}
+
+	/**
 	 * setValueinDB - private function to update columns in db
 	 *
 	 * @param	string	the column to update
@@ -960,7 +978,8 @@
 	private function setValueinDB($column, $value) {
 		switch ($column) {
 			case "stateid":
-			case "doc_group": {
+			case "doc_group":
+			case "download": {
 				$qpa = db_construct_qpa();
 				$qpa = db_construct_qpa($qpa, 'UPDATE doc_data SET ');
 				$qpa = db_construct_qpa($qpa, $column);

Modified: trunk/src/common/docman/views/listfile.php
===================================================================
--- trunk/src/common/docman/views/listfile.php	2012-07-16 18:08:13 UTC (rev 15994)
+++ trunk/src/common/docman/views/listfile.php	2012-07-16 18:13:39 UTC (rev 15995)
@@ -217,8 +217,8 @@
 }
 
 if (isset($nested_docs[$dirid]) && is_array($nested_docs[$dirid])) {
-	$tabletop = array('<input id="checkallactive" type="checkbox" title="'._('Select / Deselect all documents for massaction').'" class="tabtitle-w" onchange="controllerListFile.checkAll(\'checkeddocidactive\', \'active\')" />', '', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'));
-	$classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '');
+	$tabletop = array('<input id="checkallactive" type="checkbox" title="'._('Select / Deselect all documents for massaction').'" class="tabtitle-w" onchange="controllerListFile.checkAll(\'checkeddocidactive\', \'active\')" />', '', _('Filename'), _('Title'), _('Description'), _('Author'), _('Last time'), _('Status'), _('Size'), _('View'));
+	$classth = array('unsortable', 'unsortable', '', '', '', '', '', '', '', '');
 	if (forge_check_perm('docman', $ndg->Group->getID(), 'approve')) {
 		$tabletop[] = _('Actions');
 		$classth[] = 'unsortable';
@@ -296,6 +296,9 @@
 			}
 		}
 		echo '</td>';
+		echo '<td>';
+			echo $d->getDownload();
+		echo '</td>';
 
 		if (forge_check_perm('docman', $group_id, 'approve')) {
 			echo '<td>';




More information about the Fusionforge-commits mailing list