本文整理汇总了PHP中Position类的典型用法代码示例。如果您正苦于以下问题:PHP Position类的具体用法?PHP Position怎么用?PHP Position使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Position类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testToString
public function testToString()
{
$p = new Position(5, 10);
$this->assertEquals("(5, 10)", $p->__toString());
$p = new Position(7, 8, "/foo/bar/baz.ebnf");
$this->assertEquals("/foo/bar/baz.ebnf (7, 8)", $p->__toString());
}
示例2: registerSendingRequest
public static function registerSendingRequest(Position $pos)
{
// update the this second count
self::_incrementRequestsInSeconds();
// finally update the current last position
self::_setCurPosition($pos->getMyPositionId());
}
示例3: has
public function has(Position $position) : bool
{
if ($this->columns->contains($position->column()) && $this->columns->get($position->column())->cells()->contains($position->row())) {
return true;
}
return false;
}
示例4: okToSendRequest
/**
* Wait for your number to come up so you could send a request
*
* @return bool OK to send request, otherwise wait
*/
public function okToSendRequest(Position $pos)
{
if (MemoryData::getNumRequestsThisSecond() <= 9 && MemoryData::getNumRequestsToday() < 100000 && ($pos->getPrevPositionId() == MemoryData::getCurrentPosition() || MemoryData::getSecondsSinceLastRequest() > 30)) {
MemoryData::registerSendingRequest($pos);
return true;
} else {
return false;
}
}
示例5: position
/**
* Position request
*/
public function position($uri)
{
$this->load->library('navitia/Hydrate');
$this->load->library('navitia/Coord');
$this->load->library('navitia/Position');
$position = new Position();
$position->load_uri($uri);
$data = array('api' => $position->getJSON(), 'html' => '');
$this->load->view('json', array('json' => json_encode($data)));
}
示例6: get_all_position
public static function get_all_position($connection)
{
$statement = $connection->prepare("SELECT * FROM position");
$statement->execute();
$result = $statement->get_result();
$positions = array();
while ($row = $result->fetch_assoc()) {
$position = new Position();
$position->set_name($row["position"]);
array_push($positions, $position);
}
return $positions;
}
示例7: add
public function add($postdata)
{
$data = json_decode($postdata);
$FirstName = $data->FirstName;
$LastName = $data->LastName;
$DOB = $data->DOB;
$Address1 = $data->Address1;
$Address2 = $data->Address2;
$City = $data->City;
$State = $data->State;
$PostalCode = $data->PostalCode;
$Phone = $data->Phone;
$HireDate = $data->HireDate;
$PositionID = $data->PositionID;
$CreatedDate = date("Y-m-d H:i:s");
$Active = $data->Active == true ? 1 : 0;
$this->FirstName = $FirstName;
$this->LastName = $LastName;
$this->DOB = $DOB;
$this->Address1 = $Address1;
$this->Address2 = $Address2;
$this->City = $City;
$this->State = $State;
$this->PostalCode = $PostalCode;
$this->Phone = $Phone;
$this->HireDate = $HireDate;
$this->PositionID = $PositionID;
$this->CreatedDate = $CreatedDate;
$this->Active = $Active;
$insertData = $this->save();
$this->FirstName = null;
$this->LastName = null;
$this->DOB = null;
$this->Address1 = null;
$this->Address2 = null;
$this->City = null;
$this->State = null;
$this->PostalCode = null;
$this->Phone = null;
$this->HireDate = null;
$this->PositionID = null;
$this->CreatedDate = null;
$this->Active = null;
$returndata = new stdClass();
$returndata->message = "Staff added successfully";
$returndata->success = true;
$obj = new Position($this->db);
$Position = $obj->getById($PositionID)->LongName;
$returndata->data = array('StaffID' => $insertData->_id, 'CreatedDate' => $CreatedDate, '_Position' => $Position);
return $returndata;
}
示例8: getInstance
/**
* Singleton Pattern
*
* Auto Create Object Instance.
*
*/
public static function getInstance()
{
if (null === self::$_objInstance) {
self::$_objInstance = new Position();
}
return self::$_objInstance;
}
示例9: loadModel
public function loadModel($id)
{
$model = Position::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例10: testCreate
function testCreate()
{
$x = 53;
$y = 87;
$pos = Position::create($x, $y);
$this->assertEquals($x, $pos->x);
$this->assertEquals($y, $pos->y);
$this->assertEquals("({$x}, {$y})", (string) $pos);
}
示例11: findDivisionLeaders
public static function findDivisionLeaders($gid)
{
$conditions = array('position_id @' => array(1, 2), 'game_id' => $gid);
$params = arrayToObject(Flight::aod()->from(Member::$table)->sortAsc('position_id')->sortDesc('rank_id')->where($conditions)->select()->many());
foreach ($params as $member) {
$position = Position::find($member->position_id);
$member->position_desc = $position->desc;
}
return $params;
}
示例12: getProcessInfo
public function getProcessInfo()
{
$data = array("name" => $this->name);
$preProcessName = FlowProcess::model()->fetchAllPreProcessName($this->flowid, $this->processid);
foreach ($preProcessName as $key => $value) {
$data["pre"][$key] = $value["name"];
}
if (!empty($this->processto)) {
foreach (explode(",", $this->processto) as $key => $toId) {
$toId = intval($toId);
if ($toId == 0) {
$data["next"][$key] = Ibos::lang("End");
} else {
$next = FlowProcess::model()->fetchProcess($this->flowid, $toId);
$data["next"][$key] = $next["name"];
}
if (isset($next) && !empty($next["processin"])) {
$data["prcsout"][$key]["name"] = $next["name"];
$data["prcsout"][$key]["con"] = $next["processin"];
}
}
}
if (!empty($this->processitem)) {
$itemPart = explode(",", $this->processitem);
$data["processitem"] = $this->processitem;
$data["itemcount"] = count($itemPart);
} else {
$data["processitem"] = "";
$data["itemcount"] = 0;
}
if (!empty($this->hiddenitem)) {
$itemPart = explode(",", $this->hiddenitem);
$data["hiddenitem"] = $this->hiddenitem;
$data["hiddencount"] = count($itemPart);
} else {
$data["hiddenitem"] = "";
$data["hiddencount"] = 0;
}
if (!empty($this->uid)) {
$data["user"] = User::model()->fetchRealnamesByUids($this->uid);
} else {
$data["user"] = "";
}
if (!empty($this->deptid)) {
$data["dept"] = Department::model()->fetchDeptNameByDeptId($this->deptid);
} else {
$data["dept"] = "";
}
if (!empty($this->positionid)) {
$data["position"] = Position::model()->fetchPosNameByPosId($this->positionid);
} else {
$data["position"] = "";
}
return $data;
}
示例13: calculateNewPoint
/**
* @param Movement $move
* @return Position
* return Posizione di Move.
*/
public function calculateNewPoint(Movement $move)
{
$destination = new Position($this->x, $this->y);
switch ($move->getDirection()) {
case Movement::NORTH:
$destination->setY($destination->getY() + $move->getSpeed());
break;
case Movement::SOUTH:
$destination->setY($destination->getY() - $move->getSpeed());
break;
case Movement::WEST:
$destination->setX($destination->getX() - $move->getSpeed());
break;
case Movement::EAST:
$destination->setX($destination->getX() + $move->getSpeed());
break;
default:
throw new \RuntimeException('errore direzione');
}
return $destination;
}
示例14: index
/**
* 首页.
*
* @version 0.1.0 by GenialX
* @since 0.0.1
*
* @author 水木清华 <admin@4u4v.net>
* @author GenialX
*/
public function index()
{
$this->_common();
$this->_header();
$this->_sider();
$this->_footer();
/** 获取最新职位 **/
$data = $this->get('data') ? $this->get('data') : array();
$data['lastPositions'] = Position::getLastPositions();
$this->assign("data", $data);
$this->display();
}
示例15: gavno
protected function gavno()
{
$position = [];
$list = \Schedule::model()->findAllBySql('select * from spbp_listner_schedule a
join spbp_listner_position b on a.position_id = b.id
join spbp_form_form c on b.form_id = c.id
where a.number = c.number AND a.end_time < now() AND b.status = 1');
foreach ($list as $value) {
$a = \Position::model()->findByPk($value->position_id);
array_push($position, $a);
}
return $position;
}