function displayData()
 {
     $cityTemp = CityManager::getSingleCity('id', $this->church->getIdCity());
     if ($cityTemp === NULL) {
         $cityTemp = new City();
     }
     $stateTemp = CityManager::getSingleState('id', $cityTemp->getIdState());
     $cityString = "*************************";
     if ($stateTemp === NULL) {
         $stateTemp = new State();
     } else {
         $cityString = $cityTemp->getName() . ", " . $stateTemp->getShortName();
     }
     $this->SetFont('Arial', 'B', 10);
     $cellSizeY = 5;
     for ($i = 0; $i < 3; $i++) {
         //Get the data necesary of create the document
         $this->SetXY($x + 100, $i * 60 + $y + 40 - $cellSizeY);
         $this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', $this->church->getName()), 0, 0, 'C');
         $this->SetXY($x + 100, $i * 60 + $y + 47 - $cellSizeY);
         $this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', $this->church->getAddress()), 0, 0, 'C');
         $this->SetXY($x + 100, $i * 60 + $y + 54 - $cellSizeY);
         $this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', 'CP. ' . $this->church->getPostalCode()), 0, 0, 'C');
         $this->SetXY($x + 100, $i * 60 + $y + 61 - $cellSizeY);
         $this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', $cityString), 0, 0, 'C');
     }
 }
Esempio n. 2
0
 public function init()
 {
     $nameProject = new Zend_Form_Element_Text('nameProject');
     $nameProject->setLabel('nom Projet')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $dateBegin = new Zend_Form_Element_Text('dateBegin');
     $dateBegin->setLabel('à partir de :')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $dateEnd = new Zend_Form_Element_Text('dateEnd');
     $dateEnd->setLabel('jusqu\'à le :')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $budget = new Zend_Form_Element_Text('budget');
     $budget->setLabel('Budget :')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $localisation = new Zend_Form_Element_Select('localisation');
     $localisation->setLabel('Localisation :')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $cityModel = new City();
     $selectReferenceForCity = $cityModel->select()->setIntegrityCheck(false)->from('city');
     $localisation->addMultiOption(0, '-');
     foreach ($cityModel->fetchAll($selectReferenceForCity) as $row) {
         $localisation->addMultiOption($row->city_id, $row->city_description);
     }
     $domaine = new Zend_Form_Element_Select('domaine');
     $domaine->setLabel('Domaine :')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $reference = new ReferenceValue();
     $selectReferenceForDomain = $reference->select()->setIntegrityCheck(false)->from('reference_values')->where('reference_values.reference_Id=5');
     $domaine->addMultiOption(0, '-');
     foreach ($reference->fetchAll($selectReferenceForDomain) as $row) {
         $domaine->addMultiOption($row->value_id, $row->name);
     }
     $statut = new Zend_Form_Element_Select('statut');
     $statut->setLabel('statut :')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $statut->addMultiOptions(array('1' => 'encours', '2' => 'valide', '3' => 'suspendu'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setOptions(array('label' => $this->t('Filter'), 'required' => true));
     $this->setCancelLink(false);
     $this->addElements(array($nameProject, $dateBegin, $dateEnd, $budget, $localisation, $domaine, $statut, $submit));
 }
Esempio n. 3
0
 public function actionAdmin()
 {
     $this->rememberPage();
     $model = new City('search');
     $model->setRememberScenario('city_remember');
     $this->render('admin', array_merge(array('model' => $model), $this->params));
 }
Esempio n. 4
0
function encoder_redirect_success(City $new_city)
{
    $new_city_name = $new_city->getCity();
    $dir = "VIEW/html/Encoder/Add_Place/Add_Place_City_inc.php?success_edit=1";
    $url = BASE_URL . $dir;
    header("Location:{$url}");
    exit;
}
Esempio n. 5
0
function encoder_redirect_success(City $new_city)
{
    $new_city_name = $new_city->getCity();
    $dir = "VIEW/html/Encoder/Add_Place/Add_Place_City_inc.php?success=1&City_Name={$new_city_name}";
    $url = BASE_URL . $dir;
    header("Location:{$url}");
    //redirect the encoder to the regions add place
    exit;
}
 public function actionAdmin()
 {
     $model = new City('search');
     $model->unsetAttributes();
     if (isset($_GET['City'])) {
         $model->setAttributes($_GET['City']);
     }
     $this->render('admin', array('model' => $model));
 }
 public function testVisitor()
 {
     $expect = "Buy sushi...Buy pizza...Buy burger...";
     $city = new City();
     $city->add(new SushiBar());
     $city->add(new Pizzeria());
     $city->add(new BurgerBar());
     $result = $city->accept(new People());
     $this->assertEquals($result, $expect);
 }
 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 interpret()
 {
     $resultingCity = new City("Nowhere", -999.9, -999.9);
     foreach ($this->expressions as $currentExpression) {
         $currentCity = $currentExpression->interpret();
         if ($currentCity->getLongitude() > $resultingCity->getLongitude()) {
             $resultingCity = $currentCity;
         }
     }
     return $resultingCity;
 }
Esempio n. 10
0
 public function __construct($user_id = 0)
 {
     parent::__construct('user', $user_id);
     if ($user_id) {
         $sql = sprintf("SELECT region_id FROM user_region WHERE user_id=%d AND region_type=%d ORDER BY updated_date DESC LIMIT 1", $user_id, REGION_CITY);
         $city_id = db()->Get_Cell($sql);
         $city = new City($city_id);
         $this->city_id = $city_id;
         $this->county_id = $city->county_id();
         $this->state_id = $city->state_id();
     }
 }
 /**
  * @param City $city
  * @return bool
  * this function takes city as a parameter and add the city to the data base
  * if the city is added to the database it will return true
  * else it will return false
  */
 function Add_City(City $city)
 {
     $City_Name = $city->getCity();
     $City_Name_Amharic = $city->getCityAmharic();
     $query = "INSERT INTO city (Name,Name_Amharic) VALUES('{$City_Name}','{$City_Name_Amharic}')";
     $result = mysqli_query($this->getDbc(), $query);
     if ($result) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 50) as $index) {
         $city = new City();
         $city->link = $faker->url;
         $city->img_src = $faker->imageUrl($width = 640, $height = 480);
         $city->name_en = $faker->city;
         $city->latitude = $faker->latitude;
         $city->longitude = $faker->longitude;
         $city->save();
     }
 }
