/** This function will return statistics of a network * @access public * @return count of registered members, count of groups, count of contents */ public static function get_network_statistics($param) { // setting count variables to 0 $groups_count = $contents_count = $registered_members_count = $online_members_count = 0; $param['cnt'] = TRUE; $param['neglect_owner'] = FALSE; //network owner is a member with type OWNER $registered_members_count = Network::get_members($param); $sql = ' SELECT count(*) AS cnt FROM {groups} AS G,{contentcollections} AS CC WHERE CC. collection_id = G.group_id AND CC.is_active = ? AND G.reg_type <> ? '; $data = array(ACTIVE, REG_INVITE); $res = Dal::query($sql, $data); if ($res->numRows()) { $row = $res->fetchRow(DB_FETCHMODE_OBJECT); $groups_count = $row->cnt; } $sql = 'SELECT count(*) as cnt FROM {contents} WHERE is_active = ?'; $data = array(ACTIVE); $res = Dal::query($sql, $data); if ($res->numRows()) { $row = $res->fetchRow(DB_FETCHMODE_OBJECT); $contents_count = $row->cnt; } //getting count of online registered users $timestamp = time() - MAX_TIME_ONLINE_USER; // MAX_TIME_ONLINE_USER = 1800 sec to get a realistic count of currently online users $online_members_count = User::count_online_users($timestamp); return array('registered_members_count' => $registered_members_count, 'groups_count' => $groups_count, 'contents_count' => $contents_count, 'online_members_count' => $online_members_count); }