$ui->setPageName('portal'); /* * Main content */ $welcome_msg = sprintf("<span>%s</span> <em>%s</em>", _("Welcome to"), $node->getName()); $ui->addContent('page_header', "<div class='welcome_msg'><div class='welcome_msg_inner'>{$welcome_msg}</div></div>"); // While in validation period, alert user that he should validate his account ASAP if ($current_user && $current_user->getAccountStatus() == ACCOUNT_STATUS_VALIDATION) { $validationMsgHtml = "<div id='warning_message_area'>\n"; $validationMsgHtml .= _("You NEED to confirm your account. An email with confirmation instructions was sent to your email address. If you don't see it in your inbox, make sure to look in your spam folder."); $validationMsgHtml .= sprintf(_("Your account has been granted %s minutes of access to retrieve your email and validate your account."), $current_user->getNetwork()->getValidationGraceTime() / 60); $validationMsgHtml .= "</div>\n"; $ui->addContent('page_header', $validationMsgHtml); } // Get all the parent objects of the node $parents = HotspotGraph::getAllParents($node); // Get the contents for all elements parents of and including the node, but exclude user subscribed content if user is known foreach ($parents as $parentid) { $content_rows = array(); $parent_id = $db->escapeString($parentid); if ($current_user) { $user_id = $db->escapeString($current_user->getId()); $sql = "SELECT content_id, display_area, display_order FROM hotspot_graph_element_has_content hgehc "; $sql .= "INNER JOIN hotspot_graph_elements hge on hgehc.hotspot_graph_element_id = hge.hotspot_graph_element_id "; $sql .= "WHERE hge.hotspot_graph_element_id='{$parent_id}' AND display_page='portal' AND content_id NOT IN (SELECT content_id FROM user_has_content WHERE user_id = '{$user_id}') ORDER BY display_area, display_order, subscribe_timestamp DESC"; } else { $sql = "SELECT content_id, display_area, display_order FROM hotspot_graph_element_has_content hgehc "; $sql .= "INNER JOIN hotspot_graph_elements hge on hgehc.hotspot_graph_element_id = hge.hotspot_graph_element_id "; $sql .= "WHERE hge.hotspot_graph_element_id='{$parent_id}' AND display_page='portal' ORDER BY display_area, display_order, subscribe_timestamp DESC"; } $db->execSql($sql, $content_rows, false);
/** * Add the content marked "everywhere" from both the current node and the * current network. * * @return void */ private function addEverywhereContent() { $db = AbstractDb::getObject(); // Get all network content and node "everywhere" content $content_rows = null; $node = Node::getCurrentNode(); // Get all the parent objects of the node if ($node) { $parents = HotspotGraph::getAllParents($node); } else { $parents = array(Network::getCurrentNetwork()->getHgeId()); } $first = $db->escapeString(array_shift($parents)); $sql_from = "(SELECT content_id, display_area, display_order, subscribe_timestamp \n \t\t\tFROM hotspot_graph_element_has_content hgehc \n \t\t\tWHERE hotspot_graph_element_id='{$first}' AND display_page='everywhere')"; // Get the contents for all elements parents of and including the node, but exclude user subscribed content if user is known foreach ($parents as $parentid) { $parent_id = $db->escapeString($parentid); $sql_from .= " UNION (SELECT content_id, display_area, display_order, subscribe_timestamp \n \t\t\tFROM hotspot_graph_element_has_content hgehc \n \t\t\tWHERE hotspot_graph_element_id='{$parent_id}' AND display_page='everywhere')"; } $sql = "SELECT * FROM ({$sql_from}) AS content_everywhere ORDER BY display_area, display_order, subscribe_timestamp DESC"; $db->execSql($sql, $content_rows, false); if ($content_rows) { foreach ($content_rows as $content_row) { $content = Content::getObject($content_row['content_id']); if ($content->isDisplayableAt($node)) { $this->addContent($content_row['display_area'], $content, $content_row['display_order']); } } } }