Esempio n. 13
0
File: City.php Progetto: righ22/Xata
 public static function check($_cpt, $_cntry)
 {
     $city = City::model()->find('country_id=:cntry AND caption=:cpt', array(':cntry' => $_cntry, ':cpt' => $_cpt));
     if ($city !== null) {
         return $city->getPrimaryKey();
     }
     $city = new City();
     $city->attributes = array('caption' => $_cpt, 'country_id' => $_cntry);
     if ($city->save()) {
         return $city->getPrimaryKey();
     }
     return false;
 }
 private function ifCityUndefined($userStep, $cityName)
 {
     if (City::model()->cityNotExist($cityName)) {
         if (!WikiUtils::checkCityByWiki($cityName) && !WikiUtils::checkCityByWiki($cityName . "_(город)")) {
             $userStep->error = GameUtils::ERROR_CITY_UNDEFINED;
             return true;
         }
         $city = new City();
         $city->name = $cityName;
         $city->save();
         return false;
     }
 }
Esempio n. 15
0
 public function Delete()
 {
     global $obj, $model, $param1;
     include_once 'Model/city.php';
     $model = new City();
     $model->Id = $param1;
     if ($model->Delete()) {
         print '<span class="success">City Updated</span>';
     } else {
         print '<span class="error">' . $model->Error . '</span>';
     }
     include_once 'View/City/index.php';
 }
