Example #1
0
 public function renderDefault($bs = false)
 {
     $platforms = $this->platforms->findAll();
     /** @var PlatformView $platformComponent */
     $platformComponent = $this['platform'];
     $platformComponent->setListBootstrapTemplate($bs);
     $this->template->title = "Výpis her podle platforem";
     $this->template->platforms = $platforms;
     $this->template->unassignedGames = $unassigned = $this->games->findBy(['platform' => null]);
     $additional_nav_links = [];
     if ($unassigned) {
         $additional_nav_links[] = $this->createLink('this#unassigned', 'Hry bez platformy');
     }
     $this->template->additional_nav_links = $additional_nav_links;
 }
 public function createComponentEditPlatformForm()
 {
     $form = $this->editPlatformFormFactory->create();
     $form->onSave[] = function (Form $form, Platform $platform, PlatformPicture $picture = null) {
         if ($picture) {
             $this->pictures->save($picture);
             if ($platform->picture) {
                 $this->pictures->delete($platform->picture);
                 $this->imageManager->delete($platform->picture);
             }
             $platform->picture = $picture;
         }
         $this->platforms->save($platform);
         $this->flashMessage('Platforma ' . $platform->title . ' byla uložena.');
         $this->redirect('default');
     };
     return $form;
 }