Esempio n. 1
0
 public function actionAdmin()
 {
     $this->rememberPage();
     $model = new Region('search');
     $model->setRememberScenario('region_remember');
     $this->render('admin', array_merge(array('model' => $model), $this->params));
 }
Esempio n. 2
0
 public function get()
 {
     $uid = (int) $_REQUEST['uid'];
     if ($uid == 0) {
         $uid = $this->user->id;
     }
     $user = new User();
     $user->get($uid);
     $userData = $user->getRaw();
     //region data
     $region = new Region();
     $regionData = $region->getRaw($userData['region']);
     $userData['region'] = array('id' => $regionData['id'], 'name' => $regionData['name']);
     //counrry data
     $country = new Country();
     $countryData = $country->getRaw($userData['country']);
     $userData['country'] = array('id' => $countryData['id'], 'name' => $countryData['name']);
     // myself
     if ($uid == $this->user->id) {
         $currencyQuantity = $user->getCurrency($userData['currency']);
         $userData['currencyName'] = $userData['currency'];
         $userData['currency'] = $currencyQuantity;
     } else {
         unset($userData['gold']);
         unset($userData['currency']);
     }
     unset($userData['password']);
     return $userData;
 }
Esempio n. 3
0
 public function searchDestination($mro)
 {
     try {
         //echo 'LMwebSoapClient searchDestination';
         $result = $this->sc->searchDestinations(array('mro' => $mro->getParamsAsArray()))->return;
     } catch (Exception $ex) {
         echo $ex->getMessage();
         return null;
     }
     if ($result->destinations->info == "NOHIT") {
         Template::errorTemplate("Keine Treffer gefunden");
         return null;
     }
     $regionList = array();
     if (is_array($result->destinations->regionList)) {
         foreach ($result->destinations->regionList as $value) {
             $region = new Region();
             $region->setParamsByArray($value);
             array_push($regionList, $region);
         }
     } else {
         $region = new Region();
         $region->setParamsByArray($result->destinations->regionList);
         array_push($regionList, $region);
     }
     return $regionList;
 }
Esempio n. 4
0
function encoder_redirect_success(Region $new_region)
{
    $new_region_name = $new_region->getRegionName();
    $dir = "VIEW/html/Encoder/Add_Place/Add_Place_Region_inc.php?success=1&Region_Name={$new_region_name}";
    $url = BASE_URL . $dir;
    header("Location:{$url}");
    //redirect the encoder to the regions add place
    exit;
}
 public function actionCheckParent()
 {
     $id = $_POST['val'];
     $region = new Region();
     $model = $region->getRegionListByParentId($id);
     if (!empty($model)) {
         $this->renderPartial('checkParent', array());
     } else {
         echo "null";
     }
 }
