当前位置: 首页>>代码示例>>PHP>>正文


PHP Flight类代码示例

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


在下文中一共展示了Flight类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: find_routes

 private function find_routes($org, $dest, &$flights)
 {
     $result = array();
     $queue = new SplPriorityQueue();
     foreach ($flights as $flight) {
         if ($flight['org_id'] == $org) {
             $route = new Route($this->route_opts);
             $num_seats = Flight::get_open_seats_on_flight($flight['flight_id'], $this->user);
             $route->add_flight($flight, $num_seats);
             $queue->insert($route, $route->get_joy());
         }
     }
     //BFS to find all routes that take < 10 hours
     $count = 0;
     while ($queue->count() > 0 && $count < $this->opts['max_results']) {
         $cur_route = $queue->extract();
         if ($cur_route->get_dest() == $dest) {
             $result[] = $cur_route;
             $count++;
             continue;
         }
         foreach ($flights as $flight) {
             if (!array_key_exists($flight['dest_id'], $cur_route->visited) && $flight['org_id'] == $cur_route->get_dest() && $flight['e_depart_time'] > 30 * 60 + $cur_route->get_arrival_time()) {
                 $new_route = $cur_route->copy();
                 $num_seats = Flight::get_open_seats_on_flight($flight['flight_id'], $this->user);
                 $new_route->add_flight($flight, $num_seats);
                 if ($new_route->get_trip_time() < 24 * 60 * 60 && $new_route->seats >= $this->opts['passengers']) {
                     $queue->insert($new_route, $new_route->get_joy());
                 }
             }
         }
     }
     return $result;
 }
开发者ID:NLP-Project,项目名称:GatorAirlines,代码行数:34,代码来源:search.class.php

示例2: saveFlights

 /**
  * @param $configdepart
  * @return bool
  */
 private function saveFlights(Configdepart $configdepart)
 {
     // Combien de flights à créer
     $nbFlights = ceil($configdepart->nbjoueurs / $configdepart->slotbyflight) + $configdepart->startergap;
     // Met a jour Configdepart->slotcount : nombre de places disponibes créees
     $configdepart->slotcount = $nbFlights * $configdepart->slotbyflight;
     $configdepart->save();
     // Supprimer les Flight de cette config
     $configdepart->flights()->delete();
     // Boucle tous les flight à créer
     for ($i = 1; $i <= $nbFlights; $i++) {
         $addMinutes = ($i - 1) * $configdepart->interval;
         $newheure = Carbon::createFromFormat('H:i', $configdepart->startheure)->addMinutes($addMinutes);
         // New Flight
         $flight = new Flight();
         $flight->configdepart_id = $configdepart->id;
         $flight->num = $i;
         $flight->heure = $newheure;
         $flight->save();
         // Cree les slots
         for ($slotnum = 1; $slotnum <= $configdepart->slotbyflight; $slotnum++) {
             $slot = new Slot();
             $slot->flight_id = $flight->id;
             $slot->num = $slotnum;
             $slot->entree_id = 0;
             $slot->save();
         }
     }
     return true;
 }
开发者ID:birdiebel,项目名称:G2016,代码行数:34,代码来源:ConfigdepartsController.php

示例3: start

 public function start()
 {
     $timetableItems = $this->timetableRepo->getTimetableItemsBeyondFlightBorad();
     $flights = array();
     foreach ($timetableItems as $item) {
         $newFlight = new \Flight();
         $departure_time = $this->makeDepartureTimestamp($item->departure_day_of_week, $item->departure_hour);
         $arrival_time = clone $departure_time;
         $arrival_time->addSeconds($item->flight_duration);
         $newFlight->fill(['timetable_id' => $item->id, 'airline_id' => $item->airline_id, 'airplane_id' => $item->airplane_id, 'origin_airport_id' => $item->origin_airport_id, 'destination_airport_id' => $item->destination_airport_id, 'departure_time' => $departure_time, 'arrival_time' => $arrival_time, 'distance' => great_circle_distance($item->origin->lat, $item->origin->lng, $item->destination->lat, $item->destination->lng), 'flight_number' => $item->flight_number]);
         array_push($flights, $newFlight);
     }
     $this->addedFlights = count($flights);
     $this->flightRepo->saveMany($flights);
 }
