protected function prepareMailData() { $product = Tree::find($this->getPreparedItem('id_catalog')); $city = City::find($this->getPreparedItem('id_city')); if ($city) { $region = Region::find($city->id_region); } //$occupation = Occupation::find($this->getPreparedItem('id_occupation')); $this->setMessageSubject('Заявка на услугу: ' . $product->title_ru); $this->appendMessageBody("<html><body>"); $this->appendMessageBody("<p><b>Заявка на услугу:</b> " . $product->title_ru . "</p>"); $this->appendMessageBody("<p><b>Фамилия:</b> " . $this->getPreparedItem('last_name') . "</p>"); $this->appendMessageBody("<p><b>Имя:</b> " . $this->getPreparedItem('first_name') . "</p>"); $this->appendMessageBody("<p><b>Отчество:</b> " . $this->getPreparedItem('patronymic_name') . "</p>"); //$this->appendMessageBody("<p><b>Занятость:</b> ". $occupation->title_ru ."</p>"); $this->appendMessageBody("<p><b>Email:</b> " . $this->getPreparedItem('email') . "</p>"); $this->appendMessageBody("<p><b>Контактный телефон:</b> " . $this->getPreparedItem('phone_number') . "</p>"); if (isset($region) && $region) { $this->appendMessageBody("<p><b>Область:</b> " . $region->title_ru . "</p>"); } $this->appendMessageBody("<p><b>Город:</b> " . $city->title_ru . "</p>"); $this->appendMessageBody("<p><b>Клиент банка:</b> " . ($this->getPreparedItem('is_bank_client') ? 'Да' : 'Нет') . "</p>"); if ($this->getPreparedItem('partner_code')) { $this->appendMessageBody("<p><b>Код партнера:</b> " . $this->getPreparedItem('partner_code') . "</p>"); } $this->appendMessageBody("<html><body>"); }
protected static function boot() { parent::boot(); static::creating(function ($model) { $data = array('district_id' => $model->district_id, 'name' => $model->name); $rules = array('district_id' => 'required|integer|min:1|max:300000', 'name' => 'required|min:3|max:50'); $validator = Validator::make($data, $rules); if ($validator->fails()) { throw new ValidationException(null, null, null, $validator->messages()); } else { return $model->validate(); } }); static::updating(function ($model) { $data = array('district_id' => $model->district_id, 'name' => $model->name); $rules = array('district_id' => 'required|integer|min:1|max:300000', 'name' => 'required|min:3|max:50'); $validator = Validator::make($data, $rules); if ($validator->fails()) { throw new ValidationException(null, null, null, $validator->messages()); } else { return true; } }); static::deleting(function ($model) { $cities = City::where('municipality_id', '=', $model->id)->get(); foreach ($cities as $city) { $city = City::find($city->id)->delete(); } return true; }); }
public function editAction($dealerId = NULL) { $this->view->setVar("title", "Редагування дилера"); $user = $this->session->get("user"); $methodistBrands = \BrandsMethodists::find("user_id=" . $user->id)->toArray(); $methodistActivities = \ActivitiesMethodists::find("user_id=" . $user->id)->toArray(); $dealer = $dealerId ? \Dealers::findFirst($dealerId) : new \Dealers(); if ($dealerId and !$dealer->id) { // не найден такой диллер $this->view->pick("dealer/not-found"); return; } $city = $dealer->City; $this->view->regionId = $city ? $city->Region->id : NULL; $dealerBrands = $dealer->id ? $dealer->DealersBrands->toArray() : array(); $dealerActivities = $dealer->id ? \DealersActivities::find("dealer_id=" . $dealer->id)->toArray() : array(); $this->view->dealers = \Dealers::find(array('order' => 'title')); $this->view->regions = \Region::find(); $this->view->regionFirst = $this->view->regions[0]; $this->view->cities = \City::find(); $this->view->staffListGroup = \StafflistGroup::find(); $this->view->brands = BrandsService::getForChosenEntity(\Brands::find()->toArray(), $methodistBrands, $dealerBrands); $this->view->activities = ActivitiesService::getForChosenEntity(\Activities::find()->toArray(), $methodistActivities, $dealerActivities); $this->view->dealerStatuses = \DealerStatuses::find(); $controllers = \Users::query()->rightJoin("UserGroups")->where("UserGroups.group_id = 3")->execute(); $this->view->controllers = $controllers; $this->view->dealerControllers = $dealer->DealersControllers; $this->view->dealer = $dealer; $this->view->saved = $this->request->get("saved"); }
public function actionIndex() { $query = City::find(); $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]); $countries = $query->orderBy('name')->offset($pagination->offset)->limit($pagination->limit)->all(); return $this->render('index', ['countries' => $countries, 'pagination' => $pagination]); }
public function initialize($entity = null, $options = null) { $city = new Select('cityid', City::find(), array('using' => array('id', 'city'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Seleccione una Ciudad'))); $city->setLabel('Ciudad'); $this->add($city); $township = new Text('township'); $township->setLabel('Sector'); $this->add($township); $countryvalue = ""; $statevalue = ""; $city = ""; if (isset($entity)) { if ($entity->getCity()) { $countryvalue = $entity->getCity()->getCountry()->getCountry(); $statevalue = $entity->getCity()->getState()->getState(); } } $country = new Text('country'); $country->setLabel('País'); $country->setDefault($countryvalue); $this->add($country); $state = new Text('state'); $state->setDefault($statevalue); $state->setLabel('Estado'); $this->add($state); }
/** * Display a listing of the resource. * * @return Response */ public function getConfig() { if (Payment::VeryPayment() == false) { return View::make('clinic.payment.renews-payment'); } $user = Sentry::getUser(); $clinic = Clinic::where('user_id', $user->id)->first(); $adress = Address::find($clinic->address_id); $province_id = City::find($adress->city_id)->province_id; $country_id = Province::find($province_id)->country_id; $option = $clinic->insurances; #$option = Option::where('name', $clinic->id.'-clinic-insurance')->first(); $array = array(); if ($option) { $segs = explode(',', $option); $segok = ''; foreach ($segs as $seg) { $very = Insurance::where('id', $seg)->first(); if ($very) { $array[] = array('value' => $very->id, 'text' => $very->name); } } } /**/ $optionLang = Option::where('name', $clinic->id . '-clinic-lang')->first(); if (!$option) { return View::make('clinic.config.config')->with('country_id', $country_id)->with('clinic', $clinic)->with('adress', $adress); } else { return View::make('clinic.config.config')->with('clinic', $clinic)->with('option', $array)->with('adress', $adress)->with('country_id', $country_id)->with('optionLang', $optionLang); } }
public function indexAction() { $data = \City::find()->toArray(true); $this->view->disable(); $this->response->setContentType('application/json', 'UTF-8'); echo json_encode($data); }
public function initialize($entity = null, $options = null) { $country = new Select('countryid', Country::find(), array('using' => array('id', 'country'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Seleccione un País'))); $country->setLabel('País'); $this->add($country); if (isset($entity)) { if ($entity->getCountryid()) { $state = new Select('stateid', State::find(array("columns" => array("id,state"), "conditions" => "countryid =:countryid:", "bind" => array("countryid" => $entity->countryid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione un Estado'), 'using' => array('id', 'state'))); $state->setLabel('Estado'); $this->add($state); $city = new Select('cityid', City::find(array("columns" => array("id,city"), "conditions" => "countryid =:countryid: AND stateid =:stateid: ", "bind" => array("countryid" => $entity->countryid, "stateid" => $entity->stateid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione una ciudad'), 'using' => array('id', 'city'))); $city->setLabel('Ciudad'); $this->add($city); $township = new Select('townshipid', Township::find(array("columns" => array("id,township"), "conditions" => "cityid =:cityid:", "bind" => array("cityid" => $entity->cityid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione un Sector'), 'using' => array('id', 'township'))); $township->setLabel('Sector'); $this->add($township); $neighborhood = new Select('neighborhoodid', Neighborhood::find(array("columns" => array("id,neighborhood"), "conditions" => "cityid =:cityid:", "bind" => array("cityid" => $entity->cityid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione un Barrio'), 'using' => array('id', 'neighborhood'))); $neighborhood->setLabel('Barrio'); $this->add($neighborhood); } else { $this->set_empty_values(); } } else { $this->set_empty_values(); } $address = new Textarea('address', array("maxlength" => "400")); $address->setLabel('Dirección'); $this->add($address); $description = new Textarea('description', array("maxlength" => "100")); $description->setLabel('Descripción'); $this->add($description); }
/** * Run the database seeds. * * @return void */ public function run() { Eloquent::unguard(); DB::table('propel_fellow_wingman')->delete(); DB::table('propel_student_wingman')->delete(); Subject::truncate(); DB::table('propel_city_subject')->delete(); CalendarEvent::truncate(); CancelledCalendarEvent::truncate(); WingmanModule::truncate(); WingmanTime::truncate(); VolunteerTime::truncate(); WingmanJournal::truncate(); $fellow = Fellow::find(1); $wingman1 = Wingman::find(2); $wingman2 = Wingman::find(3); $fellow->wingman()->attach($wingman1); $fellow->wingman()->attach($wingman2); $student1 = Student::find(3); $student2 = Student::find(4); $wingman1->student()->attach($student1); $wingman1->student()->attach($student2); $cEvent1 = new CalendarEvent(); $cEvent1->type = 'volunteer_time'; $cEvent1->student()->associate($student1); $cEvent1->status = 'created'; $cEvent1->save(); $vTime1 = new VolunteerTime(); $vTime1->calendarEvent()->associate($cEvent1); $volunteer1 = Volunteer::find(4); $vTime1->volunteer()->associate($volunteer1); $subject1 = new Subject(); $subject1->name = "English"; $subject1->save(); $vTime1->subject()->associate($subject1); $vTime1->save(); $cEvent2 = new CalendarEvent(); $cEvent2->type = 'wingman_time'; $cEvent2->student()->associate($student1); $cEvent2->status = 'created'; $cEvent2->save(); $wTime1 = new WingmanTime(); $wTime1->calendarEvent()->associate($cEvent2); $wTime1->wingman()->associate($wingman1); $wModule1 = new WingmanModule(); $wModule1->name = "Programming"; $wModule1->save(); $wTime1->wingmanModule()->associate($wModule1); $wTime1->save(); $city1 = City::find(1); $subject1->city()->attach($city1); $wJournal1 = new WingmanJournal(); $wJournal1->type = 'formal'; $wJournal1->title = "Day at Navy Camp"; $wJournal1->mom = "It was awesome"; $wJournal1->student()->associate($student1); $wJournal1->wingman()->associate($wingman1); $wJournal1->save(); }
public function saveSubjects() { $user_id = $_SESSION['user_id']; $city_id = Volunteer::find($user_id)->city_id; $city = City::find($city_id); $selected_subjects = Input::get("subjects"); $city->subject()->sync($selected_subjects); return Redirect::to(URL::to('/') . "/settings/subjects")->with('success', 'Subjects Set.'); }
public function getCityList() { /* Start here set the country list */ App::import("Model", "City"); $city = new City(); $options = array('fields' => array('City.id', 'City.city_name', 'City.is_deleted')); $getCityAllWithStatus = $city->find('all', $options); $newCityList = array(); if ($city->find('count', $options) > 0) { foreach ($getCityAllWithStatus as $index => $value) { if ($value["City"]["is_deleted"] == "1") { $newCityList[$value["City"]["id"]] = $value["City"]["city_name"] . " (Under Deleted)"; } else { $newCityList[$value["City"]["id"]] = $value["City"]["city_name"]; } } } return $getCityList = $newCityList; }
function getCityList($stateCode) { App::import("Model", "City"); $model = new City(); $con2 = $model->find('list', array('fields' => array('City.id', 'City.city'), 'conditions' => array('City.stateid' => $stateCode))); if (empty($con2)) { return 0; } else { return $con2; } }
public function delete($id) { try { CityModel::find($id)->delete(); $alert['msg'] = 'City has been deleted successfully'; $alert['type'] = 'success'; } catch (\Exception $ex) { $alert['msg'] = 'This City has been already used'; $alert['type'] = 'danger'; } return Redirect::route('admin.city')->with('alert', $alert); }
protected function prepareMailData() { $product = Tree::find($this->getPreparedItem('id_catalog')); $occupation = Occupation::find($this->getPreparedItem('id_occupation')); $this->setMessageSubject('Заявка на услугу: ' . $product->title_ru); $this->appendMessageBody("<html><body>"); $this->appendMessageBody("<p><b>Заявка на услугу:</b> " . $product->title_ru . "</p>"); $this->appendMessageBody("<p><b>Фамилия:</b> " . $this->getPreparedItem('last_name') . "</p>"); $this->appendMessageBody("<p><b>Имя:</b> " . $this->getPreparedItem('first_name') . "</p>"); $this->appendMessageBody("<p><b>Отчество:</b> " . $this->getPreparedItem('patronymic_name') . "</p>"); $this->appendMessageBody("<p><b>Занятость:</b> " . $occupation->title_ru . "</p>"); $this->appendMessageBody("<p><b>Email:</b> " . $this->getPreparedItem('email') . "</p>"); $this->appendMessageBody("<p><b>Контактный телефон:</b> " . $this->getPreparedItem('phone_number') . "</p>"); $this->appendMessageBody("<p><b>Паспорт:</b> " . $this->getPreparedItem('passport') . "</p>"); $this->appendMessageBody("<p><b>ИНН:</b> " . $this->getPreparedItem('inn') . "</p>"); $this->appendMessageBody("<p><b>Клиент банка:</b> " . ($this->getPreparedItem('is_bank_client') ? 'Да' : 'Нет') . "</p>"); if ($this->getPreparedItem('id_city')) { $city = City::find($this->getPreparedItem('id_city')); if (isset($city->title_ru)) { $this->appendMessageBody("<p><b>Город:</b> " . $city->title_ru . "</p>"); } } if ($this->getPreparedItem('id_shop')) { $shop = Shop::find($this->getPreparedItem('id_shop')); if (isset($shop->title_ru)) { $this->appendMessageBody("<p><b>Магазин:</b> " . $shop->title_ru . "</p>"); } } if ($this->getPreparedItem('id_product_type')) { $productType = Product::find($this->getPreparedItem('id_product_type')); if (isset($productType->title_ru)) { $this->appendMessageBody("<p><b>Тип товара:</b> " . $productType->title_ru . "</p>"); } } if ($this->getPreparedItem('product_price')) { $this->appendMessageBody("<p><b>Стоимость товара:</b> " . $this->getPreparedItem('product_price') . "</p>"); } if ($this->getPreparedItem('term')) { $this->appendMessageBody("<p><b>Срок кредита:</b> " . $this->getPreparedItem('term') . "</p>"); } if ($this->getPreparedItem('is_insurance_loss_job')) { $this->appendMessageBody("<p><b>Страховка от временной потери работы:</b> Да</p>"); } if ($this->getPreparedItem('is_insurance_accident')) { $this->appendMessageBody("<p><b>Страховка от несчастного случая:</b> Да</p>"); } $this->appendMessageBody("<html><body>"); }
public function updateCity($id) { $cre = ["city" => Input::get('city')]; $rules = ["city" => 'required']; $validator = Validator::make($cre, $rules); if ($validator->passes()) { $city = City::find($id); $city->city_name = Input::get('city'); $city->save(); $count = Input::get('count'); $data["success"] = true; $data["message"] = html_entity_decode(View::make('admin.manage.cities.view', ["data" => $city, "count" => $count])); } else { $data["success"] = false; $data["message"] = "All fields are not filled"; } return json_encode($data); }
public function initialize($entity = null, $options = null) { $city = new Select('cityid', City::find(), array('using' => array('id', 'city'), 'useEmpty' => TRUE, 'emptyText' => 'Seleccione una Ciudad')); $city->setLabel('Ciudad'); $this->add($city); //var_dump($entity->townshipid); if (isset($entity)) { $township = new Select('townshipid', Township::find(array("columns" => array("id,township"), "conditions" => "cityid =:cityid:", "bind" => array("cityid" => $entity->cityid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione un Sector'), 'using' => array('id', 'township'))); $township->setLabel('Sector'); $this->add($township); } else { $township = new Select('townshipid', array(), array('useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Seleccione un Sector'))); $township->setLabel('Sector'); $this->add($township); } $countryvalue = ""; $statevalue = ""; $city = ""; if (isset($entity)) { if ($entity->getCity()) { $countryvalue = $entity->getCity()->getCountry()->getCountry(); $statevalue = $entity->getCity()->getState()->getState(); } } $country = new Text('country'); $country->setLabel('País'); $country->setDefault($countryvalue); $this->add($country); $state = new Text('state'); $state->setDefault($statevalue); $state->setLabel('Estado'); $this->add($state); $neighborhood = new Text('neighborhood'); $neighborhood->setLabel('Barrio'); $this->add($neighborhood); //añadimos un botón de tipo submit $submit = $this->add(new Submit('Guardar', array('class' => 'btn btn-success'))); }
protected function sendSibelForm() { // fixme: $city = City::find($this->getPreparedItem('id_city')); if ($city) { $region = Region::find($city->id_region); $area = Area::find($region->id_area); } $client = new SibelClient(); $client->setLastName($this->preparedData['last_name']); $client->setFirstName($this->preparedData['first_name']); $client->setMiddleName($this->preparedData['patronymic_name']); $client->setPhone($this->preparedData['phone_number']); $client->setProject($this->getSibelProject()); $client->setCreatedDate(date('Y-m-d H:i:s')); if (isset($area) && $area && $city) { $client->setDescription($area->title_ru); $client->setComment($city->title_ru); } $orderCode = $client->registerShortApplication(); $this->preparedData['sibel_request'] = $client->getXml(); $this->preparedData['sibel_response'] = $orderCode; }
public function provinceAction() { $this->view->disable(); $province = $this->request->getPost('province', 'string'); $this->session->set('province', $province); $qcity = City::find(array('conditions' => 'province=?1', 'bind' => array(1 => $province))); $cities = array(); foreach ($qcity as $item) { $cities[$item->id] = $item->name; } $this->response->setContentType('application/Json', 'UTF-8'); $this->response->setJsonContent(array('cities' => $cities)); $this->response->send(); }
echo $predefinedTrip->transportPackage->vehicle->vehicle_type; ?> <br> <?php echo date('Y-m-d', strtotime($predefinedTrip->transportPackage->start_date)); ?> <br> <?php echo date('H:i', strtotime($predefinedTrip->pick_up_date_time)); ?> <br> <?php echo City::find($predefinedTrip->transportPackage->origin)->city; ?> , <?php echo City::find($predefinedTrip->transportPackage->destination)->city; ?> <br> <?php echo number_format($predefinedTrip->transportPackage->rate * $predefinedTrip->transportPackage->millage, 2); ?> <br> <?php //echo number_format(TransportPackage::getPredefinedTripTotal($booking), 2); ?> </td> </tr> <?php }
function client_print_for_approval() { $qualifying_circulation_id = $this->params['named']['qualifying_circulation_id']; $printing_centers = $this->Session->read('Auth.PrintingCenter'); $printing_center_ids = Set::extract('/id', $printing_centers); App::import('Model', 'QualifyingCirculation'); $QualifyingCirculation = new QualifyingCirculation(); $options = array('conditions' => array('QualifyingCirculation.id' => $qualifying_circulation_id, 'QualifyingCirculation.printing_center_id' => $printing_center_ids)); $qualifyingCirculation = $QualifyingCirculation->find('first', $options); App::import('Model', 'Address'); $objAddress = new Address(); $options = array('conditions' => array('Address.id' => $qualifyingCirculation['DuplicateCopy']['0']['address_id'])); $addr = $objAddress->find('first', $options); $qualifyingCirculation['DuplicateCopy'][0]['Address'] = $addr['Address']; $qualifyingCirculation['DuplicateCopy'][0]['City'] = $addr['City']; $qualifyingCirculation['DuplicateCopy'][0]['State'] = $addr['State']; $qualifyingCirculation['DuplicateCopy'][0]['Zone'] = $addr['Zone']; $qualifyingCirculation['DuplicateCopy'][0]['Country'] = $addr['Country']; // Printing Center Details App::import('Model', 'PrintingCenter'); $objPrintingCenter = new PrintingCenter(); $optionsPrintingCenter = array('contain' => array('Address', 'Membership', 'PrintedAt', 'Membership.Publication', 'Membership.Edition'), 'conditions' => array('PrintingCenter.id' => $qualifyingCirculation['PrintingCenter']['id'])); $printingCenter = $objPrintingCenter->find('first', $optionsPrintingCenter); unset($qualifyingCirculation['PrintingCenter']['PrintingCenter']); unset($qualifyingCirculation['PrintingCenter']['QualifyingCirculation']); unset($qualifyingCirculation['PrintingCenter']['CreatedBy']); unset($qualifyingCirculation['PrintingCenter']['ModifiedBy']); unset($qualifyingCirculation['PrintingCenter']['Membership']['User']); unset($qualifyingCirculation['PrintingCenter']['Membership']['Address']); unset($qualifyingCirculation['PrintingCenter']['Membership']['Proposer1Representative']); unset($qualifyingCirculation['PrintingCenter']['Membership']['Proposer2Representative']); unset($qualifyingCirculation['PrintingCenter']['Membership']['CreatedBy']); unset($qualifyingCirculation['PrintingCenter']['Membership']['ModifiedBy']); unset($qualifyingCirculation['PrintingCenter']['Membership']['MembershipPayment']); unset($qualifyingCirculation['PrintingCenter']['Membership']['PrintingCenter']); unset($qualifyingCirculation['PrintingCenter']['Membership']['Representative']); // HoldingCompany.Address App::import('Model', 'HoldingCompany'); $objHoldingCompany = new HoldingCompany(); $optionsHoldingCompany = array('contain' => array('Address'), 'conditions' => array('HoldingCompany.id' => $printingCenter['Membership']['HoldingCompany'][0]['id'])); $holdingCompany = $objHoldingCompany->find('first', $optionsHoldingCompany); // PrintingCenterAuditorBranch App::import('Model', 'PrintingCenterAuditorBranch'); $objPrintingCenterAuditorBranch = new PrintingCenterAuditorBranch(); $optionsPrintingCenterAuditorBranch = array('contain' => array('AuditorBranch', 'AuditorBranch.AuditorFirm'), 'conditions' => array('PrintingCenterAuditorBranch.printing_center_id' => $printingCenter['PrintingCenter']['id'], 'PrintingCenterAuditorBranch.regular_period_id' => $qualifyingCirculation['QualifyingCirculation']['regular_period_id'])); $printingCenterAuditorBranch = $objPrintingCenterAuditorBranch->find('first', $optionsPrintingCenterAuditorBranch); $options = array('conditions' => array('Address.id' => $printingCenterAuditorBranch['AuditorBranch']['Address']['id']), 'contain' => array('Country', 'Zone', 'State', 'District', 'City')); $addr = $objAddress->find('first', $options); $printingCenterAuditorBranch['AuditorBranch']['Address'] = $addr['Address']; $printingCenterAuditorBranch['AuditorBranch']['Address']['Country'] = $addr['Country']; $printingCenterAuditorBranch['AuditorBranch']['Address']['Zone'] = $addr['Zone']; $printingCenterAuditorBranch['AuditorBranch']['Address']['State'] = $addr['State']; $printingCenterAuditorBranch['AuditorBranch']['Address']['District'] = $addr['District']; $printingCenterAuditorBranch['AuditorBranch']['Address']['City'] = $addr['City']; App::import('Model', 'SaleType'); App::import('Model', 'TradeTerm'); $SaleType = new SaleType(); $TradeTerm = new TradeTerm(); $saleTypes = $SaleType->find('list'); $subscriptionTypes = $TradeTerm->SubscriptionType->find('list'); App::import('Model', 'City'); $objCities = new City(); $cities = $objCities->find('all', array('conditions' => array('City.id' => Set::extract('/city_id', $qualifyingCirculation['WhiteForm'])))); $this->set(compact('saleTypes', 'subscriptionTypes', 'qualifyingCirculation', 'cities', 'printingCenter', 'holdingCompany', 'printingCenterAuditorBranch')); }
function GetCityData($Slug) { App::import('Model', 'City'); $objCat = new City(); // $this->City->recursive = -1; $arrData = $objCat->find("all", array("conditions" => array("City.slug" => $Slug))); return $arrData; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $city = City::find($id); if (!is_null($city)) { if ($city->delete()) { return Redirect::route('admin.cities.index')->withErrors(array('mainSuccess' => 'Градът/селото е успешно изтрит.')); } else { return Redirect::route('admin.cities.index')->withErrors(array('mainError' => 'Грешка с базата данни.')); } } else { return Redirect::route('admin.cities.index')->withErrors(array('mainError' => 'Градът/селото не е намерен.')); } }
function addressMetaData($action) { // $optionState = array(); // $optionState['order'] = array('state_name' => 'asc', 'active' => '1'); // $optionState['conditions'] = array('zone_id' => $address['zone_id'], 'active' => '1'); if (isset($this->params['named']['copy_address']) || $action == 'edit' || $action == 'copy') { App::import('Model', 'Country'); $objCountry = new Country(); App::import('Model', 'Zone'); $objZone = new Zone(); App::import('Model', 'State'); $objState = new State(); App::import('Model', 'District'); $objDistrict = new District(); App::import('Model', 'City'); $objCity = new City(); $optionZone = array(); $optionDistrict = array(); $optionCity = array(); if (!empty($this->viewVars[lcfirst($this->modelClass)]['Address'])) { $address = $this->viewVars[lcfirst($this->modelClass)]['Address']; $optionCountry['conditions'] = array('id' => $address['country_id'], 'active' => '1'); $optionZone['conditions'] = array('id' => $address['zone_id'], 'active' => '1'); $optionState['conditions'] = array('id' => $address['state_id'], 'active' => '1'); $optionDistrict['conditions'] = array('id' => $address['district_id'], 'active' => '1'); $optionCity['conditions'] = array('id' => $address['city_id'], 'active' => '1'); } $countries = $objCountry->find('list', $optionCountry); $zones = $objZone->find('list', $optionZone); $states = $objState->find('list', $optionState); $districts = $objDistrict->find('list', $optionDistrict); $cities = $objCity->find('list', $optionCity); $this->set(compact('countries', 'zones', 'states', 'districts', 'cities')); } }
function eliminar($id) { $a = City::find($id); $a->delete(); $this->session->set_flashdata('msg', '<div class="success">El ciudad fué eliminada correctamente.</div>'); redirect('ciudades'); }
public function actionCpvlist($q = null, $id = null) { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; $out = ['results' => ['id' => '', 'text' => '']]; if (!is_null($q)) { $query = new Query(); $query->select('uid as id, cpv_label AS text')->from('cpv')->where(['like', 'cpv_label', $q])->limit(20); $command = $query->createCommand(); $data = $command->queryAll(); $out['results'] = array_values($data); } elseif ($id > 0) { $out['results'] = ['id' => $id, 'text' => City::find($id)->name]; } return $out; }
public function actionGetxy() { $city = $_POST['add']; $c = City::find()->where(['name' => $city])->one(); $xy = $c->xy; return Json::encode($xy); }
function client_index() { $this->CertificateGroup->contain = array('Language', 'FrequencyType', 'Publication', 'Membership'); $filters = $this->AlaxosFilter->get_filter(); $data_certificateGroup = array(); if (empty($this->params['named']['export_excel'])) { $this->set('certificateGroups', $this->paginate($this->CertificateGroup, $filters)); } else { Configure::write('debug', 0); $options = array(); $this->set('export_to_excel', 1); $i = 0; $certificateGroups = $this->CertificateGroup->find('all', array_merge_recursive($options, array('conditions' => $filters))); foreach ($certificateGroups as $certificateGroup) { foreach ($certificateGroup as $indx => $module) { foreach ($module as $k => $v) { $arr_fields_in_xls = array(); if (!empty($arr_fields_in_xls) && in_array($k, $arr_fields_in_xls[$indx])) { $data_certificateGroup[$i][__($indx, true) . ' ' . __($k, true)] = $module[$k]; } else { $data_certificateGroup[$i][__($indx, true) . ' ' . __($k, true)] = $module[$k]; } } } $i++; } $this->set('certificateGroups', $data_certificateGroup); } App::import('Model', 'City'); foreach ($this->viewVars['certificateGroups'] as $k1 => $certificateGroups) { if (!empty($certificateGroups['Membership'])) { foreach ($certificateGroups['Membership'] as $k2 => $membership) { $options = array('conditions' => array('City.id' => $membership['edition_id'])); $objCity = new City(); $objCity->recursive = 0; $edition = $objCity->find('first', $options); $this->viewVars['certificateGroups'][$k1]['Membership'][$k2] = array_merge($this->viewVars['certificateGroups'][$k1]['Membership'][$k2], $edition); } } } $languages = $this->CertificateGroup->Language->find('list'); $frequencyTypes = $this->CertificateGroup->FrequencyType->find('list'); $publications = $this->CertificateGroup->Publication->find('list'); $this->set(compact('languages', 'frequencyTypes', 'publications')); }
public function delete_location() { $id = Request::segment(4); $city = City::find($id); City::where('id', $id)->delete(); StoreLocation::where('zipcode', $city->zipcode)->delete(); $message = "Successfully deleted the city"; $type = "success"; return Redirect::to('/admin/locations')->with('type', $type)->with('message', $message); }
echo $trip->transportPackage->vehicle->vehicle_type; ?> <br> <?php echo date('Y-m-d', strtotime($trip->transportPackage->start_date)); ?> <br> <?php echo date('H:i', strtotime($trip->pick_up_date_time)); ?> <br> <?php echo City::find($trip->transportPackage->origin)->city; ?> , <?php echo City::find($trip->transportPackage->destination)->city; ?> <br> <?php echo number_format($trip->transportPackage->rate * $trip->transportPackage->millage, 2); ?> <br> <?php //echo number_format(TransportPackage::getPredefinedTripTotal($booking), 2); ?> </td> </tr> <?php }
public function getMunicipalityIdAttribute() { return City::find($this->city_id)->municipality_id; }