On branch master
[event_calendar.git] / eventcalendar.sitemap.php
blob49d3ab3dbd10cb1f39789914e28a165fdd8a2507
1 <?php
3 /*
4 * Event Calendar for Elxis CMS 2008.x and 2009.x
6 * Sitemap extension
8 * @version 1.1
9 * @package eventCalendar
10 * @author Apostolos Koutsoulelos <akoutsoulelos@yahoo.gr>
11 * @copyright Copyright (C) 2009-2010 Apostolos Koutsoulelos. All rights reserved.
12 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
13 * @link
16 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
18 if (!defined('EVCALBASE')) {
19 global $_VERSION;
20 if ($_VERSION->RELEASE > 2008) {
21 define('EVCALBASE', 'events');
22 } else {
23 define('EVCALBASE', 'com_eventcalendar');
27 class sitemap_eventcalendar {
29 /***************/
30 /* CONSTRUCTOR */
31 /***************/
32 public function __construct() {
36 /****************************/
37 /* MENU ITEM TYPE VALIDATOR */
38 /****************************/
39 public function isOfType( $parent ) {
40 if (strpos($parent->link, 'option=com_eventcalendar')) { return true; }
41 return false;
45 /********************/
46 /* RETURN NODE TREE */
47 /********************/
48 public function getTree($parent) {
49 global $database, $xartis, $mainframe, $my;
51 $query = "SELECT id FROM #__menu"
52 ."\n WHERE link = 'index.php?option=com_eventcalendar' AND published = '1'"
53 ."\n AND ((language IS NULL) OR (language LIKE '%".$xartis->maplang."%'))";
54 $database->setQuery($query, '#__', 1, 0);
55 $_Itemid = intval($database->loadResult());
57 $database->setQuery("SELECT * FROM #__categories WHERE section = 'com_eventcalendar' ORDER BY title ASC");
58 $rows = $database->loadObjectList();
60 $list = array();
61 if ($rows) {
62 foreach ($rows as $row) {
63 $node = new stdClass;
64 $node->name = $row->title;
65 $node->link = 'index.php?option=com_eventcalendar&amp;task=catview&amp;catid='.$row->id;
66 $node->seolink = EVCALBASE.'/'.$row->seotitle.'/';
67 $node->id = $_Itemid;
68 $node->modified = time() + ($mainframe->getCfg('offset') * 3600);
69 $node->changefreq = 'daily';
70 $node->priority = '0.8';
71 $node->pid = 0;
72 $node->icon = 'category';
73 $list[$row->id] = $node;
74 unset($node);
78 return $list;
84 global $xartis;
85 $tmp = new sitemap_eventcalendar;
86 $xartis->addExtension($tmp);
87 unset($tmp);