Пример #1
0
 public function index05Action()
 {
     if ($this->request->isPost()) {
         $upload = new \ZendVN\File\Upload();
         $fileName = $upload->getFileName();
         $upload->addValidator("Extension", true, array("png", "jpg"), "image")->addValidator("Size", false, array("min" => "100KB", "max" => "1MB"), "zip");
         foreach ($fileName as $key => $value) {
             if ($upload->isValid($key)) {
                 $prefix = $key == "image" ? "img_" : "file_";
                 $upload->uploadFile($key, FILES_PATH . $key, array("task" => "rename"), $prefix);
             } else {
                 $message = $upload->getMessages();
                 echo "<pre style='font-weight:bold'>";
                 print_r($message);
                 echo "</pre>";
             }
         }
     }
 }
 public function indexAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Thư viện ảnh';
     $this->headTitle($title)->setSeparator(" - ")->append("Hệ thống quản trị website");
     if ($this->getRequest()->isPost()) {
         //Upload
         $image = '';
         $upload = new \ZendVN\File\Upload();
         $fileName = $upload->getFileName();
         if (!empty($fileName)) {
             $upload->addValidator('Extension', true, array('png', 'jpg', 'gif'), 'file');
             $upload->addValidator('Size', false, array('min' => '20kb', 'max' => '5mb'), 'file');
             if (!$upload->isValid('file')) {
                 $messages = $upload->getMessages();
                 if (!empty($messages['fileExtensionFalse'])) {
                     $error[] = 'Định dạng file không hợp lệ!';
                 }
                 if (!empty($messages['fileSizeTooBig'])) {
                     $error[] = 'Kích thước file quá lớn!';
                 }
                 if (!empty($messages['fileSizeTooSmall'])) {
                     $error[] = 'Kích thước file quá nhỏ!';
                 }
             } else {
                 //upload ảnh mới
                 $file = $upload->uploadFile('file', UPLOAD_PATH . '/gallery/', array('task' => 'rename'), 'batdongsan_');
             }
         } else {
             $error[] = 'Bạn chưa chọn file upload';
         }
         if (empty($this->_arrPost['name'])) {
             $error[] = 'Bạn chưa nhập tên file';
         }
         if (empty($error)) {
             $data = array('user_id' => $this->identity()->id, 'images' => $file, 'date_time' => date('d/m/y h:i:s'), 'name' => $this->_arrPost['name']);
             $this->getTable()->saveItem($data, array('task' => 'save-file'));
             $this->flashMessenger()->addSuccessMessage('Dữ liệu đã được lưu thành công');
             $this->redirect()->toUrl('/admin/gallery/');
         }
     }
     return new ViewModel(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'error' => $error));
 }
 public function addAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Tin tức BĐS > Thêm mới';
     $this->headTitle($title)->setSeparator(" - ")->append("Hệ thống quản trị website");
     $emailTemplateAdminForm = $this->serviceLocator->get('FormElementManager')->get('emailTemplateAdminForm');
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $emailTemplateAdminForm->setData($data);
         //Upload
         $image = '';
         $upload = new \ZendVN\File\Upload();
         $fileName = $upload->getFileName();
         if (!empty($fileName)) {
             $upload->addValidator('Extension', true, array('png', 'jpg'), 'image');
             $upload->addValidator('Size', false, array('min' => '20kb', 'max' => '800kb'), 'image');
             if (!$upload->isValid('image')) {
                 $messages = $upload->getMessages();
                 if (!empty($messages['fileExtensionFalse'])) {
                     $error[] = 'Định dạng file không hợp lệ!';
                 }
                 if (!empty($messages['fileSizeTooBig'])) {
                     $error[] = 'Kích thước file quá lớn!';
                 }
                 if (!empty($messages['fileSizeTooSmall'])) {
                     $error[] = 'Kích thước file quá nhỏ!';
                 }
             } else {
                 //upload ảnh mới
                 $image = $upload->uploadFile('image', UPLOAD_PATH . '/email-template/', array('task' => 'rename'), 'batdongsan_');
             }
         }
         if ($emailTemplateAdminForm->isValid() && empty($error)) {
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('name' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['name'])), 'content' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['content'])), 'images' => $image, 'date_time' => date('d/m/y h:i:s'));
             $this->getTable()->saveItem($data, array('task' => 'add'));
             $this->flashMessenger()->addSuccessMessage('Dữ liệu đã được lưu thành công');
             $this->redirect()->toUrl('/admin/emailtemplate/');
         } else {
             //echo '<pre>';
             //print_r($newsForm->getMessages());
             //echo '</pre>';
         }
     }
     return new ViewModel(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'myForm' => $emailTemplateAdminForm, 'error' => $error));
 }
 public function uploadifyDbAction()
 {
     $result = array();
     if ($this->getRequest()->isPost()) {
         if (!empty($_FILES)) {
             //Upload File
             $upload = new \ZendVN\File\Upload();
             $fileName = $upload->getFileName();
             if (!empty($fileName)) {
                 $upload->addValidator('Extension', true, array('png', 'jpg'), 'Filedata');
                 $upload->addValidator('Size', false, array('min' => '10kb', 'max' => '500kb'), 'Filedata');
                 if (!$upload->isValid('Filedata')) {
                     $result['status'] = 'error';
                     $messages = $upload->getMessages();
                     if (!empty($messages['fileExtensionFalse'])) {
                         $result['messages']['upload'] = 'Định dạng file không hợp lệ';
                     }
                     if (!empty($messages['fileSizeTooBig'])) {
                         $result['messages']['upload'] = 'Kích thước file quá lớn';
                     }
                     if (!empty($messages['fileSizeTooSmall'])) {
                         $result['messages']['upload'] = 'Kích thước file quá nhỏ';
                     }
                 } else {
                     $filename = $upload->uploadFile('Filedata', UPLOAD_PATH . '/project/', array('task' => 'rename'), 'batdongsan_');
                     $item = $this->getTable()->getItem($this->_arrPost, array('task' => 'get-item'));
                     //Mảng hình ảnh lấy từ database
                     $Imgdata = \Zend\Json\Json::decode($item->images);
                     // mảng chưa file upload hiện tại
                     $newValue = array();
                     $newValue[] = $filename;
                     //Gộp 2 mảng
                     if (!empty($Imgdata)) {
                         $newValue = array_merge($newValue, $Imgdata);
                     }
                     //mảng chứa chuỗi json hình ảnh
                     $arrParam['id'] = $this->_arrPost['id'];
                     $arrParam['images'] = \Zend\Json\Json::encode($newValue);
                     //Cập nhật hình ảnh vào database
                     $this->getTable()->saveItem($arrParam, array('task' => 'edit'));
                     $result['status'] = 'success';
                     $result['messages']['upload'] = 'Thành công';
                 }
             }
         }
     }
     echo \Zend\Json\Json::encode($result);
     return $this->getResponse();
 }
