public function indexAction() { //print_r(strtolower ("Nguyễn Nghị Lực"));exit; print_r(Utils::toEnglish('Nguyễn Nghị Lực')); exit; exit; //phpinfo();exit; $this->view->disable(); $params = array('apa' => 1, 'bpa' => 2); try { $result = $this->sendMail('*****@*****.**', 'test', $params); echo "Done!"; } catch (Exception $ex) { echo "Something wrong!"; } }
public function editAction() { $aParam = $this->getParam(); $check = Product::findFirst("(productname_vi='" . $aParam['productname_vi'] . "' OR productname_en='" . $aParam['productname_en'] . "') AND productid<>'" . $aParam['productid'] . "'"); if ($check == false) { $aParam["updated_at"] = (new DateTime())->format('Y-m-d H:i:s'); $aParam['productname_key_vi'] = Utils::toEnglish($aParam['productname_vi']); $aParam['productname_key_en'] = Utils::toEnglish($aParam['productname_en']); $update = Product::findFirst("productid='" . $aParam['productid'] . "'"); if ($update->update($aParam) == true) { $data = Product::findFirst("productid='" . $aParam['productid'] . "'"); return $this->showErrorJson(1, "Product", "Product", $aParam); } else { return $this->showErrorJson(0, "Product", $aParam); } } else { return $this->showErrorJson(2, "Product", $aParam); } }
public function getParam() { $aParam = array(); $aParam["query"] = $this->request->getPost("query"); $aParam["where"] = $this->request->getPost("where"); $aParam["group"] = $this->request->getPost("group"); $aParam["order"] = $this->request->getPost("order"); $aParam["language"] = $this->request->getPost("language"); $aParam["image"] = $this->request->getPost("image"); $aParam["rated"] = $this->request->getPost("rated"); $aParam["description_vi"] = $this->request->getPost("description_vi"); $aParam["description_en"] = $this->request->getPost("description_en"); $aParam["facilityid"] = $this->request->getPost("facilityid"); $aParam["facilityname_vi"] = $this->request->getPost("facilityname_vi"); $aParam["facilityname_en"] = $this->request->getPost("facilityname_en"); $aParam["categoryid"] = $this->request->getPost("categoryid"); $aParam["categoryname_vi"] = $this->request->getPost("categoryname_vi"); $aParam["categoryname_en"] = $this->request->getPost("categoryname_en"); $aParam["productid"] = $this->request->getPost("productid"); $aParam["productname_vi"] = $this->request->getPost("productname_vi"); $aParam["productname_en"] = $this->request->getPost("productname_en"); $aParam["productname_key_vi"] = $this->request->getPost("productname_key_vi"); $aParam["productname_key_en"] = $this->request->getPost("productname_key_en"); $aParam["unit"] = $this->request->getPost("unit"); $aParam["consignmentid"] = $this->request->getPost("consignmentid"); $aParam["consignmentname_vi"] = $this->request->getPost("consignmentname_vi"); $aParam["consignmentname_en"] = $this->request->getPost("consignmentname_en"); $aParam["totalprice"] = $this->request->getPost("totalprice"); $sale = $this->request->getPost("sale"); $aParam["sale"] = $sale < 0 ? 0 : $sale; $quantity = $this->request->getPost("quantity"); $aParam["quantity"] = $quantity < 0 ? 0 : $quantity; $price = $this->request->getPost("price"); $aParam["price"] = $price < 0 ? 0 : $price; $quantity_per_price = $this->request->getPost("quantity_per_price"); $aParam["quantity_per_price"] = $quantity_per_price < 0 ? 0 : $quantity_per_price; $aParam["commentid"] = $this->request->getPost("commentid"); $aParam["clientname"] = $this->request->getPost("clientname"); $aParam["userid"] = $this->request->getPost("userid"); $aParam["username"] = $this->request->getPost("username"); $aParam["fullname"] = $this->request->getPost("fullname"); $aParam["hash"] = $this->request->getPost("hash"); $aParam["password"] = $this->request->getPost("password"); $aParam["email"] = $this->request->getPost("email"); $birthday = $this->request->getPost("birthday"); $aParam["birthday"] = $birthday > 0 && $birthday < 31 ? $birthday : 0; $birthmonth = $this->request->getPost("birthmonth"); $aParam["birthmonth"] = $birthmonth > 0 && $birthmonth < 13 ? $birthmonth : 0; $birthyear = $this->request->getPost("birthyear"); $aParam["birthyear"] = $birthyear > 1900 && $birthyear < date('Y') - 10 ? $birthyear : 0; $aParam["phone"] = $this->request->getPost("phone"); $aParam["address"] = $this->request->getPost("address"); $aParam["note"] = $this->request->getPost("note"); $aParam["confirm"] = $this->request->getPost("confirm"); $aParam["deliverytime"] = $this->request->getPost("deliverytime"); $aParam["paymentmethod"] = $this->request->getPost("paymentmethod"); $aParam["video"] = $this->request->getPost("video"); $aParam["type_upload"] = $this->request->getPost("type_upload"); ////////// $aParam = array_filter($aParam); $search_key = $this->request->getPost("search_key"); $aParam["search_key"] = Utils::toEnglish($search_key == '' ? '%' : '%' . $search_key . '%'); $offset = $this->request->getPost("offset"); $aParam["offset"] = $offset == '' || $offset <= MIN_LIMIT ? MIN_LIMIT : $offset; $limit = $this->request->getPost("limit"); $aParam["limit"] = $limit == '' || ($limit < MIN_LIMIT || $limit > MAX_LIMIT) ? MAX_LIMIT : $limit; return $aParam; }