Esempio n. 16
0
 /**
  * 录入
  *
  */
 public function actionCreate()
 {
     parent::_acl('city_create');
     $model = new City();
     if (isset($_POST['City'])) {
         $model->attributes = $_POST['City'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入城市,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
Esempio n. 17
0
 public function actionCreateOrg()
 {
     $org = Organization::model()->count();
     if ($org == 0) {
         $this->layout = 'installation_layout';
         $model = new Organization();
         $user = new User();
         $auth_assign = new AuthAssignment();
         // Uncomment the following line if AJAX validation is needed
         $this->performAjaxValidation($model);
         if (isset($_POST['Organization']['organization_name']) && !empty($_POST['Organization']['phone']) && !empty($_POST['Organization']['email'])) {
             $country_model = new Country();
             $country_model->name = $_POST['Organization']['country'];
             $country_model->save();
             $state_model = new State();
             $state_model->state_name = $_POST['Organization']['state'];
             $state_model->country_id = $country_model->id;
             $state_model->save();
             $city_model = new City();
             $city_model->city_name = $_POST['Organization']['city'];
             $city_model->country_id = $country_model->id;
             $city_model->state_id = $state_model->state_id;
             $city_model->save();
             $model->attributes = $_POST['Organization'];
             $model->organization_created_by = 1;
             $model->organization_creation_date = new CDbExpression('NOW()');
             $model->city = $city_model->city_id;
             $model->state = $state_model->state_id;
             $model->country = $country_model->id;
             if ($model->save(false)) {
                 $user->user_organization_email_id = $model->email;
                 $user->user_password = md5($model->email . $model->email);
                 $user->user_type = 'admin';
                 $user->user_created_by = 1;
                 $user->user_creation_date = new CDbExpression('NOW()');
                 $user->user_organization_id = $model->organization_id;
                 $user->save();
                 $auth_assign->itemname = 'SuperAdmin';
                 $auth_assign->userid = $user->user_id;
                 $auth_assign->save(false);
                 $this->redirect(array('redirectLogin'));
             }
         }
         $this->render('create_org', array('model' => $model));
     } else {
         Yii::app()->user->logout();
         $this->redirect(array('login'));
     }
 }
Esempio n. 18
0
 public static function get_town()
 {
     $title = array("Балаклея", "Первомайск", "Богодухов", "Змиев", "Чугуев", "Валки");
     $year = rand(1750, 1950);
     $lat = rand(49923, 50062) / 1000;
     //координаты
     $lon = rand(36142, 36390) / 1000;
     $nstreets = rand(1, 20);
     //количество улиц
     $town = new City($title, $year, $lat, $lon, $nstreets);
     for ($i = 0; $i < $nstreets; $i++) {
         $town->add_street(self::get_street());
     }
     return $town;
 }
Esempio n. 19
0
 public function __construct()
 {
     $this->beforeFilter(function () {
         if (Request::format() == 'html') {
             if (!Auth::check()) {
                 return Redirect::to('/login');
             } else {
                 $this->user_id = Auth::user()->id;
                 $this->zipcode = Session::get('zipcode');
                 $this->store_id = Session::get('store_id');
                 $this->cart_id = Session::get('cart_id');
                 $lists = Lists::where('owner_id', $this->user_id)->get();
                 Session::put('lists', $lists);
                 $this->city = City::where('zipcode', $this->zipcode)->first();
                 $this->stores = DB::table('stores')->leftJoin('store_locations', 'stores.id', '=', 'store_locations.store_id')->where('store_locations.zipcode', $this->zipcode)->select('stores.*')->get();
                 $this->departments = Department::where('store_id', $this->store_id)->get();
                 $this->store = Store::find($this->store_id);
             }
         } else {
             $this->user_id = Input::get('user_id');
             $token = Input::get('token');
             if ($user = User::where('token', '=', $token)->where('id', '=', $this->user_id)->first()) {
                 $this->zipcode = $user->zipcode;
             } else {
                 $response_array = array('success' => 'false', 'error_code' => '400', 'error' => 'Invalid Token');
                 $response_code = 200;
                 $response = Response::json($response_array, $response_code);
                 return $response;
             }
         }
     }, array('except' => array()));
 }
 /**
  * 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 static function prepareInfoForTab(HotelTripElement $hotel)
 {
     /** @var $hotel HotelTripElement */
     $from = City::getCityByPk($hotel->city);
     $tab = array();
     $tab['label'] = '<b>Отель в городе ' . $from->localRu . '</b><br>' . $hotel->checkIn . " &mdash; " . $hotel->checkOut;
     $tab['id'] = $hotel->id . '_tab';
     $tab['info'] = array('type' => 'hotel', 'cityId' => $hotel->city, 'checkIn' => $hotel->checkIn, 'checkOut' => $hotel->checkOut, 'duration' => $hotel->getDuration());
     foreach ($hotel->rooms as $i => $room) {
         $tab['info']['room'][$i]['adultCount'] = $room->adultCount;
         $tab['info']['room'][$i]['childCount'] = $room->childCount;
         $tab['info']['room'][$i]['cots'] = $room->cots;
         $tab['info']['room'][$i]['childAge'] = $room->childAge;
     }
     if ($hotel->hotel) {
         $controller = Yii::app()->getController();
         $tab['content'] = $controller->renderPartial('//tour/constructor/_chosen_hotel_precompiled', array('hotel' => $hotel->hotel), true);
         $tab['itemOptions']['class'] = 'hotel fill';
         $tab['fill'] = true;
     } else {
         $tab['content'] = 'loading...';
         $tab['itemOptions']['class'] = 'hotel unfill';
         $tab['fill'] = false;
     }
     return $tab;
 }
 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 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");
 }
Esempio n. 24
0
    static function get_fees($pid = null) {
        $fees = unserialize(self::get_key('fees'));
        if (empty($fees) || !is_array($fees)) {
            return null;
        }
        $list_city = City::get_list(true);

        $list_district = District::get_list(true, $pid);

        $list_fee = array();
        if (!empty($fees)) {
            foreach ($fees as $did => $fee) {
                if (!empty($list_district[$did])) {
                    $fee['city'] = $list_city[$fee['cid']];
                    $fee['district'] = $list_district[$did];
                    $fee['delivery_fee_formatted'] = EClassApi::numberFormat($fee['delivery_fee']);
                    $fee['min_order_formatted'] = EClassApi::numberFormat($fee['min_order']);
                    $fee['min_order_fee_formatted'] = EClassApi::numberFormat($fee['min_order_fee']);
                    $fee['free_delivery_formatted'] = EClassApi::numberFormat($fee['free_delivery']);
                    $list_fee[$did] = $fee;
                }
            }
        }

        return $list_fee;
    }
 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>");
 }
