function post_detail_url($post)
 {
     $CI =& get_instance();
     $url = site_url('ads/' . $post->unique_id);
     #never remove this line
     $url .= '/' . dbc_url_title(get_category_title_by_id($post->category));
     $url .= '/' . dbc_url_title(get_post_data_by_lang($post, 'title'));
     return $url;
 }
 function prepare_map_json_from_query($query)
 {
     $CI = get_instance();
     $data = array();
     $posts = array();
     $i = 0;
     foreach ($query->result() as $row) {
         $i++;
         $post = array();
         $post['post_id'] = $row->id;
         $post['post_title'] = get_post_data_by_lang($row, 'title');
         $post['post_purpose'] = '';
         $post['featured_image_url'] = get_featured_photo_by_id($row->featured_img);
         $post['latitude'] = $row->latitude;
         $post['longitude'] = $row->longitude;
         $post['price'] = '';
         $post['rating'] = $row->rating;
         $post['post_short_address'] = get_location_name_by_id($row->city);
         $post['detail_link'] = post_detail_url($row);
         $post['parent_category'] = get_category_title_by_id($row->category);
         $post['fa_icon'] = get_category_fa_icon($row->category);
         if ($i % 3 == 1) {
             $color = "#ed5441";
         } else {
             if ($i % 3 == 2) {
                 $color = "#51d466";
             } else {
                 $color = "#609cec";
             }
         }
         $post['fa_color'] = $color;
         array_push($posts, $post);
     }
     $data['posts'] = $posts;
     return $data;
 }
Example #3
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));
     }
 }
" />
                                        </li>
                                        <?php 
    }
}
?>

                                    </ul>
                                </div>
                                <div class="clearfix"></div>

                                <hr />
                                <div class="info-box">
                                    <?php 
$fa_icon = get_category_fa_icon($post->category);
$category_title = get_category_title_by_id($post->category);
?>
                                    <i class="fa <?php 
echo $fa_icon;
?>
 bg-red category"></i>
                                    <div class="sub-cat">
                                        <a href="<?php 
echo site_url('show/categoryposts/' . $post->category . '/' . $category_title);
?>
"><?php 
echo $category_title;
?>
</a>
                                    </div>
Example #5
0
			<!-- Blog meta -->
			<div class="blog-meta">
				<!-- Date -->
				<i class="fa fa-money"></i> &nbsp; <?php 
        echo $price;
        ?>
 &nbsp;
				<!-- Author -->
				<a href="<?php 
        echo site_url('show/categoryposts/' . $post->parent_category . '/' . dbc_url_title(lang_key(get_category_title_by_id($post->parent_category))));
        ?>
"><i class="fa <?php 
        echo get_category_fa_icon($post->parent_category);
        ?>
"></i> &nbsp; <?php 
        echo get_category_title_by_id($post->parent_category);
        ?>
</a> &nbsp;
				<!-- Comments -->
				<a href="<?php 
        echo site_url('location-posts/' . $post->city . '/city/' . dbc_url_title(get_location_name_by_id($post->city)));
        ?>
"><i class="fa fa-map-marker"></i> &nbsp; <?php 
        echo get_location_name_by_id($post->city);
        ?>
</a> &nbsp;

				<i class="fa fa-calendar"></i> &nbsp; <?php 
        echo date('M d, Y', $post->create_time);
        ?>
			</div>
        ?>
" /></td>

                  <td data-title="<?php 
        echo lang_key('title');
        ?>
" class="numeric"><?php 
        echo get_post_data_by_lang($row, 'title');
        ?>
</td>

                  <td data-title="<?php 
        echo lang_key('category');
        ?>
" class="numeric"><?php 
        echo get_category_title_by_id($row->category);
        ?>
</td>

                  <td data-title="<?php 
        echo lang_key('price');
        ?>
" class="numeric"><?php 
        echo show_price($row->price, $row->contact_for_price);
        ?>
</td>
                  
                  <td data-title="<?php 
        echo lang_key('city');
        ?>
" class="numeric"><?php 
</td>
                  <td data-title="<?php 
        echo lang_key('title');
        ?>
" class="numeric"><a href="<?php 
        echo site_url('admin/category/edit/' . $row->id);
        ?>
"><?php 
        echo $row->title;
        ?>
</a></td>
                  <td data-title="<?php 
        echo lang_key('parent');
        ?>
" class="numeric"><?php 
        echo get_category_title_by_id($row->parent);
        ?>
</td>
                  <td data-title="<?php 
        echo lang_key('fa_icon');
        ?>
" class="numeric"><i class="fa <?php 
        echo $row->fa_icon;
        ?>
"></i></td>
                  <td data-title="<?php 
        echo lang_key('actions');
        ?>
" class="numeric">
                    <div class="btn-group">
                      <a class="btn btn-info dropdown-toggle" data-toggle="dropdown" href="#"><i class="fa fa-cog"></i> <?php 
        <div class="clearfix"></div>
      </div>
    </div>   
    
<!-- Container -->
<div class="container">

    <div class="row">

        <div class="col-md-9 col-sm-12 col-xs-12">
            <div class="block-heading-two">
                <h3><span><i class="fa fa-folder"></i> <?php 
echo lang_key('category');
?>
 : <?php 
echo get_category_title_by_id($category_id);
?>
</span>
                    <div class="pull-right list-switcher">
                        <a target="recent-posts" href="<?php 
echo site_url('show/categoryposts_ajax/' . $per_page . '/grid/' . $category_id);
?>
"><i class="fa fa-th "></i></a>
                        <a target="recent-posts" href="<?php 
echo site_url('show/categoryposts_ajax/' . $per_page . '/list/' . $category_id);
?>
"><i class="fa fa-th-list "></i></a>
                    </div>
                </h3>   
            </div>
            <span class="recent-posts">
 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));
     }
 }