예제 #1
0
    function getVenueTree(&$xmap, &$parent, $params,$id=0)
    {
        
        $db = &JFactory::getDBO();
        $gid = intval($xmap->gid);

         $xmap->changeLevel(1);
        if ( !$id ) {
            $query = "SELECT id , venue, alias"
                . "\nFROM #__eventlist_venues"
                . "\nWHERE published = 1"
                . "\nORDER BY ordering";
            $db->setQuery($query);
            $venues = $db->loadObjectList();

            foreach($venues as $venue)
            {
                $node = new stdclass;
                $node->id   = $parent->id;
                $node->uid   = $parent->uid.'v'.$venue->id;
                   $node->name = $venue->venue;
                $node->link = 'index.php?option=com_eventlist&view=venueevents&id='.$venue->id.':'.$venue->alias;
                $node->expandible = true;
                if ( $xmap->printNode($node) !== FALSE ) {
                    xmap_com_eventlist::getVenueTree($xmap, $parent,$params,$venue->id);
                }
            }
        } else {
            if ($params['include_events']) {
                if ($params['compat'] == '1.0') {
                    $db->setQuery ("select `id`, `title`,`alias`,UNIX_TIMESTAMP(`created`) as `created`,UNIX_TIMESTAMP(`modified`) as `modified` from #__eventlist_events where catsid=$id and `published` = '1' ".$params['days']." order by dates,times,enddates,endtimes " . $params['limit']);
		} else {
                    $db->setQuery ("select `id`, `title`,`alias`,UNIX_TIMESTAMP(`created`) as `created`,UNIX_TIMESTAMP(`modified`) as `modified` from #__eventlist_events e, #__eventlist_cats_event_relations r where e.id = r.itemid and r.catid=$id and e.`published` = '1' ".$params['days']." order by dates,times,enddates,endtimes " . $params['limit']);
		}
                $rows = $db->loadObjectList();
                foreach($rows as $event) {
                    $node = new stdclass;
                    $node->id   = $parent->id;
                    $node->uid  = $parent->uid .'e'.$event->id;
                    $node->name = $event->title;
                    $node->modified = ($event->modified? $event->modified : $event->created);
                    $node->link = 'index.php?option=com_eventlist&view=details&id='.$event->id.':'.$event->alias;
                    $node->priority   = $params['event_priority'];
                    $node->changefreq = $params['event_changefreq'];
                    $node->expandible = false;
                    $xmap->printNode($node);
                }
            }
        }

        $xmap->changeLevel(-1);
        
    }