public function editAction() { if ($this->_request->isPost()) { if (Digitalus_Filesystem_File::isUploaded('field_image')) { // Xu ly upload file $upload = new Digitalus_Resource_Image(); $ext = Digitalus_Filesystem_File::getFileExtension($_FILES['field_image']['name']); $file_name = 'manu_' . time() . ".{$ext}"; $upload->uploadImage('field_image', $file_name, DIR_VM_MANUFACTURER_IMAGE, false, false); $_POST['image'] = DIR_VM_MANUFACTURER_IMAGE . "/{$file_name}"; } if ($this->_objManus->updateFromPost()) { $this->_redirect($this->_currentControllerUrl); return; } $rowManu = $this->_objManus->createRow($this->_request->getParams()); } else { $id = $this->_request->getParam('id'); $rowManu = $this->_objManus->find($id)->current(); if (!$rowManu) { $this->_redirect($this->_currentControllerUrl); } } $this->view->rowManu = $rowManu; $this->view->title_action = $this->view->getTranslation('Edit'); }
public function addAction() { $cId = $this->_request->getParam('cId', 0); $cPath = $this->_request->getParam('cPath', null); $type_id = $this->_request->getParam('type_id', null); // Neu khong ton tai category hay product thi chuyen den trang chu if ($cId != 0 && !$this->_objCats->find($cId)->current()) { $this->_redirect($this->_currentModuleUrl); } $val = array('tax_rates_id' => 0, 'quantity' => 0, 'price' => 0, 'discount' => 0, 'weight' => 0, 'in_stock' => 0, 'quantity_order_min' => 0, 'quantity_order_max' => 0, 'quantity_order_units' => 0, 'is_virtual' => 0, 'is_free' => 0, 'is_call' => 0, 'is_always_free_shipping' => 0, 'order' => 0, 'active' => 0); //you must validate that the session ids match if ($this->_request->isPost()) { if (Digitalus_Filesystem_File::isUploaded('field_image')) { // Xu ly upload file $upload = new Digitalus_Resource_Image(); $ext = Digitalus_Filesystem_File::getFileExtension($_FILES['field_image']['name']); $file_name = 'cat_' . time() . ".{$ext}"; $upload->uploadImage('field_image', $file_name, DIR_VM_CATALOG_IMAGE, false, false); $_POST['image'] = DIR_VM_CATALOG_IMAGE . "/{$file_name}"; } if ($this->_objCats->insertFromPost()) { $this->_redirect($this->_currentControllerUrl); return; } $val = $this->_request->getParams(); } $this->view->breadCrumbs = $this->view->partial('category-product/_bread_crumbs.phtml', array('view' => $this->view, 'arrPath' => $this->view->getBreadCrumbsData($cId))); $rowProduct = $this->_objProducts->createRow($val); $this->view->rowProduct = $rowProduct; $this->view->cId = $cId; $this->view->cPath = $cPath; $this->view->type_id = $type_id; $this->view->title_action = $this->view->getTranslation('Add'); }
public function editAction() { $this->loadLeftPage(); if ($this->_request->isPost()) { if (Digitalus_Filesystem_File::isUploaded('field_default_image')) { // Xu ly upload file $upload = new Digitalus_Resource_Image(); $ext = Digitalus_Filesystem_File::getFileExtension($_FILES['field_default_image']['name']); $file_name = 'type_' . time() . ".{$ext}"; $upload->uploadImage('field_default_image', $file_name, DIR_VM_PRODUCT_TYPE_IMAGE, false, false); $_POST['default_image'] = DIR_VM_PRODUCT_TYPE_IMAGE . "/{$file_name}"; } if ($this->_objProTypes->updateFromPost()) { // Xoa toan bo cache trong trong troller nay $this->_redirect($this->_currentControllerUrl); return; } $rowType = $this->_objProTypes->createRow($this->_request->getParams()); } else { $id = $this->_request->getParam('id'); $rowType = $this->_objProTypes->find($id)->current(); if (!$rowType) { $this->_redirect($this->_currentControllerUrl); } } $this->view->rowType = $rowType; $this->view->title_action = "Edit"; }
/** * Test action * * @return void */ public function testAction() { $str = "test -------- test"; $str = preg_replace("/\\s*[-\\s]+\\s*/", "_", $str); echo "<pre>"; print_r($str); echo "</pre>"; exit; // html_entity_decode(); // $convert = Digitalus_Convert::removeAccent("Bùi Văn Tiến Đức"); // $objhtmlEntities = new Zend_Filter_HtmlEntities(); $v = new Digitalus_Convert(); $str = '<img align="left" style="" width="" height="" class="border_img" src="/media/image/images_2.jpeg" alt="" />'; // <p><img height=\"150\" width=\"100\" src=\"/media/image/images_2.jpeg\" alt=\"\" /></p> // <p><img height=\"150\" width=\"100\" src=\"/media/image/images_2.jpeg\" alt=\"\" /></p> // <img align="left" style="" width="" height="" class="border_img" src="/media/image/images_2.jpeg" alt="" /> $ss = "<p><img height=\\"150\\" width=\\"100\\" src=\\"/media/image/images_2.jpeg\\" alt=\\"\\" /></p>"; // Nguyen goc print_r($str); // Luu vao database $str_1 = $v->scriptToData($str, 'editor'); print_r($str_1); // Outputs: A 'quote' is <b>bold</b> // $str = htmlentities($str); // $str = $objhtmlEntities->filter($str); // Outputs: A 'quote' is <b>bold</b> // echo htmlentities($str, ENT_QUOTES); // Script View print_r($v->dataToScriptView($str_1)); echo "<br><br><br><br><br><br><br><br><br><br><br><br><br><br>"; print_r($v->dataToScriptEdit($ss, 'editor')); exit; if ($this->_request->isPost()) { $upload = new Digitalus_Resource_Image(); $ext = Digitalus_Filesystem_File::getFileExtension($_FILES['file_field']['name']); $upload->uploadImage('file_field', time() . ".{$ext}", 'tam_tru'); echo "<pre>"; print_r($upload->fullPath); echo "</pre>"; echo "<pre>"; print_r($_FILES); echo "</pre>"; exit; } }
public function editAction() { $cId = $this->_request->getParam('cId'); $cPath = $this->_request->getParam('cPath'); if ($this->_request->isPost()) { if (Digitalus_Filesystem_File::isUploaded('field_image')) { // Xu ly upload file $upload = new Digitalus_Resource_Image(); $ext = Digitalus_Filesystem_File::getFileExtension($_FILES['field_image']['name']); $file_name = 'cat_' . time() . ".{$ext}"; $upload->uploadImage('field_image', $file_name, DIR_VM_CATALOG_IMAGE, false, false); $_POST['image'] = DIR_VM_CATALOG_IMAGE . "/{$file_name}"; } if ($this->_objCats->updateFromPost()) { $this->_redirect($this->_currentControllerUrl); return; } $rowManu = $this->_objCats->createRow($this->_request->getParams()); } else { $rowCat = $this->_objCats->find($cId)->current(); if (!$rowCat) { $this->_redirect($this->_currentControllerUrl); } } $this->view->breadCrumbs = $this->view->partial('category-product/_bread_crumbs.phtml', array('view' => $this->view, 'arrPath' => $this->view->getBreadCrumbsData($cId))); $this->view->rowCat = $rowCat; $this->view->cId = $cId; $this->view->cPath = $cPath; $this->view->title_action = $this->view->getTranslation('Edit'); }