开发者ID:emtudo,项目名称:airline-manager,代码行数:15,代码来源:AddFlightsToBoardService.php

示例4: getIdsPerfisAutorizadosByModulo

 public static function getIdsPerfisAutorizadosByModulo($id_modulo, $id_empreendimento, $associativo)
 {
     $associativo = empty($associativo) ? false : ($associativo == 'true' ? true : false);
     $FuncionalidadeDao = new FuncionalidadeDao();
     $aux = $FuncionalidadeDao->getIdsPerfisAutorizadosByModulo($id_modulo, $id_empreendimento);
     if ($aux) {
         $aux = $aux ? $aux : array();
         $perfis = array();
         foreach ($aux as $perfil) {
             if ($associativo) {
                 if (!isset($perfis[$perfil['cod_funcionalidade']])) {
                     $perfis[$perfil['cod_funcionalidade']] = [];
                 }
                 $perfis[$perfil['cod_funcionalidade']][] = (int) $perfil['id_perfil'];
             } else {
                 if (!isset($perfis[$perfil['id_funcionalidade']])) {
                     $perfis[$perfil['id_funcionalidade']] = [];
                 }
                 $perfis[$perfil['id_funcionalidade']][] = (int) $perfil['id_perfil'];
             }
         }
         Flight::json($perfis);
     } else {
         Flight::halt(404, 'Não há resultado para a busca');
     }
 }
开发者ID:filipecoelho,项目名称:webliniaerp-api,代码行数:26,代码来源:FuncionalidadeController.php

示例5: __construct

 public function __construct()
 {
     new Model_Test();
     include "test.html";
     $tmp = Flight::get('test');
     echo "Controller_Test" . $tmp;
 }
开发者ID:LukaszPapierz,项目名称:psi2,代码行数:7,代码来源:Test.php

示例6: getBasePath

 /**
  * getBasePath
  *
  * @return string
  */
 function getBasePath()
 {
     if (strlen(Flight::request()->base) == 1) {
         return getWebsiteUrl() . '/';
     }
     return getWebsiteUrl() . Flight::request()->base . '/';
 }
开发者ID:j0an,项目名称:AcaSeDona,代码行数:12,代码来源:helpers.php

示例7: deleteAbsence

 public function deleteAbsence($id)
 {
     Flight::auth()->check();
     $absence = Flight::absence()->getAbsenceWithId($id);
     $absence->delete();
     Flight::redirect(Flight::request()->referrer);
 }
开发者ID:happyoniens,项目名称:Club,代码行数:7,代码来源:absenceController.php

示例8: recommended

 public static function recommended()
 {
     $dbname = 'predictionio_appdata';
     $mdb = Flight::mdb();
     $db = $mdb->{$dbname};
     $items = $db->items;
     $client = Flight::prediction_client();
     $recommended_movies = array();
     try {
         $user_id = $_SESSION['user_id'];
         $client = new EngineClient('http://localhost:8000');
         $recommended_movies_raw = $client->sendQuery(array('user' => $user_id, 'num' => 9));
         $movie_iids = array_map(function ($item) {
             return $item['item'];
         }, $recommended_movies_raw['itemScores']);
         $cursor = $items->find(array('itypes' => '1', '_id' => array('$in' => $movie_iids)));
         $recommended_movies = array_values(iterator_to_array($cursor));
     } catch (Exception $e) {
         echo 'Caught exception: ', $e->getMessage(), "\n";
     }
     $_SESSION['movies_viewed'] = 0;
     $_SESSION['user_id'] = '';
     Flight::render('recommended', array('recommended_movies' => $recommended_movies), 'content');
     Flight::render('layout', array('title' => 'Recommended', 'base_path' => '/movie_recommender'));
 }
开发者ID:superboybmt,项目名称:sitepoint_codes,代码行数:25,代码来源:home.php

