Exemplo n.º 1
0
 public function searchFormSucceeded(\Nette\Forms\BootstrapPHForm $form)
 {
     $values = $form->getHttpData($form::DATA_TEXT);
     // get value from html input
     unset($values["do"], $values["action"], $values["idr"]);
     $this->presenter->redirect(":Front:Catalogue:default", $values);
 }
Exemplo n.º 2
0
 function editSnippetFormSucceeded(\Nette\Forms\BootstrapPHForm $form)
 {
     $content = $form->getHttpData($form::DATA_TEXT, 'content');
     if ($form->values->l != '') {
         $langSuffix = '_' . $form->values->l;
     }
     $this->database->table("snippets")->get($form->values->snippet_id)->update(array("content" . $langSuffix => $content));
     $this->presenter->redirect(this, array("id" => $form->values->page_id, "snippet" => $form->values->snippet_id, "l" => $form->values->l));
 }
Exemplo n.º 3
0
 function imageAddFormSucceeded(\Nette\Forms\BootstrapPHForm $form)
 {
     $values = $form->getHttpData($form::DATA_TEXT);
     // get value from html input
     $fileName = $_FILES['file']['name'];
     if ($_FILES['file']['name']) {
         if (!$_FILES['file']['error']) {
             $destination = APP_DIR . '/media/' . $values["page_id"] . '/' . $fileName;
             //change this directory
             $location = $_FILES["file"]["tmp_name"];
             move_uploaded_file($location, $destination);
             chmod($destination, 0644);
             $fileSize = filesize($destination);
             $checkImage = $this->database->table("media")->where(array('name' => $fileName, 'pages_id' => $values["page_id"]));
             if ($checkImage->count() == 0) {
                 $image = \Nette\Utils\Image::fromFile($destination);
                 $image->resize(400, 250, \Nette\Utils\Image::SHRINK_ONLY);
                 $image->sharpen();
                 $image->save(APP_DIR . '/media/' . $values["page_id"] . '/tn/' . $fileName);
                 chmod(APP_DIR . '/media/' . $values["page_id"] . '/tn/' . $fileName);
                 $this->database->table("media")->insert(array('name' => $fileName, 'pages_id' => $values["page_id"], 'filesize' => $fileSize, 'file_type' => 1, 'date_created' => date("Y-m-d H:i:s")));
             }
         }
     }
     exit;
 }