function getGroupMembers($group)
{
    global $customPrefs;
    // FIXME grown-ups don't code like this
    $members = array();
    $response = $customPrefs->query("\n        SELECT *\n            FROM `group-memberships`\n            WHERE\n                `group` = '{$group}'\n    ");
    while ($membership = $response->fetch_assoc()) {
        $members[$membership['user']] = ENROLL;
    }
    $response = $customPrefs->query("\n        SELECT *\n            FROM `groups`\n            WHERE\n                `parent` = '{$group}';\n    ");
    while ($child = $response->fetch_assoc()) {
        $members = array_replace($members, getGroupMembers($child['id']));
    }
    return $members;
}
Ejemplo n.º 2
0
/** Function to get the group Information of the specified group
 * @param $groupId -- Group Id :: Type integer
 * @returns Group Detail Array in the following format:
 *   $groupDetailArray=Array($groupName,$description,$groupMembers);
 */
function getGroupInfo($groupId)
{
    global $log;
    $log->debug("Entering getGroupInfo(" . $groupId . ") method ...");
    global $adb;
    $groupDetailArr = array();
    $groupMemberArr = array();
    //Retreving the group Info
    $query = "select * from vtiger_groups where groupid=?";
    $result = $adb->pquery($query, array($groupId));
    $groupName = $adb->query_result($result, 0, 'groupname');
    $description = $adb->query_result($result, 0, 'description');
    //Retreving the Group RelatedMembers
    $groupMemberArr = getGroupMembers($groupId);
    $groupDetailArr[] = $groupName;
    $groupDetailArr[] = $description;
    $groupDetailArr[] = $groupMemberArr;
    //Returning the Group Detail Array
    $log->debug("Exiting getGroupInfo method ...");
    return $groupDetailArr;
}
Ejemplo n.º 3
0
echo $OUTPUT->heading(format_string($project->name), 2);
if (!empty($options['printintro'])) {
    if (trim(strip_tags($project->intro))) {
        echo $OUTPUT->box_start('mod_introbox', 'projectintro');
        echo format_module_intro('project', $project, $cm->id);
        echo $OUTPUT->box_end();
    }
}
//$content = file_rewrite_pluginfile_urls($project->content, 'pluginfile.php', $context->id, 'mod_project', 'content', $project->revision);
$formatoptions = new stdClass();
$formatoptions->noclean = true;
$formatoptions->overflowdiv = true;
$formatoptions->context = $context;
$members = array();
$tasks = array();
$members = getGroupMembers($currentgroup);
//Get group members of the group, ID's and last access
$tasks = getGroupsTasks($currentgroup);
$html = "<a href='../chat/index.php?id=3'>Open Chat</a><br />";
$html .= "<table border=1><tr><td style='vertical-align:top;'><u>List of Tasks</u><br /><br />+ <a href='task_create.php'>NEW</a><br /><br />";
foreach ($tasks as $task) {
    $name = getStudentName($task->members);
    $html .= "&nbsp;&nbsp;- " . $task->name . " For: ";
    $name_size = count($name);
    $name_count = 0;
    foreach ($name as $assigned_name) {
        $html .= "<b>" . $assigned_name->username . "</b>";
        if ($name_size - 1 != $name_count) {
            $html .= ", ";
        }
        $name_count++;
Ejemplo n.º 4
0
 public function json_Groupies()
 {
     $data = json_decode(file_get_contents('php://input'), true);
     $data['username'] = user_decrypt($data['username']);
     $check = $this->checkInput($data, array('username', 'gid'));
     if ($check == '') {
         if ($this->memberCheck($data['username'], $data['gid'])) {
             $return['error'] = 0;
             $return['value'] = getGroupMembers($data['gid']);
         } else {
             $return['error'] = -1;
             $return['value'] = "You aren't part of this group, or this group doesn't exist, I won't tell";
         }
     } else {
         $return['error'] = -2;
         $return['value'] = $check;
     }
     $jsonstring = json_encode($return);
     echo $jsonstring;
 }
Ejemplo n.º 5
0
         if (isset($_POST['index'])) {
             $startIndex = $_POST['index'];
         } else {
             $startIndex = 1;
         }
     } else {
         $groupID = $_GET['GID'];
         $myID = $_GET['UID'];
         //$year= $_POST['Y'];
         if (isset($_GET['index'])) {
             $startIndex = $_GET['index'];
         } else {
             $startIndex = 1;
         }
     }
     $content['Friends'] = getGroupMembers($groupID, $myID, $startIndex);
     echo json_encode($content);
     // echo json_encode(loadFriends($memberID,$myID,$startIndex));
 } else {
     if ($reason == "Load Group Feeds") {
         //echo 89;
         if (isset($_POST['reason'])) {
             $groupID = $_POST['GID'];
             $myID = $_POST['UID'];
             //$year= $_POST['Y'];
             if (isset($_POST['index'])) {
                 $startIndex = $_POST['index'];
             } else {
                 $startIndex = 1;
             }
         } else {
Ejemplo n.º 6
0
}
updateEvent(5, 'Lunch 3', null, null, null);
displayAllEvents($user, 'unsw');
//$results = getEvents($user,'unsw');
$results = getEventsForAMonth($user, 'unsw', 10, 2014);
//print_r($results);
print "--------------- Calendars of {$user} ---------------\n";
printTable(getCalendars($user));
print_r($results);
print "--------------- All groups {$user} belongs to ---------------\n";
printTable(memberOf($user));
foreach (memberOf($user) as $group) {
    if ($group['name'] == 'KKK') {
        $kkk = $group['gid'];
    }
}
print "---------------------- Members of KKK ---------------\n";
printTable(getGroupMembers($kkk));
print "---------------------- All KKK member events ---------------\n";
//printTable(getGroupMemberEvents(1));
print_r(getGroupMemberEvents($kkk));
rejectGroup(5, $user);
acceptGroup(5, $user);
//function updateEvent($eid,$ename,$estart,$eend){
print_r(getGroupMemberEventsForAMonth($kkk, 12, 2014));
//removeCalendar($user,'unsw');
/*
require_once '../controllers/scraper.php';
$ss = new Scraper();
$ss->unsw();
tokenAccess($user);*/
Ejemplo n.º 7
0
function getGroupMemberEventsForAMonth($gid, $month, $year)
{
    $CI = get_instance();
    $m = $month;
    $y = $year;
    $dc = $CI->db->escape(sprintf('%04d-%02d', $y, $m));
    $m = $month - 1;
    $y = $year;
    if ($m == 0) {
        $m = 12;
        $y = $y - 1;
    }
    $dp = $CI->db->escape(sprintf('%04d-%02d', $y, $m));
    $m = $month + 1;
    $y = $year;
    if ($m == 13) {
        $m = 1;
        $y = $y + 1;
    }
    $dn = $CI->db->escape(sprintf('%04d-%02d', $y, $m));
    $str = 'select u.uname as name, CONCAT(u.uname,"-",c.name) as title,' . ' e.eid, e.start, e.end, e.weight, e.allDay ' . ' from GroupMemberships gm join Users u on (gm.uid=u.uid) ' . '     left join Calendars c on (u.uid=c.uid) ' . '     left join Events e on (e.cid=c.cid) ' . ' where gm.gid=' . $CI->db->escape($gid) . ' and gm.accepted="Y" ' . " and (" . "(LEFT(e.start,7)={$dc} OR LEFT(e.end,7)={$dc}) " . "OR (LEFT(e.start,7)={$dp} OR LEFT(e.end,7)={$dp}) " . "OR (LEFT(e.start,7)={$dn} OR LEFT(e.end,7)={$dn}) " . "OR e.eid is null) " . ' order by u.uid;';
    //print $str . "\n";
    $resultSet = $CI->db->query($str);
    $grouped = array();
    $person = array();
    $groupEvents = $resultSet->result_array();
    foreach ($groupEvents as &$r) {
        $r['id'] = $r['eid'];
        $r['allDay'] = $r['allDay'] == 'T' ? true : false;
        //todo check if events in range
    }
    $lastUser = '';
    $groupEvents[] = array('name' => 'JUNK');
    $seen = array();
    foreach ($groupEvents as $s) {
        if ($lastUser != $s['name']) {
            if ($lastUser != '') {
                if ($person[0]['eid'] == null) {
                    $grouped[] = array('events' => array(), 'name' => $person[0]['name']);
                } else {
                    $grouped[] = array('events' => $person, 'name' => $person[0]['name']);
                }
                $seen[$person[0]['name']] = true;
            }
            $lastUser = $s['name'];
            $person = array();
            $person[] = $s;
        } else {
            $person[] = $s;
        }
    }
    foreach (getGroupMembers($gid) as $m) {
        if (!isset($seen[$m['name']]) || !$seen[$m['name']]) {
            $grouped[] = array('events' => array(), 'name' => $m['name']);
        }
    }
    return $grouped;
}
Ejemplo n.º 8
0
                continue;
            }
            // apps that are here are either beta, or have a comment. But they are still Linux apps
            $appslist[$appid]['onlinux'] = true;
            $onlinux++;
        } else {
            $appslist[$appid]['onlinux'] = true;
            $onlinux++;
        }
    }
    storeAppsDB($appslist);
} else {
    $appslist = getSteamAppsDB();
}
print $date . ": " . count($appslist) . " known apps, " . $onlinux . " marked for Linux.\n<br>";
$members = getGroupMembers();
print $date . ": " . (print count($members) . " members.\n<br>");
/* pointless stats tracking GET! */
$appsmin = 2000;
$appsmax = 0;
$publicMembers = 0;
foreach ($members as $member) {
    $memberGames = getMemberGames($member);
    if (count($memberGames) > 0) {
        $publicMembers++;
        /* print $member . " has " . $memberGames[ 'game_count' ] . " apps.\n<br>"; */
        if ($memberGames['game_count'] > 0 and array_key_exists('games', $memberGames)) {
            if ($memberGames['game_count'] > $appsmax) {
                $appsmax = $memberGames['game_count'];
            }
            if ($memberGames['game_count'] < $appsmin) {