Plugin code to connect Joomap 2.06 with Phoca gallery 2.1.0

Phoca Gallery - image gallery extension
User avatar
alphastar
Phoca Member
Phoca Member
Posts: 10
Joined: 31 Jan 2009, 17:31
Location: Donetsk, Ukraine
Contact:

Plugin code to connect Joomap 2.06 with Phoca gallery 2.1.0

Post 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;
        }
    }

?>
Last edited by caro84g on 31 Jan 2009, 20:19, edited 1 time in total.
Reason: added code tags
Be bright and shine like alpha stars!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48752
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

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

Post 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
If you find Phoca extensions useful, please support the project
Post Reply