Ejemplo n.º 1
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/';
     }
 }