• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Position类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Position类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
 }
开发者ID:bgarrels,项目名称:ebnf,代码行数:7,代码来源:PositionTest.php


示例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());
 }
开发者ID:sergrin,项目名称:crawlers-il,代码行数:7,代码来源:MemoryData.php


示例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;
 }
开发者ID:baptouuuu,项目名称:spreadsheet,代码行数:7,代码来源:Sheet.php


示例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;
     }
 }
开发者ID:sergrin,项目名称:crawlers-il,代码行数:14,代码来源:RequestManager.php


示例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)));
 }
开发者ID:VSasyan,项目名称:navitia,代码行数:13,代码来源:Navitia.php


示例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;
 }
开发者ID:kennho,项目名称:cs2102,代码行数:13,代码来源:position.php


示例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;
 }
开发者ID:parth1403,项目名称:CarTracker_PHP,代码行数:51,代码来源:Staff.php


示例8: getInstance

 /**
  * Singleton Pattern
  *
  * Auto Create Object Instance.
  *
  */
 public static function getInstance()
 {
     if (null === self::$_objInstance) {
         self::$_objInstance = new Position();
     }
     return self::$_objInstance;
 }
开发者ID:edupol,项目名称:examsystem,代码行数:13,代码来源:Position.php


示例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;
 }
开发者ID:vasitjuntong,项目名称:carsnru,代码行数:8,代码来源:PositionController.php


示例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);
 }
开发者ID:eridal,项目名称:vindinium,代码行数:9,代码来源:PositionTest.php


示例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;
 }
开发者ID:Oogieboogie23,项目名称:Division-Tracker,代码行数:10,代码来源:Division.php


示例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;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:55,代码来源:ICFlowProcess.php


示例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;
 }
开发者ID:ebasirico,项目名称:school-project,代码行数:26,代码来源:Position.php


示例14: index

 /**
  * 首页.
  * 
  * @version 0.1.0 by GenialX
  * @since   0.0.1
  * 
  * @author 水木清华 <[email protected]>
  * @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();
 }
开发者ID:echenxin-company,项目名称:TongXinRen,代码行数:21,代码来源:IndexAction.class.php


示例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;
 }
开发者ID:shipovalovyuriy,项目名称:spasibeaucoup,代码行数:13,代码来源:FrontController.php


示例16: testGetByArea

 /**
  * @covers ::getByArea
  */
 public function testGetByArea()
 {
     $position = (object) array('positionId' => 1, 'positionName' => 'MY POSITION', 'positionDescription' => 'THIS IS A COOL JOB', 'employeeArea' => 2, 'deleted' => 0, 'guid' => null);
     $position2 = (object) array('positionId' => 2, 'positionName' => 'MY POSITION', 'positionDescription' => 'THIS IS A COOL JOB', 'employeeArea' => 2, 'deleted' => 0, 'guid' => null);
     $accessor = new Position();
     $model = new Position();
     $model->save($position);
     $model2 = new Position();
     $model2->save($position2);
     $position = $accessor->getByArea(2);
     $this->assertEquals(2, count($position));
     // Clean up
     $host = getenv('DBHOST');
     $user = getenv('DBUSER');
     $pass = getenv('DBPASS');
     $db = getenv('DBNAME');
     $connectStr = "mysql:dbname=" . $db . ";host=" . $host . ";port=3306";
     $options = array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_OBJ);
     $pdo = new \PDO($connectStr, $user, $pass, $options);
     $stmt = $pdo->prepare("DELETE FROM positions");
     $stmt->execute();
 }
开发者ID:byu-oit-ssengineering,项目名称:team-managment-tool,代码行数:25,代码来源:PositionTest.php


示例17: execute

 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $web = new sfWebBrowser();
     $latest = Doctrine::getTable('Position')->createQuery('p')->limit(1)->orderBy('p.timestamp DESC')->fetchOne();
     $this->logSection($this->namespace, 'Getting latest instamapper positions');
     $instamapper = $web->get('http://www.instamapper.com/api?action=getPositions&key=' . sfConfig::get('app_instamapper_api_key') . '&num=1000' . ($latest instanceof Position ? '&from_ts=' . $latest->getTimestamp() : '') . '&format=json');
     try {
         if (!$instamapper->responseIsError()) {
             $json = json_decode($instamapper->getResponseText());
             foreach ($json->positions as $gps) {
                 if (!$latest instanceof Position || $gps->timestamp >= $latest->getTimestamp()) {
                     $position = new Position();
                     $position->setDeviceKey($gps->device_key);
                     $position->setDeviceLabel($gps->device_label);
                     $position->setTimestamp($gps->timestamp);
                     $position->setLatitude($gps->latitude);
                     $position->setLongitude($gps->longitude);
                     $position->setAltitude($gps->altitude);
                     $position->setSpeed($gps->speed);
                     $position->setHeading($gps->heading);
                     $position->save();
                     echo '.';
                     $this->new++;
                 }
             }
         } else {
             // Error response (eg. 404, 500, etc)
         }
     } catch (Exception $e) {
         // Adapter error (eg. Host not found)
     }
     echo "\n";
     $this->logSection($this->namespace, 'Done: ' . $this->new . ' added.');
 }