Esempio n. 6
0
 public function create()
 {
     $region = new Region();
     if ($this->input->post("name")) {
         $region->populate($this->input->post());
         if ($region->save()) {
             Notification::set(Regions::SUCCESS, "The region has been added");
             redirect("/regions/");
         }
     }
     $this->data["region"] = $region;
     $this->load->view("regions/create.tpl", $this->data);
 }
 /**
  * @param Region $region
  * @return bool
  * this function will add the region to the data base
  * takes region parameter
  */
 function Add_Region(Region $region)
 {
     $Region_Name = $region->getRegionName();
     $Region_Name_Amharic = $region->getRegionNameAmharic();
     //add the region to the region database
     $query = "INSERT INTO region (Name,Name_Amharic) VALUES('{$Region_Name}','{$Region_Name_Amharic}')";
     $result = mysqli_query($this->getDbc(), $query);
     if ($result) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
Esempio n. 8
0
 /**
 	@test
 	**/
 public function testLinkingMode()
 {
     $region = new Region();
     $this->assertEquals("current", $region->LinkingMode());
     $region->ID = 1;
     $this->assertEquals("link", $region->LinkingMode());
     for ($i = 2; $i <= 4; $i++) {
         $region->ID = $i;
         $this->assertEquals("link", $region->LinkingMode());
     }
     //$r1 = new RegionsPage_Controller();
     //$r1->setRequest()->param('ID') = '2';
     //var_dump($r1->getRequest()->param('ID'));
 }
Esempio n. 9
0
 public function getAllPaginated($start = 0, $pageSize = 20, $filter = "")
 {
     $theQuery = sprintf("SELECT `sights`.`id`,\n\t\t\t`sights`.`name`,\n\t\t\t`sights`.`description`,\n\t\t    `sights`.`subcat_id`,\n\t\t\t`sights`.`validated`,\n\t\t\t`sights`.`address`,\n\t\t    `sights_categories`.`id` as cat_id,\n\t\t    `sights_categories`.`name` as cat_name,\n        `localities`.`name` as loc_name,\n        `localities`.`region_id` as region_id,\n        `localities`.`latitudine` as latitude,\n        `localities`.`longitudine`as longitude\n\t\t    \tFROM `sights`\n\t\t    LEFT JOIN `sights_categories`\n\t\t    \tON `sights`.`cat_id` = `sights_categories`.`id`\n        LEFT JOIN `localities`\n          ON `sights`.`locality_id` = `localities`.`id`\n        %s\n        LIMIT %d, %d", $filter, $start, $pageSize);
     $query = $this->db->query($theQuery);
     $rez = [];
     $sCat = new SightCategory();
     $reg = new Region();
     foreach ($query->result_array() as $row) {
         $row["subcat_name"] = $sCat->getCategNameById($row["subcat_id"]);
         $row["region"] = $reg->getNameById($row["region_id"]);
         $rez[] = $row;
     }
     return $rez;
 }
Esempio n. 10
0
 public function __construct($sponsor_id = 0)
 {
     parent::__construct('sponsor', $sponsor_id);
     if ($sponsor_id) {
         $region = new Region($this->region_id(), $this->region_type());
         $office = new Office($this->office_id());
         $this->sponsor_id = $sponsor_id;
         $this->office = $this->title();
         $this->full_name = $this->name_first() . ' ' . $this->name_last();
         $this->img_name = $this->image();
         $this->public_image = $this->get_image_src();
         $this->image = $this->get_image_src();
         $this->region = $region->city_name();
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $rules = array("regionId" => "required", "regionName" => "required");
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/region/create')->withErrors($validator);
     }
     //
     $region = new Region();
     $region->regionID = Input::get('regionId');
     $region->regionName = Input::get('regionName');
     $region->save();
     return Redirect::to('/region');
 }
 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 getMyprofile()
 {
     $id = Auth::user()->id;
     $alumni_id = null;
     $sql = "SELECT * FROM alumni WHERE account_id = ?";
     $prof = DB::select($sql, array($id));
     if ($prof != null) {
         $alumni_id = $prof[0]->id;
     }
     $sql2 = "SELECT * FROM degree WHERE alumni_id = ?";
     $deg = DB::select($sql2, array($alumni_id));
     $sql3 = "SELECT * FROM work_experience WHERE alumni_id = ?";
     $wrk_exp = DB::select($sql3, array($alumni_id));
     $sql4 = "SELECT * FROM certificate WHERE alumni_id = ?";
     $certificate = DB::select($sql4, array($alumni_id));
     // $sql5 = "SELECT * FROM alumni_tracer WHERE alumni_id = ?";
     $sql5 = "SELECT at.*, sq.question, sc.choice\n\t\t\t\tFROM alumni_tracer AS at\n\t\t\t\tINNER JOIN survey_questions AS sq\n\t\t\t\tON sq.id = at.question_id\n\t\t\t\tINNER JOIN survey_choices AS sc\n\t\t\t\tON sc.id = at.choice_id\n\t\t\t\tWHERE at.alumni_id = ?\n\t\t\t\tORDER BY at.question_id";
     $a_tracer = DB::select($sql5, array($alumni_id));
     $dept = Department::all();
     $region = Region::all();
     $province = Province::all();
     $occupation = Occupation::all();
     $company = Company::all();
     $deg_title = DegreeTitle::all();
     $school = School::all();
     $jobs = Job::all();
     $field = Field::all();
     $questions = DB::select("SELECT * FROM survey_questions");
     $civil_status = DB::select("SELECT * FROM civil_status");
     return View::make('user.profile')->with('company', $company)->with('field', $field)->with('occupation', $occupation)->with('work_exp', $wrk_exp)->with('degree', $deg)->with('a_tracer', $a_tracer)->with('certificate', $certificate)->with('school', $school)->with('deg_title', $deg_title)->with('profile', $prof)->with('dept', $dept)->with('region', $region)->with('province', $province)->with('civil_status', $civil_status)->with('questions', $questions)->with('jobs', $jobs);
 }
Esempio n. 14
0
 protected function fieldRegion($jsAction = "")
 {
     $output = "";
     $allRegions = Region::getAllRows();
     echo "HERE";
     $output .= "<select name=\"" . static::regionIdFieldName . "\" {$jsAction}>\n";
     /* The following logic will determine the selected option */
     /* Chose a do...while() in order to avoid code duplication for the 'selected' option logic */
     $regionId = static::anyRegionCode;
     $regionName = "Any region";
     $firstRow = true;
     do {
         if (!$firstRow) {
             $regionId = Region::getRegionId($row);
             $regionName = Region::getRegionName($row);
         } else {
             $firstRow = false;
         }
         if ($this->searchedRegionId == $regionId) {
             $selected = "selected";
         } else {
             $selected = "";
         }
         /* here is the actual option output */
         $output .= " <option {$selected} value =\"{$regionId}\">{$regionName}</option>\n";
     } while (($row = $allRegions->fetch_row()) != NULL);
     $output .= "</select>\n";
     return $output;
 }
Esempio n. 15
0
 public function updateCMSFields(FieldList $fields)
 {
     $fields->insertBefore(new Tab('MembershipDetails', 'Membership Details'), 'Main');
     //move first and ;astname
     $fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('FirstName'));
     $fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('Surname'));
     $fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('Email'));
     $fields->addFieldToTab('Root.MembershipDetails', $region = DropdownField::create('RegionID', 'Region', Region::get()->map('ID', 'Title')));
     $region->setEmptyString(' ');
     $fields->addFieldToTab('Root.MembershipDetails', DropdownField::create('MembershipStatus', 'Membership Status', $this->owner->dbObject('MembershipStatus')->enumValues()));
     $fields->addFieldToTab('Root.MembershipDetails', $expiry = DateField::create('ExpiryDate'));
     $fields->addFieldToTab('Root.MembershipDetails', DropdownField::create('Discount', 'Discount', $this->owner->dbObject('Discount')->enumValues()));
     $fields->addFieldToTab('Root.MembershipDetails', $discountExpiry = DateField::create('DiscountExpiryDate'));
     $fields->addFieldToTab('Root.MembershipDetails', $joined = DateField::create('JoinedDate'));
     $fields->addFieldToTab('Root.MembershipDetails', TextareaField::create('NotesForMember'));
     if ($this->owner->MembershipStatus !== "Not applied") {
         $fields->addFieldToTab('Root.MembershipDetails', TextField::create('MemberNumber'));
     }
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('HomePhone'));
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('WorkPhone'));
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('MobilePhone'));
     $fields->addFieldToTab('Root.MembershipDetails', TextareaField::create('Address'));
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('Occupation'));
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('BirthDate'));
     $expiry->setConfig('showcalendar', true);
     $expiry->setConfig('showdropdown', true);
     $expiry->setConfig('dateformat', 'dd-MM-YYYY');
     $discountExpiry->setConfig('showcalendar', true);
     $discountExpiry->setConfig('showdropdown', true);
     $discountExpiry->setConfig('dateformat', 'dd-MM-YYYY');
     $joined->setConfig('showcalendar', true);
     $joined->setConfig('showdropdown', true);
     $joined->setConfig('dateformat', 'dd-MM-YYYY');
 }
 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. 17
