public function editAction() { $this->view->Title = "Quản lý quảng cáo"; $this->view->headTitle($this->view->Title); $Banner = Banner::getById($this->getRequest()->getParam('id')); if ($this->getRequest()->isPost()) { $request = $this->getRequest()->getParams(); //checkform if ($_FILES['images']['name']) { $dir = new My_Plugin_Libs(); $name = $dir->trimSpacer($request['title']); $dirname = "uploads/banner/" . $Banner->id . "/"; $upload = new My_Plugin_Upload(); $error = $upload->uploadImageFile($_FILES['images'], 2048, 1024, 1024000, array("image/png", "image/jpg", "image/gif", "image/x-png", "image/jpeg"), $dirname); if (!$error) { $filename = $upload->fileName; } } if (count($error) == 0) { $Banner->merge($request); if ($filename != "") { $Banner->image = $filename; } $Banner->save(); $this->Member->log('Quảng cáo:' . $Banner->name . '(' . $Banner->id . ')', 'Sửa chữa'); My_Plugin_Libs::setSplash('Quảng cáo: <b>' . $Banner->name . '</b> đã sửa thành công. '); //redirect to list $this->_redirect($this->_helper->url('index', 'banner', 'admin')); } if (count($error)) { $this->view->error = $error; } } $this->view->Banner = $Banner; }
public function editAction() { $this->view->Title = "Management news"; $this->view->headTitle($this->view->Title); $Content = News::getById($this->getRequest()->getParam('id')); if ($this->getRequest()->isPost()) { $request = $this->getRequest()->getParams(); //checkform $error = $this->_checkForm($request); if ($_FILES['images']['name']) { $dir = new My_Plugin_Libs(); $name = $dir->trimSpacer($request['title']); $dirname = "uploads/news/" . $Content->id . "/"; $upload = new My_Plugin_Upload(); $error = $upload->uploadImageFile($_FILES['images'], 800, 600, 1024000, array("image/png", "image/jpg", "image/gif", "image/x-png", "image/jpeg"), $dirname); if (!$error) { $filename = $upload->fileName; } } if (count($error) == 0) { $Content->merge($request); if ($filename != "") { $Content->images = $filename; } $Content->members_id = $this->Member->id; $Content->created_date = date("Y-m-d H:i:s"); $Content->save(); $this->Member->log('News:' . $Content->title . '(' . $Content->id . ')', 'Edited'); My_Plugin_Libs::setSplash('Edit: <b>' . $Content->title . '</b> have been completed. '); //redirect to list $this->_redirect($this->_helper->url('index', 'news', 'admin')); } if (count($error)) { $this->view->error = $error; } } $this->view->News = $Content; }
public function editAction() { $this->view->Title = "Phong thủy xe"; $this->view->headTitle($this->view->Title); $Product = Color::getById($this->getRequest()->getParam('id')); if ($this->getRequest()->isPost()) { $request = $this->getRequest()->getParams(); //checkform $error = $this->_checkForm($request); if ($_FILES['image']['name']) { $dir = new My_Plugin_Libs(); $name = $dir->trimSpacer($request['car_paint_color']); $dirname = "uploads/color/" . $Product->id . "/"; $upload = new My_Plugin_Upload(); $error = $upload->uploadImageFile($_FILES['image'], 800, 600, 1024000, array("image/png", "image/jpg", "image/gif", "image/x-png", "image/jpeg"), $dirname); if (!$error) { $filename = $upload->fileName; } } if (count($error) == 0) { $Product->merge($request); if ($filename != "") { $Product->image = $filename; } $Product->save(); $this->Member->log('Phong thủy xe:' . $Product->car_paint_color . '(' . $Product->id . ')', 'Sửa chữa'); My_Plugin_Libs::setSplash('Phong thủy xe: <b>' . $Product->car_paint_color . '</b> đã sửa thành công. '); //redirect to list $this->_redirect($this->_helper->url('index', 'color', 'admin')); } if (count($error)) { $this->view->error = $error; } } $this->view->Color = $Product; }
public function editAction() { $this->view->Title = "Quản lý sản phẩm"; $this->view->headTitle($this->view->Title); $Product = Product::getById($this->getRequest()->getParam('id')); if ($_GET) { $image_remove = $_GET['image']; $folder = $_GET['id']; $file = "uploads/" . $_GET['id'] . "/gallery/" . $image_remove . ".jpg"; @chmod($file, 0777); @unlink($file); echo "complete"; die; } if ($this->getRequest()->isPost()) { $request = $this->getRequest()->getParams(); //checkform $error = $this->_checkForm($request); if ($_FILES['product_images']['name']) { $dirname = "uploads/" . $Product->id . "/"; $upload = new My_Plugin_Upload(); $error = $upload->uploadImageFile($_FILES['product_images'], 800, 600, 1024000, array("image/png", "image/jpg", "image/gif", "image/x-png", "image/jpeg"), $dirname); if (!$error) { $filename = $upload->fileName; } } if ($_FILES) { $dir = "uploads/" . $Product->id . "/gallery/"; $images = $this->_uploadFiles($dir); } if (count($error) == 0) { $Product->merge($request); if ($filename != "") { $Product->product_images = $filename; } $Product->save(); $this->Member->log('Sản phẩm:' . $Product->product_name . '(' . $Product->id . ')', 'Sửa chữa'); My_Plugin_Libs::setSplash('Sản phẩm: <b>' . $Product->product_name . '</b> đã sửa thành công. '); //redirect to list $this->_redirect($this->_helper->url('index', 'product', 'admin')); } if (count($error)) { $this->view->error = $error; } } $this->view->Product = $Product; }