function edit($id = 0) { $jobsmethods = new Jobsmethod($id); if ($_SERVER['REQUEST_METHOD'] == 'GET') { } else { $jobsmethods->name_vietnamese = $this->input->post('name_vietnamese'); $jobsmethods->name_english = $this->input->post('name_english'); $jobsmethods->name_japanese = $this->input->post('name_japanese'); if ($jobsmethods->save()) { flash_message('success', 'Thành công. Thao tác đã được thực hiện.'); redirect($this->admin . 'jobsmethods/edit/' . $jobsmethods->id); } else { flash_message('error', 'Có lỗi. Vui lòng kiểm tra lại'); redirect($this->admin_url . 'jobsmethods/listAll'); } } $sitelanguage = new Sitelanguage(); $sitelanguage->order_by('position'); $sitelanguage->get()->all; $dis['sitelanguage'] = $sitelanguage; $dis['base_url'] = base_url(); $dis['view'] = 'jobsmethod/edit'; $dis['object'] = $jobsmethods; $dis['menu_active'] = "Phương thức làm việc"; $dis['title'] = "Thêm/sửa Jobsmethods"; $dis['nav_menu'] = array(array("type" => "back", "text" => "Quay về", "link" => "{$this->admin_url}jobsmethods/listAll", "onclick" => "")); $this->viewadmin($dis); }
function edit($id = 0) { $locations = new Province($id); if ($_SERVER['REQUEST_METHOD'] == 'GET') { } else { $locations->name = $this->input->post('name'); if ($locations->save()) { flash_message('success', 'Thành công. Thao tác đã được thực hiện.'); redirect($this->admin . 'locations/edit/' . $locations->id); } else { flash_message('error', 'Có lỗi. Vui lòng kiểm tra lại'); redirect($this->admin_url . 'locations/listAll'); } } $sitelanguage = new Sitelanguage(); $sitelanguage->order_by('position'); $sitelanguage->get()->all; $dis['sitelanguage'] = $sitelanguage; $dis['base_url'] = base_url(); $dis['view'] = 'location/edit'; $dis['object'] = $locations; $dis['menu_active'] = "Tỉnh thành"; $dis['title'] = "Thêm/sửa Locations"; $dis['nav_menu'] = array(array("type" => "back", "text" => "Quay về", "link" => "{$this->admin_url}locations/listAll", "onclick" => "")); $this->viewadmin($dis); }
function send_mail_all() { if ($_SERVER['REQUEST_METHOD'] == "POST") { $title = $this->input->post('title'); $content = $this->input->post('txtFull_vietnamese'); $name_form = getconfigkey('name_contact'); $email_form = getconfigkey('email_contact'); $estateusers = new Estateuser(); $estateusers->where('active', 1); $estateusers->get_iterated(); $list_error = array(); foreach ($estateusers as $row) { if (!$this->sendemail($title, $content, $row->email)) { array_push($list_error, $row->name); } } if (count($list_error) == 0) { flash_message('success', 'Gửi mail thành công.'); redirect($this->admin . 'estateusers/list_all'); } else { flash_message('error', 'Có lỗi trong quá trình gửi mail đến các thành viên sau:'); foreach ($list_error as $row) { flash_message('error', $row); } redirect($this->admin . 'estateusers/list_all'); } } $sitelanguage = new Sitelanguage(); $sitelanguage->order_by('position', 'asc'); $sitelanguage->get(); $dis['sitelanguage'] = $sitelanguage; $dis['base_url'] = base_url(); $dis['view'] = 'estateuser/send_mail_all'; $dis['menu_active'] = 'Gửi mail'; $dis['title'] = "Gửi mail đến tất cả thành viên"; $this->viewadmin($dis); }
/** * Cnews::edit_individual() * * @param integer $catalogue_id * @param integer $news_id * @return */ function edit_individual($catalogue_id = 0, $news_id = 0) { $newscatalogue = new newscatalogue($catalogue_id); if (!$newscatalogue->exists()) { show_404(); } $news = new article($news_id); if ($_SERVER['REQUEST_METHOD'] == "GET") { } else { $news->full_vietnamese = $this->input->post('txtFull_vietnamese'); $news->full_english = $this->input->post('txtFull_english'); $news->dir = $this->input->post('dir'); $news->pagi = $this->input->post('pagi'); //newstopic if ($news->save()) { $this->session->unset_userdata('dir_for_news'); redirect($this->admin . 'cnews/edit_individual/' . $news->newscatalogue->id . '/' . $news->id); } } //setup start folder for kfm $sitelanguage = new Sitelanguage(); $sitelanguage->order_by('position', 'asc'); $sitelanguage->get(); $dis['sitelanguage'] = $sitelanguage; $dis['base_url'] = base_url(); $dis['title'] = $news->title_vietnamese; $dis['menu_active'] = $news->title_vietnamese; $dis['view'] = "news/edit_individual"; $dis['object'] = $news; $this->session->set_userdata(array(config_item('session_admin') . 'menu_current' => $newscatalogue->navigation)); if (empty($news->menu_active)) { $dis['menu_active'] = $news->title_vietnamese; } else { $dis['menu_active'] = $news->menu_active; } $this->viewadmin($dis); }
function edit($id = 0, $productCatId = 0) { $product = new Product($id); if (!$product->exists()) { $product->isAutoGenerateUrl = 1; $product->active = 1; } /** * get list store */ $stores = new Store(); $stores->order_by('position', 'asc'); $stores->get_iterated(); $dis['stores'] = $stores; if ($_SERVER['REQUEST_METHOD'] == "POST") { $this->load->library('file_lib'); //save any param $product->productCode = $this->input->post('productCode'); $product->name_vietnamese = $this->input->post('productName_vietnamese'); $product->name_english = $this->input->post('productName_english'); $product->name_japanese = $this->input->post('productName_japanese'); $product->des_vietnamese = $this->input->post('des_vietnamese'); $product->des_english = $this->input->post('des_english'); $product->des_japanese = $this->input->post('des_japanese'); $product->productstatu_id = $this->input->post('productstatu_id'); $product->productmanufacture_id = $this->input->post('productManufactureId'); $product->isSale = $this->input->post('isSale'); $product->saleOffPrice = $this->input->post('saleOffPrice'); $product->saleOffPriceText = $this->input->post('saleOffPriceText'); $product->price = $this->input->post('price'); $product->priceText = $this->input->post('priceText'); $product->isUsed = $this->input->post('isUsed'); $product->isGift = $this->input->post('isGift'); $product->isHot = $this->input->post('isHot'); $product->isNew = $this->input->post('isNew'); $product->seo_title = $this->input->post('seo_title'); $product->seo_description = $this->input->post('seo_description'); $product->seo_keyword = $this->input->post('seo_keyword'); $product->searchKey = $this->input->post('searchKey'); $product->txtDescription_vietnamese = $this->input->post('txtDescription_vietnamese'); $product->txtDescription_english = $this->input->post('txtDescription_english'); $product->txtGift = $this->input->post('txtGift'); $product->txtSumary = $this->input->post('txtSumary'); $product->txtVideo = $this->input->post('txtVideo'); $product->url_vietnamese = $this->input->post('url_vietnamese'); $product->url_english = $this->input->post('url_english'); $product->origin = $this->input->post('origin'); $product->warranty = $this->input->post('warranty'); $product->active = $this->input->post('isActive'); $product->promotion = $this->input->post('promotion'); $product->status = $this->input->post('productstatus'); $product->inBox = $this->input->post('inBox'); $product->isLinePrice = $this->input->post('isLinePrice'); $product->isLinePriceSaleOff = $this->input->post('isLinePriceSaleOff'); $product->isHighlightPriceSaleOff = $this->input->post('isHighlightPriceSaleOff'); $product->priceColor = $this->input->post('priceColor'); $product->saleOffPriceColor = $this->input->post('saleOffPriceColor'); $product->color = $this->input->post('color'); $product->weight = $this->input->post('weight'); $product->materials = $this->input->post('materials'); $product->size = $this->input->post('size'); $product->style = $this->input->post('style'); $product->productcat_id = $this->input->post('productcat_id'); if (trim($product->saleOffPrice) == "") { $product->finalPrice = $product->price; } else { $product->finalPrice = $product->saleOffPrice; } if ($product->exists()) { $product->updator = $this->logged_in_user->username; } else { $product->creator = $this->logged_in_user->username; } //check product representive image is available inside post request if ($_FILES['logo']['name'] != "") { $dataupload = $this->file_lib->upload('logo', 'img/products/'); if (is_array($dataupload)) { $product->image = 'img/products/' . $dataupload['file_name']; } else { flash_message('error', $dataupload); } } //first save if ($product->save()) { } } //create list product status $productstatus = new Productstatu(); $productstatus->order_by('id', 'asc'); $productstatus->get()->all; //create list productcomment. /*$productcomments = new Productcomment(); $productcomments->order_by('id', 'desc'); $productcomments->where('product_id', $id); $productcomments->get()->all;*/ //create list productphotos $productphotos = new Productphoto(); $productphotos->where('product_id', $id); $productphotos->order_by('position', 'asc'); $productphotos->order_by('id', 'desc'); $productphotos->get_iterated(); $accessories = $product->accessory; $dis['accessories'] = $accessories; $productSpec = new productspec(); $productSpec->where('product_id', $product->id); $productSpec->order_by('position', 'asc'); $productSpec->get_iterated(); $productCat = $product->productcat; $allSpec = new productspec(); if ($product->exists()) { $allSpec->where('product_id', $product->id); } else { $allSpec->where('product_id', 0); } $allSpec->order_by('position', 'asc'); $allSpec->get_iterated(); //if create new product with productcat if (!$product->exists()) { if ($productCatId != 0) { $productCat = new Productcat($productCatId); $productSpec = $productCat->getSpec(); $allSpec = $productCat->getSpec(); } } $sitelanguage = new Sitelanguage(); $sitelanguage->order_by('position', 'asc'); $sitelanguage->get(); $dis['sitelanguage'] = $sitelanguage; $productCat = new Productcat(); $productCat->order_by('position', 'asc'); $productCat->get_iterated(); $dis['productSpec'] = $productSpec; $dis['productCat'] = $productCat; $dis['allSpec'] = $allSpec; //setPagination($this->admin.'productphoto/listAll/',$productphotos->paged->total_rows,$limit,4); $dis['title_table'] = "Trang hiện tại:"; $dis['productphotos'] = $productphotos; $dis['base_url'] = base_url(); $dis['object'] = $product; $dis['productcomments'] = $productcomments; $dis['productstatus'] = $productstatus; $dis['title'] = "Thêm/ Sửa sản phẩm"; $dis['menu_active'] = "Sản phẩm"; $dis['view'] = "products/edit"; $dis['nav_menu'] = array(array("type" => "add", "text" => "Thêm sp khác", "link" => "{$this->admin_url}products/edit", "onclick" => "")); if ($product->exists()) { array_push($dis['nav_menu'], array("type" => "add", "text" => "Thêm hình ảnh", "link" => "{$this->admin_url}productphotos/edit/" . $product->id, "onclick" => "")); } else { $product->isAutoGenerateUrl = 1; $product->isActive = 1; } $this->viewadmin($dis); }