示例9: recommended

 public static function recommended()
 {
     $dbname = 'predictionio_appdata';
     $mdb = Flight::mdb();
     $db = $mdb->{$dbname};
     $items = $db->items;
     $client = Flight::prediction_client();
     $recommended_movies = array();
     try {
         $user_id = $_SESSION['user_id'];
         $client->identify($user_id);
         $command = $client->getCommand('itemrec_get_top_n', array('pio_engine' => 'movie-recommender', 'pio_n' => 9));
         $recommended_movies_raw = $client->execute($command);
         $movie_iids = $recommended_movies_raw['pio_iids'];
         array_walk($movie_iids, function (&$movie_iid) {
             $movie_iid = '4_' . $movie_iid;
         });
         $cursor = $items->find(array('itypes' => '1', '_id' => array('$in' => $movie_iids)));
         $recommended_movies = array_values(iterator_to_array($cursor));
     } catch (Exception $e) {
         echo 'Caught exception: ', $e->getMessage(), "\n";
     }
     $_SESSION['movies_viewed'] = 0;
     $_SESSION['user_id'] = '';
     Flight::render('recommended', array('recommended_movies' => $recommended_movies), 'content');
     Flight::render('layout', array('title' => 'Recommended', 'base_path' => '/movie_recommender'));
 }
开发者ID:ChenOhayon,项目名称:sitepoint_codes,代码行数:27,代码来源:home.php

示例10: mcCacheProps

 private function mcCacheProps($filePath, $device, $channel)
 {
     $mc = Flight::mc();
     $cache = $mc->get($filePath);
     if (!$cache && Memcached::RES_NOTFOUND == $mc->getResultCode()) {
         $buildpropArray = explode("\n", file_get_contents('zip://' . $filePath . '#system/build.prop'));
         if ($device == $this->getBuildPropValue($buildpropArray, 'ro.product.device')) {
             $api_level = intval($this->getBuildPropValue($buildpropArray, 'ro.build.version.sdk'));
             $incremental = $this->getBuildPropValue($buildpropArray, 'ro.build.version.incremental');
             $timestamp = intval($this->getBuildPropValue($buildpropArray, 'ro.build.date.utc'));
             $url = $this->getBuildPropValue($buildpropArray, 'ro.build.ota.url');
             $cache = array($device, $api_level, $incremental, $timestamp, Utils::getMD5($filePath), $url);
             $mc->set($filePath, $cache);
             $mc->set($incremental, array($device, $channel, $filePath));
         } else {
             throw new Exception("{$device}: {$filePath} is in invalid path");
         }
     }
     assert($cache[0] == $device);
     $this->api_level = $cache[1];
     $this->incremental = $cache[2];
     $this->timestamp = $cache[3];
     $this->md5sum = $cache[4];
     $this->url = $cache[5];
 }
开发者ID:jfdesignnet,项目名称:CyanogenModOTA,代码行数:25,代码来源:Tokens.php

示例11: __construct

 /**
  * AssetsManager constructor.
  * @param array $conf
  */
 public function __construct($conf = [])
 {
     if (!$conf) {
         $conf = \Flight::get('config')->get('assets');
     }
     $this->loadConfig($conf);
 }
开发者ID:wwtg99,项目名称:flight2wwu,代码行数:11,代码来源:AssetsManager.php

示例12: __construct

 /**
  * PRedis constructor.
  *
  * @param array $conf
  * @param $options
  */
 public function __construct($conf = [], $options = null)
 {
     if (!$conf) {
         $conf = \Flight::get('config')->get('redis');
     }
     parent::__construct($conf, $options);
 }
开发者ID:wwtg99,项目名称:flight2wwu,代码行数:13,代码来源:PRedis.php

示例13: init

 public function init()
 {
     $data = $_REQUEST;
     if (isset($data[Profile::GET_CHANGE_PASSWORD_BUTTON])) {
         $user = Auth::getInstance()->getUser();
         if (strlen(trim($data[Profile::GET_CHANGE_MAIL])) > 0) {
             if ($user->email != trim($data[Profile::GET_CHANGE_MAIL])) {
                 if (User::validEmail(trim(strip_tags($data[Profile::GET_CHANGE_MAIL])))) {
                     $user->email = trim(strip_tags($data[Profile::GET_CHANGE_MAIL]));
                     $user->password = User::getHashPassword($user->password, strtolower($user->email));
                 } else {
                     Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=2');
                 }
             }
         }
         if (strlen(trim($data[Profile::GET_CHANGE_PASSWORD])) > 0) {
             if (!User::passwordIsValid($data[Profile::GET_CHANGE_PASSWORD])) {
                 Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=0');
             } else {
                 $user->password = User::getHashPassword(trim(strip_tags($data[Profile::GET_CHANGE_PASSWORD])), strtolower($user->email));
             }
         }
         $user->save();
         Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=1');
         return true;
     }
 }
