/** * Get all the users the current user has permissions to see * * @param boolean $includegroups (optional - default: false) * @param integer $start (optional - default: 0) * @param integer $max (optional - default: 20) * @param string $orderby (optional, either 'date', 'name' or 'moddate' - default: 'date') * @param string $sort (optional, either 'ASC' or 'DESC' - default: 'DESC') * @param string $style (optional - default 'long') may be 'short' or 'long' - how much of a user's details to load (long includes: tags and groups). * @param string $q the query term(s) * @return UserSet or Error */ function getUsersByGlobal($includegroups = false, $start = 0, $max = 20, $orderby = 'date', $sort = 'DESC', $style = 'long', $q = '') { global $CFG, $HUB_SQL; $params = array(); $params[0] = $CFG->defaultUserID; $sql = $HUB_SQL->APILIB_USERS_BY_GLOBAL_SELECT; if ($includegroups == false) { $sql .= $HUB_SQL->APILIB_USERS_BY_GLOBAL_FILTER_GROUPS; } if ($q != "") { $querySQL = getSearchQueryString($params, $q, true, false); if ($querySQL != "") { $sql .= $HUB_SQL->AND; $sql .= $querySQL; } } $us = new UserSet(); return $us->load($sql, $params, $start, $max, $orderby, $sort, $style); }
if ($procount == $graycount && $procount > $concount) { $connection->linklabelname = $CFG->LINK_PRO_SOLUTION; } else { if ($concount == $graycount && $concount > $procount) { $connection->linklabelname = $CFG->LINK_CON_SOLUTION; } else { $connection->linklabelname = $CFG->LINK_SOLUTION_ISSUE; } } } } $conSet->add($connection); } } $format_json = new format_json(); $userset = new UserSet(); foreach ($userHashtable as $userid => $user) { $userset->add($user); } $conSet->totalnodes = $totalnodes; $jsonnodes = $format_json->format($mapNodes); $jsonusers = $format_json->format($userset); $jsoncons = $format_json->format($conSet); ?> <script type='text/javascript'> var NODE_ARGS = new Array(); Event.observe(window, 'load', function() { NODE_ARGS['groupid'] = '<?php echo $groupid;
/** * Loads the pending members of the group from the database. * Only group admins can run this function. * * @return Group object (this) */ function loadpendingmembers() { global $DB, $CFG, $HUB_SQL, $USER; //check user can edit the group if (!$this->isgroupadmin($USER->userid)) { return access_denied_error(); } $this->pendingmembers = null; $params = array(); $params[0] = $this->groupid; $resArray = $DB->select($HUB_SQL->DATAMODEL_GROUP_JOIN_SELECT_PENDING, $params); if (!$resArray) { return database_error(); } else { $count = count($resArray); $us = new UserSet(); $us->totalno = $count; //$this->membercount = $us->totalno; for ($i = 0; $i < $count; $i++) { $array = $resArray[$i]; $u = new User($array['UserID']); $us->add($u->load()); } $this->pendingmembers = $us; } return $this; }
/** * Return a UserSet of participants in the debate tree for the given issue nodeid * * @param nodeid the nodeid of the Issue node to get the tree for. * @param style, the style of node to return - how much data it has (defaults to 'mini' can also be 'long' or 'short') * @return UserSet or Error. * * @uses getDebate */ function getDebateParticipants($nodeid, $style = 'mini') { $consSet = getDebate($nodeid, $style); $cons = $consSet->connections; $count = cont($cons); $userSet = new UserSet(); $userCheck = array(); for ($i = 0; $i < $count; $i++) { $next = $cons[$i]; $from = $next->from; $to = $next->to; if (!in_array($from->users[0]->userid, $userCheck)) { array_push($userCheck, $from->users[0]->userid); $userSet->add($from->users[0]); } if (!in_array($to->users[0]->userid, $userCheck)) { array_push($userCheck, $to->users[0]->userid); $userSet->add($to->users[0]); } if (!in_array($next->userid, $userCheck)) { array_push($userCheck, $next->users[0]->userid); $userSet->add($next->users[0]); } } return $userSet; }
/** * Load the data for the Sunburst visulaisation * @param url the url for the CIF data to load * @param timeout how long (in seconds) to cache the visualisation data * before it is considered out of date and should be refetched and recalculated. * Defaults to 60 seconds. * @return an associative array of arrays of nodes, connections and users from the data loaded from the CIF. * and converted to the structure required by the Sunburst visualisation. * The keys are 'nodes', 'cons' and 'users'. */ function getSunburstData($url, $timeout = 60) { global $CFG, $HUB_CACHE; $withhistory = false; $withvotes = false; $withposts = false; $data = $HUB_CACHE->getObjData($CFG->VIS_PAGE_SUNBURST . $url . $withhistory . $withvotes . $withposts); if ($data === FALSE) { //error_log("DATA not FOUND: getSunburstData"); $reader = $HUB_CACHE->getObjData('reader' . $url . $withhistory . $withvotes . $withposts); if ($reader === FALSE) { error_log("READER not FOUND: getSunburstData"); $reader = new catalyst_jsonld_reader(); $reader = $reader->load($url, $timeout, $withhistory, $withvotes, $withposts); $HUB_CACHE->setObjData('reader' . $url . $withhistory . $withvotes . $withposts, $reader, $timeout); } else { error_log("READER FOUND: getSunburstData"); } //$reader = new catalyst_jsonld_reader(); //$reader = $reader->load($url,$timeout,$withhistory,$withvotes,$withposts); $jsonnodes = array(); $jsonusers = array(); $jsoncons = array(); $data = array(); if (!$reader instanceof Error) { $userHashtable = array(); $userCheck = array(); $usersToDebates = array(); $nodeCheck = array(); $totalnodes = 0; $issueCheck = array(); $issueNodes = array(); $issueConnections = array(); $solutionNodes = array(); $connections = $reader->connectionSet->connections; $count = count($connections); $nodeSet = new NodeSet(); // GET ISSUES for ($i = 0; $i < $count; $i++) { $connection = $connections[$i]; $from = $connection->from; $to = $connection->to; if ($from->rolename == "Issue") { if (!in_array($from->nodeid, $issueCheck)) { array_push($issueNodes, $from); $nodeSet->add($from); array_push($issueCheck, $from->nodeid); } } if ($to->rolename == "Issue") { if (!in_array($to->nodeid, $issueCheck)) { array_push($issueNodes, $to); $nodeSet->add($to); array_push($issueCheck, $to->nodeid); } } } // GET ISSUE TREES function loadMoreIssueChildNodes(&$connections, $nextArray, &$parentlist) { global $issueConnections; $countj = count($nextArray); for ($j = 0; $j < $countj; $j++) { $nextid = $nextArray[$j]; $newNextArray = array(); foreach ($connections as $connection) { $from = $connection->from; $to = $connection->to; if ($to->nodeid == $nextid || $from->nodeid == $nextid) { if ($from->nodeid == $nextid) { array_push($newNextArray, $to->nodeid); } else { array_push($newNextArray, $from->nodeid); } array_push($parentlist, $connection); if (($key = array_search($connection, $connections)) !== false) { unset($connections[$key]); } } } if (count($newNextArray) > 0 && count($connections) > 0) { loadMoreIssueChildNodes($connections, $newNextArray, $parentlist); } } } set_time_limit(60); $nextArray = array(); $countj = count($issueNodes); for ($j = 0; $j < $countj; $j++) { $next = $issueNodes[$j]; $nextid = $next->nodeid; $list = array(); foreach ($connections as $connection) { $from = $connection->from; $to = $connection->to; if ($to->nodeid == $nextid || $from->nodeid == $nextid) { if ($from->nodeid == $nextid) { array_push($nextArray, $to->nodeid); } else { array_push($nextArray, $from->nodeid); } array_push($list, $connection); if (($key = array_search($connection, $connections)) !== false) { unset($connections[$key]); } } } $issueConnections[$nextid] = $list; loadMoreIssueChildNodes($connections, $nextArray, $issueConnections[$nextid]); } // COUNT TYPES FOR DETAILS PANEL $count = count($issueNodes); for ($i = 0; $i < $count; $i++) { $node = $issueNodes[$i]; if (isset($node->users[0])) { if (!array_key_exists($node->nodeid, $nodeCheck)) { $nodeCheck[$node->nodeid] = $node; } if (!array_key_exists($node->users[0]->userid, $userHashtable)) { $globaluser = clone $node->users[0]; $globaluser->procount = 0; $globaluser->concount = 0; $globaluser->ideacount = 0; $globaluser->debatecount = 1; $userHashtable[$node->users[0]->userid] = $globaluser; } else { $globaluser = $userHashtable[$node->users[0]->userid]; $globaluser->debatecount = $globaluser->debatecount + 1; $userHashtable[$node->users[0]->userid] = $globaluser; } if (array_key_exists($node->nodeid, $issueConnections)) { $cons = $issueConnections[$node->nodeid]; $countcons = count($cons); $localusers = array(); $debateowner = $node->users[0]; $debateowner->procount = 0; $debateowner->concount = 0; $debateowner->ideacount = 0; $debateowner->debatecount = 1; $localusers[$node->users[0]->userid] = $debateowner; if (!array_key_exists($node->users[0]->userid, $userCheck)) { $userCheck[$node->users[0]->userid] = $node->users[0]; } for ($j = 0; $j < $countcons; $j++) { $con = $cons[$j]; $fromNode = $con->from; if (!array_key_exists($fromNode->nodeid, $nodeCheck)) { $nodeCheck[$fromNode->nodeid] = $fromNode; } //$toNode = $con->to; $thisuser = clone $fromNode->users[0]; if (!array_key_exists($thisuser->userid, $userCheck)) { $userCheck[$thisuser->userid] = $thisuser; } if (!array_key_exists($thisuser->userid, $userHashtable)) { $globaluser = clone $fromNode->users[0]; $globaluser->procount = 0; $globaluser->concount = 0; $globaluser->ideacount = 0; $globaluser->debatecount = 0; if ($fromNode->role->name == 'Pro') { $globaluser->procount = 1; } if ($fromNode->role->name == 'Con') { $globaluser->concount = 1; } if ($fromNode->role->name == 'Solution') { $globaluser->ideacount = 1; } $userHashtable[$thisuser->userid] = $globaluser; } else { $globaluser = $userHashtable[$thisuser->userid]; if ($fromNode->role->name == 'Pro') { $globaluser->procount = $globaluser->procount + 1; } if ($fromNode->role->name == 'Con') { $globaluser->concount = $globaluser->concount + 1; } if ($fromNode->role->name == 'Solution') { $globaluser->ideacount = $globaluser->ideacount + 1; } $userHashtable[$thisuser->userid] = $globaluser; } if (!array_key_exists($thisuser->userid, $localusers)) { $thisuser->procount = 0; $thisuser->concount = 0; $thisuser->ideacount = 0; $thisuser->debatecount = 0; if ($fromNode->role->name == 'Pro') { $thisuser->procount = 1; } if ($fromNode->role->name == 'Con') { $thisuser->concount = 1; } if ($fromNode->role->name == 'Solution') { $thisuser->ideacount = 1; } $localusers[$thisuser->userid] = $thisuser; } else { $thisuser = $localusers[$thisuser->userid]; if ($fromNode->role->name == 'Pro') { $thisuser->procount = $thisuser->procount + 1; } if ($fromNode->role->name == 'Con') { $thisuser->concount = $thisuser->concount + 1; } if ($fromNode->role->name == 'Solution') { $thisuser->ideacount = $thisuser->ideacount + 1; } $localusers[$thisuser->userid] = $thisuser; } } } $usersToDebates[$node->nodeid] = $localusers; } } $conSet = new ConnectionSet(); $count = count($usersToDebates); //$userHashtable = $userCheck; foreach ($usersToDebates as $nodeid => $users) { //$from = $nodeCheck[$nodeid]; foreach ($users as $userid => $user) { $to = $user; $connection = new Connection(); $procount = $user->procount; $concount = $user->concount; $ideacount = $user->ideacount; $debatecount = $user->debatecount; $totalnodes = $totalnodes + ($ideacount + $debatecount + $procount + $concount); $connection->procount = $procount; $connection->concount = $concount; $connection->ideacount = $ideacount; $connection->debatecount = $debatecount; $connection->toid = $userid; $connection->fromid = $nodeid; $graycount = $ideacount + $debatecount; if ($procount > $concount && $procount > $graycount) { $connection->linklabelname = $CFG->LINK_PRO_SOLUTION; } else { if ($concount > $procount && $concount > $graycount) { $connection->linklabelname = $CFG->LINK_CON_SOLUTION; } else { if ($procount == $graycount && $procount > $concount) { $connection->linklabelname = $CFG->LINK_PRO_SOLUTION; } else { if ($concount == $graycount && $concount > $procount) { $connection->linklabelname = $CFG->LINK_CON_SOLUTION; } else { $connection->linklabelname = $CFG->LINK_SOLUTION_ISSUE; } } } } $conSet->add($connection); } } $format_json = new format_json(); $userset = new UserSet(); foreach ($userHashtable as $userid => $user) { $userset->add($user); } $conSet->totalnodes = $totalnodes; $jsonnodes = $format_json->format($nodeSet); $jsonusers = $format_json->format($userset); $jsoncons = $format_json->format($conSet); } $data['nodes'] = $jsonnodes; $data['cons'] = $jsoncons; $data['users'] = $jsonusers; $HUB_CACHE->setObjData($CFG->VIS_PAGE_SUNBURST . $url . $withhistory . $withvotes . $withposts, $data, $timeout); } else { //error_log("DATA FOUND: getSunburstData"); } return $data; }
public function __construct(array $emails) { parent::__construct(new UFC_Email($emails)); }
} } public function next() { // TODO: Implement next() method. } public function valid() { // TODO: Implement valid() method. } public function current() { // TODO: Implement current() method. } public function rewind() { // TODO: Implement rewind() method. } public function key() { // TODO: Implement key() method. } } $allClients = new UserSet(); $Client1 = new Client('qwe', '111'); $Client2 = new Client('asd', '222'); $Client3 = new Client('zxc', '111'); $allClients->add($Client1); $allClients->add($Client2); $allClients->add($Client3); $allClients->checkLogin('111');
/** * Return a list of users who have requested the email digest of Recent Activity. * @return a UserSet of users found. */ function getRecentActivityEmailUsers() { global $CFG, $DB, $HUB_SQL; $params = array(); $params[0] = $CFG->defaultUserID; $sql = $HUB_SQL->UTILLIB_RECENT_ACTIVITY_EMAIL_USERS; $us = new UserSet(); $us->load($sql, $params, 0, -1, 'date', 'DESC', 'long'); return $us; }
function handler_former_users($page) { global $globals; require_once 'userset.inc.php'; $view = new UserSet(new UFC_GroupFormerMember($globals->asso('id'))); $view->addMod('groupmember', 'Anciens membres', true, array('noadmin' => true)); $view->apply('former_users', $page); $page->changeTpl('xnetgrp/former_users.tpl'); }