I have made some changes to Phoca Download which I'd like to present for you consideration. I am the lead developer on the JEvents calendar and co-developer of Joomfish - for both projects we have created a special members club. The club benefits include access to exclusive member only download areas - we have been using RokDownloads for this but are a bit frustrated with the features and layouts.
I have taken a look at Phoca Download as an alternative and it looks very promising apart from the fact that we can't control access to sections/categories/files on a user type basis (i.e. bronze, silver or gold member access). In RokDownloads I was able to write a content and system plugin that enabled me to manipulate the files and folders that were available. In Phoca there is no equivalent mechanism possible.
I have made some simple changes to a test installation that makes this possible - this basically uses a plugin to inject additional contraints in the database queries.
For example in the section model method _getCategoryListQuery the code is changed to
Code: Select all
function _getCategoryListQuery( $sectionId, $aid, $params ) {
$wheres[] = " cc.section= ".(int)$sectionId;
if ($aid !== null) {
$wheres[] = "cc.access <= " . (int) $aid;
}
$wheres[] = " cc.published = 1";
$categoryOrdering = $this->_getCategoryOrdering();
// GWE MOD - to allow for access restrictions
JPluginHelper::importPlugin("phoca");
$dispatcher =& JDispatcher::getInstance();
$joins = array();
$results = $dispatcher->trigger('onGetCategoryList', array (&$wheres, &$joins, $sectionId, $params));
// END GWE MOD
$query = " SELECT cc.id, cc.title, cc.alias, COUNT(c.id) AS numdoc"
. " FROM #__phocadownload_categories AS cc"
. " LEFT JOIN #__phocadownload AS c ON c.catid = cc.id AND c.published = 1 AND c.textonly = 0"
. (count($joins)>0?( " LEFT JOIN " .implode( " LEFT JOIN ", $joins )):"") // GWE MOD
. " WHERE " . implode( " AND ", $wheres )
. " GROUP BY cc.id"
. " ORDER BY cc.".$categoryOrdering;
return $query;
}
Is there any chance this type of change could be adopted in the phoca code base so I don't need to maintain a separate version?
Geraint