0
 public static function newInstance()
 {
     if( !self::$instance instanceof self ) {
         self::$instance = new self;
     }
     return self::$instance;
 }
Esempio n. 18
0
 public function create()
 {
     $paises = Pais::all();
     $estados = Region::all();
     $categorias = CategoriasNegocio::lists('nombre', 'id');
     return View::make('negocios.create')->with('paises', $paises)->with('estados', $estados)->with('categorias', $categorias);
 }
Esempio n. 19
0
 /**
  * List region by country code
  * 
  * @url GET /country/$code/region
  */
 public function getRegionbyCountry($code)
 {
     if ($code) {
         return Region::newInstance()->findByCountry($code);
     }
     return array();
 }
Esempio n. 20
0
 public function getNonCurrentRegions()
 {
     if (null === $this->_nonCurrentRegions) {
         $this->_nonCurrentRegions = Region::model()->findAll('id != :regionId', array(':regionId' => $this->currentRegion->id));
     }
     return $this->_nonCurrentRegions;
 }
Esempio n. 21
0
 public function utcToLocal($datetime)
 {
     $region = Region::model()->findByPk(Yii::app()->session['region']);
     $timeZoneName = $region->time_zone;
     $timezone = new DateTimeZone($timeZoneName);
     $offset = $timezone->getOffset(new DateTime());
     return strtotime($datetime) + $offset;
 }
 public function show(SS_HTTPRequest $request)
 {
     $region = Region::get()->byID($request->param('ID'));
     if (!$region) {
         return $this->httpError(404, 'That region could not be found');
     }
     return array('Region' => $region, 'Title' => $region->Title);
 }
