| 105 | | if ($current_user && $current_user->isNobody()) |
| 106 | | { |
| 107 | | $html .= _("You do not have permissions to access any administration functions."); |
| 108 | | } else { |
| 109 | | |
| 110 | | $html .= "<ul class='admin_menu_list'>\n"; |
| 111 | | |
| 112 | | if ($current_user && $current_user->isSuperAdmin()) |
| 113 | | { |
| 114 | | $html .= "<li><a href='user_log.php'>"._("User logs")."</a></li>\n"; |
| 115 | | $html .= "<li><a href='online_users.php'>"._("Online Users")."</a></li>\n"; |
| 116 | | $html .= "<li><a href='stats.php'>"._("Statistics")."</a></li>\n"; |
| 117 | | $html .= "<li><a href='import_user_database.php'>"._("Import NoCat user database")."</a></li>\n"; |
| 118 | | $html .= "<li><a href='content_admin.php'>"._("Content manager")."</a></li>\n"; |
| 119 | | } |
| 120 | | |
| 121 | | $html .= "</ul>\n"; |
| 122 | | |
| 123 | | // If the user is super admin OR owner of at least one hotspot show the menu |
| 124 | | if ($current_user && ($current_user->isSuperAdmin() || $current_user->isOwner())) |
| 125 | | { |
| 126 | | /* Node admin */ |
| 127 | | $html .= "<div class='admin_section_container'>\n"; |
| 128 | | $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; |
| 129 | | $html .= "<div class='admin_section_title'>"._("Node administration:")." </div>\n"; |
| 130 | | |
| 131 | | $html .= "<div class='admin_section_data'>\n"; |
| 132 | | |
| 133 | | if ($current_user->isSuperAdmin()) |
| 134 | | $sql_additional_where = ''; |
| 135 | | else |
| 136 | | $sql_additional_where = "AND node_id IN (SELECT node_id from node_stakeholders WHERE is_owner = true AND user_id='".$current_user->getId()."')"; |
| 137 | | $html .= "<div id='NodeSelector'>\n"; |
| 138 | | $html .= Node :: getSelectNodeUI('object_id', $sql_additional_where); |
| 139 | | $html .= "</div>\n"; |
| 140 | | $html .= "</div>\n"; |
| 141 | | $html .= "<div class='admin_section_tools'>\n"; |
| 142 | | |
| 143 | | $html .= "<input type='hidden' name='object_class' value='Node'>\n"; |
| 144 | | $html .= "<input type='hidden' name='action' value='edit'>\n"; |
| 145 | | $html .= "<input type='submit' name='edit_submit' value='"._("Edit")."'>\n"; |
| 146 | | |
| 147 | | $html .= "</div>\n"; |
| 148 | | $html .= '</form>'; |
| 149 | | $html .= "</div>\n"; |
| 150 | | } |
| 151 | | |
| 152 | | /* Network admin */ |
| 153 | | if ($current_user && $current_user->isSuperAdmin()) |
| 154 | | { |
| 155 | | $html .= "<div class='admin_section_container'>\n"; |
| 156 | | $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; |
| 157 | | $html .= "<div class='admin_section_title'>"._("Network administration:")." </div>\n"; |
| 158 | | |
| 159 | | $html .= "<div class='admin_section_data'>\n"; |
| 160 | | $html .= "<input type='hidden' name='action' value='edit'>\n"; |
| 161 | | $html .= "<input type='hidden' name='object_class' value='Network'><br>\n"; |
| 162 | | $html .= Network :: getSelectNetworkUI('object_id'); |
| 163 | | $html .= "</div>\n"; |
| 164 | | $html .= "<div class='admin_section_tools'>\n"; |
| 165 | | |
| 166 | | $html .= "<input type=submit name='edit_submit' value='"._("Edit")."'>\n"; |
| 167 | | $html .= "</div>\n"; |
| 168 | | $html .= '</form>'; |
| 169 | | $html .= "</div>\n"; |
| 170 | | } |
| 171 | | } |
| | 105 | if ($current_user && $current_user->isNobody()) |
| | 106 | { |
| | 107 | $html .= _("You do not have permissions to access any administration functions."); |
| | 108 | } |
| | 109 | else |
| | 110 | { |
| | 111 | |
| | 112 | if ($current_user && $current_user->isSuperAdmin()) |
| | 113 | { |
| | 114 | $html .= "<li><a href='user_log.php'>"._("User logs")."</a></li>\n"; |
| | 115 | $html .= "<li><a href='online_users.php'>"._("Online Users")."</a></li>\n"; |
| | 116 | $html .= "<li><a href='stats.php'>"._("Statistics")."</a></li>\n"; |
| | 117 | $html .= "<li><a href='import_user_database.php'>"._("Import NoCat user database")."</a></li>\n"; |
| | 118 | $html .= "<li><a href='content_admin.php'>"._("Content manager")."</a></li>\n"; |
| | 119 | } |
| | 120 | |
| | 121 | $html .= "</ul>\n"; |
| | 122 | |
| | 123 | // If the user is super admin OR owner of at least one hotspot show the menu |
| | 124 | if ($current_user && ($current_user->isSuperAdmin() || $current_user->isOwner())) |
| | 125 | { |
| | 126 | /* Node admin */ |
| | 127 | $html .= "<div class='admin_section_container'>\n"; |
| | 128 | $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; |
| | 129 | $html .= "<div class='admin_section_title'>"._("Node administration:")." </div>\n"; |
| | 130 | |
| | 131 | $html .= "<div class='admin_section_data'>\n"; |
| | 132 | |
| | 133 | if ($current_user->isSuperAdmin()) |
| | 134 | $sql_additional_where = ''; |
| | 135 | else |
| | 136 | $sql_additional_where = "AND node_id IN (SELECT node_id from node_stakeholders WHERE is_owner = true AND user_id='".$current_user->getId()."')"; |
| | 137 | $html .= "<div id='NodeSelector'>\n"; |
| | 138 | $html .= Node :: getSelectNodeUI('object_id', $sql_additional_where); |
| | 139 | $html .= "</div>\n"; |
| | 140 | $html .= "</div>\n"; |
| | 141 | $html .= "<div class='admin_section_tools'>\n"; |
| | 142 | |
| | 143 | $html .= "<input type='hidden' name='object_class' value='Node'>\n"; |
| | 144 | $html .= "<input type='hidden' name='action' value='edit'>\n"; |
| | 145 | $html .= "<input type='submit' name='edit_submit' value='"._("Edit")."'>\n"; |
| | 146 | |
| | 147 | $html .= "</div>\n"; |
| | 148 | $html .= '</form>'; |
| | 149 | $html .= "<div class='admin_section_tools'>\n"; |
| | 150 | $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; |
| | 151 | $html .= "<input type='hidden' name='action' value='new_ui'>\n"; |
| | 152 | $html .= "<input type='hidden' name='object_class' value='Node'><br>\n"; |
| | 153 | $html .= "<input type=submit name='new_submit' value='"._("Create")."'>\n"; |
| | 154 | $html .= "</form>\n"; |
| | 155 | $html .= "</div>\n"; |
| | 156 | $html .= "</div>\n"; |
| | 157 | } |
| | 158 | |
| | 159 | /* Network admin */ |
| | 160 | if ($current_user && $current_user->isSuperAdmin()) |
| | 161 | { |
| | 162 | $html .= "<div class='admin_section_container'>\n"; |
| | 163 | $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; |
| | 164 | $html .= "<div class='admin_section_title'>"._("Network administration:")." </div>\n"; |
| | 165 | |
| | 166 | $html .= "<div class='admin_section_data'>\n"; |
| | 167 | $html .= "<input type='hidden' name='action' value='edit'>\n"; |
| | 168 | $html .= "<input type='hidden' name='object_class' value='Network'><br>\n"; |
| | 169 | $html .= Network :: getSelectNetworkUI('object_id'); |
| | 170 | $html .= "</div>\n"; |
| | 171 | $html .= "<div class='admin_section_tools'>\n"; |
| | 172 | |
| | 173 | $html .= "<input type=submit name='edit_submit' value='"._("Edit")."'>\n"; |
| | 174 | $html .= "</div>\n"; |
| | 175 | $html .= "</form>\n"; |
| | 176 | $html .= "<div class='admin_section_tools'>\n"; |
| | 177 | $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; |
| | 178 | $html .= "<input type='hidden' name='action' value='new_ui'>\n"; |
| | 179 | $html .= "<input type='hidden' name='object_class' value='Network'><br>\n"; |
| | 180 | $html .= "<input type=submit name='new_submit' value='"._("Create")."'>\n"; |
| | 181 | $html .= "</form>\n"; |
| | 182 | $html .= "</div>\n"; |
| | 183 | $html .= "</div>\n"; |
| | 184 | } |
| | 185 | } |