emeyer
Karma: 0
|
Re:plugin for Joomap - 2009/05/02 12:23
I have each container linked to a menu. This is a joomap to list files in containers from such menu links:
<?php defined('_JEXEC') or die('Direct Access to this location is not allowed.'); $tmp = new Joomap_Remository; JoomapPlugins::addPlugin( $tmp ); class Joomap_Remository { function isOfType( &$joomla, &$parent ) { if( strpos($parent->link, 'option=com_remository') ) { return true; } return false; } function &getTree( &$joomap, &$parent ) { if( strpos($parent->link, '&func=select') ) { list($script, $query) = explode('?', $parent->link, 2); $queryParts = explode('&', $query); $query = new StdClass(); foreach ($queryParts as $part) { list($key, $val) = explode('=', $part, 2); if ($key) $query->$key = $val; } $database =& JFactory::getDBO(); $list = array(); $database->setQuery("SELECT id, filetitle FROM #__downloads_files WHERE published ='1' AND containerid ='$query->id'"); $myfiles = $database->loadObjectList(); foreach($myfiles as $myfile) { $node = new stdclass; $node->id = $parent->id; $node->name = $myfile->filetitle; $node->link = 'index.php?option=com_remository&func=fileinfo&id='.$myfile->id; $node->tree = array(); $list[$myfile->id] = $node; } return $list; } } }
?>
Post edited by: emeyer, at: 2009/05/02 12:23
http://heavensonearth.com |