當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OperationsData::findAirport方法代碼示例

本文整理匯總了PHP中OperationsData::findAirport方法的典型用法代碼示例。如果您正苦於以下問題:PHP OperationsData::findAirport方法的具體用法?PHP OperationsData::findAirport怎麽用?PHP OperationsData::findAirport使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OperationsData的用法示例。


在下文中一共展示了OperationsData::findAirport方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: airportgrid

 public function airportgrid()
 {
     $page = $this->get->page;
     // get the requested page
     $limit = $this->get->rows;
     // get how many rows we want to have into the grid
     $sidx = $this->get->sidx;
     // get index row - i.e. user click to sort
     $sord = $this->get->sord;
     // get the direction
     if (!$sidx) {
         $sidx = 1;
     }
     # http://dev.phpvms.net/admin/action.php/operations/
     # ?_search=true&nd=1270940867171&rows=20&page=1&sidx=flightnum&sord=asc&searchField=code&searchString=TAY&searchOper=eq
     /* Do the search using jqGrid */
     $where = array();
     if ($this->get->_search == 'true') {
         $searchstr = jqgrid::strip($this->get->filters);
         $where_string = jqgrid::constructWhere($searchstr);
         # Append to our search, add 1=1 since it comes with AND
         #	from above
         $where[] = "1=1 {$where_string}";
     }
     # Do a search without the limits so we can find how many records
     $count = count(OperationsData::findAirport($where));
     if ($count > 0) {
         $total_pages = ceil($count / $limit);
     } else {
         $total_pages = 0;
     }
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     $start = $limit * $page - $limit;
     // do not put $limit*($page - 1)
     if ($start < 0) {
         $start = 0;
     }
     # And finally do a search with the limits
     $airports = OperationsData::findAirport($where, $limit, $start, "{$sidx} {$sord}");
     if (!$airports) {
         $airports = array();
     }
     # Form the json header
     $json = array('page' => $page, 'total' => $total_pages, 'records' => $count, 'rows' => array());
     # Add each row to the above array
     foreach ($airports as $row) {
         if ($row->fuelprice == 0) {
             $row->fuelprice = 'Live';
         }
         $edit = '<a href="#" onclick="editairport(\'' . $row->icao . '\'); return false;">Edit</a>';
         $tmp = array('id' => $row->id, 'cell' => array($row->icao, $row->name, $row->country, $row->fuelprice, $row->lat, $row->lng, $edit));
         $json['rows'][] = $tmp;
     }
     header("Content-type: text/x-json");
     echo json_encode($json);
 }
開發者ID:ryanunderwood,項目名稱:phpVMS,代碼行數:58,代碼來源:Operations.php


注:本文中的OperationsData::findAirport方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。