root/trunk/midcom/de.linkm.sitemap/viewer.php

Revision 17359, 2.6 kB (checked in by flack, 1 month ago)

switch to PHP5-style constructors, part 7

  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 /**
3  * @package de.linkm.sitemap
4  * @author The Midgard Project, http://www.midgard-project.org
5  * @version $Id$
6  * @copyright The Midgard Project, http://www.midgard-project.org
7  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
8  */
9
10 /**
11  * Sitemap MidCOM Viewer class.
12  *
13  * @package de.linkm.sitemap
14  */
15 class de_linkm_sitemap_viewer extends midcom_baseclasses_components_request
16 {
17     var $_nav;            // midcom_helper_nav reference
18     var $_current_node;   // ID of current node we're in
19     var $_root_node_id;   // ID of the root node to use
20
21     function __construct($object, $config)
22     {
23         parent::__construct($object, $config);
24         $this->_current_node = null;
25     }
26
27     /**
28      * Initialize the request switch and the content topic.
29      *
30      * @access protected
31      */
32     function _on_initialize()
33     {
34         // Google Sitemap Mode creates an XML output of the sitemap. Configuration switch
35         // defines whether we should show the sitemap as content or
36         if ($this->_config->get('google_sitemap_mode'))
37         {
38             $this->_request_switch['sitemap'] = Array
39             (
40                 'handler'      => array ('de_linkm_sitemap_handler_sitemap', 'xml'),
41             );
42         }
43         else
44         {
45             $this->_request_switch['sitemap'] = Array
46             (
47                 'handler'      => array ('de_linkm_sitemap_handler_sitemap', 'sitemap'),
48             );
49
50             $this->_request_switch['xml_sitemap'] = array
51             (
52                 'handler'      => array ('de_linkm_sitemap_handler_sitemap', 'xml'),
53                 'fixed_args'   => array ('sitemap.xml'),
54             );
55         }
56
57         // Match /config/
58         $this->_request_switch['config'] = Array
59         (
60             'handler' => Array('midcom_core_handler_configdm', 'configdm'),
61             'schemadb' => 'file:/de/linkm/sitemap/config/schemadb_config.inc',
62             'schema' => 'config',
63             'fixed_args' => Array('config'),
64         );
65     }
66
67     /**
68      * Get the list of root nodes
69      *
70      * @access public
71      * @static
72      */
73     function list_root_nodes()
74     {
75         $root_topic = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ROOTTOPIC);
76
77         $root_nodes = array();
78         $root_nodes[''] = '';
79
80         $qb = midcom_db_topic::new_query_builder();
81         $qb->add_constraint('up', '=', $root_topic->id);
82         $qb->add_order('score');
83         $qb->add_order('name');
84         $nodes = $qb->execute();
85
86         foreach ($nodes as $node)
87         {
88             $root_nodes[$node->guid] = $node->extra;
89         }
90
91         return $root_nodes;
92     }
93 }
94 ?>
Note: See TracBrowser for help on using the browser.