本文整理汇总了PHP中Region类的典型用法代码示例。如果您正苦于以下问题:PHP Region类的具体用法?PHP Region怎么用?PHP Region使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Region类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionAdmin
public function actionAdmin()
{
$this->rememberPage();
$model = new Region('search');
$model->setRememberScenario('region_remember');
$this->render('admin', array_merge(array('model' => $model), $this->params));
}
示例2: get
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;
}
示例3: searchDestination
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;
}
示例4: encoder_redirect_success
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;
}
示例5: actionCheckParent
public function actionCheckParent()
{
$id = $_POST['val'];
$region = new Region();
$model = $region->getRegionListByParentId($id);
if (!empty($model)) {
$this->renderPartial('checkParent', array());
} else {
echo "null";
}
}
示例6: create
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);
}
示例7: Add_Region
/**
* @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;
}
}
示例8: testLinkingMode
/**
@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'));
}
示例9: getAllPaginated
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;
}
示例10: __construct
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();
}
}
示例11: store
/**
* 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');
}
示例12: editAction
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");
}
示例13: getMyprofile
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);
}
示例14: fieldRegion
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;
}
示例15: updateCMSFields
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');
}