当前位置: 首页>>代码示例>>PHP>>正文


PHP Location类代码示例

本文整理汇总了PHP中Location的典型用法代码示例。如果您正苦于以下问题:PHP Location类的具体用法?PHP Location怎么用?PHP Location使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Location类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getObjectStructure

 static function getObjectStructure()
 {
     global $user;
     //Load Libraries for lookup values
     $location = new Location();
     $location->orderBy('displayName');
     if ($user->hasRole('libraryAdmin')) {
         $homeLibrary = Library::getPatronHomeLibrary();
         $location->libraryId = $homeLibrary->libraryId;
     }
     $location->find();
     $locationList = array();
     while ($location->fetch()) {
         $locationList[$location->locationId] = $location->displayName;
     }
     require_once ROOT_DIR . '/sys/Browse/BrowseCategory.php';
     $browseCategories = new BrowseCategory();
     $browseCategories->orderBy('label');
     $browseCategories->find();
     $browseCategoryList = array();
     while ($browseCategories->fetch()) {
         $browseCategoryList[$browseCategories->textId] = $browseCategories->label . " ({$browseCategories->textId})";
     }
     $structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the hours within the database'), 'locationId' => array('property' => 'locationId', 'type' => 'enum', 'values' => $locationList, 'label' => 'Location', 'description' => 'A link to the location which the browse category belongs to'), 'browseCategoryTextId' => array('property' => 'browseCategoryTextId', 'type' => 'enum', 'values' => $browseCategoryList, 'label' => 'Browse Category', 'description' => 'The browse category to display '), 'weight' => array('property' => 'weight', 'type' => 'numeric', 'label' => 'Weight', 'weight' => 'Defines how lists are sorted within the widget.  Lower weights are displayed to the left of the screen.', 'required' => true));
     foreach ($structure as $fieldName => $field) {
         $field['propertyOld'] = $field['property'] . 'Old';
         $structure[$fieldName] = $field;
     }
     return $structure;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:30,代码来源:LocationBrowseCategory.php

示例2: add

 public function add()
 {
     $location = new LocationForm();
     $form = $location->form();
     if ($this->request->isPost()) {
         $form->setFieldValues($this->request->getPost());
         if ($form->isValid()) {
             $country_name = $this->request->getPost('lace-country-name');
             //get country
             $country_iso3 = $this->request->getPost('lace-country-iso3');
             //get iso3
             $country_iso2 = $this->request->getPost('lace-country-iso2');
             //get iso2
             $post_code = $this->request->getPost('lace-postcode');
             //get post code
             $enabled = $this->request->getPost('lace-enabled');
             //get enabled
             $location = new Location();
             $location->save(['name' => $country_name, 'iso_code_3' => $country_iso3, 'iso_code_2' => $country_iso2, 'postcode_required' => isset($post_code) ? $post_code : 0, 'status' => isset($enabled) ? $enabled : 0]);
             //redirect to country
             $this->session->setRequestValue('success', 'Country Successfully Added', 1);
             $this->response->redirect($this->request->getBasePath() . '/' . $this->request->getPath(0) . '/locations');
         }
     }
     $this->setView('location/add_country');
     $this->view->title = 'Add Location';
     $this->view->form = $form;
     $this->response->setBody($this->view->render());
     $this->response->send();
 }
开发者ID:OpenSourceAfrica,项目名称:lacecart,代码行数:30,代码来源:LocationsController.php

示例3: index_post

 /**
  * Upload an image via form-data.
  * Allowed only .jpg format.
  *
  * Optional parameters: (lat, lon), tag, description.
  */
 function index_post()
 {
     header('Access-Control-Allow-Origin: *');
     if (!isset($_FILES['image'])) {
         $this->response(error('Provide \'image\' parameter.', 400), 400);
         return;
     }
     $imageBytes = $_FILES['image'];
     $imageDescription = $this->post('description');
     $lat = $this->post('lat');
     $lon = $this->post('lon');
     $location = null;
     if ($lat != null && $lon != null) {
         $location = new Location();
         $location->setLat((double) $lat);
         $location->setLon((double) $lon);
     }
     $tagValue = $this->post('tag');
     $tag = null;
     if ($tagValue != null) {
         $tag = new Tag();
         $tag->setValue($tagValue);
     }
     $imageModel = new ImageModel($this->db);
     try {
         $image = $imageModel->createImage($imageBytes, $imageDescription, $tag, $location);
         $this->response($image->serialize(), 201);
     } catch (ImageAlreadyExistsException $e) {
         $this->response(error('Image already exists.', 409), 409);
     } catch (InvalidImageExtensionException $e) {
         $this->response(error('Invalid image extension. Allowed only .jpg.', 400), 400);
     }
 }
开发者ID:Rudianasaja,项目名称:ImageWall,代码行数:39,代码来源:images.php

示例4: isTFTP

 public function isTFTP()
 {
     $Location = new Location($this->get('locationID'));
     if ($Location && $Location->isValid()) {
         return $Location->get('tftp');
     }
 }
开发者ID:bramverstraten,项目名称:fogproject,代码行数:7,代码来源:LocationAssociation.class.php

示例5: RegexpRuleResultAssignTest

 /**
  * @test
  */
 public function RegexpRuleResultAssignTest()
 {
     global $DB, $PF_CONFIG;
     $DB->connect();
     $rule = new Rule();
     $location = new Location();
     $input = array('name' => 'Monsols04', 'entities_id' => 0);
     $location->add($input);
     $input = array('is_active' => 1, 'name' => 'Location regexp', 'match' => 'AND', 'sub_type' => 'PluginFusioninventoryInventoryRuleLocation', 'ranking' => 1);
     $rules_id = $rule->add($input);
     // Add criteria
     $rulecriteria = new RuleCriteria();
     $input = array('rules_id' => $rules_id, 'criteria' => "name", 'pattern' => "/computer (.*)/", 'condition' => PluginFusioninventoryInventoryRuleLocation::REGEX_MATCH);
     $rulecriteria->add($input);
     // Add action
     $ruleaction = new RuleAction();
     $input = array('rules_id' => $rules_id, 'action_type' => 'assign', 'field' => 'locations_id', 'value' => 1);
     $ruleaction->add($input);
     $input = array('name' => 'computer Monsols04');
     $_SESSION["plugin_fusioninventory_entity"] = 0;
     $ruleLocation = new PluginFusioninventoryInventoryRuleLocationCollection();
     $ruleLocation->getCollectionPart();
     $loc = $ruleLocation->processAllRules($input, array());
     $a_references = array('locations_id' => 1, '_ruleid' => 50);
     $this->assertEquals($a_references, $loc, 'Location result assign_result');
     $rule->delete(array('id' => $rules_id), True);
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:30,代码来源:RuleLocationTest.php

示例6: departureBoard

 public function departureBoard(Location $location)
 {
     $url = $this->config->getRejseplanenBaseUrl() . '/departureBoard?id=' . urlencode($location->getId());
     $xml = file_get_contents($url);
     // file_put_contents('/tmp/data', $xml."\n");
     return $this->responseFactory->getDepartureBoardResponse($xml);
 }
开发者ID:pingvinen,项目名称:whatiscoming,代码行数:7,代码来源:RejseplanenService.class.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     DB::table('locations')->truncate();
     $locationClusterCmb = new Location();
     $locationClusterCmb->code = "CLS_001";
     $locationClusterCmb->name = "Colombo";
     $locationClusterCmb->location_type_id = 1;
     $locationClusterCmb->parent_location_id = 0;
     $locationClusterCmb->save();
     $locationRegMah = new Location();
     $locationRegMah->code = "REG_001";
     $locationRegMah->name = "Maharagama";
     $locationRegMah->location_type_id = 2;
     $locationRegMah->parent_location_id = $locationClusterCmb->id;
     $locationRegMah->save();
     $locationRegG5 = new Location();
     $locationRegG5->code = "REG_002";
     $locationRegG5->name = "Gampaha";
     $locationRegG5->location_type_id = 2;
     $locationRegG5->parent_location_id = $locationClusterCmb->id;
     $locationRegG5->save();
     $locationTmpNug = new Location();
     $locationTmpNug->code = "TMP_001";
     $locationTmpNug->name = "Nugegoda";
     $locationTmpNug->location_type_id = 3;
     $locationTmpNug->parent_location_id = $locationRegMah->id;
     $locationTmpNug->save();
 }
开发者ID:alexixim,项目名称:blood-bank,代码行数:34,代码来源:LocationsTableSeeder.php

示例8: getCountryList

 public function getCountryList()
 {
     /* Start here set the country list */
     App::import("Model", "Location");
     $location = new Location();
     $options = array('fields' => array('Location.county_name'));
     return $getLocationArray = $location->find('list', $options);
 }
开发者ID:agashish,项目名称:wms_master,代码行数:8,代码来源:CommonComponent.php

示例9: addLocation

 /**
  * @param \Sitemapper\Url $url
  */
 public function addLocation(Location $location)
 {
     $node = $this->root->appendChild($this->doc->createElement(static::URL_NODE_NAME));
     $node->appendChild($this->doc->createElement('loc', $location->getLocation()));
     if ($location->getLastModification()) {
         $node->appendChild($this->doc->createElement('lastmod', $location->getLastModification()));
     }
     return $node;
 }
开发者ID:marcelomx,项目名称:sitemapper,代码行数:12,代码来源:AbstractSitemap.php

示例10: actionAdmin

 public function actionAdmin()
 {
     $model = new Location('search');
     $model->unsetAttributes();
     if (isset($_GET['Location'])) {
         $model->setAttributes($_GET['Location']);
     }
     $this->render('admin', array('model' => $model));
 }
开发者ID:shakyapranin,项目名称:IMS,代码行数:9,代码来源:LocationController.php

示例11: testLocationModel

 public function testLocationModel()
 {
     $location = new Location();
     $location->name = '';
     $location->longitude = '33.979700';
     $location->latitude = '-84.001750';
     $location->description = 'A challenging maze';
     $location->save();
 }
开发者ID:Abenaman,项目名称:ggc-talk,代码行数:9,代码来源:LocationTest.php

示例12: testLocationByPosition

 public function testLocationByPosition()
 {
     $Location = new Location();
     $Location->setPosition(49.9, 7.77);
     $Forecast = new Forecast(new Openweathermap(), $Location);
     $object = $Forecast->object();
     if ($object->isEmpty()) {
         $this->markTestSkipped('Openweathermap: Position "49,9, 7.77" was not available.');
     }
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:10,代码来源:ForecastTest.php

示例13: getDistanceInMetersTo

 public function getDistanceInMetersTo(Location $other)
 {
     $radiusOfEarth = 6371000;
     // Earth's radius in meters.
     $diffLatitude = $other->getLatitude() - $this->latitude;
     $diffLongitude = $other->getLongitude() - $this->longitude;
     $a = sin($diffLatitude / 2) * sin($diffLatitude / 2) + cos($this->latitude) * cos($other->getLatitude()) * sin($diffLongitude / 2) * sin($diffLongitude / 2);
     $c = 2 * asin(sqrt($a));
     $distance = $radiusOfEarth * $c;
     return $distance;
 }
开发者ID:RyanMolina,项目名称:MICRO,代码行数:11,代码来源:closestpoint.php

示例14: execute

 public function execute($lastRunDt = null)
 {
     $config = Zend_Registry::get('config');
     $checkDtStart = new Zend_Date($this->_lastRunDt);
     $checkDtStart->subHour($config->user->numHoursEvaluationReminder->val);
     $checkDtEnd = new Zend_Date();
     $checkDtEnd->subHour($config->user->numHoursEvaluationReminder->val);
     $event = new Event();
     $events = $event->getEvents(null, null, null, $checkDtStart->getTimestamp(), $checkDtEnd->getTimestamp(), 'open');
     $location = new Location();
     $workshop = new Workshop();
     $instructor = new Event_Instructor();
     $attendee = new Event_Attendee();
     $eu = new Evaluation_User();
     foreach ($events as $e) {
         $startDt = strtotime($e->date . ' ' . $e->startTime);
         $endDt = strtotime($e->date . ' ' . $e->endTime);
         if ($checkDtStart->getTimestamp() < $endDt && $checkDtEnd->getTimestamp() >= $endDt) {
             $evalAvailableDt = new Zend_Date($endDt);
             $evalAvailableDt->addHour($config->user->numHoursEvaluationAvailability->val);
             if ($evalAvailableDt->getTimestamp() > time()) {
                 $taken = $eu->getCompleted($e->eventId);
                 $thisLocation = $location->find($e->locationId);
                 if (is_null($thisLocation)) {
                     throw new Ot_Exception_Data('msg-error-noLocation');
                 }
                 $thisWorkshop = $workshop->find($e->workshopId);
                 if (is_null($thisWorkshop)) {
                     throw new Ot_Exception_Data('msg-error-noWorkshop');
                 }
                 $instructors = $instructor->getInstructorsForEvent($e->eventId);
                 $instructorNames = array();
                 $instructorEmails = array();
                 foreach ($instructors as $i) {
                     $instructorNames[] = $i['firstName'] . ' ' . $i['lastName'];
                     $instructorEmails[] = $i['emailAddress'];
                 }
                 $data = array('workshopName' => $thisWorkshop->title, 'workshopDate' => date('m/d/Y', $startDt), 'workshopStartTime' => date('g:i a', $startDt), 'workshopEndTime' => date('g:i a', $endDt), 'workshopMinimumEnrollment' => $e->minSize, 'workshopCurrentEnrollment' => $e->roleSize, 'locationName' => $thisLocation->name, 'locationAddress' => $thisLocation->address, 'instructorNames' => implode(', ', $instructorNames), 'instructorEmails' => implode(', ', $instructorEmails));
                 $attending = $attendee->getAttendeesForEvent($e->eventId, 'attending');
                 foreach ($attending as $a) {
                     if ($a['attended'] == 1 && !in_array($a['accountId'], $taken)) {
                         $trigger = new Ot_Trigger();
                         $trigger->setVariables($data);
                         $trigger->accountId = $a['accountId'];
                         $trigger->studentEmail = $a['emailAddress'];
                         $trigger->studentName = $a['firstName'] . ' ' . $a['lastName'];
                         $trigger->studentUsername = $a['username'];
                         $trigger->dispatch('Event_Evaluation_Reminder');
                     }
                 }
             }
         }
     }
 }
开发者ID:ncsuwebdev,项目名称:classmate,代码行数:54,代码来源:WorkshopEvaluationReminder.php

示例15: categorydispatchAction

 function categorydispatchAction()
 {
     try {
         $this->_helper->viewRenderer->setNoRender();
         $locationid = $this->_getParam('qloc');
         $category = $this->_getParam('qcategory');
         //echo $location;
         //echo $category;
         if (empty($locationid) || empty($category)) {
             $this->_redirect('/');
         } else {
             $location = new Location($locationid);
             $country = $location->getCountry();
             $city = $location->getUriCity();
             $state = $location->getUriState();
             /*
             $searchRules = $location->getSearchRules();
             
             			// Some locaiton only has state.
             if (empty($searchRules->city))
             {
             	$city = $state;
             }
             
             // Some locaiton only has city.
             if (empty($searchRules->state))
             {
             	$state = $city;
             }
             */
             $this->_redirect("/" . Tag::myUrlEncode($category) . "/" . $city . "/" . $state . "/" . $country . "/" . $locationid);
             /*
             $locationArray = explode('|', $location);
             $this->_redirect("/" . Tag::myUrlEncode($category) . "/" . Tag::myUrlEncode($locationArray[0]). "/" . Tag::myUrlEncode($locationArray[1]) . "/" . Tag::myUrlEncode($locationArray[2]) .  "/");
             */
             /*
             $routerParams = array(
             	'query' => $category,
                 'city'  => $locationArray[0],
             	'country' => $locationArray[1]
             );
             */
             //echo $this->_help->url($routerParams, 'user');
             // Redirect to results page
             //$this->_redirect("/" . Tag::myUrlEncode($category) . "/" . Tag::myUrlEncode($locationArray[0]). "/" . Tag::myUrlEncode($locationArray[1]));
         }
         // Using homepage template.
         //Hotspot_Plugin_ViewSetup::setUpSiteTemplate(Hotspot_Plugin_ViewSetup::SIMPLEVIEW);
         //$this->_helper->viewRenderer->setNoRender();
         //echo 'wlecome to hotspot101';
     } catch (Exception $e) {
         echo $e;
     }
 }
开发者ID:xinghao,项目名称:shs,代码行数:54,代码来源:IndexController.php


注:本文中的Location类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。