Esempio n. 26
0
 public function edit($id)
 {
     $param['pageNo'] = 3;
     $param['user'] = UserModel::find($id);
     $param['cities'] = CityModel::all();
     return View::make('admin.user.edit')->with($param);
 }
Esempio n. 27
0
 public static function category_meta(\ApiParam $params)
 {
     $metaConfig = array();
     $category = \Category::loadByName($params->categoryEnglishName);
     $category->clientType = \Category::CLIENT_API;
     $city = \City::loadByName($params->cityEnglishName ?: 'shanghai');
     if (!isset(\Page::$context['city'])) {
         \Page::$context['city'] = $city;
     }
     if (!isset(\Page::$context['category'])) {
         \Page::$context['category'] = $category;
     }
     if (!isset($metaConfig['wanted']) && $category->get('wanted')) {
         $meta = \Meta::factory('Radio', $category)->set('name', "wanted")->set('displayName', '供求')->set('controlView', 'radio')->set('style', 'required')->set('values', '1,0')->set('labels', explode('|', $category->get('wanted')));
         $metaConfig['wanted'] = self::metaConfig($meta, $city, $category, $params);
     }
     foreach ($category->metas() as $meta) {
         if (empty($meta->name)) {
             continue;
         }
         $metaConfig[$meta->name] = self::metaConfig($meta, $city, $category, $params);
     }
     //todo 暂时兼容
     if (!isset($metaConfig['images'])) {
         $meta = \Meta::factory('Input', $category)->set('name', "images")->set('displayName', '照片')->set('controlView', 'image')->set('style', '');
         $metaConfig['images'] = self::metaConfig($meta, $city, $category, $params);
     }
     return $metaConfig;
 }
Esempio n. 28
0
 public static function newInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Esempio n. 29
0
 public function run()
 {
     $country = Country::model()->findAll(['order' => 'country_order']);
     $region = Regions::model()->findAllByAttributes(['id_country' => $this->model['countries']]);
     $city = City::model()->findAllByAttributes(['id_region' => $this->model['region']]);
     $this->render('main', ['model' => $this->model, 'title' => $this->title, 'prefix_name' => $this->prefixName, 'country' => $country, 'region' => $region, 'city' => $city]);
 }
Esempio n. 30
0
 public function actionMore()
 {
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/enjoy.css');
     $city_id = Yii::app()->request->getQuery('city', 0);
     $time_sort = Yii::app()->request->getQuery('time_sort', 'DESC');
     $price_sort = Yii::app()->request->getQuery('lp_dol');
     $criteria = new CDbCriteria();
     $criteria->order = 'id DESC';
     if (!empty($city_id)) {
         $criteria->addCondition('city_id=' . $city_id);
     }
     if (!empty($time_sort)) {
         $criteria->order = 'accessDate ' . $time_sort;
     }
     if (!empty($price_sort)) {
         $criteria->order = 'lp_dol ' . $price_sort;
     }
     $criteria->addCondition('lp_dol>3000000');
     $count = House::model()->count($criteria);
     $pager = new CPagination($count);
     $pager->pageSize = 10;
     $pager->applyLimit($criteria);
     $house_list = House::model()->findAll($criteria);
     $subject_list = Subject::model()->findAll(array('order' => 'id DESC'));
     $cur_city = City::model()->findByPk($city_id);
     $data = array('house_list' => $house_list, 'subject_list' => $subject_list, 'cur_city' => $cur_city, 'count' => $count, 'time_sort' => $time_sort, 'price_sort' => $price_sort, 'pages' => $pager);
     $this->render('more', $data);
 }