function insertFormSucceeded(\Nette\Forms\BootstrapUIForm $form) { $doc = new \App\Model\Document($this->database); $doc->setType(2); $doc->setTitle($form->values->title); $page = $doc->create($this->presenter->user->getId()); \App\Model\IO::directoryMake(substr(APP_DIR, 0, -4) . '/www/media/' . $page); $this->presenter->redirect(":Admin:Blog:detail", array("id" => $page)); }
function insertFormSucceeded(\Nette\Forms\BootstrapUIForm $form) { $doc = new \App\Model\Document($this->database); $doc->setType(3); $doc->setTitle($form->values->title); $doc->setSlug($form->values->title); $id = $doc->create($this->presenter->user->getId()); \App\Model\IO::directoryMake(APP_DIR . '/media/' . $id); $this->presenter->redirect(":Admin:Events:detail", array("id" => $id)); }
function insertFormSucceeded(\Nette\Forms\BootstrapUIForm $form) { $doc = new \App\Model\Document($this->database); $doc->setType($form->values->type); $doc->setTitle($form->values->title); $doc->setPreview($form->values->preview); $page = $doc->create($this->presenter->user->getId(), $form->values->category); \App\Model\IO::directoryMake(APP_DIR . '/media/' . $page); $this->presenter->redirect(this, array("id" => $form->values->category, "type" => $form->values->type)); }
function insertFormSucceeded(\Nette\Forms\BootstrapPHForm $form) { $doc = new \App\Model\Document($this->database); $doc->setType(5); $doc->createSlug("contact-" . $form->values->user); $doc->setTitle($form->values->title); $page = $doc->create($this->presenter->user->getId()); \App\Model\IO::directoryMake(substr(APP_DIR, 0, -4) . '/www/media/' . $page); $arr = array("pages_id" => $page, "type" => 1, "name" => 'contact-' . $form->values->user, "users_id" => $form->values->user); $this->database->table("contacts")->insert($arr); $this->presenter->redirect(this, array("id" => $form->values->page)); }
function addSucceeded(\Nette\Forms\BootstrapUIForm $form) { $doc = new \App\Model\Document($this->database); $doc->setType(5); $doc->createSlug("contact-" . $form->values->email); $doc->setTitle($form->values->email); $page = $doc->create($this->presenter->user->getId()); \App\Model\IO::directoryMake(substr(APP_DIR, 0, -4) . '/www/media/' . $page, 0755); $arr = array("users_id" => null, "pages_id" => $page, "type" => 0); $arr["email"] = $form->values->email; $arr["name"] = $form->values->email; $this->database->table("contacts")->insert($arr); $this->presenter->flashMessage("Byli jste přihlášení k odeběru newsletteru"); $this->presenter->redirect(this); }
function insertFormSucceeded(\Nette\Forms\BootstrapPHForm $form) { $doc = new \App\Model\Document($this->database); $doc->setType(5); $doc->createSlug("contact-" . $form->values->title); $doc->setTitle($form->values->title); $page = $doc->create($this->template->user->getId()); \App\Model\IO::directoryMake(substr(APP_DIR, 0, -4) . '/www/media/' . $page, 0755); $arr = array("users_id" => null, "pages_id" => $page, "type" => $form->values->type); if ($form->values->type == 0) { $arr["name"] = $form->values->title; } else { $arr["company"] = $form->values->title; } $this->database->table("contacts")->insert($arr); $this->presenter->redirect(":Admin:Contacts:detail", array("id" => $page)); }
function uploadFormSucceeded(\Nette\Forms\BootstrapUIForm $form) { $fileDirectory = APP_DIR . '/media/' . $form->values->id; \App\Model\IO::directoryMake($fileDirectory, 0755); if (strlen($_FILES["the_file"]["tmp_name"]) > 1) { $imageExists = $this->database->table("media")->where(array('name' => $_FILES["the_file"]["name"], 'pages_id' => $form->values->id)); $fileName = $fileDirectory . '/' . $_FILES["the_file"]["name"]; \App\Model\IO::remove($fileName); copy($_FILES["the_file"]["tmp_name"], $fileName); chmod($fileName, 0644); if ($imageExists->count() == 0) { $this->database->table("media")->insert(array('name' => $_FILES["the_file"]["name"], 'pages_id' => $form->values->id, 'description' => $form->values->description, 'filesize' => filesize($fileDirectory . '/' . $_FILES["the_file"]["name"]), 'file_type' => 1, 'date_created' => date("Y-m-d H:i:s"))); } // thumbnails $image = \Nette\Utils\Image::fromFile($fileName); $image->resize(400, 250, \Nette\Utils\Image::SHRINK_ONLY); $image->sharpen(); $image->save(APP_DIR . '/media/' . $form->values->id . '/tn/' . $_FILES["the_file"]["name"]); chmod(APP_DIR . '/media/' . $form->values->id . '/tn/' . $_FILES["the_file"]["name"], 0644); } $this->redirect(this, array("id" => $form->values->id, "category" => $form->values->category)); }
function uploadFormSucceeded(\Nette\Forms\BootstrapUIForm $form) { if (!empty($_FILES)) { $ds = DIRECTORY_SEPARATOR; $storeFolder = 'media/' . $form->values->pages_id; \App\Model\IO::directoryMake(APP_DIR . $ds . $storeFolder); $tempFile = $_FILES['file']['tmp_name']; //3 $realFile = $_FILES['file']['name']; //3 $targetPath = APP_DIR . $ds . $storeFolder . $ds; //4 $targetFile = $targetPath . $_FILES['file']['name']; //5 move_uploaded_file($tempFile, $targetFile); //6 chmod($targetFile, 0644); $fileSize = filesize($targetFile); //$fileType = pathinfo($realFile, PATHINFO_EXTENSION); //$fileTypeC = str_replace(array("doc", "docx", "xlsx", "xls"), array("word", "word", "excel", "excel"), $fileType); $checkImage = $this->database->table("media")->where(array('name' => $realFile, 'pages_id' => $form->values->id)); // Thumbnail for images if (\App\Model\IO::isImage($targetFile)) { \App\Model\IO::directoryMake(APP_DIR . $ds . $storeFolder . $ds . 'tn', 0755); // thumbnails $image = \Nette\Utils\Image::fromFile($targetFile); $image->resize(400, 250, \Nette\Utils\Image::SHRINK_ONLY); $image->sharpen(); $image->save(APP_DIR . '/media/' . $form->values->pages_id . '/tn/' . $realFile); chmod(APP_DIR . '/media/' . $form->values->pages_id . '/tn/' . $realFile, 0644); } if ($checkImage->count() == 0) { $this->database->table("media")->insert(array('name' => $realFile, 'pages_id' => $form->values->pages_id, 'filesize' => $fileSize, 'file_type' => 1, 'date_created' => date("Y-m-d H:i:s"))); } else { echo "Nejsem reálný soubor"; } } exit; }
function dropFileUploadFormSucceeded(\Nette\Forms\BootstrapUIForm $form) { if (!empty($_FILES)) { $ds = DIRECTORY_SEPARATOR; $storeFolder = 'media/' . $form->values->pages_id; \App\Model\IO::directoryMake(APP_DIR . $ds . $storeFolder, 0755); $tempFile = $_FILES['file']['tmp_name']; $realFile = $_FILES['file']['name']; $targetPath = APP_DIR . $ds . $storeFolder . $ds; $targetFile = $targetPath . $_FILES['file']['name']; move_uploaded_file($tempFile, $targetFile); chmod($targetFile, 0644); $fileSize = filesize($targetFile); $checkImage = $this->database->table("media")->where(array('name' => $realFile, 'pages_id' => $form->values->id)); if ($checkImage->count() == 0) { $this->database->table("media")->insert(array('name' => $realFile, 'pages_id' => $form->values->pages_id, 'filesize' => $fileSize, 'file_type' => 0, 'date_created' => date("Y-m-d H:i:s"))); } else { echo "Nejsem reálný soubor"; } } exit; }