| 336 | | // Get all node content |
| 337 | | $node_id = $db->escapeString($node->getId()); |
| 338 | | $sql_node = "UNION (SELECT content_id, display_area, display_order, subscribe_timestamp FROM node_has_content WHERE node_id='$node_id' AND display_page='everywhere')"; |
| 339 | | } |
| 340 | | $sql = "SELECT * FROM ($sql_network $sql_node) AS content_everywhere ORDER BY display_area, display_order, subscribe_timestamp DESC"; |
| 341 | | |
| | 334 | $parents = HotspotGraph::getAllParents($node); |
| | 335 | } else { |
| | 336 | $parents = array(Network :: getCurrentNetwork()->getHgeId()); |
| | 337 | } |
| | 338 | |
| | 339 | $first = $db->escapeString(array_shift($parents)); |
| | 340 | $sql_from = "(SELECT content_id, display_area, display_order, subscribe_timestamp |
| | 341 | FROM hotspot_graph_element_has_content hgehc |
| | 342 | WHERE hotspot_graph_element_id='$first' AND display_page='everywhere')"; |
| | 343 | |
| | 344 | // Get the contents for all elements parents of and including the node, but exclude user subscribed content if user is known |
| | 345 | foreach($parents as $parentid) { |
| | 346 | $parent_id = $db->escapeString($parentid); |
| | 347 | $sql_from .= " UNION (SELECT content_id, display_area, display_order, subscribe_timestamp |
| | 348 | FROM hotspot_graph_element_has_content hgehc |
| | 349 | WHERE hotspot_graph_element_id='$parent_id' AND display_page='everywhere')"; |
| | 350 | } |
| | 351 | $sql = "SELECT * FROM ($sql_from) AS content_everywhere ORDER BY display_area, display_order, subscribe_timestamp DESC"; |