function getAllVotingForUser($userid, $direction, $sort, $oldsort) { global $DB, $CFG, $HUB_SQL; $params = array(); $params[0] = $userid; $allNodeVotes = array(); if ($direction) { if ($oldsort === $sort) { if ($direction === 'ASC') { $direction = "DESC"; } else { $direction = "ASC"; } } else { $direction = "DESC"; } } else { $direction = "DESC"; } $allNodeVotes = array(); $sql = $HUB_SQL->STATSLIB_USER_ALL_VOTING; if ($sort != 'Name' && $sort != "NodeType") { $sql .= $HUB_SQL->STATSLIB_ALL_VOTING_ORDER_BY . $sort . " " . $direction; } $ns = new NodeSet(); $ns->loadNodesWithExtras($sql, $params, 'short'); // These properties had to be taken out of the original sql call // as Virtuoso complained about a long data type error // Do now data called as separate Nodes and these sorts are done afterwards. if ($sort === "Name") { if ($direction === "ASC") { usort($ns->nodes, 'nameSortASC'); } else { usort($ns->nodes, 'nameSortDESC'); } } else { if ($sort === "NodeType") { if ($direction === "ASC") { usort($ns->nodes, 'roleTextSortASC'); } else { usort($ns->nodes, 'roleTextSortDESC'); } } } return $ns; }
/** * Fetch a node list of lemons used against the given issue for the current user. * @param $issueid the id of the issue to get the lemons for. * @returns NodeSet or Error */ function getMyLemonsForIssue($issueid) { global $USER, $HUB_SQL; $params = array(); $params[0] = $USER->userid; $params[1] = $issueid; $ns = new NodeSet(); return $ns->loadNodesWithExtras($HUB_SQL->DATAMODEL_UTIL_USER_LEMONS_FOR_ISSUE, $params); }