Great idea - I have shown the modified mod_edocman_documents.php file to this post.
Code:
<?php
/**
* @version 1.0.0
* @package Joomla
* @subpackage Edocman
* @author Tuan Pham Ngoc
* @copyright Copyright (C) 2011 Ossolution Team
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die ('Restricted access');
require_once JPATH_ADMINISTRATOR.'/components/com_edocman/helpers/edocman.php';
EdocmanHelper::loadLanguage();
$db = & JFactory::getDBO();
$user = & JFactory::getUser() ;
$itemId = (int) $params->get('item_id');
if (!$itemId)
$itemId = EdocmanHelper::getItemid();
$numberDocuments = $params->get('number_documents', 6);
$categoryIds = $params->get('category_ids', '');
$type = $params->get('module_type', 1);
$where = array() ;
$where[] = 'a.published =1 ' ;
$where[] = 'a.access IN ('.implode(',', $user->getAuthorisedViewLevels()).')' ;
if ($categoryIds != '') {
$where[] = ' a.id IN (SELECT document_id FROM #__edocman_document_category WHERE category_id IN ('.$categoryIds.'))' ;
}
$sql = 'SELECT a.id, a.title, a.filename, a.hits, a.downloads FROM #__edocman_documents AS a WHERE '.implode(' AND ', $where) ;
switch ($type) {
case 1 :
$sql .= ' ORDER BY a.title ASC, a.ordering ' ;
$layout = 'lastest';
break ;
case 2 :
$sql .= ' ORDER BY a.hits DESC, a.ordering ' ;
$layout = 'top_hits' ;
break ;
case 3 :
$sql .= ' ORDER By a.downloads DESC ' ;
$layout = 'top_downloads';
break ;
}
$sql .= ' LIMIT 0, '.$numberDocuments ;
$db->setQuery($sql) ;
$rows = $db->loadObjectList();
require(JModuleHelper::getLayoutPath('mod_edocman_documents', $layout));
?>