Esempio n. 23
0
 /**
  * @return Region
  */
 public function getRegion()
 {
     //lazy load the region
     if ($this->_region === null) {
         $this->_region = Region::finder()->findByPk($this->RegionID);
     }
     return $this->_region;
 }
Esempio n. 24
0
 public function loadRegion($id)
 {
     $model = Region::model()->findByPk($id);
     if (null === $model) {
         throw new CHttpException(404, Yii::t('app', 'The requested page does not exist.'));
     }
     return $model;
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     //
     $newId = Supplier::generateId();
     $areas = Area::all();
     $regions = Region::all();
     return View::make('supplier.new', ['id' => $newId, 'areas' => $areas, 'regions' => $regions]);
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     //
     $newId = Warehouse::generateId();
     $areas = Area::all();
     $regions = Region::all();
     return View::make('warehouse.new', ['id' => $newId, 'areas' => $areas, 'regions' => $regions]);
 }
 function FieldHolder()
 {
     $regions = Region::shipping_regions();
     $jsonRegions = json_encode($regions);
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascriptTemplate('swipestripe/javascript/RegionField.js', array("regions" => $jsonRegions, 'defaultValue' => $this->Value()));
     return parent::FieldHolder();
 }
Esempio n. 28
0
 public function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create('Root'));
     $fields->addFieldsToTab('Root.Main', array(TextField::create('Title'), TextareaField::create('Description'), CurrencyField::create('PricePerNight', 'Price (per night)'), DropdownField::create('Bedrooms')->setSource(ArrayLib::valuekey(range(1, 10))), DropdownField::create('Bathrooms')->setSource(ArrayLib::valuekey(range(1, 10))), DropdownField::create('RegionID', 'Region')->setSource(Region::get()->map('ID', 'Title'))->setEmptyString('-- Select a region --'), CheckboxField::create('FeaturedOnHomepage', 'Feature on homepage')));
     $fields->addFieldToTab('Root.Photos', $upload = UploadField::create('PrimaryPhoto', 'Primary photo'));
     $upload->getValidator()->setAllowedExtensions(array('png', 'jpeg', 'jpg', 'gif'));
     $upload->setFolderName('property-photos');
     return $fields;
 }
Esempio n. 29
0
 public function processRegion($patientquery, $visitquery, $value, $title = "")
 {
     if ($value != "all") {
         $title .= " From " . Region::find($value)->region . " Region ";
         $patientquery->whereIn('id', PatientReport::where('region', $value)->get()->lists('patient_id') + array('0'));
         $visitquery->whereIn('id', PatientInfo::where('region', $value)->get()->lists('visit_id') + array('0'));
     }
     return array($patientquery, $visitquery, $title);
 }
Esempio n. 30
0
 public function region(SS_HTTPRequest $r)
 {
     $region = Region::get()->byID($r->param('ID'));
     if (!$region) {
         return $this->httpError(404, 'That region was not found');
     }
     $this->articleList = $this->articleList->filter(array('RegionID' => $region->ID));
     return array('SelectedRegion' => $region);
 }