Beispiel #1
0
 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);
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
 function edit($id = 0)
 {
     $newscatalogue = new newscatalogue($id);
     if ($_SERVER['REQUEST_METHOD'] == "GET") {
     } else {
         $newscatalogue->name_vietnamese = $this->input->post('name_vietnamese');
         $newscatalogue->name_english = $this->input->post('name_english');
         $newscatalogue->name_japanese = $this->input->post('name_japanese');
         $parentcat = new newscatalogue(trim($this->input->post('parentcat')));
         $newscatalogue->title_bar = $this->input->post('title_bar');
         $newscatalogue->slogan = $this->input->post('slogan');
         $newscatalogue->keyword = $this->input->post('keyword');
         $newscatalogue->group = $this->input->post('group');
         if ($this->logged_in_user->adminrole->id == 1) {
             $newscatalogue->navigation = $this->input->post('navigation');
             $newscatalogue->menu_active = $this->input->post('menu_active');
         }
         $this->load->helper('remove_vn_helper');
         $newscatalogue->name_none = remove_vn($newscatalogue->name_vietnamese);
         if ($newscatalogue->save(array('parentcat' => $parentcat))) {
             redirect($this->admin . 'newscatalogues/list_all/');
         }
     }
     $parentcat = new newscatalogue();
     $parentcat->where('parentcat_id', NULL);
     if ($newscatalogue->exists()) {
         $parentcat->where('id !=', $newscatalogue->id);
     }
     $parentcat->order_by('position', 'asc');
     $parentcat->get();
     $sitelanguage = new Sitelanguage();
     $sitelanguage->get()->all;
     $dis['sitelanguage'] = $sitelanguage;
     $dis['base_url'] = base_url();
     $dis['parentcat'] = $parentcat;
     $dis['title'] = "Thêm/ Sửa danh mục tin tức";
     $dis['menu_active'] = "Danh mục tin tức";
     $dis['view'] = "newscatalogue/edit";
     $dis['object'] = $newscatalogue;
     $dis['nav_menu'] = array(array("type" => "back", "text" => "Back", "link" => "{$this->admin_url}newscatalogues/", "onclick" => ""));
     $this->viewadmin($dis);
 }
Beispiel #4
0
 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);
 }
Beispiel #5
0
 /**
  * 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);
 }
Beispiel #6
0
 function edit($id = 0)
 {
     $productcat = new productcat($id);
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $this->load->library('file_lib');
         //get the object parameter
         $productcat->name_vietnamese = $this->input->post('name_vietnamese');
         $productcat->name_english = $this->input->post('name_english');
         $productcat->name_japanese = $this->input->post('name_japanese');
         $parentcat = new productcat(trim($this->input->post('productCategoryId')));
         $productcat->isShowInHot = $this->input->post('isShowInHot');
         $productcat->isShowInNew = $this->input->post('isShowInNew');
         $productcat->isShowInParentHot = $this->input->post('isShowInParentHot');
         $productcat->isHide = $this->input->post('isHide');
         $productcat->isShowLogo = $this->input->post('isShowLogo');
         $productcat->seo_title_vietnamese = $this->input->post('seo_title_vietnamese');
         $productcat->seo_keyword_vietnamese = $this->input->post('seo_keyword_vietnamese');
         $productcat->seo_description_vietnamese = $this->input->post('seo_description_vietnamese');
         $productcat->seo_title_english = $this->input->post('seo_title_english');
         $productcat->seo_keyword_english = $this->input->post('seo_keyword_english');
         $productcat->seo_description_english = $this->input->post('seo_description_english');
         $productcat->numProductHomepage = $this->input->post('numProductHomepage');
         $productcat->tag = $this->input->post('tag');
         if ($_FILES['logo']['name'] != "") {
             $dataupload = $this->file_lib->upload('logo', 'img/category/');
             if (is_array($dataupload)) {
                 $productcat->image = 'img/category/' . $dataupload['file_name'];
             } else {
                 flash_message('error', $dataupload);
             }
         }
         $this->load->helper('remove_vn_helper');
         if (!$productcat->exists()) {
             $productcat->url_vietnamese = remove_vn($productcat->name_vietnamese);
             $productcat->url_english = remove_vn($productcat->name_english);
         } else {
             $productcat->url_vietnamese = $this->input->post('url_vietnamese');
             $productcat->url_english = $this->input->post('url_english');
         }
         if ($productcat->save(array('parentcat' => $parentcat))) {
             flash_message('success', 'Thành công. Thao tác đã được thực hiện.');
             redirect($this->admin . 'productcats/edit/' . $productcat->id);
         }
     }
     $dis['base_url'] = base_url();
     $sitelanguage = new Sitelanguage();
     $sitelanguage->get()->all;
     $dis['sitelanguage'] = $sitelanguage;
     $dis['nav_menu'] = array(array("type" => "back", "text" => "Back", "link" => "{$this->admin_url}productcats/listAll/" . $productcat->parentcat->id, "onclick" => ""), array("type" => "add", "text" => "Thêm danh mục khác", "link" => "{$this->admin_url}productcats/edit/", "onclick" => ""));
     //load any resource if the product category is exist
     if ($productcat->exists()) {
         //title depend on category name
         $dis['title'] = $productcat->name;
         $dis['productcatspec'] = $productcat->getSpec();
         /*$dis['nav_menu'] = array_merge($dis['nav_menu'],array(
                    array(
         			"type"=>"add",
         			"text"=>"Thêm thông số",
         			"link"=>"javascript:void(0)",
         			"onclick"=>"addSpecDialog_show()"		
         		),
                    array(
         			"type"=>"edit",
         			"text"=>"Copy thông số",
         			"link"=>"javascript:void(0)",
         			"onclick"=>"copySpecDialog_show()"		
         		),
                    array(
         			"type"=>"edit",
         			"text"=>"Thêm sp homepage",
         			"link"=>"javascript:void(0)",
         			"onclick"=>"showProductMultiDialog(0)"		
         		)
                ));*/
         $productHome = new producthome();
         $productHome->where('productcat_id', $productcat->id);
         $productHome->order_by('position', 'asc');
         $productHome->get_iterated();
         $dis['productHome'] = $productHome;
     } else {
         $dis['title'] = "Thêm/ Sửa danh mục sản phẩm";
     }
     $dis['menu_active'] = "Danh mục sản phẩm";
     $dis['view'] = "productcats/edit";
     $dis['object'] = $productcat;
     //$dis['productspecification'] = $productspecifications;
     $this->viewadmin($dis);
 }
Beispiel #7
0
 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);
 }