private function getDiskStatsForUser(User $user, $group_id) { $disk_stats = array('services' => array(), 'total' => $this->disk_usage_manager->returnTotalProjectSize($group_id), 'quota' => $this->getAllowedQuotaInBytes($group_id)); if ($this->userHasAdminPrivileges($user, $group_id)) { $disk_stats['services'] = $this->disk_usage_manager->returnTotalServiceSizeByProject($group_id); } return $disk_stats; }
$statPeriod = 3; } if ($period == 'year') { $statDuration = 12; $link = '?' . $serviceParam . '&group_id=' . $groupId . '&period=months'; } else { $statDuration = $statPeriod; $link = '?' . $serviceParam . '&group_id=' . $groupId . '&period=year'; } $endDate = date('Y-m-d'); $startDate = date('Y-m-d', mktime(0, 0, 0, date('m') - $statDuration, date('d'), date('y'))); $params['group'] = $groupId; $params['title'] = $GLOBALS['Language']->getText('admin_groupedit', 'proj_admin') . ': ' . $project->getPublicName(); project_admin_header($params); echo '<h2>' . $GLOBALS['Language']->getText('plugin_statistics_admin_page', 'show_statistics') . '</h2>'; $usedProportion = $duMgr->returnTotalProjectSize($groupId); $allowedQuota = $duMgr->getProperty('allowed_quota'); $pqm = new ProjectQuotaManager(); $customQuota = $pqm->getProjectCustomQuota($groupId); if ($customQuota) { $allowedQuota = $customQuota; } if ($allowedQuota) { echo '<div id="help_init" class="stat_help">' . $GLOBALS['Language']->getText('plugin_statistics_admin_page', 'disk_usage_proportion', array($duHtml->sizeReadable($usedProportion), $allowedQuota . 'GiB')) . '</div>'; echo '<p><img src="/plugins/statistics/project_cumulativeDiskUsage_graph.php?func=usage&size=' . $usedProportion . '&group_id=' . $groupId . '" title="Disk usage percentage" /></p>'; } else { echo '<LABEL><b>'; echo $GLOBALS['Language']->getText('plugin_statistics', 'widget_total_project_size'); echo '</b></LABEL>'; echo $duHtml->sizeReadable($usedProportion); }