Phoca Download Tree Module with joomla 1.6

Phoca Download - download manager
nag_05us
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 12 Jan 2011, 15:30

Phoca Download Tree Module with joomla 1.6

Post by nag_05us »

Hi,

Phoca Download Tree Module with joomla 1.6 is giving below error , kindly help..

Fatal error: Call to undefined method PhocaDownloadHelperRoute::getsectionsroute() in .........modules\mod_phocadownload_tree\mod_phocadownload_tree.php on line 149

Thanks in advance...
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Tree Module with joomla 1.6

Post by Jan »

Hi, there is no such module for Joomla! 1.6 yet. :idea:

BTW: You cannot install Joomla! 1.5 component in Joomla! 1.6 (Joomla! 1.5 and Joomla! 1.6 are completely different systems inside)
If you find Phoca extensions useful, please support the project
nag_05us
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 12 Jan 2011, 15:30

Re: Phoca Download Tree Module with joomla 1.6

Post by nag_05us »

Hi Phoca Hero,

I need this module badly, can i expect this module to come shortly or suggest how to show this in tree structure... :x
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Tree Module with joomla 1.6

Post by Jan »

Hi, really no idea when I will find time to overwrite it :-(

Jan
If you find Phoca extensions useful, please support the project
webbati
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 21 Feb 2011, 15:31

Re: Phoca Download Tree Module with joomla 1.6

Post by webbati »

I have modified tree module so now it can display all categories and subcategories.
I have created a new directory (modules/mod_phocadownload_tree/helpers) and inside it a file named "mod_phocadownload_tree.php" with this content:

Code: Select all

<?php
defined('_JEXEC') or die();



class PhocaDownloadTree

{
	
	
	function getCats(){
		
		
			$db =& JFactory::getDBO();

			$query = "SELECT * FROM #__phocadownload_categories ORDER BY parent_id";
		
			$db->setQuery($query);
		
			$cats = $db->loadObjectList();
		
		return $cats;
	}
	
	
	function getSubCats( $pid ) {
		
			$db =& JFactory::getDBO();

			$query = "SELECT * FROM #__phocadownload_categories WHERE parent_id = '".$pid."' ORDER BY id";
	
			$subCats = $db->loadObjectList();
		
		return $subCats;
	
	
	}

}
?>




and have modified a entrypoint file "mod_phocadownload_tree.php" in "modules/mod_phocadownload_tree/" with:

Code: Select all


<?php
/*
 * @package Joomla 1.5
 * 
 * modified version for Joomla 1.6 by webbati 
 * 
 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 *
 * @module Phoca - Phoca Module
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @based on javascript: dTree 2.05 www.destroydrop.com/javascript/tree/
 * @copyright (c) 2002-2003 Geir Landrö
 * 
 */
defined('_JEXEC') or die('Restricted access');// no direct access
if (!JComponentHelper::isEnabled('com_phocadownload', true)) {
	return JError::raiseError(JText::_('Phoca Download Error'), JText::_('Phoca Download is not installed on your system'));
}

require_once( JPATH_BASE.DS.'components'.DS.'com_phocadownload'.DS.'helpers'.DS.'phocadownload.php' );
require_once( JPATH_BASE.DS.'components'.DS.'com_phocadownload'.DS.'helpers'.DS.'route.php' );
require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_phocadownload'.DS.'helpers'.DS.'phocadownload.php' );
require_once( JPATH_BASE.DS.'modules'.DS.'mod_phocadownload_tree'.DS.'helpers'.DS.'mod_phocadownload_tree.php' );

$user 		= &JFactory::getUser();
$db 		= &JFactory::getDBO();
$menu 		= &JSite::getMenu();
$document	= &JFactory::getDocument();
		
// Start CSS
$document->addStyleSheet(JURI::base(true).'/modules/mod_phocadownload_tree/assets/dtree.css');
$document->addScript( JURI::base(true) . '/modules/mod_phocadownload_tree/assets/dtree.js' );
$imgPath = JURI::base(true) . '/modules/mod_phocadownload_tree/assets/';

//Unique id for more modules
$treeId = "d".uniqid( "tree_" );

// Current category info
$id 	= JRequest::getVar( 'id', 0, '', 'int' );
$option = JRequest::getVar( 'option', 0, '', 'string' );
$view 	= JRequest::getVar( 'view', 0, '', 'string' );
$categorie = new PhocaDownloadTree; 

// Params
$hideC = $params->get( 'hide_categories', '');
$hideS = $params->get( 'hide_sections', '' );


$aid 	= $user->get('aid', 0);	


$miecats = $categorie->getCats();

$tree 		= array();
$newIdSec	= array();
$newIdCat	= array();
$userAID	= $user->get('aid', 0);
$userID		= $user->get('id', 0);


foreach ($miecats as $miecat){
	
	

	if ($miecat->parent_id == '0'){
			
	$link = JRoute::_(PhocaDownloadHelperRoute::getCategoryRoute($miecat->id, $miecat->alias));	
	$tree[] =  $treeId.'.add('.$miecat->id.', 0 ,\''.addslashes($miecat->title).'\',\''.$link.'\');'."\n";
	$newIdSec[$miecat->id] = $miecat->id;
	

	$subcats = $categorie->getSubCats($miecat->id);
	
	foreach ($subcats as $subcat){
		if ($subcat->parent_id != '0'){
			
		$link = JRoute::_(PhocaDownloadHelperRoute::getCategoryRoute($subcat->id, $subcat->alias, $subcat->id));
				$tree[] =  $treeId.'.add('.$subcat->id.','.$subcat->parent_id .',\''.addslashes($subcat->title).'\',\''.$link.'\');'."\n";
				$newIdCat[$subcat->id] = $subcat->id;
		
	
		
				} // fine if subcat
		
		
			} // fine foreach subcats
	
		} // fine if 
	
	} // fine foreach  miecats

// We added unique numbers to categories and sections (because section can have the same id as category we must to add other ids)
if ( $option == 'com_phocadownload' && $view == 'categories' ) {
	if (isset($newIdSec[$id])) {
		$catAndSecId = (int)$newIdSec[$id];
	} else {
		$catAndSecId = 0;
	}
} else if ( $option == 'com_phocadownload' && $view == 'category' ) {
	if (isset($newIdCat[$id])) {
		$catAndSecId = (int)$newIdCat[$id];
	} else {
		$catAndSecId = 0;
	} 
} else {
	$catAndSecId = 0;
}

// Categories (Head)
$linkSections = JRoute::_(PhocaDownloadHelperRoute::getCategoriesRoute());
// Create javascript code	
$jsTree = '';
foreach($tree as $key => $value) {
	$jsTree .= $value ;
}
//  Output
$output ='<div style="text-align:left;">';
$output.='<div class="dtree">';
$output.='<script type="text/javascript">'."\n";
$output.='<!--'."\n";
$output.=''."\n";
$output.=''.$treeId.' = new dTree2568(\''.$treeId.'\', \''.$imgPath.'\');'."\n";
$output.=''."\n";
$output.=''.$treeId.'.add(0,-1,\''.JText::_( 'Download' ).'\',\''.$linkSections.'\');'."\n";
$output.=$jsTree;
$output.=''."\n";
$output.='document.write('.$treeId.');'."\n";
$output.=''.$treeId.'.openTo('. (int) $catAndSecId.',\'true\');'. "\n";
$output.=''."\n";
$output.='//-->'."\n";
$output.='</script>';
$output.='</div></div>';

require(JModuleHelper::getLayoutPath('mod_phocadownload_tree'));
?>


if you prefer to show only the main categories and only the first level look here http://forum.joomla.it/index.php/topic,126581.0.html where i describe how to do it.

i hope this help you, bye
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Tree Module with joomla 1.6

Post by Jan »

Hi, thank you for this info.

Jan
If you find Phoca extensions useful, please support the project
Post Reply