/** * * Displays the disk usage for a given project * * @param Integer $groupId Id of the project we want retrieve its disk usage * */ public function getTotalProjectSize($groupId) { $totalSize = $this->_dum->returnTotalProjectSize($groupId); $allowedQuota = $this->_dum->getProperty('allowed_quota'); $pqm = new ProjectQuotaManager(); $allowedQuota = $pqm->getProjectCustomQuota($groupId); if ($allowedQuota) { $html = '<div style="text-align:center"><p>' . $GLOBALS['Language']->getText('plugin_statistics_admin_page', 'disk_usage_proportion', array($this->sizeReadable($totalSize), $allowedQuota . 'GiB')) . '</p></div>'; } else { $html = '<LABEL><b>'; $html .= $GLOBALS['Language']->getText('plugin_statistics', 'widget_total_project_size'); $html .= '</b></LABEL>'; $html .= $this->sizeReadable($totalSize); } $html .= '<div style="text-align:center"><p>'; $graph = '<img src="/plugins/statistics/project_cumulativeDiskUsage_graph.php?func=progress&group_id=' . $groupId . '" title="Project total disk usage graph" />'; $user = UserManager::instance()->getCurrentUser(); $project = ProjectManager::instance()->getProject($groupId); if ($project->userIsAdmin($user)) { $pluginManager = PluginManager::instance(); $p = $pluginManager->getPluginByName('statistics'); $html .= '<a href="' . $p->getPluginPath() . '/project_stat.php?group_id=' . $groupId . '">' . $graph . '<a>'; } else { $html .= $graph; } $html .= '</p></div>'; return $html; }
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); } $title = $GLOBALS['Language']->getText('plugin_statistics_admin_page', 'disk_usage_period_' . $period, array($statDuration)); //Display tooltip for start and end date.