Пример #5
0
 public function addAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Quản lý thành viên > Thêm mới';
     $this->headTitle($title)->setSeparator(" - ")->append("Hệ thống quản trị website");
     $itemsUserGroup = $this->getUserGroupTable()->listItem($this->_arrParam, array('task' => 'list-items'));
     $userForm = $this->serviceLocator->get('FormElementManager')->get('userForm');
     $itemsGroup = $this->getUserGroupTable()->itemInselectBox($this->_arrParam, array('task' => 'list-item-group'));
     //$itemsGroup     = array_slice ($itemsGroup,1,count($itemsGroup) - 1);
     $itemsCity = $this->getTable()->itemInselectBox($this->_arrParam, array('task' => 'list-item-city'));
     //$itemsCity      = array_slice ($itemsCity,1,count($itemsCity) - 1);
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $userForm->setData($data);
         //Kiểm tra chọn select box
         if (empty($this->_arrPost['group_id'])) {
             $error[] = 'Bạn phải chọn thông tin Nhóm của khách hàng! ';
         }
         if (empty($this->_arrPost['city_id'])) {
             $error[] = 'Bạn phải chọn thông tin Thành phố của khách hàng!';
         }
         //Upload
         $avatar = '';
         $upload = new \ZendVN\File\Upload();
         $fileName = $upload->getFileName();
         if (!empty($fileName)) {
             $upload->addValidator('Extension', true, array('png', 'jpg'), 'image');
             $upload->addValidator('Size', false, array('min' => '10kb', 'max' => '500kb'), 'image');
             if (!$upload->isValid('image')) {
                 $messages = $upload->getMessages();
                 if (!empty($messages['fileExtensionFalse'])) {
                     $error[] = 'Định dạng file không hợp lệ!';
                 }
                 if (!empty($messages['fileSizeTooBig'])) {
                     $error[] = 'Kích thước file quá lớn!';
                 }
                 if (!empty($messages['fileSizeTooSmall'])) {
                     $error[] = 'Kích thước file quá nhỏ!';
                 }
             } else {
                 //upload ảnh mới
                 $avatar = $upload->uploadFile('image', UPLOAD_PATH . '/avatar/', array('task' => 'rename'), 'batdongsan_');
             }
         }
         if ($userForm->isValid() && empty($error)) {
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('username' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['username'])), 'password' => md5($this->_arrPost['password']), 'email' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['email'])), 'avatar' => $avatar, 'fullname' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['fullname'])), 'city_id' => $purifier->purify($this->_arrPost['city_id']), 'website' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['website'])), 'phone' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['phone'])), 'group_id' => $purifier->purify($this->_arrPost['group_id']), 'diachi' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['diachi'])), 'introduced' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['introduced'])));
             $this->getTable()->saveItem($data, array('task' => 'add'));
             $this->flashMessenger()->addSuccessMessage('Dữ liệu đã được lưu thành công');
             $this->redirect()->toUrl('/admin/user/');
         }
     }
     return new ViewModel(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'myForm' => $userForm, 'itemsGroup' => $itemsGroup, 'itemsCity' => $itemsCity, 'error' => $error));
 }
 public function addAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Tiếp thị qua Email > Thêm mới';
     $this->headTitle($title)->setSeparator(" - ")->append("Hệ thống quản trị website");
     $ssFilter = new Container($this->_namespace);
     $emailMarketingAdminForm = $this->serviceLocator->get('FormElementManager')->get('emailMarketingAdminForm');
     $itemTemplate = $this->getTable()->getItem($ssFilter->templateEmail, array('task' => 'get-item-email-template'));
     //Bind
     $object = new ArrayObject(array('content' => $itemTemplate['content']));
     $emailMarketingAdminForm->bind($object);
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $emailMarketingAdminForm->setData($data);
         //Upload
         $file = '';
         $upload = new \ZendVN\File\Upload();
         $fileName = $upload->getFileName();
         if (!empty($fileName)) {
             $upload->addValidator('Extension', true, array('doc', 'docx'), 'file');
             $upload->addValidator('Size', false, array('min' => '1kb', 'max' => '5mb'), 'file');
             if (!$upload->isValid('file')) {
                 $messages = $upload->getMessages();
                 if (!empty($messages['fileExtensionFalse'])) {
                     $error[] = 'Định dạng file không hợp lệ!';
                 }
                 if (!empty($messages['fileSizeTooBig'])) {
                     $error[] = 'Kích thước file quá lớn!';
                 }
                 if (!empty($messages['fileSizeTooSmall'])) {
                     $error[] = 'Kích thước file quá nhỏ!';
                 }
             } else {
                 //upload ảnh mới
                 $file = $upload->uploadFile('file', UPLOAD_PATH . '/email-attachment/', array('task' => 'rename'), 'batdongsan_');
             }
         }
         //===========Kiểm tra xem nhập email=============
         $validator = new \Zend\Validator\EmailAddress();
         $arrEmail = explode(",", $this->_arrPost['email']);
         $arrEmail = array_unique($arrEmail);
         //loại bỏ email trùng nhau
         //kiểm tra số lượng email
         if (count($arrEmail) > 3) {
             $error[] = 'Chỉ được nhập tối đa 3 email';
         }
         foreach ($arrEmail as $key => $email) {
             //(thừa dấu phẩy ở đầu và cuối chuỗi)
             if ($email == '') {
                 $error[] = "Giữa các email phải cách nhau bằng dấu phẩy";
                 break;
             }
             //Kiểm tra xem email có hợp lệ không
             if (!$validator->isValid($email)) {
                 $error[] = 'Email không hợp lệ';
                 break;
             }
         }
         if ($emailMarketingAdminForm->isValid() && empty($error)) {
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('name' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['name'])), 'content' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['content'])), 'email' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['email'])), 'file' => $file, 'date_time' => date('d/m/y h:i:s'));
             $this->getTable()->saveItem($data, array('task' => 'add'));
             $this->flashMessenger()->addSuccessMessage('Dữ liệu đã được lưu thành công');
             $this->redirect()->toUrl('/admin/emailmarketing/');
         } else {
             //echo '<pre>';
             //print_r($newsForm->getMessages());
             //echo '</pre>';
         }
     }
     return new ViewModel(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'myForm' => $emailMarketingAdminForm, 'error' => $error));
 }
 public function addAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Biểu mẫu hợp đồng > Thêm mới';
     $this->headTitle($title)->setSeparator(" - ")->append("Hệ thống quản trị website");
     $contractFormForm = $this->serviceLocator->get('FormElementManager')->get('contractFormForm');
     //Danh mục
     $itemsCategoryNews = $this->getTable()->itemInselectBox($this->_arrParam, array('task' => 'list-item-category'));
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $contractFormForm->setData($data);
         if (empty($this->_arrPost['cat_id'])) {
             $error[] = 'Bạn phải chọn Danh mục!';
         }
         //Upload
         $file = '';
         $upload = new \ZendVN\File\Upload();
         $fileName = $upload->getFileName();
         if (!empty($fileName)) {
             $upload->addValidator('Extension', true, array('doc', 'docx'), 'file');
             $upload->addValidator('Size', false, array('min' => '20kb', 'max' => '5mb'), 'file');
             if (!$upload->isValid('file')) {
                 $messages = $upload->getMessages();
                 if (!empty($messages['fileExtensionFalse'])) {
                     $error[] = 'Định dạng file không hợp lệ!';
                 }
                 if (!empty($messages['fileSizeTooBig'])) {
                     $error[] = 'Kích thước file quá lớn!';
                 }
                 if (!empty($messages['fileSizeTooSmall'])) {
                     $error[] = 'Kích thước file quá nhỏ!';
                 }
             } else {
                 //upload ảnh mới
                 $file = $upload->uploadFile('file', UPLOAD_PATH . '/contract-form/', array('task' => 'rename'), 'batdongsan_');
             }
         }
         if ($contractFormForm->isValid() && empty($error)) {
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('cat_id' => $purifier->purify($this->_arrPost['cat_id']), 'title' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['title'])), 'file' => $file, 'date_time' => date('d/m/y h:i:s'));
             $this->getTable()->saveItem($data, array('task' => 'add'));
             $this->flashMessenger()->addSuccessMessage('Dữ liệu đã được lưu thành công');
             $this->redirect()->toUrl('/admin/contractform/');
         } else {
             //echo '<pre>';
             //print_r($newsForm->getMessages());
             //echo '</pre>';
         }
     }
     return new ViewModel(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'myForm' => $contractFormForm, 'itemsCategoryNews' => $itemsCategoryNews, 'error' => $error));
 }
 public function addAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Doanh nghiệp BĐS > Tạo doanh nghiệp';
     $this->headTitle($title)->setSeparator(" - ")->append("Hệ thống quản trị website");
     //kiểm tra xem thành viên đã tạo trang doanh nghiệp chưa
     //1 thành viên chỉ được tạo duy nhất 1 trang doanh nghiệp
     $this->_arrParam['alias'] = $this->identity()->username;
     $item = $this->getTable()->getItem($this->_arrParam);
     //Mỗi thành viên chỉ được tạo duy nhất 1 trang doanh nghiệp
     if (!empty($item)) {
         $this->redirect()->toUrl('/user/business/');
     }
     //Thành viên có parent khác 0(tức là nhân viên của thành viên khac) không khởi tạo được trang doanh nghiệp
     if ($this->identity()->parent != 0) {
         $this->redirect()->toUrl('/user/account/');
     }
     $businessForm = $this->serviceLocator->get('FormElementManager')->get('businessUserForm');
     //list city
     $itemsCity = $this->getTable()->itemInselectBox($this->_arrParam, array('task' => 'list-item-city'));
     //loại hình doanh nghiệp
     $itemsTypeBusinesss = $this->getTable()->itemInselectBox($this->_arrParam, array('task' => 'list-item-type-business'));
     //Bind
     $object = new ArrayObject(array('name' => $this->identity()->fullname, 'alias' => $this->identity()->username));
     $businessForm->bind($object);
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $businessForm->setData($data);
         //Kiểm tra chọn select box
         if (empty($this->_arrPost['city'])) {
             $error[] = 'Bạn phải chọn thông tin Thành phố của doanh nghiệp!';
         }
         if (empty($this->_arrPost['district'])) {
             $error[] = 'Bạn phải chọn thông tin Quận huyện của doanh nghiệp!';
         }
         if (empty($this->_arrPost['type_business'])) {
             $error[] = 'Bạn phải chọn thông tin loại hình doanh nghiệp!';
         }
         //Upload
         $logo = '';
         $upload = new \ZendVN\File\Upload();
         $fileName = $upload->getFileName();
         if (!empty($fileName)) {
             $upload->addValidator('Extension', true, array('png', 'jpg'), 'image');
             $upload->addValidator('Size', false, array('min' => '1kb', 'max' => '500kb'), 'image');
             if (!$upload->isValid('image')) {
                 $messages = $upload->getMessages();
                 if (!empty($messages['fileExtensionFalse'])) {
                     $error[] = 'Định dạng file không hợp lệ!';
                 }
                 if (!empty($messages['fileSizeTooBig'])) {
                     $error[] = 'Kích thước file quá lớn!';
                 }
                 if (!empty($messages['fileSizeTooSmall'])) {
                     $error[] = 'Kích thước file quá nhỏ!';
                 }
             } else {
                 //upload ảnh mới
                 $logo = $upload->uploadFile('image', UPLOAD_PATH . '/logo-business/', array('task' => 'rename'), 'batdongsan_');
             }
         }
         if ($businessForm->isValid() && empty($error)) {
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('type_business' => $purifier->purify($this->_arrPost['type_business']), 'name' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['name'])), 'alias' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['alias'])), 'logo' => $logo, 'address' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['address'])), 'city' => $purifier->purify($this->_arrPost['city']), 'district' => $purifier->purify($this->_arrPost['district']), 'ward' => $purifier->purify($this->_arrPost['ward']), 'phone' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['phone'])), 'fax' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['fax'])), 'website' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['website'])), 'intro' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['intro'])), 'contact' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['contact'])), 'department' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['department'])), 'date_time' => date('d/m/y h:i:s'));
             $this->getTable()->saveItem($data, array('task' => 'add'));
             $this->flashMessenger()->addSuccessMessage('Dữ liệu đã được lưu thành công');
             $this->redirect()->toUrl('/user/business/');
         } else {
             //echo '<pre>';
             //print_r($businessForm->getMessages());
             //echo '</pre>';
         }
     }
     return new ViewModel(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'myForm' => $businessForm, 'itemsTypeBusinesss' => $itemsTypeBusinesss, 'itemsCity' => $itemsCity, 'error' => $error));
 }
 public function fileAction()
 {
     $error = array();
     $item = $this->getTable()->getItem($this->_arrParam, array('task' => 'get-item'));
     $redirect = new Container('redirect');
     $redirect->curentUrl = '/admin/filemanager/file/' . $item->id;
     $totalItem = $this->getTable()->countItem($this->_arrParam, array('task' => 'file'));
     $items = $this->getTable()->listItem($this->_arrParam, array('task' => 'list-items-paginator-file'));
     $fileFolderSize = 0;
     foreach ($items as $value) {
         $folder = FILE_MANAGER_URL_CODINH . '/' . $value['name_folder'];
         $fileFolderSize += @filesize($folder . '/' . $value['filename']);
     }
     $fileFolderSize = \ZendVN\File\ConvertSize::convert($fileFolderSize, 2, ' ');
     //Tiêu đề
     $title = 'Quản lý file > Thư mục ' . $item->name . ' | Tổng số file : ' . $totalItem . ' | Tổng dung lượng: ' . $fileFolderSize;
     $this->headTitle($title)->setSeparator(" - ")->append("Hệ thống quản trị website");
     if ($this->getRequest()->isPost()) {
         //Upload
         $image = '';
         $upload = new \ZendVN\File\Upload();
         $fileName = $upload->getFileName();
         if (!empty($fileName)) {
             $upload->addValidator('Extension', true, array('png', 'jpg', 'gif', 'txt', 'rar', 'zip', 'exe', 'doc', 'docx', 'xls', 'pdf'), 'file');
             $upload->addValidator('Size', false, array('min' => '20kb', 'max' => '5mb'), 'file');
             if (!$upload->isValid('file')) {
                 $messages = $upload->getMessages();
                 if (!empty($messages['fileExtensionFalse'])) {
                     $error[] = 'Định dạng file không hợp lệ!';
                 }
                 if (!empty($messages['fileSizeTooBig'])) {
                     $error[] = 'Kích thước file quá lớn!';
                 }
                 if (!empty($messages['fileSizeTooSmall'])) {
                     $error[] = 'Kích thước file quá nhỏ!';
                 }
             } else {
                 //upload ảnh mới
                 $file = $upload->uploadFile('file', FILE_MANAGER_PATH . '/' . $item->name . '/', array('task' => 'rename'), 'batdongsan_');
             }
         } else {
             $error[] = 'Bạn chưa chọn file upload';
         }
         if (empty($this->_arrPost['name'])) {
             $error[] = 'Bạn chưa nhập tên file';
         }
         if (empty($error)) {
             $data = array('folder_id' => $item->id, 'filename' => $file, 'name' => $this->_arrPost['name'], 'date_time' => date('d/m/y h:i:s'));
             $this->getTable()->saveItem($data, array('task' => 'save-file'));
             $this->flashMessenger()->addSuccessMessage('Dữ liệu đã được lưu thành công');
             $this->redirect()->toUrl('/admin/filemanager/file/' . $item->id);
         }
     }
     return new ViewModel(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'error' => $error));
 }