/**
  * Process admin interface of this object.
  *
  * @return void
  *
  * @access public
  */
 public function processGraphAdminUI(&$errMsg, $network = null)
 {
     $hge_id = $this->getHgeId();
     if (is_null($network) || Security::hasPermission(Permission::P('NETWORK_PERM_ALLOW_GROUP_NODE'), $network)) {
         $name = "hge_{$hge_id}_graph";
         HotspotGraph::processGraphAdminUI($this, $errMsg);
     }
 }
Beispiel #2
0
 /**
  * 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']);
             }
         }
     }
 }
Beispiel #3
0
$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);
Beispiel #4
0
 /**
  * 
  * @param string $start_object_id The id of the object to start the search from
  * @param string $function the function to get the next level of elements
  * @param string $object_id the object id to searhc for
  * @param array $visited the array of visited element
  * @return boolean true if cycle
  */
 protected static function isCycle($start_object_id, $function, $object_id, &$visited = array())
 {
     if ($start_object_id == $object_id) {
         return true;
     }
     $visited[] = $start_object_id;
     $cycle = false;
     $next_level = HotspotGraph::$function($start_object_id);
     if ($next_level) {
         foreach ($next_level as $next_row) {
             if (!in_array($next_row['next_element_id'], $visited)) {
                 $cycle = $cycle || HotspotGraph::isCycle($next_row['next_element_id'], $function, $object_id, $visited);
             }
             if ($cycle) {
                 break;
             }
         }
     }
     return $cycle;
 }