public function search() { $param['pageNo'] = 1; $param['store_name'] = Input::has('store') ? Input::get('store') : ''; $param['company_name'] = Input::has('company') ? Input::get('company') : ''; $param['category_id'] = Input::has('category') ? Input::get('category') : ''; $param['city_id'] = Input::has('city') ? Input::get('city') : ''; $param['waiting_time_min'] = Input::has('min') ? Input::get('min') : WAITING_TIME_MIN; $param['waiting_time_max'] = Input::has('max') ? Input::get('max') : WAITING_TIME_MAX; $param['is_all'] = Input::has('is_all') ? true : !Input::has('min'); $userId = Session::has('user_id') ? Session::get('user_id') : 0; $prefix = DB::getTablePrefix(); $result = DB::table('store')->join('company', 'store.company_id', '=', 'company.id')->leftJoin(DB::raw('(SELECT * FROM ' . $prefix . 'queue WHERE user_id = ' . $userId . ' AND DATE(created_at) = DATE(NOW()) GROUP BY store_id) AS ' . $prefix . 'queues'), 'store.id', '=', 'queues.store_id')->join('status', 'store.id', '=', 'status.store_id')->leftJoin(DB::raw('(SELECT count(*) as cnt, store_id FROM ' . $prefix . 'agent WHERE is_active = 1 GROUP BY store_id) AS ' . $prefix . 'agt'), 'agt.store_id', '=', 'store.id')->join('company_setting', 'company_setting.company_id', '=', 'company.id')->join('category', 'category.id', '=', 'company.category_id')->join('city', 'city.id', '=', 'company.city_id')->select('store.id', 'store.name as store_name', 'store.address as address', 'company.name as company_name', 'company_setting.waiting_time', 'status.current_queue_no', 'status.last_queue_no', 'agt.cnt', 'queues.queue_no'); if ($param['store_name'] != '') { $result = $result->where('store.name', 'like', '%' . $param['store_name'] . '%'); } if ($param['company_name'] != '') { $result = $result->where('company.name', 'like', '%' . $param['company_name'] . '%'); } if ($param['category_id'] != '') { $result = $result->where('category.id', '=', $param['category_id']); } if ($param['city_id'] != '') { $result = $result->where('city.id', '=', $param['city_id']); } if (!$param['is_all']) { $result = $result->whereRaw($prefix . 'agt.cnt > 0')->whereRaw('((' . $prefix . 'status.last_queue_no - ' . $prefix . 'status.current_queue_no' . ') * ' . $prefix . 'company_setting.waiting_time / 60) / (' . $prefix . 'agt.cnt)' . ' BETWEEN ' . $param['waiting_time_min'] . ' AND ' . $param['waiting_time_max']); } $stores = $result->paginate(PAGINATION_SIZE); $param['stores'] = $stores; $param['categories'] = CategoryModel::all(); $param['cities'] = CityModel::all(); return View::make('user.store.search')->with($param); }
public function edit($id) { $param['pageNo'] = 3; $param['user'] = UserModel::find($id); $param['cities'] = CityModel::all(); return View::make('admin.user.edit')->with($param); }
public function edit($id) { $param['pageNo'] = 2; $param['company'] = CompanyModel::find($id); $param['cities'] = CityModel::all(); $param['categories'] = CategoryModel::all(); return View::make('admin.company.edit')->with($param); }
public function showResults() { $data = array('title' => 'Resultados'); $data['sports'] = Sport::all()->lists('description', 'idSport'); $data['tests'] = Test::all()->lists('name', 'idTest'); $data['cities'] = City::all()->lists('description', 'idCity'); return View::make('results', $data); }
public function signup() { $param['pageNo'] = 99; $param['cities'] = CityModel::all(); if ($alert = Session::get('alert')) { $param['alert'] = $alert; } return View::make('user.auth.signup')->with($param); }
public function city() { $this->noview(); $data = array(); $city = City::all(array(), array("name", "id")); foreach ($city as $c) { array_push($data, array("id" => $c->id, "name" => $c->name)); } echo json_encode($data); }
public function index() { $company = CompanyModel::find(Session::get('company_id')); $param['pageNo'] = 7; $param['company'] = $company; $param['cities'] = CityModel::all(); $param['categories'] = CategoryModel::all(); if ($alert = Session::get('alert')) { $param['alert'] = $alert; } return View::make('company.account.index')->with($param); }
public function consultaViaje() { $viaje_id = Input::get('viaje'); $viajeApi = new ViajeApiController(); $viaje = $viajeApi->postJson(false, $viaje_id); $servidor = new ServidorApiController(); if ($viaje[0]["servidor_id"] > 0) { $servidor = $servidor->getServidorProfile(false, $viaje[0]["servidor_id"]); } $ciudades = City::all(); return View::make('servidor/travelinfoconsult', array('servidor' => $servidor, 'ciudades' => $ciudades, 'viaje' => $viaje)); }
public static function profile() { if (current_user_can('profile')) { $user_id = get_current_user_id(); $usermeta = \UserMeta::where('user_id', $user_id)->first(); $cities = self::idandname(\City::all(), "id", "name"); $provinces = self::idandname(\Province::all(), "id", "name"); $countries = self::idandname(\Country::all(), "id", "name"); View::make("site/user/profile", compact('cities', 'provinces', 'countries', 'usermeta')); die; } wp_redirect("/login"); exit; }
public function getIndex() { $category_selected = ""; $tocity = ""; if (isset($_GET['size'])) { $category_selected = $_GET['size']; Session::put('category_selected', $category_selected); } if (Session::has('category_selected')) { $category_selected = Session::get('category_selected'); } $perPage = 8; if (isset($_GET['tocity'])) { $tocity = $_GET['tocity']; Session::put('city', $tocity); } if (Session::has('city')) { $tocity = Session::get('city'); } if (isset($_GET['page'])) { $currentPage = $_GET['page'] - 1; } else { $currentPage = 0; } if ($tocity != "") { $cakes = Cakes::where('type', '=', $category_selected)->where('city', '=', $tocity)->get()->toArray(); } else { $cakes = Cakes::where('type', '=', $category_selected)->get()->toArray(); } $tmp = array(); foreach ($cakes as $arg) { $tmp[$arg['title']][] = $arg; } $cakes = $tmp; $pagedData = array_slice($cakes, $currentPage * $perPage, $perPage); $links = Paginator::make($cakes, count($cakes), $perPage); return View::make('cake.index')->with('category_selected', $category_selected)->with('city_list', City::all())->with('cakes', $pagedData)->with('links', $links)->with('tocity', $tocity)->with('city_to_go', ""); }
public function post_register() { $rules = array('regName' => 'required|match:/[a-z]+/', 'regLastName' => 'required|match:/[a-z]+/', 'regMail' => 'required|unique:users,email', 'regMail2' => 'required', 'regPassword' => 'required|max:18|min:3', 'regPassword2' => 'same:regPassword', 'regDate' => 'before:01/01/1998', 'regCell' => 'required'); $vld = Validator::make(Input::all(), $rules); if ($vld->fails()) { $getCity = City::all(); $get1stTowns = Town::where('city_id', '=', 1)->get(); return View::make('user.register')->with('city', $getCity)->with('towns', $get1stTowns); } $data = Input::all(); //Gender Validation if ($data['regGender'] === 'Woman') { $data['regGender'] = 0; } elseif ($data['regGender'] === 'Man') { $data['regGender'] = 1; } else { $data['regGender'] = -1; } //Date Validation $MySQLDate = date('Y-m-d', strtotime(str_replace('/', '-', $data['regDate']))); try { // create the user $user = Sentry::user()->register(array('email' => $data['regMail'], 'password' => $data['regPassword'], 'metadata' => array('first_name' => $data['regName'], 'last_name' => $data['regLastName'], 'birth_date' => $MySQLDate, 'city' => $data['regCity'], 'town' => $data['regTown'], 'phone' => $data['regPhone'], 'cell_phone' => $data['regCell'], 'sex' => $data['regGender']))); if ($user) { // the user was created $_user = Sentry::user($user['id']); $link = URL::Base() . '/user/activate/' . $user['hash']; $name = $_user->metadata['first_name'] . ' ' . $_user->metadata['last_name']; $to = $_user['email']; sendActivation($to, $name, $link); } else { return Response::error('500'); } } catch (Sentry\SentryException $e) { return View::make('user.register')->with('error', $e->getMessage()); } return View::make('user.register-complete'); }
public function update($id) { $data = array('menu' => 'Event', 'title' => 'Event', 'description' => '', 'breadcrumb' => array('Event' => route('admin.event'))); if (!Session::has('time') && (!Session::has('validasi') && Session::get('validasi') != 'event')) { $time = time(); Session::put('time', $time); } $event = Events::where('id', $id)->first(); $data['action'] = 'admin.event.update.post'; $data['event'] = $event; $data['event_category'] = EventCategory::all(); $data['user'] = User::all(); $data['city'] = City::all(); $data['photos'] = Photo::where('type_name', '=', 'events')->where('type_id', '=', $event->id)->orderBy('id', 'desc')->get(); // return $data; return View::make('admin.pages.event.create')->with($data); }
public function edit_shopper() { $id = Request::segment(4) ? Request::segment(4) : 0; $sub_title = Request::segment(4) ? "Edit Shopper" : "Add Shopper"; $shopper = Shopper::find($id); $cities = City::all(); $zipcodes = array(); foreach ($cities as $city) { array_push($zipcodes, $city->zipcode); } $locations = Shopper::find($id); if (!$locations) { $location = ''; } else { $location = $locations->zipcode; } return View::make('admin.shopper_form')->with('title', 'Shopper')->with('sub_title', $sub_title)->with('shopper', $shopper)->with('selected_zipcodes', $location)->with('zipcodes', $zipcodes); }
public function get_edit($id = false) { if (!$id) { return Redirect::to('drivers'); } $cities = array(); $pools = array(); foreach (City::all() as $city) { $cities[$city->id] = $city->city; } foreach (Pool::all() as $pool) { $pools[$pool->id] = $pool->pool_name; } $this->data['cities'] = $cities; $this->data['pools'] = $pools; $this->data['driver'] = Driver::find($id); $this->data['create'] = false; $this->data['driver_id'] = $id; return View::make('themes.modul.' . $this->views . '.form', $this->data); }
public function editar($id) { if ($this->session->userdata('grupo') == 'admin' or $this->session->userdata('id') == $id) { if (!$id) { $this->session->set_flashdata('msg', '<div class="notice">El usuario solicitado no existe.</div>'); redirect('usuarios'); } elseif ($_POST) { $this->load->helper('date'); $this->load->library('Utils'); $insert = $_POST; $usuario = User::find($id); $usuario->update_attributes(elements(array('nombre', 'apellido', 'direccion', 'telefono', 'email', 'celular', 'usuario', 'grupo', 'password'), $insert)); if ($usuario->is_valid()) { if ($usuario->save()) { $this->session->set_flashdata('msg', '<div class="success">El usuario se guardó correctamente.</div>'); redirect($this->agent->referrer()); } else { $this->session->set_flashdata('msg', '<div class="error">Hubo un error al guardar los datos.</div>'); redirect($this->agent->referrer()); } } else { $data['errors'] = $usuario->errors; } } else { $data['a'] = User::find($id); } $data['paises'] = Country::all(); $data['provincias'] = State::all(); $data['ciudades'] = City::all(); $data['titulo'] = "Editar usuario"; $data['action'] = "usuarios/editar/" . $id; $this->template->write_view('content', 'usuarios/agregar', $data); $this->template->render(); } else { $this->session->set_flashdata('msg', '<div class="error">No tiene privilegios para realizar esta acción.</div>'); redirect('usuarios/index/'); } }
public function consulta() { $servidores = Servidor::all(); $instituciones = InstGenera::all(); $temas = Tema::all(); $ciudades = City::all(); $data = array('servidores' => $servidores, 'instituciones' => $instituciones, 'temas' => $temas, 'ciudades' => $ciudades); $view = View::make('viajes/gridViajes', $data)->nest('child', 'viajes.consulta', $data); return $view; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $cities = $this->city->all(); return View::make('cities.index', compact('cities')); }
public function pricesearch() { $index = SliderImages::all(); $country = Country::all(); $city = City::all(); $gallery = Gallery::all(); $startdatae_search = strtotime(Input::get('startdatae_search')); $startdatae_search = date('Y-m-d H:i:s', $startdatae_search); $enddate_search = strtotime(Input::get('enddate_search')); $enddate_search = date('Y-m-d H:i:s', $enddate_search); $country_search = Input::get('country_search'); $price_search_start = Input::get('price_search_start'); $price_search_end = Input::get('price_search_end'); if ($enddate_search == '1970-01-01 00:00:00') { $enddate_search = '2038-01-19 00:00:00'; } if (empty($price_search_start)) { $price_search_start = '0'; } if (empty($price_search_end)) { $res = DB::select(DB::raw('select max(price) as max_price from tours')); foreach ($res as $value) { $price_search_end = (int) $value->max_price + 1; } } $tours = new Tours(); if ($startdatae_search != '1970-01-01 00:00:00') { $tours = $tours->where('start_date', '>', $startdatae_search); } if ($enddate_search != '1970-01-01 00:00:00') { $tours = $tours->where('end_date', '<', $enddate_search); } $tours = $tours->where('country', '=', $country_search); if (!empty($price_search_start)) { $tours = $tours->where('price', '>', $price_search_start); } if (!empty($price_search_end)) { $tours = $tours->where('price', '<', $price_search_end); } $tours = $tours->get(); return View::make('main.search')->with('tours', $tours)->with('country', $country)->with('gallery', $gallery)->with('slider', $index); }
public function getCake() { return View::make('home.cake')->with('products', Product::where('category_id', '=', '15')->orderBy('created_at', 'DESC')->paginate(8))->with('city_list', City::all()); }
public function create() { $data['social_action'] = array(); $data['social_target'] = SocialTarget::all(); $data['social_action_category'] = SocialActionCategory::all(); $data['user'] = User::all(); $data['city'] = City::all(); $data['action'] = 'buat-aksi-sosial.post'; if (Request::isMethod('post')) { $input = Input::all(); $postSocialAction = SocialAction::StoreSocialActionFront($input); if ($postSocialAction != 'ok') { Session::flash('validasi', $postSocialAction); return Redirect::route('buat-aksi-sosial'); } else { Session::flash('sukses', 'Proses pendaftaran aksi sosial berhasil dilakukan. Data Anda telah masuk ke dalam database kami. Selanjutnya admin dari BagiKasih akan melakukan verifikasi data Anda. Terima kasih.'); return Redirect::route('temukan-aksi-sosial'); } } return View::make('bagikasih.social-action.create')->with($data); }
public function update($id) { $data = array('menu' => 'Target Sosial', 'title' => 'Target Sosial', 'description' => '', 'breadcrumb' => array('Target Sosial' => route('admin.social-target'))); if (!Session::has('time') && (!Session::has('validasi') && Session::get('validasi') != 'social_targets')) { $time = time(); Session::put('time', $time); } $social_target = SocialTarget::where('id', $id)->first(); $data['action'] = 'admin.social-target.update.post'; $data['social_target'] = $social_target; $data['social_target_category'] = SocialTargetCategory::all(); $data['user'] = User::all(); $data['city'] = City::all(); // Get Photos that related with this $data['photos'] = Photo::where('type_name', '=', 'social_targets')->where('type_id', '=', $social_target->id)->orderBy('id', 'desc')->get(); // return $data; return View::make('admin.pages.social-target.create')->with($data); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $cities = City::all(); return Response::json($cities); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $cities_data = City::all(); return View::make('admin.city.list')->with('cities', $cities_data); }
public function editar($id) { if (!$id) { $this->session->set_flashdata('msg', '<div class="notice">El alumno solicitado no existe.</div>'); redirect('alumnos'); } elseif ($_POST) { $this->load->helper('date'); $this->load->library('Utils'); $insert = $_POST; $insert['fecha_nacimiento'] = $this->utils->fecha_formato('%Y-%m-%d', $insert['fecha_nacimiento']); $insert['fecha_inscripcion'] = $this->utils->fecha_formato('%Y-%m-%d', $insert['fecha_inscripcion']); $alumno = Student::find($id); $alumno->update_attributes(elements(array('city_id', 'nombre', 'apellido', 'fecha_nacimiento', 'sexo', 'tipo_documento', 'nro_documento', 'domicilio', 'tenencia', 'nacionalidad', 'grupo_sanguineo', 'telefono', 'celular', 'obs_medicas', 'observaciones', 'colegio_procedencia', 'fecha_inscripcion'), $insert)); if ($alumno->is_valid()) { if ($alumno->save()) { $this->session->set_flashdata('msg', '<div class="success">El alumno se guardó correctamente.</div>'); redirect($this->agent->referrer()); } else { $this->session->set_flashdata('msg', '<div class="error">Hubo un error al guardar los datos.</div>'); redirect($this->agent->referrer()); } } else { $data['errors'] = $alumno->errors; } } else { $data['a'] = Student::find($id); } $data['paises'] = Country::all(); $data['provincias'] = State::all(); $data['ciudades'] = City::all(); $data['titulo'] = "Editar alumno"; $data['action'] = "alumnos/editar/" . $id; $this->template->write_view('content', 'alumnos/agregar', $data); $this->template->render(); }
public function filters($offset = 0) { $string = '%' . $this->input->post('ciudad') . '%'; $c = $this->input->post('country_id'); $prov = $this->input->post('state_id'); $condiciones = ''; $valores = array(); if ($string != '%%') { $condiciones .= " nombre LIKE ?"; $valores['ciudad'] = $string; } if ($prov > 0) { if ($condiciones != '') { $condiciones .= " AND "; } $condiciones .= " state_id = ?"; $valores['prov'] = $prov; } if ($c > 0) { if ($condiciones != '') { $condiciones .= " AND "; } $condiciones .= " country_id = ?"; $valores['pais'] = $c; } $this->session->set_userdata('filtros_ciudades', $valores); $conditions = array_merge(array($condiciones), $valores); $config['base_url'] = site_url('ciudades/index'); $config['total_rows'] = City::count(array('joins' => array('state'), 'conditions' => $conditions)); $config['per_page'] = '10'; $config['num_links'] = '10'; $config['first_link'] = '← primero'; $config['last_link'] = 'último →'; $this->load->library('pagination', $config); $ciudades = City::all(array('joins' => array('state'), 'conditions' => $conditions, 'limit' => $config['per_page'], 'offset' => $offset)); $this->table->set_heading('Orden', 'País', 'Provincia', 'Ciudad', 'Acciones'); foreach ($ciudades as $ciudad) { $this->table->add_row($ciudad->id, $ciudad->state->country->pais, $ciudad->state->provincia, $ciudad->nombre, anchor('ciudades/editar/' . $ciudad->id, img('static/img/icon/pencil.png'), 'class="tipwe" title="Editar"') . ' ' . anchor('ciudades/eliminar/' . $ciudad->id, img('static/img/icon/trash.png'), 'class="tipwe eliminar" title="Eliminar"')); } echo $this->table->generate(); echo '<div class="pagination">'; echo $this->pagination->create_links(); echo '</div>'; }
finish(); // ---------------------------------------------- start("Select each by name"); foreach ($cities as $city) { City::get($city->id); } finish(); // ----------------------------------------------z start("Update all"); repeat(20, function () { City::objects()->update(['population' => 1]); }); finish(); // ----------------------------------------------z $cities = City::all(); start("Update each (update)"); foreach ($cities as $city) { $city->population += 1; $city->update(); } finish(); // ----------------------------------------------z $cities = City::all(); start("Update each (save)"); foreach ($cities as $city) { $city->population += 1; $city->save(); } finish(); // ---------------------------------------------- save();
public function editPermissions(Request $request, $id) { $user = User::findOrFail($id); $stores = Warehouse::with('city')->where('type', 'store')->get()->groupBy('city_id'); $active_store_id = $stores->keys()->first(); $warehouses = Warehouse::with('city')->where('type', 'warehouse')->get()->groupBy('city_id'); $active_warehouse_id = $warehouses->keys()->first(); $cities = City::all()->keyBy('id'); $roles = Role::where('is_active', 1)->get(); return view('user.editPermissions', compact('user', 'stores', 'warehouses', 'roles', 'cities', 'active_store_id', 'active_warehouse_id')); }
public function showCities() { $cities = City::all(); return View::make('reports.class-status.select-city')->with('cities', $cities); }