Codeigniter - Ayuda para modificar buscador carpooling

 
Vista:
sin imagen de perfil

Ayuda para modificar buscador carpooling

Publicado por Sebastian (3 intervenciones) el 23/04/2017 18:46:50
Hola, estoy desarrollando una plataforma de Carpooling, y requiero ayuda con lo siguiente:

El buscador de viajes funciona así: El usuario indica: Origen, destino y fecha, da clic e Buscar y el sistema arroja los resultados, pero exige que se coloquen los 3 campos para poder realizar la consulta.
Requiero ayuda para “abrir la búsqueda”, es decir, que se pueda buscar, solo indicando 1 o 2 de los campos: (Ejemplo, poder buscar solo por):
Origen
Destino
Fecha
Origen y destino
Origen y fecha

Entre otras combinaciones.

Esta desarrollado en codeigniter, y se hacen llamados a traves de las apis de google
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de kip
Val: 53
Oro
Ha mantenido su posición en Codeigniter (en relación al último mes)
Gráfica de Codeigniter

Ayuda para modificar buscador carpooling

Publicado por kip (21 intervenciones) el 24/04/2017 00:33:58
Hola, podrias colocar el codigo que llevas hasta ahora ? aunque sea el controlador que hace la comunicacion con la PI y que recibe los parametros de cliente ?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

Ayuda para modificar buscador carpooling

Publicado por Sebastian (3 intervenciones) el 24/04/2017 05:38:09
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
 
class Search extends Front_Controller {
 
    var $travel;
    var $id;
 
    function __construct() {
        parent::__construct();
 
        $this->load->library('pagination');
        $this->load->helper('text');
        $this->load->model('search_model');
        $this->load->model('Home_model');
        $this->load->model('home_model');
        $this->load->model('vechicle_model');
        $this->load->model('category_model');
        $this->load->model('trip_model');
 
        if ($this->auth_travel->is_logged_in(false, false)):
            $this->CI = & get_instance();
            $this->carpool = $this->CI->carpool_session->userdata('carpool');
            $carpool_session['carpool_session'] = $this->CI->carpool_session->userdata('carpool');
            $this->id = $carpool_session['carpool_session']['user_id'];
 
        else:
            $this->travel = '';
        endif;
    }
 
    function index() {
        $this->load->helper('form');
 
        $data['seo_title'] = 'Información del viaje';
        $data['seo_keyword'] = '';
        $data['seo_description'] = '';
        $term = false;
        $data['error'] = '';
        $data['alert'] = 0;
        $data['email'] = '';
 
        $data['param'] = '';
        $data['vechicletype'] = $this->vechicle_model->getvechicletype_list();
        $data['vechiclecategory'] = $this->category_model->getcategory_list();
        $data['advertisement_search_image'] = $this->home_model->getsearchad_image();
 
 
        if ($_GET) {
            $param = array('SOURCE' => $this->input->get('source', true), 'DESTINATION' => $this->input->get('destination', false), 'fromlatlng' => $this->input->get('formlatlng', true), 'tolatlng' => $this->input->get('tolatlng', true), 'frequency' => date('w', strtotime(str_replace("/", "-", $this->input->get('journey_date', true)))), 'date' => $this->input->get('journey_date', true), 'vechiclecategory' => $this->input->get('VECHICATEGORY_FILTER', true), 'vechicletype' => $this->input->get('VECHITYPE_FILTER', true), 'amenities' => $this->input->get('AMENITIES_FILTER', true), 'traveltype' => $this->input->get('TRAVELTYPE_FILTER', true), 'allowtype' => $this->input->get('TRAVELALLOW_FILTER', true), 'frquencytype' => $this->input->post('FREQUENCY_FILTER', true), 'return' => $this->input->get('Return_Type', true), 'gender' => $this->input->get('GenderFilter', true),'comfort'=>$this->input->post('ComfortFilter', true));
        } else {
 
            $param = array('SOURCE' => $this->input->get('source', true), 'DESTINATION' => $this->input->get('destination', false), 'fromlatlng' => $this->input->get('formlatlng', true), 'tolatlng' => $this->input->get('tolatlng', true), 'frequency' => date('w', strtotime(str_replace("/", "-", $this->input->get('journey_date', true)))), 'date' => $this->input->get('journey_date', true), 'vechiclecategory' => $this->input->get('VECHICATEGORY_FILTER', true), 'vechicletype' => $this->input->get('VECHITYPE_FILTER', true), 'amenities' => $this->input->get('AMENITIES_FILTER', true), 'traveltype' => $this->input->get('TRAVELTYPE_FILTER', true), 'frquencytype' => $this->input->get('FREQUENCY_FILTER', true), 'allowtype' => $this->input->get('TRAVELALLOW_FILTER', true), 'return' => $this->input->get('Return_Type', true), 'gender' => $this->input->get('GenderFilter', true),'comfort'=>$this->input->post('ComfortFilter', true));
        }
 
        if (!empty($param['fromlatlng']) && !empty($param['tolatlng']) && !empty($param['date'])) {
 
            $this->session->set_userdata('journeyDate', $param['date']);
            $data['selparam'] = $param;
            $data = $this->search_model->getSearchResults($param, $offset = null, $data);
            $data = $this->search_model->SearchResults_count($param, $data);
            if ($data['count'] == 0) {
                $data['alert'] = 1;
            }
        } else {
 
            $data['selparam'] = $param;
            $data['count'] = '';
            $data['search_results'] = '';
            $data['error'] = 'Correct source,desination address and date required';
        }
        if (!empty($this->travel)) {
            $data['travel'] = $this->travel;
        }
 
 
 
        $this->load->view('search', $data);
    }
 
