function displayUsersListPagination($currentPage) { $numberOfUsers = getNumberOfUsers(); $numberOfPages = ceil($numberOfUsers / 10); echo '<div class="listing-pagination">'; echo '<ul>'; if ($currentPage != 1) { echo '<li><a class="prev" href="' . home_url() . '/admin-account/?pagination=' . ($currentPage - 1) . '"><img src="' . get_template_directory_uri() . '/imgs/testimonial-left-arrow.png"></a></li>'; } for ($i = 1; $i < $numberOfPages; $i++) { if ($i == $currentPage) { echo '<li><a ' . ($i == $currentPage ? 'class="current-page"' : '') . ' >' . $i . '</a></li>'; } else { echo '<li><a ' . ($i == $currentPage ? 'class="current-page"' : '') . ' href="' . home_url() . '/admin-account/?pagination=' . $i . '">' . $i . '</a></li>'; } echo '<li><span>-</span></li>'; } echo '<li><a ' . ($i == $currentPage ? 'class="current-page"' : '') . ' href="' . home_url() . '/admin-account/?pagination=' . $i . '">' . $i . '</a></li>'; if ($currentPage != $numberOfPages) { echo '<li><a class="next" href="' . home_url() . '/admin-account/?pagination=' . ($currentPage + 1) . '"><img src="' . get_template_directory_uri() . '/imgs/testimonial-right-arrow.png"></a></li>'; } echo '</ul>'; echo '</div>'; }
<?php /* * Script to print some stats on home page.... *********************************************/ /* get number of sections */ $sectionNum = getNumberOfSections(); /* get number of subnets */ $subnetNum = getNumberOfSubnets(); /* get number of IP addresses, split IPv4 / IPv6 */ $IPv4Count = getNuberOfIPv4Addresses(); $IPv6Count = getNuberOfIPv6Addresses(); /* get All users */ $userCount = getNumberOfUsers(); ?> <!-- stats table --> <table class="table table-striped table-condensed table-hover"> <!-- sections --> <tr> <td class="title"><?php print _('Number of Sections'); ?> </td> <td><?php print $sectionNum; ?> </td> </tr>
function getActivityData($a_params) { //indicates number of activity indicator, now in [0..5] $indicatorNr = $a_params['indicatorNr']; //indicates number for sub activity indicator, possible value depends on value of indicatorNr $subIndicatorNr = $a_params['subIndicatorNr']; $f_params = array(); //indicates for what other users data is visible. 0=mean other, 1=anonymous others, 2=others $f_params['privacyLevel'] = $a_params['privacyLevel']; //0=all groups, so elgg total. If >0 then data is filtered for group guid $f_params['groupGuid'] = $a_params['groupGuid']; //indicates if activity and performance should be shared with other users. 0=no, 1=yes $f_params['shareWithOthers'] = $a_params['shareWithOthers']; //indicates if activity and performance should always shared. 0=no, 1=yes $f_params['alwaysShowOthers'] = $a_params['alwaysShowOthers']; //comma separated list of user guids that must be excluded from the data //if one of these users is the current user, me should be excluded from the data $f_params['excludedFromDashboardUserGuids'] = $a_params['excludedFromDashboardUserGuids']; //if >0 get all data starting from startEpoch $f_params['startEpoch'] = $a_params['startEpoch']; //if >0 get all data till endEpoch $f_params['endEpoch'] = $a_params['endEpoch']; //get all data in intervals between startEpoch and endEpoch $f_params['numberOfMonths'] = $a_params['numberOfMonths']; //get all data in intervals between startEpoch and endEpoch $f_params['numberOfIntervals'] = $a_params['numberOfIntervals']; //get end date, it is in format yyyy-mm-dd $f_params['endDate'] = $a_params['endDate']; //indicates for which users data should be given. 0=all users, 1=current user, 2=all but current user $f_params['userCollectionNr'] = $a_params['userCollectionNr']; //minimal 1 interval if ($f_params['numberOfIntervals'] == 0) { $f_params['numberOfIntervals'] = 1; } //determine endEpoch if not set if ($f_params['endEpoch'] == 0) { if ($f_params['endDate'] != '') { $f_params['endEpoch'] = strtotime($f_params['endDate']); } else { //set it to now $f_params['endEpoch'] = time(); } } //if numberOfMonths > 0, set endEpoch to end of month so intervals roughly correspond to months if ($f_params['numberOfMonths'] > 0) { $month = date("m", $f_params['endEpoch']); $year = date("Y", $f_params['endEpoch']); $f_params['endEpoch'] = mktime(23, 59, 59, ++$month, 0, $year); } //determine $startEpoch if ($f_params['numberOfMonths'] > 0) { $f_params['startEpoch'] = strtotime("-" . $f_params['numberOfMonths'] . " Months", $f_params['endEpoch']); } else { if ($f_params['startEpoch'] == 0) { //get oldest timestamp in database $sql = " SELECT posted AS time FROM elgg_river ORDER BY posted ASC LIMIT 1"; $f_params['startEpoch'] = getTime($sql); } } $f_params['intervalTime'] = ($f_params['endEpoch'] - $f_params['startEpoch']) / $f_params['numberOfIntervals']; $users = getUsers($f_params); $f_params['users'] = $users; $showUsers = getShowUsers($f_params); $f_params['showUsers'] = $showUsers; $userGuids = getUserGuids($f_params); $f_params['userGuids'] = $userGuids; $userNames = getUserNames($f_params); $f_params['userNames'] = $userNames; // $numberOfCreatedUsers = getNumberOfIntervalUsers($f_params, "create"); // $numberOfBannedUsers = getNumberOfIntervalUsers($f_params, "ban"); $numberOfUsers = getNumberOfUsers($f_params); // $f_params['numberOfCreatedUsers'] = $numberOfCreatedUsers; // $f_params['numberOfBannedUsers'] = $numberOfBannedUsers; $f_params['numberOfUsers'] = $numberOfUsers; $data = ""; if ($indicatorNr == 0 && $subIndicatorNr == -1) { //I am productive $data = getUserResults(getData0($f_params), $f_params); } else { if ($indicatorNr == 1 && $subIndicatorNr == -1) { //I deliver quality contributions $data = getUserResults(getData1($f_params), $f_params); } else { if ($indicatorNr == 2 && $subIndicatorNr == -1) { //I am involved $data = getUserResults(getData2($f_params), $f_params); } else { if ($indicatorNr == 3 && $subIndicatorNr == -1) { //I am socially active $data = getUserResults(getData3($f_params), $f_params); } else { if ($indicatorNr == 4 && $subIndicatorNr == -1) { //I am available $data = getUserResults(getData4($f_params), $f_params); } else { if ($indicatorNr == 5 && $subIndicatorNr == -1) { //I am reading $data = getUserResults(getData5($f_params), $f_params); } else { if ($indicatorNr == 0 && $subIndicatorNr == 0) { //I am productive, number of objects created and updated, by all users, current user or all but current user $data = getResult(getNumberOfCreatedAndUpdatedObjects($f_params)); } else { if ($indicatorNr == 0 && $subIndicatorNr == 1) { //I am involved, number of comments to other users, for all users, current user or all but current user $data = getResult(getNumberOfCommentsToOthers($f_params)); } else { if ($indicatorNr == 1 && $subIndicatorNr == 0) { //I deliver quality contributions, number of ratings from others on created or updated objects and groups, for all users, current user or all but current user $data = getResult(getNumberOfRatingsFromOthers($f_params)); } else { if ($indicatorNr == 1 && $subIndicatorNr == 1) { //I deliver quality contributions, mean rating from others on created or updated objects and groups, for all users, current user or all but current user $data = getResult(getMeanRatingFromOthers($f_params)); } else { if ($indicatorNr == 2 && $subIndicatorNr == 0) { //I am involved, number of ratings to others on created or updated objects and groups, for all users, current user or all but current user $data = getResult(getNumberOfRatingsToOthers($f_params)); } else { if ($indicatorNr == 2 && $subIndicatorNr == 1) { //I am involved, number of comments to other users, for all users, current user or all but current user $data = getResult(getNumberOfCommentsToOthers($f_params)); } else { if ($indicatorNr == 3 && $subIndicatorNr == 0) { //I am socially active, number of friend requests by others, for all users, current user or all but current user $data = getResult(getNumberOfFriendRequestsFromOthers($f_params)); } else { if ($indicatorNr == 3 && $subIndicatorNr == 1) { //I am socially active, number of friend requests to others, for all users, current user or all but current user $data = getResult(getNumberOfFriendRequestsToOthers($f_params)); } else { if ($indicatorNr == 4 && $subIndicatorNr == 0) { //I am available, number of plugin views (also updates), for all users, current user or all but current user $data = getResult(getNumberOfPluginViews($f_params)); } } } } } } } } } } } } } } } $result = ''; if ($indicatorNr >= 0 && $subIndicatorNr >= 0) { $result .= "{"; $result .= "\"userids\": " . getResult($userGuids) . ",\n"; $result .= "\"usernames\": " . getStringResult($userNames) . ",\n"; $result .= "\"showUsers\": " . getResult($showUsers) . ",\n"; $result .= "\"count\": " . $data; $result .= "}"; } else { if ($indicatorNr >= 0 && $subIndicatorNr == -1) { $result .= "{"; $result .= "\"userids\": " . getResult($userGuids) . ",\n"; $result .= "\"usernames\": " . getStringResult($userNames) . ",\n"; $result .= "\"showUsers\": " . getResult($showUsers) . ",\n"; $result .= "\"data\": " . $data; $result .= "}"; } else { $result .= "{"; $result .= "\"userids\": " . getResult($userGuids) . ",\n"; $result .= "\"usernames\": " . getStringResult($userNames) . ",\n"; $result .= "\"showUsers\": " . getResult($showUsers) . ",\n"; $f_params['data0'] = getData0($f_params); $f_params['data1'] = getData1($f_params); $f_params['data2'] = getData2($f_params); $f_params['data3'] = getData3($f_params); $f_params['data4'] = getData4($f_params); $result .= "\"data0\": " . getUserResults($f_params['data0'], $f_params) . ",\n" . "\"data1\": " . getUserResults($f_params['data1'], $f_params) . ",\n" . "\"data2\": " . getUserResults($f_params['data2'], $f_params) . ",\n" . "\"data3\": " . getUserResults($f_params['data3'], $f_params) . ",\n" . "\"data4\": " . getUserResults($f_params['data4'], $f_params); $result .= "}"; } } return $result; }