Ejemplo n.º 1
0
function getViewsByNode($nodeid, $style = "long")
{
    global $USER, $HUB_SQL, $DB;
    if (!isset($nodeid) || $nodeid == "") {
        return database_error();
    }
    $params = array();
    $currentuser = '';
    if (isset($USER->userid)) {
        $currentuser = $USER->userid;
    }
    $params[0] = $nodeid;
    $sql = $HUB_SQL->APILIB_MAPS_FOR_NODE_SELECT;
    // PERMISSIONS
    //if($scope == 'my'){
    //	$params[count($params)] = currentuser;
    //	$sql .= $HUB_SQL->APILIB_NODES_PERMISSIONS_MY;
    //} else {
    $params[count($params)] = 'N';
    $params[count($params)] = $currentuser;
    $params[count($params)] = $currentuser;
    $sql .= $HUB_SQL->AND . $HUB_SQL->APILIB_NODES_PERMISSIONS_ALL;
    //}
    //error_log("Search=".$sql);
    $vs = new ViewSet();
    return $vs->loadFromNodes($sql, $params, $style);
}
Ejemplo n.º 2
0
         if ($len == 3) {
             $id = check_param($parts[2], PARAM_TEXT);
             $node = getNode($id);
             $node->cipher = $cipher;
             if (isset($unobfuscationid) && $unobfuscationid != "") {
                 $node->unobfuscationid = $unobfuscationid;
             }
             $response = $node;
         }
     }
     break;
 case "views":
     $checkNodes = array();
     // All Isses Grouped and not grouped
     if ($len == 2) {
         $viewSet = new ViewSet();
         $viewSet->cipher = $cipher;
         if (isset($unobfuscationid) && $unobfuscationid != "") {
             $viewSet->unobfuscationid = $unobfuscationid;
         }
         $allIssues = getNodesByGlobal(0, -1, 'date', 'ASC', "Issue");
         if (!$allIssues instanceof Error) {
             $count = count($allIssues->nodes);
             for ($i = 0; $i < $count; $i++) {
                 $issue = $allIssues->nodes[$i];
                 if (!$issue instanceof Error) {
                     $conSet = getDebate($issue->nodeid, 'cif');
                     if (!$conSet instanceof Error) {
                         $view = new View($issue->nodeid);
                         $countj = count($conSet->connections);
                         for ($j = 0; $j < $countj; $j++) {