$userinfo = PilotData::getPilotData($pilotid); //Alle Daten des Piloten in Variablen speichern //PilotID $pilotcode = PilotData::GetPilotCode($userinfo->code, $userinfo->pilotid); //Pilot Name $name = $userinfo->firstname . ' ' . $userinfo->lastname; //Rang Bild $rankimg = $userinfo->rankimage; //Rang $rank = $userinfo->rank; //Flüge insg. $totalflights = $userinfo->totalflights; //Stunden insg. $totalhours = Util::AddTime($userinfo->totalhours, $userinfo->transferhours); //Landesflagge $countryflag = Countries::getCountryImage($userinfo->location); //Landesname $countryname = Countries::getCountryName($userinfo->location); //IVAO Status Badge fieldvalue = IVAO VID $fieldvalue = PilotData::GetFieldValue($pilotid, 'IVAO-VID'); if ($fieldvalue != '') { $ivao = '<a href="http://www.ivao.aero/members/person/details.asp?ID=' . $fieldvalue . '" target="_blank"><img src="http://status.ivao.aero/' . $fieldvalue . '.png" width="220" height="66" border="0" alt="IVAO ID" /></a>'; } else { $ivao = 'Not a IVAO Member'; } //Avatar if (!file_exists(SITE_ROOT . AVATAR_PATH . '/' . $pilotcode . '.png')) { $avatar = 'No avatar'; } else { $avatar = '<img src="' . SITE_URL . AVATAR_PATH . '/' . $pilotcode . '.png' . '" alt="Pilot Avatar" /> '; }
</li> <li><strong>Rank: </strong><?php echo $pilot->rank; ?> </li> <li><strong>Total Flights: </strong><?php echo $pilot->totalflights; ?> </li> <li><strong>Total Hours: </strong><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?> </li> <li><strong>Location: </strong> <img src="<?php echo Countries::getCountryImage($pilot->location); ?> " alt="<?php echo Countries::getCountryName($pilot->location); ?> " /> <?php echo Countries::getCountryName($pilot->location); ?> </li> <?php // Show the public fields if ($allfields) { foreach ($allfields as $field) {
public function getpilotsjson() { $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; } /* 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}"; } Config::Set('PILOT_ORDER_BY', "{$sidx} {$sord}"); # Do a search without the limits so we can find how many records $count = count(PilotData::findPilots($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 $allpilots = PilotData::findPilots($where, $limit, $start); if (!$allpilots) { $allpilots = array(); } # Form the json header $json = array('page' => $page, 'total' => $total_pages, 'records' => $count, 'rows' => array()); # Add each row to the above array foreach ($allpilots as $row) { $pilotid = PilotData::getPilotCode($row->code, $row->pilotid); $status = $row->retired == 0 ? 'Active' : 'Retired'; $location = '<img src="' . Countries::getCountryImage($row->location) . '" alt="' . $row->location . '" />'; $edit = '<a href="' . adminurl('/pilotadmin/viewpilots?action=viewoptions&pilotid=' . $row->pilotid) . '">Edit</a>'; $tmp = array('id' => $row->id, 'cell' => array($row->id, $pilotid, $row->firstname, $row->lastname, $row->email, $location, $status, $row->rank, $row->totalflights, $row->totalhours, $row->lastip, $edit)); $json['rows'][] = $tmp; } header("Content-type: text/x-json"); echo json_encode($json); }