    function search_ajax($offset) {
        $this->load->helper('form');
 
        $param = array('SOURCE' => $this->input->post('source', true), 'DESTINATION' => $this->input->post('destination', true), 'fromlatlng' => $this->input->post('formlatlng', true), 'tolatlng' => $this->input->post('tolatlng', true), 'frequency' => date('w', strtotime(str_replace("/", "-", $this->input->get('journey_date', true)))), 'date' => $this->input->post('journey_date', true), 'vechiclecategory' => $this->input->post('VECHICATEGORY_FILTER', true), 'vechicletype' => $this->input->post('VECHITYPE_FILTER', true), 'filter' => $this->input->post('FILTER', true), 'amenities' => $this->input->post('AMENITIES_FILTER', true), 'traveltype' => $this->input->post('TRAVELTYPE_FILTER', true), 'frquencytype' => $this->input->post('FREQUENCY_FILTER', true), 'allowtype' => $this->input->post('TRAVELALLOW_FILTER', true), 'return' => $this->input->post('Return_Type', true),'gender'=>$this->input->post('GenderFilter', true),'comfort'=>$this->input->post('ComfortFilter', true));
 
        $data['vechicletype'] = $this->vechicle_model->getvechicletype_list();
        $data['selparam'] = $param;
 
        if (!empty($param['fromlatlng']) && !empty($param['tolatlng']) && !empty($param['date'])) {
            $data = $this->search_model->getSearchResults($param, $offset, $data);
            $data = $this->search_model->SearchResults_count($param, $data);
        } else {
            $data['count'] = '';
            $data['search_results'] = '';
        }
 
        $data['filter'] = $param['filter'];
 
        if (!empty($this->travel)) {
            $data['travel'] = $this->travel;
        }
 
        if ($data['filter'] == 1) {
            $this->load->view('search_ajax', $data);
        } else {
            $data['currentpage'] = $offset / 5;
            $this->load->view('search_ajax_more', $data);
        }
    }
 
    function search_map() {
        $this->load->helper('form');
 
        $param = array('SOURCE' => $this->input->post('source', true), 'DESTINATION' => $this->input->post('destination', true), 'fromlatlng' => $this->input->post('formlatlng', true), 'tolatlng' => $this->input->post('tolatlng', true), 'frequency' => date('w', strtotime(str_replace("/", "-", $this->input->get('journey_date', true)))), 'date' => $this->input->post('journey_date', true), 'vechiclecategory' => $this->input->post('VECHICATEGORY_FILTER', true), 'vechicletype' => $this->input->post('VECHITYPE_FILTER', true), 'filter' => $this->input->post('FILTER', true), 'amenities' => $this->input->post('AMENITIES_FILTER', true), 'traveltype' => $this->input->post('TRAVELTYPE_FILTER', true), 'frquencytype' => $this->input->post('FREQUENCY_FILTER', true), 'allowtype' => $this->input->post('TRAVELALLOW_FILTER', true), 'return' => $this->input->post('Return_Type', true),'gender'=>$this->input->post('GenderFilter', true),'comfort'=>$this->input->post('ComfortFilter', true));
        $data['vechicletype'] = $this->vechicle_model->getvechicletype_list();
        $data['selparam'] = $param;
 
        if (!empty($param['fromlatlng']) && !empty($param['tolatlng']) && !empty($param['date'])) {
            $data = $this->search_model->getSearchResults($param, $offset = 'null', $data, $map_view = 1);
            $data = $this->search_model->SearchResults_count($param, $data);
            if ($data['count'] != 0) {
                $this->load->library('googlemaps');
 
                $config['center'] = $param['fromlatlng'];
                $config['zoom'] = '10';
                $this->googlemaps->initialize($config);
 
                if ($data['map_details']) {
                    if ($data['search_results']) {
                        foreach ($data['search_results'] as $result) {
                            $marker = array();
                            $marker['position'] = $data['map_details']['latlng_' . $result['trip_id']];
                            $marker['infowindow_content'] = $data['map_details']['source_' . $result['trip_id']];
                            $marker['icon'] = theme_img('map-marker-ico.png');
                            $this->googlemaps->add_marker($marker);
                        }
                    }
                }
 
                $data['map'] = $this->googlemaps->create_map();
                $this->load->view('search_map', $data);
            } else {
                echo false;
            }
        }
    }
 
}
 
?>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar