public function renderSmazatPrihoz($id = null) { $form = $this['deletePrihozForm']; $form['send']->caption = 'Smazat příhoz'; if (!$form->isSubmitted()) { $this->template->prihoz = $this->database->findById('drazba', $id); if (!$this->template->prihoz) { $this->flashMessage('Tento příhoz neexistuje. Je možné, že ho někdo smazal.'); $this->redirect('Homepage:default'); } $form['id_nemovitost']->value = $this->template->prihoz->id_nemovitost; $this->drazba->zahrnPocatecniNastaveni($this->template->prihoz->id_nemovitost); $this->template->status = $this->drazba->vratStatus(); } }
public function renderSmazatNemovitost($id = null) { // propojim s formem $form = $this['deleteNemovitostForm']; $form['send']->caption = 'Smazat nemovitost'; // pokusim nacist nemovitost $this->template->nemovitost = $this->database->findById('nemovitost', $id); if (!$this->template->nemovitost) { $this->flashMessage('Tato nemovitost neexistuje. Je možné, že ji někdo smazal.'); $this->redirect('Homepage:default'); } // pokud nemovitost nactena provadim operace potrebne pro vykresleni template $this->drazba->zahrnPocatecniNastaveni($id); $this->template->status = $this->drazba->vratStatus(); $form->setDefaults($this->template->nemovitost); }
public function renderDelete($id = null, $file_id = null) { // definice formu a uprava popisku buttonu $form = $this['deleteFileForm']; $form['del']->caption = 'Smazat PDF'; // overim ze nemovitost opravdu existuje $this->template->nemovitost = $this->database->findById('nemovitost', $id); if (!$this->template->nemovitost) { $this->flashMessage('Tato nemovitost neexistuje. Je možné, že ji někdo smazal.'); $this->redirect('Homepage:default'); } // pokus o nacteni file z db $file = $this->database->findById('file', (int) $file_id); // pokud se mi nepodari najit soubor a nebo soubor nepatri nemovitosti, ze ktere se na ni snazi uzivatel dostat if (!$file || isset($file) && $file->id_property != $id) { $this->flashMessage('Požadovaný soubor není dostupný.'); $this->redirect('File:vypis', $id); } $this->template->file = $file; // predam si file i do sablony pro vypis $this->drazba->zahrnPocatecniNastaveni($id); $this->template->status = $this->drazba->vratStatus(); }
public function renderNastavHlavniFoto($id = null) { $form = $this['setMainPhotoForm']; $form['send']->caption = 'Nastavit hlavní foto'; $this->template->nemovitost = $this->database->findById('nemovitost', $id); // osetreni nemovitosti a nastaveni statusu if (!$this->template->nemovitost) { $this->flashMessage('Tato nemovitost neexistuje. Je možné, že ji někdo smazal.'); $this->redirect('Homepage:default'); } $this->drazba->zahrnPocatecniNastaveni($id); $this->template->status = $this->drazba->vratStatus(); $main_photo = false; // pokusim se nactist hlavni foto k dane nemovitosti $main_photo = $this->database->findAll("photo")->where("id_property", $id)->where("order", 1)->fetch(); if ($main_photo != false) { // nasel jsem ho $this->template->main_photo_id = $main_photo->id; // vratim id nemovitosti } else { // nenasel jsem ho $this->template->main_photo_id = 0; } }