public function renderVypis()
 {
     $this->addCss('input-specific.css');
     $this->addJs('input-specific.js');
     $week = $this->getParam("tyden");
     if (!is_numeric($week)) {
         $week = 0;
     }
     $timePars = DatetimeManager::getWeeksBounds($week);
     $dbTimePars = DatetimeManager::format($timePars, DatetimeManager::DB_FULL);
     $game_types = $this->prepareGames();
     $game_type_id = $this->getParam("game_id");
     if ($this->gameTypes->fetchById($game_type_id)) {
         $this->template['defaultGame'] = $game_type_id;
     }
     $this->template['reservation'] = ['formAction' => ['controller' => 'rezervace', 'action' => 'rezervovat'], 'types' => Tables\Reservation::getTypes(), 'games' => $game_types, 'desks' => Tables\Desk::fetchAll($this->pdo)];
     $this->template['event'] = ['formAction' => ['controller' => 'udalost', 'action' => 'pridat'], 'gameList' => Tables\Event::addNoGame($game_types)];
     $this->template['games'] = $this->prepareGames($dbTimePars);
     $rw = $this->reservationManager->prepareReservationWeek($week);
     $this->template['reservationWeek'] = $rw;
     $this->template['pageTitle'] = $rw['pageTitle'];
     $this->template['weekShift'] = $this->makeWeekLinks($week);
     $this->template['resListColSize'] = $this->colSizeFromGet();
     $this->template['fetchUpcommingLink'] = ['controller' => 'ajax', 'action' => 'upcommingReservations', 'game' => null];
     $refill = $this->pickRefill();
     $this->template['refill'] = $refill;
     if ($this->user->isAdministrator()) {
         $this->template['switchButtons'] = ['res' => ['label' => 'rezervaci'], 'evt' => ['label' => 'událost']];
         $this->template['switchButtons'][$refill ? $refill['type'] : 'res']['active'] = true;
     }
 }
 public function doUpravitStoly()
 {
     $desks = ['delete' => [], 'update' => []];
     foreach ($_POST as $key => $desk) {
         $desk['desk_id'] = explode('_', $key)[1];
         $keep = !isset($desk['delete']);
         unset($desk['delete']);
         if ($keep) {
             $desks['update'][] = $desk;
         } else {
             $desks['delete'][] = $desk['desk_id'];
         }
     }
     $updated = Tables\Desk::updateMany($this->pdo, $desks['update']);
     if ($updated > 0) {
         $this->message->info("{$updated} stolů bylo upraveno.");
     }
     $deleted = Tables\Desk::deleteMany($this->pdo, $desks['delete']);
     if ($deleted > 0) {
         $this->message->info("{$deleted} stolů bylo smazáno.");
     }
     $this->redirectPars('sprava', 'stoly');
 }