开发者ID:smilexx,项目名称:quest.dev,代码行数:27,代码来源:Profile.php

示例14: updateStatus

 public static function updateStatus($idNotaFiscal, $id_empreendimento)
 {
     try {
         $NotaFiscalDao = new NotaFiscalDao();
         $ConfiguracaoDao = new ConfiguracaoDao();
         $conf = $ConfiguracaoDao->getConfiguracoes($id_empreendimento);
         $flg_ambiente_nfe = isset($conf['flg_ambiente_nfe']) && ((int) $conf['flg_ambiente_nfe'] == 1 || (int) $conf['flg_ambiente_nfe'] == 0) ? (int) $conf['flg_ambiente_nfe'] : 0;
         $tokens['token_focus_producao'] = isset($conf['token_focus_producao']) ? $conf['token_focus_producao'] : '';
         $tokens['token_focus_homologacao'] = isset($conf['token_focus_homologacao']) ? $conf['token_focus_homologacao'] : '';
         $NfeDao = new NfeDao($flg_ambiente_nfe, $tokens);
         $NfeDao->id_ref = $idNotaFiscal;
         $retornoParceiro = $NfeDao->buscaNfe();
         $nfTO = new stdClass();
         $nfTO->cod_nota_fiscal = $idNotaFiscal;
         $nfTO->status = $retornoParceiro->status;
         $nfTO->status_sefaz = $retornoParceiro->status_sefaz;
         $nfTO->mensagem_sefaz = $retornoParceiro->mensagem_sefaz;
         $nfTO->status_sefaz_cancelamento = isset($retornoParceiro->status_sefaz_cancelamento) ? $retornoParceiro->status_sefaz_cancelamento : NULL;
         $nfTO->mensagem_sefaz_cancelamento = isset($retornoParceiro->mensagem_sefaz_cancelamento) ? $retornoParceiro->mensagem_sefaz_cancelamento : NULL;
         $nfTO->caminho_xml_cancelamento = isset($retornoParceiro->caminho_xml_cancelamento) ? substr($NfeDao->server, 0, -1) . $retornoParceiro->caminho_xml_cancelamento : NULL;
         if ($nfTO->status == 'autorizado') {
             $nfTO->serie = $retornoParceiro->serie;
             $nfTO->numero = $retornoParceiro->numero;
             $nfTO->chave_nfe = $retornoParceiro->chave_nfe;
             $nfTO->caminho_xml_nota_fiscal = substr($NfeDao->server, 0, -1) . $retornoParceiro->caminho_xml_nota_fiscal;
             $nfTO->caminho_danfe = substr($NfeDao->server, 0, -1) . $retornoParceiro->caminho_danfe;
         }
         $NotaFiscalDao->updateNota($nfTO);
         $notaAtualizada = $NotaFiscalDao->getNota($idNotaFiscal);
         Flight::json($notaAtualizada);
     } catch (Exception $e) {
         jsonException($e);
     }
 }
开发者ID:filipecoelho,项目名称:webliniaerp-api,代码行数:34,代码来源:NotaFiscalController.php

示例15: findByDivision

 public static function findByDivision($game_id, $limit = false)
 {
     if (!$limit) {
         $limit = 10;
     }
     return arrayToObject(Flight::aod()->from(self::$table)->where(array("member.game_id" => $game_id))->limit($limit)->sortDesc('date')->join('actions', array('actions.id' => 'user_actions.type_id'))->join('member', array('member.member_id' => 'user_actions.target_id'))->select(array('date', 'user_id', 'type_id', 'target_id', 'verbage', 'icon'))->many());
 }
开发者ID:Oogieboogie23,项目名称:Division-Tracker,代码行数:7,代码来源:UserAction.php


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