开发者ID:benlumley,项目名称:followben,代码行数:36,代码来源:getPositionsTask.class.php


示例18: _edit

 public static function _edit()
 {
     $user = User::find(intval($_SESSION['userid']));
     $member = Member::findByMemberId($_POST['member_id']);
     $platoons = Platoon::find_all($member->game_id);
     // if user role lower than plt ld, show only own platoon's squads
     $platoon_id = $user->role >= 2 && !User::isDev() ? $member->platoon_id : false;
     $squads = Squad::findAll($member->game_id, $platoon_id);
     $positionsArray = Position::find_all();
     $rolesArray = Role::find_all();
     $memberGames = MemberGame::get($member->id);
     if (User::isUser($member->id)) {
         $userInfo = User::findByMemberId($member->id);
     } else {
         $userInfo = null;
     }
     Flight::render('modals/view_member', array('user' => $user, 'member' => $member, 'userInfo' => $userInfo, 'platoons' => $platoons, 'memberGames' => $memberGames, 'squads' => $squads, 'positionsArray' => $positionsArray, 'rolesArray' => $rolesArray));
 }
开发者ID:Oogieboogie23,项目名称:Division-Tracker,代码行数:18,代码来源:MemberController.php


示例19: fetchAllListByFlowId

 public function fetchAllListByFlowId($flowId)
 {
     $list = $this->fetchAllByFlowId($flowId);
     foreach ($list as &$per) {
         $per["userName"] = !empty($per["uid"]) ? User::model()->fetchRealnamesByUids($per["uid"]) : "";
         if (!empty($per["deptid"])) {
             if ($per["deptid"] == "alldept") {
                 $per["deptName"] = "全体部门";
             } else {
                 $per["deptName"] = Department::model()->fetchDeptNameByDeptId($per["deptid"]);
             }
         } else {
             $per["deptName"] = "";
         }
         $per["posName"] = !empty($per["positionid"]) ? Position::model()->fetchPosNameByPosId($per["positionid"]) : "";
         $per["typeName"] = Ibos::lang($this->_typeLangMap[$per["type"]], "workflow.default");
         if (array_key_exists($per["scope"], $this->_scopeLangMap)) {
             $per["scopeName"] = Ibos::lang($this->_scopeLangMap[$per["scope"]], "workflow.default");
         } else {
             $per["scopeName"] = Department::model()->fetchDeptNameByDeptId($per["scope"]);
         }
     }
     return $list;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:24,代码来源:FlowPermission.php


示例20: foreach

// Part 1 //////////////////////////////////////////////////////////////////////
// Initialize position
$current = Position::origin();
$positions = [(string) $current];
// Loop through each direction instruction character
foreach ($directions as $direction) {
    $current->moveDirection($direction);
    $positions[] = (string) $current;
}
$counts = array_count_values($positions);
$houses = count($counts);
print "Houses that got at least 1 present: {$houses}.";
// Part 2 //////////////////////////////////////////////////////////////////////
// Initialize position
$santa = Position::origin();
$santaPositions = [(string) $santa];
$robo = Position::origin();
$roboPositions = [(string) $robo];
// Loop through each direction instruction character
foreach ($directions as $i => $direction) {
    if ($i % 2 == 0) {
        $robo->moveDirection($direction);
        $roboPositions[] = (string) $robo;
    } else {
        $santa->moveDirection($direction);
        $santaPositions[] = (string) $santa;
    }
}
$counts = array_count_values(array_merge($santaPositions, $roboPositions));
$houses = count($counts);
print "Houses that got at least 1 present: {$houses}.";
开发者ID:ryanwinchester,项目名称:adventofcode,代码行数:31,代码来源:answer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Positioner类代码示例发布时间:2022-05-23
下一篇:
PHP Portlet类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap