Exemple #1
0
 public function rules($id = null)
 {
     $result = [];
     $dfcode = default_lang();
     $result[$dfcode . '.name'] = 'required';
     return $result;
 }
Exemple #2
0
 public function edit($id)
 {
     $listpages = $this->page->all(default_lang());
     $listcats = $this->cat->all('cat', default_lang());
     $services = $this->services->all(default_lang(), null);
     $data = ['title' => 'Cập nhật Menu', 'listpages' => $listpages, 'listcats' => $listcats, 'listservices' => $services, 'parents' => [0 => 'Chọn mục cha'] + $this->menu->listAll($id, default_lang(), true), 'item' => $this->menu->getEdit($id)];
     return view('backend.menu.edit', $data);
 }
 public function edit($id)
 {
     $post = $this->post->getEdit($id);
     $cats = $this->cat->getAllType('cat', default_lang());
     $currcats = $post->cattype('cat')->lists('id')->toArray();
     $data = ['title' => 'Chỉnh sửa bài viết', 'item' => $post, 'treecats' => $this->cat->list_tree_label($cats, 0, 0, $currcats), 'tags' => $this->cat->listType('tag', default_lang()), 'curtags' => $post->cattype('tag')->lists('id')->toArray()];
     return view('post.edit', $data);
 }
 public function rules()
 {
     $langs = get_langs();
     $rules = [];
     //        foreach ($langs as $lang) {
     //            $rules[$lang->code . '.post_title'] = 'required';
     //        }
     $rules[default_lang() . '.post_title'] = 'required';
     return $rules;
 }
Exemple #5
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (in_array('admin', $request->segments())) {
         app()->setLocale('backend/vi');
     } elseif ($lang = session()->get('locale')) {
         app()->setLocale($lang);
     } else {
         app()->setLocale(default_lang());
     }
     return $next($request);
 }
Exemple #6
0
 public function listParent($id, $type = 'cat', $lang = null)
 {
     $lang = $lang ? $lang : default_lang();
     $cats = $this->model->where('type', $type)->where('id', '!=', $id)->with(['langs' => function ($q) use($lang) {
         $q->where('code', $lang);
         $q->select('cat_desc.*');
     }])->get();
     $result = [];
     foreach ($cats as $cat) {
         $result[$cat->id] = $cat->langs->first()->name;
     }
     return $result;
 }
Exemple #7
0
 function site_url($uri = '', $lang = '')
 {
     $CI =& get_instance();
     $lang = $lang == '' ? $CI->uri->segment(1) : $lang;
     if ($lang == '') {
         $lang = default_lang();
     }
     if ($lang == 'admin') {
         $lang = 'en';
     }
     if ($lang == 'tv') {
         $lang = 'en';
     }
     $final_url = $CI->config->site_url($lang . '/' . $uri);
     //$final_url = str_replace('http://','https://',$final_url);
     return $final_url;
 }
 public function add()
 {
     $this->form_validation->set_rules('title_' . default_lang(), lang_key('title'), 'required');
     $this->form_validation->set_rules('type', lang_key('type'), 'required');
     if ($this->form_validation->run() == FALSE) {
         if ($this->input->post('action_type') == 'update') {
             $this->manage($this->input->post('id'));
         } else {
             $this->manage();
         }
     } else {
         $data['featured_img'] = $this->input->post('featured_img');
         $data['type'] = $this->input->post('type');
         $this->load->model('admin/system_model');
         $langs = $this->system_model->get_all_langs();
         $titles = array();
         $descriptions = array();
         foreach ($langs as $lang => $long_name) {
             $titles[$lang] = $this->input->post('title_' . $lang);
             $descriptions[$lang] = $this->input->post('description_' . $lang);
         }
         $data['title'] = json_encode($titles);
         $data['description'] = json_encode($descriptions);
         $data['created_by'] = $this->session->userdata('user_id');
         $data['create_time'] = time();
         $data['status'] = $this->input->post('action');
         if (constant("ENVIRONMENT") == 'demo') {
             $this->session->set_flashdata('msg', '<div class="alert alert-success">Data updated.[NOT AVAILABLE ON DEMO]</div>');
         } else {
             if ($this->input->post('action_type') == 'update') {
                 $id = $this->input->post('id');
                 $this->blog_model->update_post($data, $id);
                 $this->session->set_flashdata('msg', '<div class="alert alert-success">' . lang_key('post_updated') . '</div>');
             } else {
                 $id = $this->blog_model->insert_post($data);
                 $this->session->set_flashdata('msg', '<div class="alert alert-success">' . lang_key('post_created') . '</div>');
             }
         }
         redirect(site_url('admin/blog/manage/' . $id));
     }
 }
Exemple #9
0
 protected function getLang($lang_code = null, $columns = ['id', 'code', 'lname'])
 {
     $lang_code = $lang_code == null ? default_lang() : $lang_code;
     return $this->where('code', $lang_code)->first($columns);
 }
 public function rss()
 {
     $this->load->helper('xml');
     $curr_lang = get_current_lang();
     if ($curr_lang == '') {
         $curr_lang = default_lang();
     }
     $value = array();
     $value['curr_lang'] = $curr_lang;
     $value['feed_name'] = translate(get_settings('site_settings', 'site_title', 'Santa Barbara'));
     $value['encoding'] = 'utf-8';
     $value['feed_url'] = site_url('show/rss');
     $value['page_description'] = lang_key('your web description');
     $value['page_language'] = $curr_lang . '-' . $curr_lang;
     $value['creator_email'] = get_settings('webadmin_email', 'contact_email', '');
     $value['posts'] = $this->show_model->get_properties_by_range(0, $this->PER_PAGE, 'id', 'desc');
     # header("Content-Type: application/rss+xml");
     load_view('rss_view', $value, FALSE, $this->active_theme);
 }
Exemple #11
0
 public function updatepost()
 {
     $state_active = get_settings('classified_settings', 'show_state_province', 'yes');
     $id = $this->input->post('id');
     $page = $this->input->post('page');
     //		$this->form_validation->set_rules('purpose', 			lang_key('purpose'), 			'required');
     $this->form_validation->set_rules('category', lang_key('category'), 'required');
     $this->form_validation->set_rules('contact_for_price', lang_key('contact_for_price'), 'xss_clean');
     if ($this->input->post('contact_for_price') == '') {
         $this->form_validation->set_rules('price', lang_key('price'), 'required');
     }
     $this->form_validation->set_rules('country', lang_key('country'), 'required');
     if ($state_active == 'yes') {
         $this->form_validation->set_rules('state', lang_key('state'), 'required');
     }
     $this->form_validation->set_rules('selected_city', lang_key('city'), 'xss_clean');
     $this->form_validation->set_rules('city', lang_key('city'), 'required');
     $this->form_validation->set_rules('zip_code', lang_key('zip_code'), 'xss_clean');
     $this->form_validation->set_rules('address', lang_key('address'), 'required');
     $this->form_validation->set_rules('latitude', lang_key('latitude'), 'required');
     $this->form_validation->set_rules('longitude', lang_key('longitude'), 'required');
     $this->form_validation->set_rules('title_' . default_lang(), lang_key('title'), 'required');
     $this->form_validation->set_rules('description_' . default_lang(), lang_key('description'), 'required');
     $this->form_validation->set_rules('featured_img', lang_key('featured_img'), 'required');
     $this->update_post_validation();
     if ($this->form_validation->run() == FALSE) {
         $this->editpost($page, $id);
     } else {
         $meta_search_text = '';
         //meta information for simple searching
         $this->load->helper('date');
         $format = 'DATE_RFC822';
         $time = time();
         $data = array();
         $data['purpose'] = 'sell';
         //			$meta_search_text .= $data['purpose'].' ';
         $data['category'] = $this->input->post('category');
         $meta_search_text .= get_category_title_by_id($data['category']) . ' ';
         $data['parent_category'] = get_category_parent_by_id($data['category']);
         $meta_search_text .= get_category_title_by_id($data['parent_category']) . ' ';
         $data['contact_for_price'] = $this->input->post('contact_for_price');
         $data['price'] = $this->input->post('price');
         $data['phone_no'] = $this->input->post('phone_no');
         $data['country'] = $this->input->post('country');
         $meta_search_text .= get_location_name_by_id($data['country']) . ' ';
         $data['state'] = $state_active == 'yes' ? $this->input->post('state') : 0;
         $meta_search_text .= get_location_name_by_id($data['state']) . ' ';
         $selected_city = $this->input->post('selected_city');
         $city = $this->input->post('city');
         if ($selected_city == '') {
             $new_city_id = $this->post_model->get_location_id_by_name($city, 'city', $data['state'], $data['country']);
         } else {
             $new_city_id = $selected_city;
         }
         $data['city'] = $new_city_id;
         $meta_search_text .= get_location_name_by_id($data['city']) . ' ';
         $data['zip_code'] = $this->input->post('zip_code');
         $meta_search_text .= $data['zip_code'] . ' ';
         $data['address'] = $this->input->post('address');
         $meta_search_text .= $data['address'] . ' ';
         $data['latitude'] = $this->input->post('latitude');
         $data['longitude'] = $this->input->post('longitude');
         $this->load->model('admin/system_model');
         $langs = $this->system_model->get_all_langs();
         $titles = array();
         $descriptions = array();
         foreach ($langs as $lang => $long_name) {
             $titles[$lang] = $this->input->post('title_' . $lang);
             $meta_search_text .= $titles[$lang] . ' ';
             $descriptions[$lang] = $this->input->post('description_' . $lang);
         }
         $data['title'] = json_encode($titles);
         $data['description'] = json_encode($descriptions);
         $data['tags'] = $this->input->post('tags');
         $meta_search_text .= $data['tags'] . ' ';
         $data['featured_img'] = $this->input->post('featured_img');
         $data['video_url'] = $this->input->post('video_url');
         $data['gallery'] = $this->input->post('gallery') != false ? json_encode($this->input->post('gallery')) : '[]';
         $data['last_update_time'] = $time;
         $data['search_meta'] = $meta_search_text;
         $this->before_post_update();
         if (constant("ENVIRONMENT") == 'demo') {
             $this->session->set_flashdata('msg', '<div class="alert alert-success">Data updated.[NOT AVAILABLE ON DEMO]</div>');
         } else {
             $post_id = $this->post_model->update_post($data, $id);
             $this->after_post_update($post_id);
             $this->session->set_flashdata('msg', '<div class="alert alert-success">' . lang_key('post_updated') . '</div>');
         }
         redirect(site_url('admin/classified/allposts/' . $page));
     }
 }
Exemple #12
0
 public function addestate()
 {
     $dl = default_lang();
     $this->config->load('realcon');
     $enable_custom_fields = $this->config->item('enable_custom_fields');
     if ($enable_custom_fields == 'Yes') {
         $fields = $this->config->item('custom_fields');
         foreach ($fields as $field) {
             if ($field['validation'] != '') {
                 $this->form_validation->set_rules($field['name'], $field['title'], $field['validation']);
             }
         }
     }
     $this->form_validation->set_rules('title' . $dl, 'Title', 'required');
     $this->form_validation->set_rules('description' . $dl, 'Description', 'required');
     $this->form_validation->set_rules('type', 'Type', 'required');
     $this->form_validation->set_rules('purpose', 'Purpose', 'required');
     $purpose = $this->input->post('purpose');
     $type = $this->input->post('type');
     $meta_search_text = '';
     //meta information for simple searching
     if ($purpose == 'DBC_PURPOSE_SALE') {
         $this->form_validation->set_rules('total_price', 'Sales Price', 'required');
         $this->form_validation->set_rules('price_per_unit', 'Price per Unit', 'required');
         $this->form_validation->set_rules('price_unit', 'Price unit', 'required');
         $meta_search_text .= 'sale' . ' ';
     } elseif ($purpose == 'DBC_PURPOSE_RENT') {
         $this->form_validation->set_rules('rent_price', 'Rent Price', 'required');
         $this->form_validation->set_rules('rent_price_unit', 'Rent Price unit', 'required');
         $meta_search_text .= 'rent' . ' ';
     } else {
         $this->form_validation->set_rules('total_price', 'Sales Price', 'required');
         $this->form_validation->set_rules('price_per_unit', 'Price per Unit', 'required');
         $this->form_validation->set_rules('price_unit', 'Price unit', 'required');
         $this->form_validation->set_rules('rent_price', 'Rent Price', 'required');
         $this->form_validation->set_rules('rent_price_unit', 'Rent Price unit', 'required');
     }
     #price validation end
     if ($type == 'DBC_TYPE_APARTMENT') {
         $this->form_validation->set_rules('home_size', 'Home size', 'required');
         $this->form_validation->set_rules('home_size_unit', 'Home size unit', 'required');
         $this->form_validation->set_rules('bedroom', 'Bed rooms', 'required');
         $this->form_validation->set_rules('bath', 'Bathroom', 'required');
         $this->form_validation->set_rules('year_built', 'Year Built', 'required');
         $meta_search_text .= 'apartment' . ' ';
     } else {
         if ($type == 'DBC_TYPE_HOUSE') {
             $this->form_validation->set_rules('home_size', 'Home size', 'required');
             $this->form_validation->set_rules('home_size_unit', 'Home size unit', 'required');
             $this->form_validation->set_rules('lot_size', 'Lot size', 'required');
             $this->form_validation->set_rules('lot_size_unit', 'Lot size unit', 'required');
             $this->form_validation->set_rules('bedroom', 'Bed rooms', 'required');
             $this->form_validation->set_rules('bath', 'Bathroom', 'required');
             $this->form_validation->set_rules('year_built', 'Year Built', 'required');
             $meta_search_text .= 'house' . ' ';
         } else {
             if ($type == 'DBC_TYPE_LAND') {
                 $this->form_validation->set_rules('lot_size', 'Lot size', 'required');
                 $this->form_validation->set_rules('lot_size_unit', 'Lot size unit', 'required');
                 $meta_search_text .= 'land' . ' ';
             } else {
                 if ($type == 'DBC_TYPE_COMSPACE') {
                     $this->form_validation->set_rules('home_size', 'Home size', 'required');
                     $this->form_validation->set_rules('home_size_unit', 'Home size unit', 'required');
                     $this->form_validation->set_rules('year_built', 'Year Built', 'required');
                     $meta_search_text .= 'comercial space' . ' ';
                 } else {
                     if ($type == 'DBC_TYPE_CONDO') {
                         $this->form_validation->set_rules('home_size', 'Home size', 'required');
                         $this->form_validation->set_rules('home_size_unit', 'Home size unit', 'required');
                         $this->form_validation->set_rules('bedroom', 'Bed rooms', 'required');
                         $this->form_validation->set_rules('bath', 'Bathroom', 'required');
                         $this->form_validation->set_rules('year_built', 'Year Built', 'required');
                         $meta_search_text .= 'condo' . ' ';
                     } else {
                         if ($type == 'DBC_TYPE_VILLA') {
                             $this->form_validation->set_rules('home_size', 'Home size', 'required');
                             $this->form_validation->set_rules('home_size_unit', 'Home size unit', 'required');
                             $this->form_validation->set_rules('lot_size', 'Lot size', 'required');
                             $this->form_validation->set_rules('lot_size_unit', 'Lot size unit', 'required');
                             $this->form_validation->set_rules('bedroom', 'Bed rooms', 'required');
                             $this->form_validation->set_rules('bath', 'Bathroom', 'required');
                             $this->form_validation->set_rules('year_built', 'Year Built', 'required');
                             $meta_search_text .= 'villa' . ' ';
                         }
                     }
                 }
             }
         }
     }
     $this->form_validation->set_rules('condition', 'Condition', 'required');
     $this->form_validation->set_rules('address', 'Address', 'required');
     $this->form_validation->set_rules('country', 'Country', 'required');
     //$this->form_validation->set_rules('selected_state', 'State/province', 'required');
     $this->form_validation->set_rules('state', 'State/province', 'required');
     //$this->form_validation->set_rules('selected_city', 'City/Twon', 'required');
     $this->form_validation->set_rules('city', 'City/Twon', 'required');
     $this->form_validation->set_rules('zip_code', 'Zip code', 'required');
     $this->form_validation->set_rules('latitude', 'Latitude', 'required');
     $this->form_validation->set_rules('longitude', 'Longitude', 'required');
     $this->form_validation->set_rules('featured_img', 'Featured image', 'required');
     if ($this->form_validation->run() == FALSE) {
         $this->newestate('error');
     } else {
         if (constant("ENVIRONMENT") == 'demo') {
             $this->session->set_flashdata('msg', '<div class="alert alert-success">Data updated.[NOT AVAILABLE ON DEMO]</div>');
         } else {
             $data = array();
             $data['unique_id'] = uniqid();
             $data['type'] = $this->input->post('type');
             $data['purpose'] = $this->input->post('purpose');
             if ($purpose == 'DBC_PURPOSE_SALE') {
                 $data['total_price'] = $this->input->post('total_price');
                 $data['price_per_unit'] = $this->input->post('price_per_unit');
                 $data['price_unit'] = $this->input->post('price_unit');
             } elseif ($purpose == 'DBC_PURPOSE_RENT') {
                 $data['total_price'] = $this->input->post('rent_price');
                 $data['rent_price'] = $this->input->post('rent_price');
                 $data['rent_price_unit'] = $this->input->post('rent_price_unit');
             } else {
                 $data['total_price'] = $this->input->post('total_price');
                 $data['price_per_unit'] = $this->input->post('price_per_unit');
                 $data['price_unit'] = $this->input->post('price_unit');
                 $data['rent_price'] = $this->input->post('rent_price');
                 $data['rent_price_unit'] = $this->input->post('rent_price_unit');
             }
             #price validation end
             if ($type == 'DBC_TYPE_APARTMENT') {
                 $data['home_size'] = $this->input->post('home_size');
                 $data['home_size_unit'] = $this->input->post('home_size_unit');
                 $data['bedroom'] = $this->input->post('bedroom');
                 $data['bath'] = $this->input->post('bath');
                 $data['year_built'] = $this->input->post('year_built');
                 $meta_search_text .= ' bedroom bathroom' . $data['bedroom'] . ' ' . $data['bath'] . ' ' . $data['year_built'];
             } else {
                 if ($type == 'DBC_TYPE_HOUSE') {
                     $data['home_size'] = $this->input->post('home_size');
                     $data['home_size_unit'] = $this->input->post('home_size_unit');
                     $data['lot_size'] = $this->input->post('lot_size');
                     $data['lot_size_unit'] = $this->input->post('lot_size_unit');
                     $data['bedroom'] = $this->input->post('bedroom');
                     $data['bath'] = $this->input->post('bath');
                     $data['year_built'] = $this->input->post('year_built');
                     $meta_search_text .= ' bedroom bathroom' . $data['bedroom'] . ' ' . $data['bath'] . ' ' . $data['year_built'];
                 } else {
                     if ($type == 'DBC_TYPE_LAND') {
                         $data['lot_size'] = $this->input->post('lot_size');
                         $data['lot_size_unit'] = $this->input->post('lot_size_unit');
                     } else {
                         if ($type == 'DBC_TYPE_COMSPACE') {
                             $data['home_size'] = $this->input->post('home_size');
                             $data['home_size_unit'] = $this->input->post('home_size_unit');
                             $data['year_built'] = $this->input->post('year_built');
                             $meta_search_text .= ' ' . $data['year_built'];
                         } else {
                             if ($type == 'DBC_TYPE_CONDO') {
                                 $data['home_size'] = $this->input->post('home_size');
                                 $data['home_size_unit'] = $this->input->post('home_size_unit');
                                 $data['bedroom'] = $this->input->post('bedroom');
                                 $data['bath'] = $this->input->post('bath');
                                 $data['year_built'] = $this->input->post('year_built');
                                 $meta_search_text .= ' bedroom bathroom' . $data['bedroom'] . ' ' . $data['bath'] . ' ' . $data['year_built'];
                             } else {
                                 if ($type == 'DBC_TYPE_VILLA') {
                                     $data['home_size'] = $this->input->post('home_size');
                                     $data['home_size_unit'] = $this->input->post('home_size_unit');
                                     $data['lot_size'] = $this->input->post('lot_size');
                                     $data['lot_size_unit'] = $this->input->post('lot_size_unit');
                                     $data['bedroom'] = $this->input->post('bedroom');
                                     $data['bath'] = $this->input->post('bath');
                                     $data['year_built'] = $this->input->post('year_built');
                                     $meta_search_text .= ' bedroom bathroom' . $data['bedroom'] . ' ' . $data['bath'] . ' ' . $data['year_built'];
                                 }
                             }
                         }
                     }
                 }
             }
             $data['estate_condition'] = $this->input->post('condition');
             $meta_search_text .= ' ' . $data['estate_condition'];
             $data['address'] = $this->input->post('address');
             $meta_search_text .= ' ' . $data['address'];
             $data['country'] = $this->input->post('country');
             $meta_search_text .= ' ' . get_location_name_by_id($data['country']);
             $state_id = $this->realestate_model->get_location_id_by_name($this->input->post('state'), 'state', $data['country']);
             $data['state'] = $state_id;
             $meta_search_text .= ' ' . $this->input->post('state');
             $city_id = $this->realestate_model->get_location_id_by_name($this->input->post('city'), 'city', $state_id);
             $data['city'] = $city_id;
             $meta_search_text .= ' ' . $this->input->post('city');
             $data['zip_code'] = $this->input->post('zip_code');
             $data['latitude'] = $this->input->post('latitude');
             $data['longitude'] = $this->input->post('longitude');
             $data['facilities'] = json_encode($this->input->post('facilities'));
             $data['featured_img'] = $this->input->post('featured_img');
             $this->load->helper('date');
             $format = 'DATE_RFC822';
             $time = time();
             $data['create_time'] = standard_date($format, $time);
             $data['created_by'] = $this->input->post('created_by') != '' ? $this->input->post('created_by') : $this->session->userdata('user_id');
             $publish_directly = get_settings('memento_settings', 'publish_directly', 'Yes');
             $data['status'] = $publish_directly == 'Yes' ? 1 : 2;
             // 2 = pending
             $id = $this->realestate_model->insert_estate($data);
             $default_title = $this->input->post('title' . $dl);
             $meta_search_text .= ' ' . $default_title;
             $default_description = $this->input->post('description' . $dl);
             $meta_search_text .= ' ' . $default_description;
             $meta_search_text .= $this->input->post('tags');
             #collecting meta information for simple searching is complete
             #now update the post table with the information
             $data = array();
             $data['search_meta'] = $meta_search_text;
             $this->realestate_model->update_estate($data, $id);
             $this->load->model('admin/system_model');
             $query = $this->system_model->get_all_langs();
             $active_languages = $query->result();
             $data = array();
             $data['post_id'] = $id;
             $data['key'] = 'title';
             $data['status'] = 1;
             $value = array();
             foreach ($active_languages as $row) {
                 $title = $this->input->post('title' . $row->short_name);
                 $value[$row->short_name] = $title;
             }
             $data['value'] = json_encode($value);
             $this->realestate_model->insert_estate_meta($data);
             $data = array();
             $data['post_id'] = $id;
             $data['key'] = 'description';
             $data['status'] = 1;
             $value = array();
             foreach ($active_languages as $row) {
                 $description = $this->input->post('description' . $row->short_name);
                 $value[$row->short_name] = $description;
             }
             $data['value'] = json_encode($value);
             $this->realestate_model->insert_estate_meta($data);
             add_post_meta($id, 'tags', $this->input->post('tags'));
             if ($purpose == 'DBC_PURPOSE_RENT') {
                 add_post_meta($id, 'from_rent_date', $this->input->post('from_date'));
                 add_post_meta($id, 'to_rent_date', $this->input->post('to_date'));
             }
             add_post_meta($id, 'energy_efficiency', $this->input->post('energy_efficiency'));
             #increase users post count
             $user_id = $this->session->userdata('user_id');
             $post_count = get_user_meta($user_id, 'post_count', 0);
             $post_count++;
             add_user_meta($user_id, 'post_count', $post_count);
             #adding distance information
             $distance_ids = $this->input->post('distance_id');
             $distance_titles = $this->input->post('distance_title');
             $distance_icons = $this->input->post('distance_icon');
             $distance_values = $this->input->post('distance_value');
             $distance_units = $this->input->post('distance_unit');
             $i = 0;
             $vals = array();
             foreach ($distance_ids as $key => $value) {
                 $dis_info = array();
                 $dis_info['id'] = $distance_ids[$key];
                 $dis_info['title'] = $distance_titles[$key];
                 $dis_info['icon'] = $distance_icons[$key];
                 $dis_info['value'] = $distance_values[$key];
                 $dis_info['units'] = $distance_units[$key];
                 $vals[$i++] = json_encode($dis_info);
             }
             add_post_meta($id, 'distance_info', json_encode($vals));
             if ($enable_custom_fields == 'Yes') {
                 $fields = $this->config->item('custom_fields');
                 $data = array();
                 foreach ($fields as $field) {
                     $data[$field['name']] = $this->input->post($field['name']);
                 }
             }
             add_post_meta($id, 'custom_values', json_encode($data));
             $this->session->set_flashdata('msg', '<div class="alert alert-success">Property added</div>');
         }
         redirect(site_url('admin/realestate/editestate/0/' . $id));
     }
 }
 function get_post_data_by_lang($post, $column = 'title', $lang = '')
 {
     if ($lang == '') {
         $lang = get_current_lang();
     }
     if ($column == 'title') {
         $titles = json_decode($post->title);
         if (isset($titles->{$lang}) && $titles->{$lang} != '') {
             return $titles->{$lang};
         } else {
             return $titles->{default_lang()};
         }
     } else {
         $descriptions = json_decode($post->description);
         if (isset($descriptions->{$lang}) && $descriptions->{$lang} != '') {
             return $descriptions->{$lang};
         } else {
             return $descriptions->{default_lang()};
         }
     }
 }
 public function updatepost()
 {
     $state_active = get_settings('business_settings', 'show_state_province', 'yes');
     $id = $this->input->post('id');
     $page = $this->input->post('page');
     if (!$this->checkpermission($id)) {
         $this->session->set_flashdata('<div class="alert alert-danger">' . lang_key('dont_have_permission') . '</div>');
         redirect(site_url('admin/business/allposts'));
     }
     $this->form_validation->set_rules('category', lang_key('category'), 'required');
     $this->form_validation->set_rules('phone_no', lang_key('phone'), 'required');
     $this->form_validation->set_rules('email', lang_key('email'), 'required');
     $this->form_validation->set_rules('country', lang_key('country'), 'required');
     if ($state_active == 'yes') {
         $this->form_validation->set_rules('state', lang_key('state'), 'required');
     }
     $this->form_validation->set_rules('selected_city', lang_key('city'), 'xss_clean');
     $this->form_validation->set_rules('city', lang_key('city'), 'required');
     $this->form_validation->set_rules('zip_code', lang_key('zip_code'), 'xss_clean');
     $this->form_validation->set_rules('address', lang_key('address'), 'required');
     $this->form_validation->set_rules('latitude', lang_key('latitude'), 'required');
     $this->form_validation->set_rules('longitude', lang_key('longitude'), 'required');
     $this->form_validation->set_rules('title_' . default_lang(), lang_key('title'), 'required');
     $this->form_validation->set_rules('description_' . default_lang(), lang_key('description'), 'required');
     $this->form_validation->set_rules('featured_img', lang_key('featured_img'), 'required');
     $this->update_post_validation();
     if ($this->form_validation->run() == FALSE) {
         $this->editpost($page, $id);
     } else {
         $meta_search_text = '';
         //meta information for simple searching
         $this->load->helper('date');
         $format = 'DATE_RFC822';
         $time = time();
         $data = array();
         $data['category'] = $this->input->post('category');
         $meta_search_text .= get_category_title_by_id($data['category']) . ' ';
         $data['price_range'] = $this->input->post('price_range');
         $data['phone_no'] = $this->input->post('phone_no');
         $data['email'] = $this->input->post('email');
         $data['website'] = $this->input->post('website');
         $data['founded'] = $this->input->post('founded');
         $meta_search_text .= $data['founded'] . ' ';
         $data['country'] = $this->input->post('country');
         $meta_search_text .= get_location_name_by_id($data['country']) . ' ';
         $data['state'] = $state_active == 'yes' ? $this->input->post('state') : 0;
         $meta_search_text .= get_location_name_by_id($data['state']) . ' ';
         $selected_city = $this->input->post('selected_city');
         $city = $this->input->post('city');
         if ($selected_city == '') {
             $new_city_id = $this->post_model->get_location_id_by_name($city, 'city', $data['state'], $data['country']);
         } else {
             $new_city_id = $selected_city;
         }
         $data['city'] = $new_city_id;
         $meta_search_text .= get_location_name_by_id($data['city']) . ' ';
         $data['zip_code'] = $this->input->post('zip_code');
         $meta_search_text .= $data['zip_code'] . ' ';
         $data['address'] = $this->input->post('address');
         $meta_search_text .= $data['address'] . ' ';
         $data['latitude'] = $this->input->post('latitude');
         $data['longitude'] = $this->input->post('longitude');
         $this->load->model('admin/system_model');
         $langs = $this->system_model->get_all_langs();
         $titles = array();
         $descriptions = array();
         foreach ($langs as $lang => $long_name) {
             $titles[$lang] = $this->input->post('title_' . $lang);
             $meta_search_text .= $titles[$lang] . ' ';
             $descriptions[$lang] = $this->input->post('description_' . $lang);
         }
         $data['title'] = json_encode($titles);
         $data['description'] = json_encode($descriptions);
         $data['tags'] = $this->input->post('tags');
         $meta_search_text .= $data['tags'] . ' ';
         $data['featured_img'] = $this->input->post('featured_img');
         $data['video_url'] = $this->input->post('video_url');
         $data['gallery'] = $this->input->post('gallery') != false ? json_encode($this->input->post('gallery')) : '[]';
         $opening_hours = array();
         $days = $this->input->post('days');
         $opening_times = $this->input->post('opening_hour');
         $closing_times = $this->input->post('closing_hour');
         foreach ($days as $key => $day) {
             $opening_hour = array();
             if ($opening_times[$key] == 'Closed') {
                 $opening_hour['day'] = $day;
                 $opening_hour['closed'] = 1;
                 $opening_hour['start_time'] = '';
                 $opening_hour['close_time'] = '';
             } else {
                 $opening_hour['day'] = $day;
                 $opening_hour['closed'] = 0;
                 $opening_hour['start_time'] = $opening_times[$key];
                 $opening_hour['close_time'] = $closing_times[$key];
             }
             array_push($opening_hours, $opening_hour);
         }
         $data['opening_hour'] = json_encode($opening_hours);
         $data['additional_features'] = $this->input->post('additional_features') != '' ? json_encode(array_filter($this->input->post('additional_features'))) : '[]';
         $data['last_update_time'] = $time;
         $data['search_meta'] = $meta_search_text;
         $this->before_post_update();
         if (constant("ENVIRONMENT") == 'demo') {
             $this->session->set_flashdata('msg', '<div class="alert alert-success">Data updated.[NOT AVAILABLE ON DEMO]</div>');
         } else {
             $post_id = $id;
             $this->post_model->update_post($data, $id);
             add_post_meta($post_id, 'facebook_profile', $_POST['facebook_profile']);
             add_post_meta($post_id, 'twitter_profile', $_POST['twitter_profile']);
             add_post_meta($post_id, 'linkedin_profile', $_POST['linkedin_profile']);
             add_post_meta($post_id, 'pinterest_profile', $_POST['pinterest_profile']);
             add_post_meta($post_id, 'googleplus_profile', $_POST['googleplus_profile']);
             add_post_meta($post_id, 'business_logo', $this->input->post('business_logo'));
             $this->after_post_update($post_id);
             $this->session->set_flashdata('msg', '<div class="alert alert-success">' . lang_key('post_updated') . '</div>');
         }
         redirect(site_url('edit-business/' . $page . '/' . $id));
     }
 }
Exemple #15
0
'class' => 'form-horizontal'
]) !!}
<br />

<div class="form-group">
    <label class="text-left control-label col-sm-3">Nhóm Menu</label>
    <div class="col-sm-9">
        {!! Form::hidden('group_id', $currgroup->id) !!}
        {!! Form::text('group_name', $currgroup->name, ['class' => 'form-control', 'disabled']) !!}
    </div>
</div>

<div class="tab-content">
    <?php 
$i = 0;
$dfcode = default_lang();
?>
    @foreach(get_langs() as $lang)
    <?php 
$i++;
$code = $lang->code;
?>
    <div class="tab-pane fade <?php 
if ($i == 1) {
    echo 'in active';
}
?>
" id="lang-{{$code}}">

        {!! fForm::groupText('Tên Menu (*)', $code.'[name]', null) !!}
    </div>
Exemple #16
0
</a></li>
                    <?php 
    $flag++;
}
?>
                </ul>
                <div class="tab-content" id="myTabContent1">
                     <?php 
$flag = 1;
foreach ($active_languages as $lang) {
    ?>
                     <div id="<?php 
    echo $lang->short_name;
    ?>
" class="tab-pane fade in <?php 
    echo default_lang() == $lang->short_name ? 'active' : '';
    ?>
">

                    <div class="form-group">
                      <label class="col-sm-3 col-lg-2 control-label"><?php 
    echo lang_key('title');
    ?>
: <span style="color:red;">*</span></label>
                      <div class="col-sm-4 col-lg-5 controls">
                        <?php 
    $title = get_title_for_edit_by_id_lang($estate->id, $lang->short_name);
    $title = set_value('title' . $lang->short_name) != '' ? set_value('title' . $lang->short_name) : $title;
    ?>
                        <input type="text" name="title<?php 
    echo $lang->short_name;
</a></li>
                    <?php 
    $flag++;
}
?>
                </ul>
                <div class="tab-content" id="myTabContent1">
                     <?php 
$flag = 1;
foreach ($langs as $lang => $long_name) {
    ?>
                     <div id="<?php 
    echo $lang;
    ?>
" class="tab-pane fade in <?php 
    echo default_lang() == $lang ? 'active' : '';
    ?>
">
                    
                        <div class="form-group">
                            <label class="col-md-3 control-label"><?php 
    echo lang_key('title');
    ?>
</label>
                            <div class="col-md-8">
                                <?php 
    $v = set_value('title_' . $lang) != '' ? set_value('title_' . $lang) : '';
    ?>
                                <input type="text" name="title_<?php 
    echo $lang;
    ?>
Exemple #18
0
 public function savesitesettings($key = 'site_settings')
 {
     $this->load->model('options_model');
     foreach ($_POST as $k => $value) {
         if ($k != 'ga_tracking_code') {
             $this->form_validation->set_rules($k, $k, 'required');
         }
     }
     if ($this->form_validation->run() == FALSE) {
         $this->sitesettings($key, 'error');
     } else {
         if (constant("ENVIRONMENT") == 'demo') {
             $this->session->set_flashdata('msg', '<div class="alert alert-success">Data updated.[NOT AVAILABLE ON DEMO]</div>');
         } else {
             $data['values'] = json_encode($_POST);
             $res = $this->options_model->getvalues($key);
             if ($res == '') {
                 $data['key'] = $key;
                 $this->options_model->addvalues($data);
             } else {
                 $this->options_model->updatevalues($key, $data);
             }
             $this->session->set_flashdata('msg', '<div class="alert alert-success">' . lang_key('Data updated') . '</div>');
         }
         $current_lang = $this->uri->segment(1);
         $url = site_url('admin/system/sitesettings/' . $key);
         $url = str_replace('/' . $current_lang . '/', '/' . default_lang() . '/', $url);
         redirect($url);
     }
 }
 function get_current_lang()
 {
     $CI = get_instance();
     $lang = $CI->uri->segment(1) != '' ? $CI->uri->segment(1) : default_lang();
     if (!@file_exists(FCPATH . "dbc_config/locals/" . $lang . '.yml')) {
         $lang = default_lang();
     }
     return $lang;
 }
Exemple #20
0
$CI->load->config('classifieds');
$languages = $CI->config->item('active_languages');
?>

            <a data-toggle="dropdown" href="" class="user-menu dropdown-toggle">
                <i class="fa fa-globe"></i>
                <span class="hhh user_info"><?php 
echo isset($languages[$curr_lang]) ? $languages[$curr_lang] : 'language';
?>
</span>
                <i class="fa fa-caret-down"></i>
            </a>

            <?php 
if ($CI->uri->segment(1) == '') {
    $uri .= '/' . default_lang();
}
echo '<ul class="dropdown-menu dropdown-navbar" id="user_menu2">';
$url = $uri;
foreach ($languages as $short_name => $long_name) {
    $uri = str_replace('/' . $curr_lang . '/', '/' . $short_name . '/', $url);
    $sel = $curr_lang == $short_name ? 'active' : '';
    echo '<li class="' . $sel . '"><a href="' . $uri . '">' . $long_name . '</a></li>';
}
echo '</ul>';
?>

        </li>
		<li>
			<a href="<?php 
echo site_url();
Exemple #21
0
 public function getSelect($fields = ['cat_desc.cat_id as id', 'name', 'cat_desc.slug'], $lang_code = null)
 {
     return $this->langs()->where('code', $lang_code == null ? default_lang() : $lang_code)->first($fields);
 }
Exemple #22
0
        <script type="text/javascript">var old_ie = 0;</script>
        <!--[if lte IE 8]> <script type="text/javascript"> old_ie = 1; </script><style type="text/css">.ie-message{display:block;}</style> < ![endif]-->

        <script type="text/javascript">var switchTo5x=true;</script>
        <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
        <script type="text/javascript" src="http://s.sharethis.com/loader.js"></script>
        
        
    </head>


<?php 
$CI = get_instance();
$curr_lang = $CI->uri->segment(1);
if ($curr_lang == '') {
    $curr_lang = default_lang();
}
if ($curr_lang == 'ar') {
    ?>
        <link rel="stylesheet" href="<?php 
    echo theme_url();
    ?>
/assets/css/rtl-fix.css">
        <link rel="stylesheet" href="<?php 
    echo theme_url();
    ?>
/assets/css/media_ar.css">
        <body class="home" dir="rtl">
    <?php 
} else {
    ?>
Exemple #23
0
 public function edit($id)
 {
     $item = $this->cat->getEdit($id);
     $data = ['title' => 'Chỉnh sửa tiện nghi', 'item' => $item, 'parents' => [0 => 'Chọn mục'] + $this->cat->listType('roomconv', $id, true, default_lang())];
     return view('backend.room.convenient.edit', $data);
 }
Exemple #24
0
 function lang_key($key = '')
 {
     if (defined('LANG_ARRAY')) {
         $lang = json_decode(constant('LANG_ARRAY'));
         return isset($lang->{$key}) ? $lang->{$key} : $key;
     } else {
         $CI = get_instance();
         $CI->load->database();
         $curr_lang = $CI->uri->segment(1);
         $default_lang = default_lang();
         if ($curr_lang == '') {
             $query = $CI->db->get_where('language', array('short_name' => $default_lang, 'status' => 1));
         } else {
             $query = $CI->db->get_where('language', array('short_name' => $curr_lang, 'status' => 1));
         }
         if ($query->num_rows() > 0) {
             $row = $query->row();
             if (!defined('LANG_ARRAY')) {
                 define('LANG_ARRAY', $row->values);
             }
             $lang = json_decode($row->values);
             return isset($lang->{$key}) ? $lang->{$key} : $key;
         } else {
             return $key;
         }
     }
 }
Exemple #25
0
<?php

$curr_lang = $this->uri->segment(1) != '' ? $this->uri->segment(1) : default_lang();
?>
        <div class="row">
          <?php 
$current_url = base64_encode(current_url() . '/#data-content');
?>
          <div id="data-content" class="col-md-9 custom_home_content"  style="-webkit-transition: all 0.7s ease-in-out; transition: all 0.7s ease-in-out;">
              
              <h1 class="recent-grid"><span class="OS_icon_f"><i class="fa fa-home fa-4"></i></span>&nbsp;<?php 
echo lang_key('featured_estates');
?>
</h1>
              <?php 
$query = isset($featured) ? $featured : array();
?>
              <?php 
require 'carousel_view.php';
?>
              <!-- /Thumbnails container -->
              <div class="clearfix"></div>
              <?php 
if ($query->num_rows() > 0) {
    ?>
              <div class="view-more"><a class="" href="<?php 
    echo site_url('show/properties/featured');
    ?>
"><?php 
    echo lang_key('view_all');
    ?>
<link href="<?php 
echo base_url();
?>
assets/datatable/dataTables.bootstrap.css" rel="stylesheet">
<?php 
$curr_page = $this->uri->segment(5);
if ($curr_page == '') {
    $curr_page = 0;
}
$dl = default_lang();
?>

<div class="row">
  

  <div class="col-md-12">

    <div class="box">

      <div class="box-title">

        <h3><i class="fa fa-bars"></i> <?php 
echo lang_key('all_posts');
?>
</h3>

        <div class="box-tool">

          <a href="#" data-action="collapse"><i class="fa fa-chevron-up"></i></a>

Exemple #27
0
 public function edit($id)
 {
     $item = $this->imgcat->getEdit($id);
     $data = ['title' => 'Chỉnh sửa Danh mục', 'item' => $item, 'parents' => [0 => 'Chọn mục'] + $this->imgcat->listType('imgcat', $id, true, default_lang())];
     return view('backend.imgcat.edit', $data);
 }