本文整理汇总了PHP中Location::getID方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::getID方法的具体用法?PHP Location::getID怎么用?PHP Location::getID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Location
的用法示例。
在下文中一共展示了Location::getID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSave
public function testSave()
{
$loc = new Location();
$loc->setBuildingID(1);
$loc->setRoom(9999);
$loc->save();
$this->assertTrue($loc->getID() != NULL);
$fetched = new Location();
$fetched->fetch($loc->getID());
$this->assertEquals($fetched->getID(), $loc->getID());
$this->assertEquals($fetched->getBuildingID(), $loc->getBuildingID());
$this->assertEquals($fetched->getRoom(), $loc->getRoom());
//delete from DB for cleanup
//TODO -- replace with proper delete method
$sql = "DELETE FROM `locations` WHERE id=?";
$sql = $this->db->prepareQuery($sql, $loc->getID());
$this->db->query($sql);
}
示例2: Location
<?php
require 'models/config.php';
$loc = new Location();
$loc->setBuildingID(10);
$loc->save();
echo $loc->getID();
示例3: realadd
/**
* Really add the kill.
* @param integer $id If set, use the given id to post this kill.
* @return integer
*/
protected function realadd($id = null)
{
if ($this->timestamp == "" || !$this->getVictim()->getID() || !$this->victimship->getName() || !$this->solarsystem->getID() || !$this->victimallianceid || !$this->victimcorpid || !$this->getFBPilotID() || !$this->getHash(false, false)) {
return 0;
}
// TODO: Redo accounting for ammo (see kill_detail).
// // Check slot counts.
// $locations = array();
// foreach ($this->droppeditems_ as $dest) {
// $locations[$dest->getLocationID()] += $dest->getQuantity();
// }
// foreach ($this->destroyeditems_ as $dest) {
// $locations[$dest->getLocationID()] += $dest->getQuantity();
// }
// $dogma = Cacheable::factory('dogma', $this->victimship->getID());
// $lowcount = (int)$dogma->attrib['lowSlots']['value'];
// $medcount = (int)$dogma->attrib['medSlots']['value'];
// $hicount = (int)$dogma->attrib['hiSlots']['value'];
// // Is there anything flyable that has no rig slots?
// $rigcount = (int)($dogma->attrib['rigSlots']['value'] ?
// $dogma->attrib['rigSlots']['value'] : 3);
// $subcount = 5;
// if ($lowcount
// && ($locations[1] > $hicount
// || $locations[2] > $medcount
// || $locations[3] > $lowcount
// || $locations[5] > $rigcount)
// ) {
// return 0;
// } else if ((!$lowcount && $locations[7])
// && ($locations[7] > $subcount
// || $locations[5] > $rigcount)
// ) {
// return 0;
// }
if ($id == null) {
$qid = 'null';
} else {
$qid = $id;
}
if (!$this->dmgtaken) {
$this->dmgtaken = 0;
}
if (is_null($this->xCoordinate)) {
$this->xCoordinate = 0;
}
if (is_null($this->yCoordinate)) {
$this->yCoordinate = 0;
}
if (is_null($this->zCoordinate)) {
$this->zCoordinate = 0;
}
$mysqlTimestamp = toMysqlDateTime($this->timestamp);
$qry = DBFactory::getDBQuery();
$sql = "INSERT INTO kb3_kills\n (kll_id , kll_timestamp , kll_victim_id , kll_all_id , kll_crp_id , kll_ship_id , kll_system_id , kll_fb_plt_id , kll_points , kll_dmgtaken, kll_external_id, kll_isk_loss, kll_x, kll_y, kll_z, kll_location)\n VALUES (" . $qid . ",\n '" . $mysqlTimestamp . "',\n " . $this->victimid . ",\n " . $this->victimallianceid . ",\n " . $this->victimcorpid . ",\n " . $this->victimship->getID() . ",\n " . $this->solarsystem->getID() . ",\n " . $this->getFBPilotID() . ",\n " . $this->calculateKillPoints() . ",\n " . $this->dmgtaken . ", ";
if ($this->externalid) {
$sql .= $this->externalid . ", ";
} else {
$sql .= "NULL, ";
}
$sql .= $this->getISKLoss() . ",\n " . $this->xCoordinate . ",\n " . $this->yCoordinate . ",\n " . $this->zCoordinate . ",";
if (!is_null($this->getNearestCelestial())) {
$sql .= $this->nearestCelestial->getID();
} else {
$sql .= "NULL";
}
$sql .= " )";
$qry->autocommit(false);
if (!$qry->execute($sql)) {
return $this->rollback($qry);
}
if ($id) {
$this->id = $id;
} else {
$this->id = $qry->getInsertID();
}
if (!$this->id) {
return $this->rollback($qry);
}
// involved
$order = 0;
$invall = array();
$invcrp = array();
$involveddsql = 'insert into kb3_inv_detail
(ind_kll_id, ind_timestamp, ind_plt_id, ind_sec_status, ind_all_id, ind_crp_id, ind_shp_id, ind_wep_id, ind_order, ind_dmgdone )
values ';
$involvedasql = 'insert into kb3_inv_all
(ina_kll_id, ina_all_id, ina_timestamp) values ';
$involvedcsql = 'insert into kb3_inv_crp
(inc_kll_id, inc_crp_id, inc_timestamp) values ';
$notfirstd = false;
$notfirsta = false;
$notfirstc = false;
// Make sure involved parties are ordered by damage done.
usort($this->involvedparties_, array('Kill', 'involvedComparator'));
//.........这里部分代码省略.........
示例4: setUpLocation
private function setUpLocation()
{
$location = new Location();
$buildingID = Location::lookupBuildingID($this->request['buildingName']);
if ($buildingID == false) {
//building not found
return -1;
}
$location->setBuildingID($buildingID);
//handle reports with no room or blank room set
if (isset($this->request['room']) && strtolower($this->request['room']) != 'null' && $this->request['room'] != '') {
$location->setRoom($this->request['room']);
}
$location->save();
//creates new location if necessary. sets id
return $location->getID();
}
示例5: createLocation
/**
* Creates a location and returns the new location as returned from the
* API.
*
* @param Google\MyBusiness\Location $location
* @param Google\MyBusiness\Account $account = null
* @param boolean $dryRun = false
*/
public function createLocation(Location $location, Account $account = null, $dryRun = false)
{
$ownerAccountID = $location->getOwnerAccountID();
if (strlen($ownerAccountID)) {
$account = new Account();
$account->setID($ownerAccountID);
} elseif ($account) {
self::_validateID($account);
} else {
$account = $this->_getCachedAccount();
}
if ($location->getID() !== null) {
throw new InvalidArgumentException('A new location may not already contain an ID.');
}
/* Even if the creation of new locations is disabled, we'll still allow
dry runs. */
if (!GOOGLE_MYBUSINESS_API_ALLOW_NEW_LOCATIONS && !$dryRun) {
throw new RuntimeException('Cannot create new locations unless the ' . 'GOOGLE_MYBUSINESS_API_ALLOW_NEW_LOCATIONS setting is ' . 'defined as true.');
}
$requestBody = array('location' => $location->toREST(), 'languageCode' => $location->getLanguageCode(), 'validateOnly' => $dryRun, 'requestId' => $location->getHash());
$request = new APIRequest($account->getName() . '/locations');
$request->setPayload(json_encode($requestBody));
$this->_parseCallback = '_parseLocationResponse';
return $this->_makeRequest($request);
}