Example #1
0
 function index()
 {
     $connection = $this->getServerConnection();
     $mapService = new \ManiaHost\Services\MapService($connection->getMapsDirectory());
     $usedSpace = $mapService->getSize('$uploaded/', array(), null, null, null, null, true);
     $analytics = new \ManiaHost\Services\AnalyticsService();
     $data = $analytics->getRental('day', '-6 days');
     $abscissa = array();
     $values = array();
     foreach ($data as $value) {
         $abscissa[] = $value[0];
         $values[] = $value[1];
     }
     $barChart = new \Google\ImageCharts\BarChart();
     $barChart->setSize(600, 200);
     $barChart->setTitle('Rental per day');
     $barChart->setAbscissaAxis($abscissa);
     $barChart->setData($values);
     $RentalUrl = $barChart->getUrl();
     $data = $analytics->getRevenuesAnalytics('day', '-6 days');
     $abscissa = array();
     $values = array();
     foreach ($data as $value) {
         $abscissa[] = $value[0];
         $values[] = $value[1];
     }
     $barChart = new \Google\ImageCharts\BarChart();
     $barChart->setSize(600, 200);
     $barChart->setTitle('Incomes per day');
     $barChart->setAbscissaAxis($abscissa);
     $barChart->setData($values);
     $IncomesUrl = $barChart->getUrl();
     $this->response->usedSpace = $usedSpace;
     $this->response->rentalUrl = $RentalUrl;
     $this->response->incomesUrl = $IncomesUrl;
 }
Example #2
0
 protected function chooseSelector($path, $recursive)
 {
     $connection = $this->getServerConnection();
     $mapsPath = $connection->getMapsDirectory();
     $mapService = new \ManiaHost\Services\MapService($mapsPath);
     $maps = $mapService->getList($path, array(), null, null, null, null, $recursive);
     $maps = array_map(function (\ManiaHost\Services\Map $m) {
         return $m->path . $m->filename;
     }, $maps);
     $selected = $this->session->get('selected', array());
     $count = 0;
     foreach ($maps as $map) {
         if (in_array($map, $selected)) {
             $count++;
         }
     }
     if ($count == count($maps)) {
         $this->response->selector = '../unselect-all/';
     } else {
         $this->response->selector = '../select-all/';
     }
 }