Page 1 of 1

Plugin code to connect Joomap 2.06 with Phoca gallery 2.1.0

Posted: 31 Jan 2009, 17:54
by alphastar
Hello everybody.

I want to connect Joomap 2.06 with Phoca gallery 2.1.0. To do this I used Datso gallery plugin and modified it according to Phoca tables. But if there is only one menu item of Phoca gallery kind that's ok. If there are 2 ore more menu items of Phoca - problems with displaying occure. There all categories and subcategories displayed in each menu item of map. You can see it herehttp://natalia-roman-design.com/en/site-map Is here anyone who can modify this code (I'm not a programmer)?

Code: Select all

<?php

    defined( '_VALID_MOS' ) or die( 'Restricted access.' );

    $tmp = new Joomap_PhocaGallery;
    JoomapPlugins::addPlugin( $tmp );

   class Joomap_PhocaGallery {

  
  function isOfType( &$joomla, &$parent ) {
            if( strpos($parent->link, 'option=com_phocagallery') ) {
                return true;}
            return false;
        }
    
        function &getTree( &$joomap, &$parent ) {
            global $database;
    
            $list = array();
        
            $database->setQuery("select id, title, parent_id from #__phocagallery_categories order by ordering");
            $categories = $database->loadObjectList();
    
            foreach($categories as $category) {
                $node = new stdclass;
                $node->id   = $parent_id->id;
                $node->name = $category->title;
                $node->link = $parent_id->link.'&Itemid='.$parent_id->id.'&func=viewcategory&catid='.$category->id;
                $node->tree = array();
                $node->pid = $category->parent_id;
            
                $list[$category->id] = $node;
            }
        
            foreach( $list as $id => $category ) {                            // move children into their parent nodes
                if( $category->pid > 0  && isset($list[$category->pid]) ) {
                    $list[ $category->pid ]->tree[$id] = &$list[$id];
                }
            }
            
            foreach( $list as $id => $category ) {                            // remove children from top tree
                if( $category->pid > 0 ) {
                    unset( $list[$id] );
                }
            }
            
        return $list;
        }
    }

?>

Re: Plugin code to connect Joomap 2.06 with Phoca gallery 2.1.0

Posted: 10 Mar 2009, 16:23
by Jan
Hi, yes. On one hant the itemid and menu id is very powerful in Joomla! but on other there are some problems like this or like creating links in some component (because if link is created in component, it doesn't have any Itemid and need to find some :-( )

Jan