/**
  * Delete page with all content
  */
 function handleDelete($id)
 {
     $doc = new Model\Document($this->database);
     $doc->delete($id);
     Model\IO::removeDirectory(APP_DIR . '/media/' . $id);
     $this->redirect(":Admin:Events:default", array("id" => null));
 }
 function insertFormSucceeded(\Nette\Forms\BootstrapUIForm $form)
 {
     $doc = new \App\Model\Document($this->database);
     $doc->setType(5);
     $doc->createSlug("contact-" . $form->values->name);
     $doc->setTitle($form->values->name);
     $page = $doc->create($this->presenter->user->getId());
     // create new contact
     $this->database->table("contacts")->insert(array("categories_id" => 5, "pages_id" => $page, "users_id" => $this->presenter->user->getId(), "name" => $form->values->name, "street" => $form->values->street, "zip" => $form->values->zip, "city" => $form->values->city));
     $this->presenter->redirect(":Front:Profile:addresses");
 }
 /**
  * Delete page
  */
 function handleDeletePage($id)
 {
     $page = new Model\Page($this->database);
     $pages = $page->getChildren($id);
     $pages[] = $id;
     foreach ($pages as $item) {
         echo 1;
         $doc = new Model\Document($this->database);
         $doc->delete($item);
         Model\IO::removeDirectory(APP_DIR . '/media/' . $item);
     }
     $this->redirect(this, array("id" => null, "type" => $this->getParameter("type")));
 }