/** * Show the content of the widget * * @return void * * @see Widget::getContent() */ public function getContent() { $request =& HTTPRequest::instance(); $group_id = $request->get('group_id'); $duMgr = new Statistics_DiskUsageManager(); $duHtml = new Statistics_DiskUsageHtml($duMgr); return $duHtml->getTotalProjectSize($group_id); }
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ require 'pre.php'; require_once dirname(__FILE__) . '/../include/Statistics_DiskUsageHtml.class.php'; // First, check plugin availability $pluginManager = PluginManager::instance(); $p = $pluginManager->getPluginByName('statistics'); if (!$p || !$pluginManager->isPluginAvailable($p)) { header('Location: ' . get_server_url()); } // Grant access only to site admin if (!UserManager::instance()->getCurrentUser()->isSuperUser()) { header('Location: ' . get_server_url()); } $duMgr = new Statistics_DiskUsageManager(); $duHtml = new Statistics_DiskUsageHtml($duMgr); $vFunc = new Valid_WhiteList('func', array('show_one_project', 'show_top_projects', 'show_service', 'show_top_users', 'show_one_user')); $vFunc->required(); if ($request->valid($vFunc)) { $func = $request->get('func'); } else { $func = 'show_service'; } $vStartDate = new Valid('start_date'); $vStartDate->addRule(new Rule_Date()); $vStartDate->required(); if ($request->valid($vStartDate)) { $startDate = $request->get('start_date'); } else { $startDate = date('Y-m-d', strtotime('-1 week')); }
header('Location: ' . get_server_url()); } // Grant access only to project admins $user = UserManager::instance()->getCurrentUser(); if (!$project->userIsAdmin($user)) { header('Location: ' . get_server_url()); } $vPeriod = new Valid_WhiteList('period', array('year', 'months')); $vPeriod->required(); if ($request->valid($vPeriod)) { $period = $request->get('period'); } else { $period = 'months'; } $duMgr = new Statistics_DiskUsageManager(); $duHtml = new Statistics_DiskUsageHtml($duMgr); // selected service $vServices = new Valid_WhiteList('services', array_keys($duMgr->getProjectServices(false))); $vServices->required(); if ($request->validArray($vServices)) { $selectedServices = $request->get('services'); } else { $selectedServices = array_keys($duMgr->getProjectServices(false)); } if ($project && !$project->isError()) { // Prepare params $serviceParam = ''; $first = true; foreach ($selectedServices as $serv) { if ($first != true) { $serviceParam .= '&';