| 1 | <?php |
|---|
| 2 | /********************************************************************\ |
|---|
| 3 | * This program is free software; you can redistribute it and/or * |
|---|
| 4 | * modify it under the terms of the GNU General Public License as * |
|---|
| 5 | * published by the Free Software Foundation; either version 2 of * |
|---|
| 6 | * the License, or (at your option) any later version. * |
|---|
| 7 | * * |
|---|
| 8 | * This program is distributed in the hope that it will be useful, * |
|---|
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|---|
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|---|
| 11 | * GNU General Public License for more details. * |
|---|
| 12 | * * |
|---|
| 13 | * You should have received a copy of the GNU General Public License* |
|---|
| 14 | * along with this program; if not, contact: * |
|---|
| 15 | * * |
|---|
| 16 | * Free Software Foundation Voice: +1-617-542-5942 * |
|---|
| 17 | * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * |
|---|
| 18 | * Boston, MA 02111-1307, USA gnu@gnu.org * |
|---|
| 19 | * * |
|---|
| 20 | \********************************************************************/ |
|---|
| 21 | /**@file index.php Displays all the content associated to a hotspot |
|---|
| 22 | * @author Copyright (C) 2005 François Proulx |
|---|
| 23 | */ |
|---|
| 24 | |
|---|
| 25 | define('BASEPATH', '../'); |
|---|
| 26 | require_once BASEPATH.'include/common.php'; |
|---|
| 27 | require_once BASEPATH.'classes/MainUI.php'; |
|---|
| 28 | require_once BASEPATH.'include/common_interface.php'; |
|---|
| 29 | require_once BASEPATH.'classes/Node.php'; |
|---|
| 30 | |
|---|
| 31 | if (CONF_USE_CRON_FOR_DB_CLEANUP == false) |
|---|
| 32 | { |
|---|
| 33 | garbage_collect(); |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | $node = null; |
|---|
| 37 | if(!empty($_REQUEST['gw_id'])) |
|---|
| 38 | $node = Node :: getObject($_REQUEST['gw_id']); |
|---|
| 39 | |
|---|
| 40 | if ($node == null) |
|---|
| 41 | { |
|---|
| 42 | $smarty->display("templates/message_unknown_hotspot.html"); |
|---|
| 43 | exit; |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | $node_id = $node->getId(); |
|---|
| 47 | $portal_template = $node_id.".html"; |
|---|
| 48 | Node :: setCurrentNode($node); |
|---|
| 49 | |
|---|
| 50 | $ui = new MainUI(); |
|---|
| 51 | if (isset ($session)) |
|---|
| 52 | { |
|---|
| 53 | $smarty->assign("original_url_requested", $session->get(SESS_ORIGINAL_URL_VAR)); |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | $tool_html = ''; |
|---|
| 57 | |
|---|
| 58 | $tool_html .= "<h1>"._("Online users")."</h1>"."\n"; |
|---|
| 59 | $tool_html .= '<p class="indent">'."\n"; |
|---|
| 60 | $current_node = Node :: getCurrentNode(); |
|---|
| 61 | if ($current_node != null) |
|---|
| 62 | { |
|---|
| 63 | $current_node_id = $current_node->getId(); |
|---|
| 64 | $online_users = $current_node->getOnlineUsers(); |
|---|
| 65 | $num_online_users = count($online_users); |
|---|
| 66 | if ($num_online_users > 0) |
|---|
| 67 | { |
|---|
| 68 | //$tool_html .= $num_online_users.' '._("other users online at this hotspot..."); |
|---|
| 69 | $tool_html .= "<ul class='users_list'>\n"; |
|---|
| 70 | foreach($online_users as $online_user) |
|---|
| 71 | $tool_html .= "<li>{$online_user->getUsername()}</li>\n"; |
|---|
| 72 | $tool_html .= "</ul>\n"; |
|---|
| 73 | } |
|---|
| 74 | else |
|---|
| 75 | { |
|---|
| 76 | $tool_html .= _("Nobody is online at this hotspot..."); |
|---|
| 77 | } |
|---|
| 78 | } |
|---|
| 79 | else |
|---|
| 80 | { |
|---|
| 81 | $current_node_id = null; |
|---|
| 82 | $tool_html .= _("You are not currently at a hotspot..."); |
|---|
| 83 | } |
|---|
| 84 | $tool_html .= "</p>"."\n"; |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | /* |
|---|
| 88 | $tool_html .= '<p class="indent">'."\n"; |
|---|
| 89 | $tool_html .= "<a href='content.php?gw_id={$current_node_id}' target='_blank.right'><img src='/images/start.gif'></a>"."\n"; |
|---|
| 90 | $tool_html .= "</p>"."\n"; |
|---|
| 91 | */ |
|---|
| 92 | $ui->setToolContent($tool_html); |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | $html = ''; |
|---|
| 96 | $html .= "<div id='portal_container'>\n"; |
|---|
| 97 | |
|---|
| 98 | /* Node section */ |
|---|
| 99 | // Get all locative artistic content for this node |
|---|
| 100 | $contents = $node->getAllLocativeArtisticContent(); |
|---|
| 101 | if($contents) |
|---|
| 102 | { |
|---|
| 103 | $html .= "<table width='100%'><tr><td>"; |
|---|
| 104 | $html .= "<div class='portal_node_section'>\n"; |
|---|
| 105 | $html .= "<span class='portal_section_title'>"._("Content from:")." "; |
|---|
| 106 | |
|---|
| 107 | $node_homepage = $node->getHomePageURL(); |
|---|
| 108 | if(!empty($node_homepage)) |
|---|
| 109 | { |
|---|
| 110 | $html .= "<a href='$node_homepage'>"; |
|---|
| 111 | } |
|---|
| 112 | $html .= $node->getName(); |
|---|
| 113 | if(!empty($node_homepage)) |
|---|
| 114 | { |
|---|
| 115 | $html .= "</a>\n"; |
|---|
| 116 | } |
|---|
| 117 | $html .= "</span>"; |
|---|
| 118 | $html .= "</td></tr></table>"; |
|---|
| 119 | |
|---|
| 120 | foreach ($contents as $content) |
|---|
| 121 | { |
|---|
| 122 | $html .= "<div class='portal_content'>\n"; |
|---|
| 123 | $html .= $content->getUserUI(); |
|---|
| 124 | $html .= "</div>"; |
|---|
| 125 | } |
|---|
| 126 | $html .= "</div>\n"; |
|---|
| 127 | } |
|---|
| 128 | |
|---|
| 129 | $ui->setMainContent($html); |
|---|
| 130 | $ui->display(); |
|---|
| 131 | |
|---|
| 132 | ?> |
|---|