function show(Pilot $pilot)
 {
     $active = Flight::with('departure', 'departure.country', 'arrival', 'arrival.country')->whereVatsimId($pilot->vatsim_id)->whereIn('state', array(0, 1, 3, 4))->first();
     $flights = Flight::with('departure', 'departure.country', 'arrival', 'arrival.country')->whereVatsimId($pilot->vatsim_id)->whereState(2)->orderBy('arrival_time', 'desc')->take(15)->get();
     $flightCount = Flight::whereVatsimId($pilot->vatsim_id)->whereState(2)->count();
     $stats = new FlightStat(Flight::whereVatsimId($pilot->vatsim_id));
     if ($pilot->processing == 0) {
         Queue::push('LegacyUpdate', $pilot->vatsim_id, 'legacy');
         $pilot->processing = 2;
         $pilot->save();
     }
     if ($pilot->processing == 2) {
         Messages::success('The data for this pilot is currently being processed. In a couple of minutes, all statistics will be available.')->one();
     }
     $distances = $stats->distances($pilot->distance);
     $citypair = $stats->citypair();
     if ($flights->count() > 0) {
         $durations = $stats->durations($pilot->duration);
         extract($durations);
     }
     // Charts: popular airlines, airports and aircraft
     $airlines = $stats->topAirlines();
     $airports = $stats->topAirports();
     $aircraft = $stats->topAircraft();
     $this->javascript('assets/javascript/jquery.flot.min.js');
     $this->javascript('assets/javascript/jquery.flot.pie.min.js');
     $this->autoRender(compact('pilot', 'flights', 'active', 'distances', 'airlines', 'aircraft', 'airports', 'longest', 'shortest', 'citypair', 'hours', 'minutes'), $pilot->name);
 }
 function generate()
 {
     global $smarty;
     $this->toplist->generate();
     $i = 1;
     $rows = array();
     while ($row = $this->toplist->getRow()) {
         $pilot = Pilot::getByID($row['plt_id']);
         $uri = edkURI::build(array('a', 'kill_detail', true), array('kll_id', $row['kll_id'], true));
         if ($row['plt_externalid']) {
             $img = imageURL::getURL('Pilot', $row['plt_externalid'], 32);
         } else {
             $img = $pilot->getPortraitURL(32);
         }
         $ship = Ship::getByID($row['ship']);
         $shipUri = edkURI::build(array('a', 'invtype', true), array('id', $row['ship'], true));
         if ((int) number_format($row["isk"], 0, "", "") > 1000000000) {
             $isk = number_format($row["isk"] / 1000000000, 2, ".", "") . " b";
         } elseif ((int) number_format($row["isk"], 0, "", "") > 1000000) {
             $isk = number_format($row["isk"] / 1000000, 2, ".", "") . " M";
         } else {
             $isk = number_format($row["isk"], 0, ".", ",");
         }
         $rows[] = array('rank' => $i, 'name' => $pilot->getName(), 'uri' => $uri, 'portrait' => $img, 'shipImage' => $ship->getImage(32), 'shipName' => $ship->getName(), 'shipId' => $row['ship'], 'shipURI' => $shipUri, 'isk' => $isk);
         $i++;
     }
     $smarty->assign('tl_name', 'Pilot');
     $smarty->assign('tl_type', $this->entity_);
     $smarty->assignByRef('tl_rows', $rows);
     return $smarty->fetch(getcwd() . '/mods/most_expensive_toplist/templates/toplisttable_expensive.tpl');
 }
Beispiel #3
0
 private function updateChars()
 {
     if (empty($this->chars)) {
         return $this->chars;
     }
     foreach ($this->chars as $char) {
         // check if chars eveid exists in kb
         $sql = 'select plts.plt_id, plts.plt_externalid from kb3_pilots plts where plts.plt_name = "' . $char['Name'] . '"';
         $qry = DBFactory::getDBQuery();
         $qry->execute($sql);
         if ($qry->recordCount() != 0) {
             // pilot is in kb db, check he has his char id
             $row = $qry->getRow();
             $pilot_id = $row['plt_id'];
             $pilot_external_id = $row['plt_externalid'];
             if ($pilot_external_id == 0 && $pilot_id != 0) {
                 // update DB with ID
                 $qry->execute("UPDATE kb3_pilots SET plt_externalid = " . intval($char['charID']) . "\n                                     WHERE plt_id = " . $pilot_id);
             }
         } else {
             // pilot is not in DB
             // Set Corp
             $pilotscorp = Corporation::lookup($char['corpName']);
             // Check Corp was set, if not, add the Corp
             if (!$pilotscorp->getID()) {
                 $ialliance = Alliance::add('None');
                 $pilotscorp = Corporation::add($char['corpName'], $ialliance, gmdate("Y-m-d H:i:s"));
             }
             Pilot::add($char['Name'], $pilotscorp, gmdate("Y-m-d H:i:s"), intval($char['charID']));
         }
     }
     return;
 }
 function index()
 {
     $q = trim(Input::get('q'));
     if (empty($q) || !Input::has('q')) {
         return Redirect::home();
     }
     if (!Input::has('guess') || Input::get('guess') != 'no') {
         $regex = array('pilot' => '[0-9]+', 'airport' => '[A-Z0-9]{4}', 'airline' => '[A-Z0-9]{3}', 'airportIata' => '[A-Z0-9]{3}', 'citypair' => '([A-Z0-9]{3,4})(?:(?:\\s*?[-|>]\\s*?)|\\s+to\\s+|\\s+)([A-Z0-9]{3,4})', 'callsign' => '.*');
         $search = new Search($q);
         foreach ($regex as $type => $pattern) {
             if (preg_match('/^' . $pattern . '$/i', $q, $matches) && ($match = $search->quick($type, $matches))) {
                 Messages::info('You were redirected here by a best guess of the search system. <a href="' . URL::route('search', array('q' => $q, 'guess' => 'no')) . '" class="alert-link">Return to search results.</a>');
                 return $match;
             }
         }
     }
     $pilots = Pilot::where(function ($search) use($q) {
         $search->where('vatsim_id', '=', $q);
         $search->orWhere(function ($name) use($q) {
             $name->where('name', 'LIKE', '%' . $q . '%');
             $name->where('anonymous', '=', false);
         });
     })->where('vatsim_id', '!=', 0)->get();
     $flights = Flight::where('callsign', '=', $q)->orderBy('departure_time', 'desc')->get();
     $airlines = Airline::where('icao', '=', $q)->orWhere('name', 'LIKE', '%' . $q . '%')->get();
     $airports = Airport::where('icao', '=', $q)->orWhere('iata', '=', $q)->orWhere('name', 'LIKE', '%' . $q . '%')->orWhere('city', 'LIKE', '%' . $q . '%')->get();
     $this->autoRender(compact('q', 'flights', 'pilots', 'airlines', 'airports'), 'Search');
 }
Beispiel #5
0
 function pilot()
 {
     $pilot = Pilot::find($this->query);
     if (!is_null($pilot)) {
         return Redirect::route('pilot.show', $pilot->vatsim_id);
     }
     return false;
 }
 /**
  * Generate the output html from the template file.
  */
 function generate()
 {
     global $smarty;
     $rows = array();
     $max = 0;
     for ($i = 1; $i <= $this->length_; $i++) {
         $row = $this->toplist_->getRow();
         if ($row) {
             $rows[] = $row;
         }
         if ($row['cnt'] > $max) {
             $max = $row['cnt'];
         }
     }
     if (empty($rows)) {
         return;
     }
     $pilot = new Pilot($rows[0]['plt_id']);
     $smarty->assign('title', $this->title_);
     $smarty->assign('pilot_portrait', $pilot->getPortraitURL(64));
     $smarty->assign('award_img', config::get('cfg_img') . "/awards/" . $this->award_ . ".png");
     $smarty->assign('url', edkURI::build(array('a', 'pilot_detail', true), array('plt_id', $rows[0]['plt_id'], true)));
     $smarty->assign('name', $pilot->getName());
     $bar = new BarGraph($rows[0]['cnt'], $max);
     $smarty->assign('bar', $bar->generate());
     $smarty->assign('cnt', $rows[0]['cnt']);
     for ($i = 2; $i < $this->length_ + 1; $i++) {
         if (!$rows[$i - 1]['plt_id']) {
             break;
         } else {
             if (!$rows[$i - 1]['plt_name']) {
                 $pilot = new Pilot($rows[$i - 1]['plt_id']);
                 $pilotname = $pilot->getName();
             } else {
                 $pilotname = $rows[$i - 1]['plt_name'];
             }
         }
         $bar = new BarGraph($rows[$i - 1]['cnt'], $max);
         $top[$i] = array('url' => edkURI::build(array('a', 'pilot_detail', true), array('plt_id', $rows[$i - 1]['plt_id'], true)), 'name' => $pilotname, 'bar' => $bar->generate(), 'cnt' => $rows[$i - 1]['cnt']);
     }
     $smarty->assign('top', $top);
     $smarty->assign('comment', $this->comment_);
     return $smarty->fetch(get_tpl('award_box'));
 }
Beispiel #7
0
/**
 * Fetch the board owners.
 * @return array Array of id strings to add to URLS
 */
function getOwners()
{
    $myids = array();
    if (!defined('MASTER') || !MASTER) {
        foreach (config::get('cfg_pilotid') as $entity) {
            $pilot = new Pilot($entity);
            $myids[] = '&pilot=' . urlencode($pilot->getName());
        }
        foreach (config::get('cfg_corpid') as $entity) {
            $corp = new Corporation($entity);
            $myids[] = '&corp=' . urlencode($corp->getName());
        }
        foreach (config::get('cfg_allianceid') as $entity) {
            $alli = new Alliance($entity);
            $myids[] = '&alli=' . urlencode($alli->getName());
        }
    }
    return $myids;
}
 function show(Pilot $pilot)
 {
     $actives = ATC::with('airport', 'airport.country')->whereVatsimId($pilot->vatsim_id)->whereNull('end')->where('facility_id', '!=', 99)->get();
     $duties = ATC::with('airport', 'airport.country')->whereVatsimId($pilot->vatsim_id)->whereNotNull('end')->where('facility_id', '!=', 99)->orderBy('end', 'desc')->take(15)->get();
     if ($pilot->processing == 0) {
         Queue::push('LegacyUpdate', $pilot->vatsim_id, 'legacy');
         $pilot->processing = 2;
         $pilot->save();
     }
     if ($pilot->processing == 2) {
         Messages::success('The data for this controller is currently being processed. In a couple of minutes, all statistics will be available.')->one();
     }
     $stat = new ControllerStat(ATC::whereVatsimId($pilot->vatsim_id)->where('facility_id', '!=', 99));
     extract($stat->durations($pilot->duration_atc));
     $airports = $stat->topAirports();
     $facilities = $stat->topFacilities();
     $this->javascript('assets/javascript/jquery.flot.min.js');
     $this->javascript('assets/javascript/jquery.flot.pie.min.js');
     $this->autoRender(compact('pilot', 'duties', 'actives', 'airport', 'airports', 'longest', 'hours', 'minutes', 'facilities'), $pilot->name);
 }
Beispiel #9
0
 function addScout($pilot_name)
 {
     $scoutship = "9999";
     //get pilot order
     $pqry = new DBPreparedQuery();
     $pqry->prepare("select max(ind_order), ind_timestamp from kb3_inv_detail where ind_kll_id = ? group by ind_timestamp");
     $pqry->bind_param('i', $this->killID_);
     $pqry->bind_result($scoutorder, $timestamp);
     if (!$pqry->execute() || !$pqry->recordCount()) {
         return false;
     } else {
         $pqry->fetch();
     }
     $scoutorder = $scoutorder + 1;
     //lookup pilot id by name
     $pilot = Pilot::lookup($pilot_name);
     if (!$pilot) {
         return false;
     }
     if (isset($pilot)) {
         $pilotid = $pilot->getID();
         if ($pilotid == 0) {
             return false;
         }
     } else {
         return false;
     }
     $qry = new DBQuery(true);
     $qry->execute("INSERT INTO kb3_scout (`inp_kll_id`,`inp_plt_id`) VALUES ('" . $this->killID_ . "','" . $pilotid . "')");
     $this->scouts_[] = $this->getPilotData($pilotid, $qry->getInsertID());
     if (!isset($this->scouts_)) {
         return false;
     }
     $qry->execute("INSERT INTO kb3_inv_detail (`ind_kll_id`,`ind_timestamp`,`ind_plt_id`,`ind_all_id`,`ind_crp_id`,`ind_shp_id`,`ind_order`) VALUES ('" . $this->killID_ . "','" . $timestamp . "','" . $pilotid . "','" . $this->scouts_[0]['allianceid'] . "','" . $this->scouts_[0]['corpid'] . "','" . $scoutship . "','" . $scoutorder . "')");
     //add to pilot's stats
     $qry->execute("SELECT 1 FROM kb3_sum_pilot WHERE psm_plt_id = '" . $pilotid . "'");
     if ($qry->recordCount() > 0) {
         $this->kill = new Kill($this->killID_);
         $qry->execute("INSERT INTO kb3_sum_pilot \n                                    (psm_plt_id, psm_shp_id, psm_kill_count, psm_kill_isk) \n                                    VALUES ('" . $pilotid . "','" . $this->kill->getVictimShip()->getClass()->getID() . "', 1, '" . $this->kill->getISKLoss() . "') \n                                    ON DUPLICATE KEY \n                                       UPDATE psm_kill_count = psm_kill_count + 1, \n                                              psm_kill_isk = psm_kill_isk + '" . $this->kill->getISKLoss() . "'");
         //Jalon debugging - i had to run this query to fix the DB, it was missing a default value:
         //alter table kb3_inv_detail modify column ind_dmgdone int(11) not null default 0;
         //error_log("INSERT INTO kb3_sum_pilot (psm_plt_id, psm_shp_id, psm_kill_count, psm_kill_isk) VALUES ('".$pilotid."','".$this->kill->getVictimShip()->getClass()->getID()."', 1, '".$this->kill->getISKLoss()."') ON DUPLICATE KEY UPDATE psm_kill_count = psm_kill_count + 1, psm_kill_isk = psm_kill_isk + '".$this->kill->getISKLoss()."'");
         $qry->execute("UPDATE kb3_pilots \n                                          SET plt_kpoints = plt_kpoints + '" . $this->kill->getKillPoints() . "' WHERE plt_id = '" . $pilotid . "'");
     }
     //make sure involved count is shown correctly (it's generated before this class is loaded)
     header("Location: ?a=kill_detail&kll_id=" . $this->killID_);
     exit;
 }
Beispiel #10
0
 function display()
 {
     global $smarty;
     $alls = $corps = $pilots = false;
     if (config::get('cfg_allianceid')) {
         $alls = array();
         foreach (config::get('cfg_allianceid') as $entity) {
             $alliance = new Alliance($entity);
             if ($alliance->getExternalID()) {
                 $url = edkURI::page('alliance_detail', $alliance->getExternalID(), 'all_ext_id');
             } else {
                 $url = edkURI::page('alliance_detail', $alliance->getID(), 'all_id');
             }
             $alls[] = array('id' => $alliance->getID(), 'extid' => $alliance->getExternalID(), 'name' => $alliance->getName(), 'portrait' => $alliance->getPortraitURL(128), 'url' => $url);
         }
     }
     if (config::get('cfg_corpid')) {
         $corps = array();
         foreach (config::get('cfg_corpid') as $entity) {
             $corp = new Corporation($entity);
             if ($corp->getExternalID()) {
                 $url = edkURI::page('corp_detail', $corp->getExternalID(), 'crp_ext_id');
             } else {
                 $url = edkURI::page('corp_detail', $corp->getID(), 'crp_id');
             }
             $corps[] = array('id' => $corp->getID(), 'extid' => $corp->getExternalID(), 'name' => $corp->getName(), 'portrait' => $corp->getPortraitURL(128), 'url' => $url);
         }
     }
     if (config::get('cfg_pilotid')) {
         $pilots = array();
         foreach (config::get('cfg_pilotid') as $entity) {
             $pilot = new Pilot($entity);
             if ($pilot->getExternalID()) {
                 $url = edkURI::page('pilot_detail', $pilot->getExternalID(), 'plt_ext_id');
             } else {
                 $url = edkURI::page('pilot_detail', $pilot->getID(), 'plt_id');
             }
             $pilots[] = array('id' => $pilot->getID(), 'extid' => $pilot->getExternalID(), 'name' => $pilot->getName(), 'portrait' => $pilot->getPortraitURL(128), 'url' => $url);
         }
     }
     $smarty->assignByRef('alliances', $alls);
     $smarty->assignByRef('corps', $corps);
     $smarty->assignByRef('pilots', $pilots);
     return $smarty->fetch(get_tpl('self'));
 }
Beispiel #11
0
 function generate()
 {
     global $smarty;
     $this->toplist->generate();
     $i = 1;
     $rows = array();
     while ($row = $this->toplist->getRow()) {
         $pilot = Pilot::getByID($row['plt_id']);
         if ($row['plt_externalid']) {
             $uri = edkURI::build(array('a', 'pilot_detail', true), array('plt_ext_id', $row['plt_externalid'], true));
             $img = imageURL::getURL('Pilot', $row['plt_externalid'], 32);
         } else {
             $uri = edkURI::build(array('a', 'pilot_detail', true), array('plt_id', $row['plt_id'], true));
             $img = $pilot->getPortraitURL(32);
         }
         $rows[] = array('rank' => $i, 'name' => $pilot->getName(), 'uri' => $uri, 'portrait' => $img, 'count' => $row['cnt']);
         $i++;
     }
     $smarty->assign('tl_name', 'Pilot');
     $smarty->assign('tl_type', $this->entity_);
     $smarty->assignByRef('tl_rows', $rows);
     return $smarty->fetch(get_tpl('toplisttable'));
 }
Beispiel #12
0
 function fire($job, $vatsim_id)
 {
     $pilot = Pilot::whereVatsimId($vatsim_id)->first();
     if ($pilot->processing == 1) {
         $job->delete();
         return;
     }
     try {
         $it = new XmlIterator\XmlIterator('https://cert.vatsim.net/vatsimnet/idstatusint.php?cid=' . $vatsim_id, 'user');
         $official = iterator_to_array($it)[0];
         $pilot->name = $official['name_first'] . ' ' . $official['name_last'];
         $pilot->rating_id = $official['rating'];
     } catch (ErrorException $e) {
     }
     $newFlights = array();
     $flights = Flight::whereVatsimId($pilot->vatsim_id)->whereState(2)->get();
     $totalDistance = 0;
     $totalDuration = 0;
     $totalFlights = $flights->count();
     foreach ($flights as $flight) {
         if ($flight->processed == 1) {
             $totalDistance += $flight->distance;
             $totalDuration += $flight->duration;
         } else {
             $callsign = str_replace('-', '', strtoupper($flight->callsign));
             if (!is_null($airline = $this->getAirlines($callsign))) {
                 // Airline
                 $flight->isAirline($airline->icao);
                 unset($airline);
             } elseif (!is_null($registration = $this->getRegistrations($callsign))) {
                 $flight->isPrivate($registration->country_id);
                 unset($registration);
             }
             if (!is_null($flight->departure_time) && !is_null($flight->arrival_time)) {
                 $duration = $this->duration($flight->departure_time, $flight->arrival_time);
                 $flight->duration = $duration;
                 $totalDuration += $duration;
                 unset($duration);
             }
             $distance = 0;
             foreach ($flight->positions as $key => $position) {
                 if ($key > 0) {
                     $distance += $this->distance($position->lat, $position->lon, $previous->lat, $previous->lon);
                 }
                 $previous = $position;
             }
             $flight->distance = $distance;
             // $flight->processed = true;
             // $flight->save();
             if (!is_nan($distance)) {
                 $totalDistance += $distance;
             }
             unset($distance, $previous);
         }
         $newFlights[] = array('id' => $flight->id, 'duration' => $flight->duration, 'distance' => $flight->distance, 'airline_id' => $flight->airline_id, 'callsign_type' => $flight->callsign_type);
         unset($flight);
     }
     unset($flights);
     Log::info('queue:legacy[' . $job->getJobId() . '] - processed flights');
     DB::statement("create temporary table if not exists flights_temp (\n\t\t\t`id` int(10) unsigned NOT NULL,\n\t\t\t`callsign_type` tinyint(1) NOT NULL DEFAULT '0',\n\t\t\t`airline_id` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,\n\t\t\t`duration` smallint(6) NOT NULL DEFAULT '0',\n\t\t\t`distance` smallint(6) NOT NULL DEFAULT '0',\n\t\t\tPRIMARY KEY (`id`)\n\t\t)");
     Log::info('queue:legacy[' . $job->getJobId() . '] - created temp table flights');
     $remaining = count($newFlights);
     $step = 0;
     do {
         Log::info('queue:legacy[' . $job->getJobId() . '] - inserted flights - ' . $remaining);
         DB::table('flights_temp')->insert(array_slice($newFlights, 100 * $step, 100));
         $remaining -= 100;
         $step++;
     } while ($remaining > 0);
     Log::info('queue:legacy[' . $job->getJobId() . '] - inserted flights - done');
     DB::statement("update flights dest, flights_temp src set\n\t\t\tdest.callsign_type = src.callsign_type,\n\t\t\tdest.airline_id = src.airline_id,\n\t\t\tdest.duration = src.duration,\n\t\t\tdest.distance = src.distance,\n\t\t\tdest.processed = 1\n\t\twhere dest.id = src.id\n\t\t");
     Log::info('queue:legacy[' . $job->getJobId() . '] - updated flights');
     $atcs = ATC::whereVatsimId($vatsim_id)->whereNotNull('end')->get();
     $totalDurationAtc = 0;
     $totalAtc = $atcs->count();
     $newAtc = array();
     foreach ($atcs as $atc) {
         if ($atc->processed) {
             if ($atc->facility_id != 99) {
                 $totalDurationAtc += $atc->duration;
             } else {
                 $totalAtc--;
             }
         } else {
             $atc->facility_id = ends_with($atc->callsign, '_ATIS') ? 99 : $atc->facility_id;
             $duration = $this->duration($atc->start, $atc->end);
             $atc->duration = $duration;
             if ($atc->facility_id != 99) {
                 $totalDurationAtc += $duration;
             }
             if ($atc->facility_id < 6) {
                 $airport = Airport::select('icao')->whereIcao(explode('_', $atc->callsign)[0])->orWhere('iata', '=', explode('_', $atc->callsign)[0])->pluck('icao');
                 $atc->airport_id = is_null($airport) ? null : $airport;
                 unset($airport);
             } elseif ($atc->facility_id == 6) {
                 $sector = SectorAlias::select('sectors.code')->where('sector_aliases.code', '=', explode('_', $atc->callsign)[0])->join('sectors', 'sector_aliases.sector_id', '=', 'sectors.id')->pluck('code');
                 $atc->sector_id = is_null($sector) ? null : $sector;
                 unset($sector);
             } else {
                 $totalAtc--;
             }
             // $atc->processed = true;
             // $atc->save();
         }
         $newAtc[] = array('id' => $atc->id, 'airport_id' => $atc->airport_id, 'sector_id' => $atc->sector_id, 'duration' => $atc->duration, 'facility_id' => $atc->facility_id);
         unset($atc);
     }
     unset($atcs);
     Log::info('queue:legacy[' . $job->getJobId() . '] - processed atc');
     DB::statement("create temporary table if not exists atc_temp (\n\t\t\t`id` int(10) unsigned NOT NULL,\n\t\t\t`facility_id` smallint(6) unsigned NOT NULL,\n\t\t\t`airport_id` varchar(6) COLLATE utf8_unicode_ci DEFAULT NULL,\n\t\t\t`sector_id` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,\n\t\t\t`duration` smallint(6) NOT NULL DEFAULT '0',\n\t\t\tPRIMARY KEY (`id`)\n\t\t)");
     Log::info('queue:legacy[' . $job->getJobId() . '] - created temp table atc');
     $remaining = count($newAtc);
     $step = 0;
     do {
         Log::info('queue:legacy[' . $job->getJobId() . '] - inserted atc - ' . $remaining);
         DB::table('atc_temp')->insert(array_slice($newAtc, 100 * $step, 100));
         $remaining -= 100;
         $step++;
     } while ($remaining > 0);
     Log::info('queue:legacy[' . $job->getJobId() . '] - inserted atc - done');
     DB::statement("update atc dest, atc_temp src set\n\t\t\tdest.duration = src.duration,\n\t\t\tdest.facility_id = src.facility_id,\n\t\t\tdest.airport_id = src.airport_id,\n\t\t\tdest.sector_id = src.sector_id,\n\t\t\tdest.processed = 1\n\t\twhere dest.id = src.id\n\t\t");
     Log::info('queue:legacy[' . $job->getJobId() . '] - updated atc');
     $pilot->processing = 1;
     $pilot->distance = $totalDistance;
     $pilot->duration = $totalDuration;
     $pilot->counter = $totalFlights;
     $pilot->counter_atc = $totalAtc;
     $pilot->duration_atc = $totalDurationAtc;
     $pilot->save();
     $job->delete();
 }
Beispiel #13
0
 public static function nameToId($type, $set, $value)
 {
     if ($type == 'nametoid') {
         $api = new API_NametoID();
         $api->setNames($value);
     } else {
         if ($type == 'idtoname') {
             $api = new API_IDtoName();
             $api->setIDs($value);
         }
     }
     $api->fetchXML();
     if ($type == 'nametoid') {
         $char_info = $api->getNameData();
     } else {
         if ($type == 'idtoname') {
             $char_info = $api->getIDData();
         }
     }
     if (isset($char_info[0]['characterID']) && strlen($char_info[0]['characterID']) > 0) {
         $timestamp = gmdate('%Y.%m.%d %H:%i:%s', time());
         if ($set == 'p') {
             $all = Alliance::add('Unknown');
             $crp = Corporation::add('Unknown', $all, $timestamp, 0, false);
             $plt = Pilot::add($char_info[0]['name'], $crp, $timestamp, $char_info[0]['characterID'], false);
             $_POST['option_cfg_pilotid'] = $value = $plt->getID();
             $pilots = config::get('cfg_pilotid');
             $pilots[] = intval($value);
             config::set('cfg_pilotid', $pilots);
             $html = '<input type="text" id="option_cfg_pilotid"' . ' name="option_cfg_pilotid" value="" size="40"' . ' maxlength="64" />';
         } else {
             if ($set == 'c') {
                 $all = Alliance::add('Unknown');
                 $crp = new Corporation();
                 $crp->add($char_info[0]['name'], $all, $timestamp, $char_info[0]['characterID'], false);
                 $_POST['option_cfg_corpid'] = $value = $crp->getID();
                 $corps = config::get('cfg_corpid');
                 $corps[] = intval($value);
                 config::set('cfg_pilotid', $corps);
                 $html = '<input type="text" id="option_cfg_corpid"' . ' name="option_cfg_corpid" value="" size="40"' . ' maxlength="64" />';
             } else {
                 if ($set == 'a') {
                     $all = Alliance::add('Unknown');
                     $_POST['option_cfg_allianceid'] = $value = $all->getID();
                     $alliances = config::get('option_cfg_allianceid');
                     $alliances[] = intval($value);
                     config::set('option_cfg_allianceid', $alliances);
                     $html = '<input type="text" id="option_cfg_allianceid"' . ' name="option_cfg_allianceid" value="" size="40"' . ' maxlength="64" />';
                 }
             }
         }
         return $html;
     } else {
         return $html;
     }
 }
Beispiel #14
0
 /**
  *  Show the overall statistics for this alliance.
  */
 function stats()
 {
     $this->summary->generate();
     if ($this->pilot->getExternalID()) {
         $apiInfo = new API_CharacterInfo();
         $apiInfo->setID($this->pilot->getExternalID());
         $result .= $apiInfo->fetchXML();
         // Update the name if it has changed.
         if ($result == "") {
             $data = $apiInfo->getData();
             $this->alliance = Alliance::add($data['alliance'], $data['allianceID']);
             $this->corp = Corporation::add($data['corporation'], $this->alliance, $apiInfo->getCurrentTime(), $data['corporationID']);
             $this->pilot = Pilot::add($data['characterName'], $this->corp, $apiInfo->getCurrentTime(), $data['characterID']);
         }
     }
     global $smarty;
     $smarty->assign('portrait_URL', $this->pilot->getPortraitURL(128));
     $smarty->assign('corp_id', $this->corp->getID());
     $smarty->assign('corp_name', $this->corp->getName());
     $smarty->assign('all_name', $this->alliance->getName());
     $smarty->assign('all_id', $this->alliance->getID());
     $smarty->assign('klist_count', $this->summary->getTotalKills());
     $smarty->assign('klist_real_count', $this->summary->getTotalRealKills());
     //$this->klist->getRealCount());
     $smarty->assign('llist_count', $this->summary->getTotalLosses());
     $smarty->assign('klist_isk_B', round($this->summary->getTotalKillISK() / 1000000000, 2));
     $smarty->assign('llist_isk_B', round($this->summary->getTotalLossISK() / 1000000000, 2));
     //Pilot Efficiency Mod Begin (K Austin)
     if ($this->summary->getTotalKills() == 0) {
         $pilot_survival = 100;
         $pilot_efficiency = 0;
     } else {
         if ($this->summary->getTotalKills() + $this->summary->getTotalLosses()) {
             $pilot_survival = round($this->summary->getTotalLosses() / ($this->summary->getTotalKills() + $this->summary->getTotalLosses()) * 100, 2);
         } else {
             $pilot_survival = 0;
         }
         if ($this->summary->getTotalKillISK() + $this->summary->getTotalLossISK()) {
             $pilot_efficiency = round($this->summary->getTotalKillISK() / ($this->summary->getTotalKillISK() + $this->summary->getTotalLossISK()) * 100, 2);
         } else {
             $pilot_efficiency = 0;
         }
     }
     $smarty->assign('pilot_survival', $pilot_survival);
     $smarty->assign('pilot_efficiency', $pilot_efficiency);
     $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
     $this->lpoints = $this->summary->getTotalLossPoints();
     $this->points = $this->summary->getTotalKillPoints();
     return $smarty->fetch(get_tpl('pilot_detail_stats'));
 }
Beispiel #15
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Pilot $value A Pilot object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Pilot $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Beispiel #16
0
 /**
  * Fetch the pilot name from CCP using the stored external ID.
  *
  * Corporation will be set to Unknown.
  */
 private function fetchPilot()
 {
     if (!$this->externalid) {
         return false;
     }
     $apiInfo = new API_CharacterInfo();
     $apiInfo->setID($this->externalid);
     $result .= $apiInfo->fetchXML();
     if ($result == "") {
         $data = $apiInfo->getData();
         $this->alliance = Alliance::add($data['alliance'], $data['allianceID']);
         $this->corp = Corporation::add($data['corporation'], $this->alliance, $apiInfo->getCurrentTime(), $data['corporationID']);
         $this->name = $data['characterName'];
         Pilot::add($data['characterName'], $this->corp, $apiInfo->getCurrentTime(), $data['characterID']);
     } else {
         return false;
     }
 }
Beispiel #17
0
// corp
$box = imagettfbbox(10, 0, MPATH . 'GUNSHIP2.TTF', $corp->getName());
$width = $box[4];
imagettftext($im, 10, 0, 319 - $width, 71, $black, MPATH . 'GUNSHIP2.TTF', $corp->getName());
imagettftext($im, 10, 0, 318 - $width, 70, $red, MPATH . 'GUNSHIP2.TTF', $corp->getName());
// player
$box = imagettfbbox(16, 0, MPATH . 'GUNSHIP2.TTF', $name);
$width = $box[4];
imagettftext($im, 16, 0, 319 - $width, 91, $black, MPATH . 'GUNSHIP2.TTF', $name);
imagettftext($im, 16, 0, 318 - $width, 90, $red, MPATH . 'GUNSHIP2.TTF', $name);
// time, victim, victim corp and ship killed
imagettftext($im, 11, 0, 39, 16, $black, MPATH . 'spaceage.ttf', $kill->getTimeStamp());
imagettftext($im, 11, 0, 38, 15, $white, MPATH . 'spaceage.ttf', $kill->getTimeStamp());
imagettftext($im, 11, 0, 39, 26, $black, MPATH . 'spaceage.ttf', $kill->getVictimName());
imagettftext($im, 11, 0, 38, 25, $white, MPATH . 'spaceage.ttf', $kill->getVictimName());
imagettftext($im, 11, 0, 39, 36, $black, MPATH . 'spaceage.ttf', $kill->getVictimCorpName());
imagettftext($im, 11, 0, 38, 35, $white, MPATH . 'spaceage.ttf', $kill->getVictimCorpName());
imagettftext($im, 11, 0, 6, 46, $black, MPATH . 'spaceage.ttf', $kill->getVictimShipName());
imagettftext($im, 11, 0, 5, 45, $white, MPATH . 'spaceage.ttf', $kill->getVictimShipName());
// ship
$sid = $kill->getVictimShipExternalID();
$img = shipImage::get($sid);
imagecopyresampled($im, $img, 5, 5, 0, 0, 30, 30, 64, 64);
// player portrait
if (!$pid) {
    $pid = 0;
}
$img = imagecreatefromjpeg(Pilot::getPortraitPath(256, $pid));
imagefilledrectangle($im, 318, 18, 392, 92, $greyred_trans);
imagecopyresampled($im, $img, 320, 20, 0, 0, 70, 70, 256, 256);
imagedestroy($img);
Beispiel #18
0
    $pilot = Cacheable::factory('Pilot', $plt_id);
} else {
    $plt_ext_id = (int) edkURI::getArg('ext');
    if ($plt_ext_id) {
        $pilot = new Pilot(0, $plt_id);
        $plt_id = $pilot->getID();
    } else {
        $plt_id = edkURI::getArg('id');
        if (!$plt_id) {
            errorPic('No pilot id specified.');
            $pilot = new Pilot();
        } else {
            if ($plt_id < 1000000) {
                $pilot = Cacheable::factory('Pilot', $plt_id);
            } else {
                $pilot = new Pilot(0, $plt_id);
                $plt_id = $pilot->getID();
            }
        }
    }
}
if (!$plt_ext_id) {
    $plt_ext_id = $pilot->getExternalID();
}
// If we still don't have an external ID then just use the internal for names.
if (!$plt_ext_id) {
    $plt_ext_id = $plt_id;
}
if (!$pilot->exists()) {
    errorPic('That pilot doesnt exist.');
}
Beispiel #19
0
 /**
  * Return the raw killmail for this kill.
  *
  * @return string
  */
 function getRawMail()
 {
     if (!is_null($this->mail)) {
         return $this->mail;
     }
     if (config::get('km_cache_enabled') && file_exists(KB_PAGECACHEDIR . "/" . $this->getID() . ".txt")) {
         $this->mail = file_get_contents(KB_PAGECACHEDIR . "/" . $this->getID() . ".txt");
         return $this->mail;
     }
     if (!$this->timestamp) {
         $this->execQuery();
     }
     if (!$this->valid) {
         return "The specified kill ID is not valid.";
     }
     if ($this->isClassified()) {
         return 'Killmail not yet available, try again in ' . round($this->getClassifiedTime() / 3600, 2) . ' hrs.';
     }
     static $locations;
     if (!isset($locations)) {
         $qry = DBFactory::getDBQuery();
         $qry->execute("SELECT itl_id, itl_location FROM kb3_item_locations");
         while ($row = $qry->getRow()) {
             $locations[$row['itl_id']] = $row['itl_location'];
         }
     }
     $ship = $this->getVictimShip();
     $shipclass = $ship->getClass();
     if (!$this->getVictimCorpName()) {
         $corp = new Corporation($this->victimcorpid);
         $this->victimcorpname = $corp->getName();
     }
     if (!$this->getVictimAllianceName()) {
         $all = new Alliance($this->victimallianceid);
         $this->victimalliancename = $all->getName();
     }
     if (!$this->getVictimName()) {
         trigger_error("Invalid mail, victim name blank", E_USER_ERROR);
         return "";
     } else {
         if (!$this->getVictimCorpName()) {
             trigger_error("Invalid mail, victim corporation blank", E_USER_ERROR);
             return "";
         } else {
             if (!$this->getVictimAllianceName() && !$this->getVictimFactionName()) {
                 trigger_error("Invalid mail, victim alliance blank", E_USER_ERROR);
                 return "";
             } else {
                 if (!$ship->getName()) {
                     trigger_error("Invalid mail, ship blank", E_USER_ERROR);
                     return "";
                 } else {
                     if (!$this->getSystem()->getName()) {
                         trigger_error("Invalid mail, system blank", E_USER_ERROR);
                         return "";
                     }
                 }
             }
         }
     }
     $mail = substr(str_replace('-', '.', $this->getTimeStamp()), 0, 16) . "\r\n\r\n";
     // Starbase (so this is a POS mail)
     if (in_array($shipclass->getID(), array(35, 36, 37, 38))) {
         $mail .= "Corp: " . $this->getVictimCorpName() . "\r\n";
         if ($this->getIsVictimFaction()) {
             $mail .= "Alliance: None\r\n";
         } else {
             $mail .= "Alliance: " . $this->getVictimAllianceName() . "\r\n";
         }
         $mail .= "Faction: " . $this->getVictimFactionName() . "\r\n";
         //$ship = $this->getVictimShip();
         $mail .= "Destroyed: " . $ship->getName() . "\r\n";
         if ($this->getVictimName() == $this->getSystem()->getName()) {
             $mail .= "Moon: Unknown\r\n";
         } else {
             $mail .= "Moon: " . $this->getVictimName() . "\r\n";
         }
         $mail .= "System: " . $this->getSystem()->getName() . "\r\n";
         $mail .= "Security: " . $this->getSystem()->getSecurity(true) . "\r\n";
         $mail .= "Damage Taken: " . $this->dmgtaken . "\r\n\r\n";
         $mail .= "Involved parties:\r\n\r\n";
     } else {
         $mail .= "Victim: " . $this->getVictimName() . "\r\n";
         $mail .= "Corp: " . $this->getVictimCorpName() . "\r\n";
         if ($this->getIsVictimFaction()) {
             $mail .= "Alliance: None\r\n";
         } else {
             $mail .= "Alliance: " . $this->getVictimAllianceName() . "\r\n";
         }
         $mail .= "Faction: " . $this->getVictimFactionName() . "\r\n";
         //$ship = $this->getVictimShip();
         $mail .= "Destroyed: " . $ship->getName() . "\r\n";
         $system = $this->getSystem();
         $mail .= "System: " . $system->getName() . "\r\n";
         $mail .= "Security: " . $system->getSecurity(true) . "\r\n";
         $mail .= "Damage Taken: " . $this->dmgtaken . "\r\n\r\n";
         $mail .= "Involved parties:\r\n\r\n";
     }
     foreach ($this->involvedparties_ as $inv) {
         /* @var $inv InvolvedParty */
         $pilot = new Pilot($inv->getPilotID());
         $corp = new Corporation($inv->getCorpID());
         $alliance = new Alliance($inv->getAllianceID());
         $weapon = $inv->getWeapon();
         $ship = $inv->getShip();
         // Split these into multiple ifs so the error tells us where the
         // problem was.
         if (!$pilot->getName()) {
             trigger_error("Invalid mail, invalid involved pilot", E_USER_ERROR);
             var_dump($pilot);
             return "";
         } else {
             if (!$corp->getName()) {
                 trigger_error("Invalid mail, invalid involved corporation", E_USER_ERROR);
                 return "";
             } else {
                 if (!$alliance->getName()) {
                     trigger_error("Invalid mail, invalid involved alliance", E_USER_ERROR);
                     return "";
                 } else {
                     if (!$weapon->getName()) {
                         trigger_error("Invalid mail, invalid involved weapon", E_USER_ERROR);
                         return "";
                     } else {
                         if (!$ship->getName()) {
                             trigger_error("Invalid mail, invalid involved ship", E_USER_ERROR);
                             return "";
                         }
                     }
                 }
             }
         }
         if ($pilot->getName() == $weapon->getName()) {
             $name = $pilot->getName() . " / " . $corp->getName();
         } else {
             $name = $pilot->getName();
         }
         $mail .= "Name: " . $name;
         if ($pilot->getID() == $this->getFBPilotID()) {
             $mail .= " (laid the final blow)";
         }
         $mail .= "\r\n";
         if ($pilot->getName() != $weapon->getName()) {
             $mail .= "Security: " . $inv->getSecStatus() . "\r\n";
             $mail .= "Corp: " . $corp->getName() . "\r\n";
             if ($alliance->isFaction()) {
                 $mail .= "Alliance: None\r\n";
                 $mail .= "Faction: " . $alliance->getName() . "\r\n";
             } else {
                 $mail .= "Alliance: " . $alliance->getName() . "\r\n";
                 $mail .= "Faction: None\r\n";
             }
             $mail .= "Ship: " . $ship->getName() . "\r\n";
             $mail .= "Weapon: " . $weapon->getName() . "\r\n";
             $mail .= "Damage Done: " . $inv->getDamageDone() . "\r\n";
         } else {
             $mail .= "Damage Done: " . $inv->getDamageDone() . "\r\n";
         }
         $mail .= "\r\n";
     }
     if (count($this->destroyeditems_) > 0) {
         $mail .= "\r\nDestroyed items:\r\n\r\n";
         foreach ($this->destroyeditems_ as $destroyed) {
             $item = $destroyed->getItem();
             $mail .= $item->getName();
             if ($destroyed->getQuantity() > 1) {
                 $mail .= ", Qty: " . $destroyed->getQuantity();
             }
             if ($destroyed->getLocationID() == 5) {
                 $mail .= " (Cargo)";
             } else {
                 if ($destroyed->getLocationID() == 87) {
                     $mail .= " (Drone Bay)";
                 } else {
                     if ($destroyed->getLocationID() == 89) {
                         $mail .= " (Implant)";
                     } else {
                         if ($destroyed->getLocationID() == -1) {
                             $mail .= " (Copy)";
                         }
                     }
                 }
             }
             $mail .= "\r\n";
         }
     }
     if (count($this->droppeditems_) > 0) {
         $mail .= "\r\nDropped items:\r\n\r\n";
         foreach ($this->droppeditems_ as $dropped) {
             $item = $dropped->getItem();
             $mail .= $item->getName();
             if ($dropped->getQuantity() > 1) {
                 $mail .= ", Qty: " . $dropped->getQuantity();
             }
             if ($dropped->getLocationID() == 5) {
                 $mail .= " (Cargo)";
             } else {
                 if ($dropped->getLocationID() == 87) {
                     $mail .= " (Drone Bay)";
                 } else {
                     if ($dropped->getLocationID() == 89) {
                         $mail .= " (Implant)";
                     } else {
                         if ($dropped->getLocationID() == -1) {
                             $mail .= " (Copy) (Cargo)";
                         }
                     }
                 }
             }
             $mail .= "\r\n";
         }
     }
     if ($this->id && config::get('km_cache_enabled')) {
         file_put_contents(KB_MAILCACHEDIR . "/" . $this->getID() . ".txt", $mail);
     }
     $this->mail = $mail;
     return $mail;
 }
Beispiel #20
0
 /**
  *
  * @param KillList $killList
  * @return string KillList as XML
  */
 public static function killListToXML($killList)
 {
     global $idfeedversion;
     $qry = DBFactory::getDBQuery();
     $date = gmdate('Y-m-d H:i:s');
     $xml = "<?xml version='1.0' encoding='UTF-8'?>\n\t\t<eveapi version='2' edkapi='" . $idfeedversion . "'>\n\t\t</eveapi>";
     $sxe = new SimpleXMLElement($xml);
     // Let's start making the xml.
     $sxe->addChild('currentTime', $date);
     $result = $sxe->addChild('result');
     $kills = $result->addChild('rowset');
     $kills->addAttribute('name', 'kills');
     $kills->addAttribute('key', 'killID');
     $kills->addAttribute('columns', 'killID,solarSystemID,killTime,moonID,hash,trust');
     $count = 0;
     $timing = '';
     while ($kill = $killList->getKill()) {
         if (config::get('km_cache_enabled') && CacheHandler::exists($kill->getID() . ".xml", 'mails')) {
             $cachedRow = new SimpleXMLElement(CacheHandler::get($kill->getID() . ".xml", 'mails'));
             IDFeed::addXMLElement($kills, $cachedRow);
             continue;
         }
         $count++;
         if ($kill->isClassified()) {
             continue;
         }
         //$kill = Kill::getByID($kill->getID());
         $row = $kills->addChild('row');
         $row->addAttribute('killID', intval($kill->getExternalID()));
         $row->addAttribute('killInternalID', intval($kill->getID()));
         $row->addAttribute('solarSystemID', $kill->getSystem()->getExternalID());
         $row->addAttribute('killTime', $kill->getTimeStamp());
         $row->addAttribute('moonID', '0');
         $row->addAttribute('hash', bin2hex(IDFeed::getHash($kill, true)));
         $row->addAttribute('trust', 3);
         $victim = Pilot::getByID($kill->getVictimID());
         $victimCorp = Corporation::getByID($kill->getVictimCorpID());
         $victimAlliance = Alliance::getByID($kill->getVictimAllianceID());
         $victimrow = $row->addChild('victim');
         if ($victim->getName() == $kill->getVictimShipName()) {
             $victimrow->addAttribute('characterID', "0");
             $victimrow->addAttribute('characterName', "");
         } else {
             $victimrow->addAttribute('characterID', $victim->getExternalID());
             $victimrow->addAttribute('characterName', $victim->getName());
         }
         $victimrow->addAttribute('corporationID', $victimCorp->getExternalID());
         $victimrow->addAttribute('corporationName', $victimCorp->getName());
         if ($victimAlliance->isFaction()) {
             $victimrow->addAttribute('allianceID', 0);
             $victimrow->addAttribute('allianceName', '');
             $victimrow->addAttribute('factionID', $victimAlliance->getFactionID());
             $victimrow->addAttribute('factionName', $victimAlliance->getName());
         } else {
             $victimrow->addAttribute('allianceID', $victimAlliance->getExternalID());
             $victimrow->addAttribute('allianceName', $victimAlliance->getName());
             $victimrow->addAttribute('factionID', 0);
             $victimrow->addAttribute('factionName', '');
         }
         $victimrow->addAttribute('damageTaken', $kill->getDamageTaken());
         $victimrow->addAttribute('shipTypeID', $kill->getVictimShipExternalID());
         $involved = $row->addChild('rowset');
         $involved->addAttribute('name', 'attackers');
         $involved->addAttribute('columns', 'characterID,characterName,corporationID,corporationName,allianceID,allianceName,factionID,factionName,securityStatus,damageDone,finalBlow,weaponTypeID,shipTypeID');
         $sql = "SELECT ind_sec_status, ind_all_id, ind_crp_id,\n\t\t\t\tind_shp_id, ind_wep_id, ind_order, ind_dmgdone, plt_id, plt_name,\n\t\t\t\tplt_externalid, crp_name, crp_external_id,\n\t\t\t\twtype.typeName AS wep_name FROM kb3_inv_detail\n\t\t\t\tJOIN kb3_pilots ON (plt_id = ind_plt_id)\n\t\t\t\tJOIN kb3_corps ON (crp_id = ind_crp_id)\n\t\t\t\tJOIN kb3_invtypes wtype ON (ind_wep_id = wtype.typeID)\n\t\t\t\tWHERE ind_kll_id = " . $kill->getID() . " ORDER BY ind_order ASC";
         $qry->execute($sql);
         while ($inv = $qry->getRow()) {
             $invrow = $involved->addChild('row');
             if (strpos($inv['plt_name'], '- ') !== false) {
                 $inv['plt_name'] = substr($inv['plt_name'], strpos($inv['plt_name'], '- ') + 2);
             } else {
                 if (strpos($inv['plt_name'], '#') !== false) {
                     $name = explode("#", $inv['plt_name']);
                     $inv['plt_name'] = $name[3];
                 }
             }
             if ($inv['plt_name'] == $inv['wep_name']) {
                 $invrow->addAttribute('characterID', 0);
                 $invrow->addAttribute('characterName', "");
                 $invrow->addAttribute('weaponTypeID', 0);
                 $invrow->addAttribute('shipTypeID', $inv['ind_wep_id']);
             } else {
                 $invrow->addAttribute('characterID', $inv['plt_externalid']);
                 $invrow->addAttribute('characterName', $inv['plt_name']);
                 $invrow->addAttribute('weaponTypeID', $inv['ind_wep_id']);
                 $invrow->addAttribute('shipTypeID', $inv['ind_shp_id']);
             }
             $invrow->addAttribute('corporationID', $inv['crp_external_id']);
             $invrow->addAttribute('corporationName', $inv['crp_name']);
             $invAlliance = Alliance::getByID($inv['ind_all_id']);
             if ($invAlliance->isFaction()) {
                 $invrow->addAttribute('allianceID', 0);
                 $invrow->addAttribute('allianceName', '');
                 $invrow->addAttribute('factionID', $invAlliance->getFactionID());
                 $invrow->addAttribute('factionName', $invAlliance->getName());
             } else {
                 if (strcasecmp($invAlliance->getName(), "None") == 0) {
                     $invrow->addAttribute('allianceID', 0);
                     $invrow->addAttribute('allianceName', "");
                 } else {
                     $invrow->addAttribute('allianceID', $invAlliance->getExternalID());
                     $invrow->addAttribute('allianceName', $invAlliance->getName());
                 }
                 $invrow->addAttribute('factionID', 0);
                 $invrow->addAttribute('factionName', '');
             }
             $invrow->addAttribute('securityStatus', number_format($inv['ind_sec_status'], 1));
             $invrow->addAttribute('damageDone', $inv['ind_dmgdone']);
             if ($inv['plt_id'] == $kill->getFBPilotID()) {
                 $final = 1;
             } else {
                 $final = 0;
             }
             $invrow->addAttribute('finalBlow', $final);
         }
         $sql = "SELECT * FROM kb3_items_destroyed WHERE itd_kll_id = " . $kill->getID();
         $qry->execute($sql);
         $qry2 = DBFactory::getDBQuery();
         $sql = "SELECT * FROM kb3_items_dropped WHERE itd_kll_id = " . $kill->getID();
         $qry2->execute($sql);
         if ($qry->recordCount() || $qry2->recordCount()) {
             $items = $row->addChild('rowset');
             $items->addAttribute('name', 'items');
             $items->addAttribute('columns', 'typeID,flag,qtyDropped,qtyDestroyed, singleton');
             while ($iRow = $qry->getRow()) {
                 $itemRow = $items->addChild('row');
                 $itemRow->addAttribute('typeID', $iRow['itd_itm_id']);
                 $itemRow->addAttribute('flag', $iRow['itd_itl_id']);
                 if ($iRow['itd_itl_id'] == -1) {
                     $itemRow->addAttribute('singleton', 2);
                 } else {
                     $itemRow->addAttribute('singleton', 0);
                 }
                 $itemRow->addAttribute('qtyDropped', 0);
                 $itemRow->addAttribute('qtyDestroyed', $iRow['itd_quantity']);
             }
             while ($iRow = $qry2->getRow()) {
                 $itemRow = $items->addChild('row');
                 $itemRow->addAttribute('typeID', $iRow['itd_itm_id']);
                 $itemRow->addAttribute('flag', $iRow['itd_itl_id']);
                 if ($iRow['itd_itl_id'] == -1) {
                     $itemRow->addAttribute('singleton', 2);
                 } else {
                     $itemRow->addAttribute('singleton', 0);
                 }
                 $itemRow->addAttribute('qtyDropped', $iRow['itd_quantity']);
                 $itemRow->addAttribute('qtyDestroyed', 0);
             }
         }
         if (config::get('km_cache_enabled')) {
             CacheHandler::put($kill->getID() . ".xml", $row->asXML(), 'mails');
         }
         $timing .= $kill->getID() . ": " . (microtime(true) - $starttime) . "<br />";
     }
     $sxe->addChild('cachedUntil', $date);
     return $sxe->asXML();
 }
 public static function GenerateRow($pods = false, $header = true)
 {
     global $smarty;
     $klist = new KillList();
     $klist->setOrdered(true);
     $klist->setOrderBy("kll_isk_loss DESC");
     if ($pods == false) {
         $klist->setPodsNoobShips(false);
     } else {
         $klist->addVictimShipClass(2);
     }
     $klist->setLimit(self::NUM_DISPLAYED);
     if (isset($_GET["w"])) {
         self::$week = intval($_GET["w"]);
     }
     if (isset($_GET["m"])) {
         self::$month = intval($_GET["m"]);
     }
     if (isset($_GET["y"])) {
         self::$year = intval($_GET["y"]);
     }
     self::setTime(self::$week, self::$year, self::$month);
     $view = preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['view']);
     if (config::get('show_monthly')) {
         $start = makeStartDate(0, self::$year, self::$month);
         $end = makeEndDate(0, self::$year, self::$month);
         $klist->setStartDate(gmdate('Y-m-d H:i', $start));
         $klist->setEndDate(gmdate('Y-m-d H:i', $end));
         $smarty->assign("displaylist", date('F', mktime(0, 0, 0, self::$month, 1, self::$year)) . ", " . self::$year);
     } else {
         $klist->setWeek(self::$week);
         $klist->setYear(self::$year);
         $plist->setWeek(self::$week);
         $plist->setYear(self::$year);
         $smarty->assign("displaylist", "Week " . self::$week . ", " . self::$year);
     }
     if (config::get("exp_incloss")) {
         $smarty->assign("displaytype", "Kills and Losses");
         involved::load($klist, "combined");
     } else {
         $smarty->assign("displaytype", "Kills");
         involved::load($klist, "kill");
     }
     $kills = array();
     while ($kill = $klist->getKill()) {
         $kll = array();
         $plt = new Pilot($kill->getVictimID());
         if ($kill->isClassified() && !Session::isAdmin()) {
             $kll['systemsecurity'] = "-";
             $kll['system'] = Language::get("classified");
         } else {
             $kll['systemsecurity'] = $kill->getSolarSystemSecurity();
             $kll['system'] = $kill->getSolarSystemName();
         }
         $kll["id"] = $kill->getID();
         $kll["victim"] = $kill->getVictimName();
         $kll["victimid"] = $kill->getVictimID();
         $kll["victimship"] = $kill->getVictimShipName();
         $kll["victimshipid"] = $kill->getVictimShipExternalID();
         $kll["victimshipclass"] = $kill->getVictimShipClassName();
         $kll["victimcorp"] = $kill->getVictimCorpName();
         $kll["victimcorpid"] = $kill->getVictimCorpID();
         $alliance = Alliance::getByID($kill->getVictimAllianceID());
         if ($pods == false) {
             $kll["victimimageurl"] = $kill->getVictimShipImage(128);
         } else {
             $kll["victimimageurl"] = $plt->getPortraitURL(128);
         }
         $kll["victimallimage"] = $alliance->getPortraitURL(32);
         $kll["victimallname"] = $alliance->getName();
         if ((int) number_format($kill->getISKLoss(), 0, "", "") > 1000000000) {
             $kll["isklost"] = number_format($kill->getISKLoss() / 1000000000, 2, ".", "") . " Billion";
         } elseif ((int) number_format($kill->getISKLoss(), 0, "", "") > 1000000) {
             $kll["isklost"] = number_format($kill->getISKLoss() / 1000000, 2, ".", "") . " Million";
         } else {
             $kll["isklost"] = number_format($kill->getISKLoss(), 0, ".", ",");
         }
         if (config::get('cfg_allianceid') && in_array($kill->getVictimAllianceID(), config::get('cfg_allianceid'))) {
             $kll["class"] = "kl-loss";
             $kll["classlink"] = '<font color="#AA0000">&bull;</font>';
         } elseif (config::get('cfg_corpid') && in_array($kill->getVictimCorpID(), config::get('cfg_corpid'))) {
             $kll["class"] = "kl-loss";
             $kll["classlink"] = '<font color=\\"#AA0000\\">&bull;</font>';
         } elseif (config::get('cfg_pilotid') && in_array($kill->getVictimID(), config::get('cfg_pilotid'))) {
             $kll["class"] = "kl-loss";
             $kll["classlink"] = '<font color="#AA0000">&bull;</font>';
         } else {
             $kll["class"] = "kl-kill";
             $kll["classlink"] = '<font color="#00AA00">&bull;</font>';
         }
         $kills[] = $kll;
     }
     if ($header == true) {
         $smarty->assign("header", true);
     } else {
         $smarty->assign("header", false);
     }
     $smarty->assign("killlist", $kills);
     $smarty->assign("width", 100 / self::NUM_DISPLAYED);
     return $smarty->fetch(get_tpl('most_expensive_summary'));
 }
Beispiel #22
0
 /**
  * Generates the menu for the user
  * @return string
  */
 public static function menu()
 {
     $box = new Box('User');
     $box->setIcon('menu-item.gif');
     if (!user::loggedin()) {
         $box->addOption('link', 'Login', edkURI::build(array('a', 'login', true)));
         $box->addOption('link', 'Register', edkURI::build(array('a', 'register', true)));
     } else {
         if (user::get('usr_pilot_id')) {
             $plt = Pilot::getByID((int) user::get('usr_pilot_id'));
             $box->addOption('link', $plt->getName(), edkURI::build(array('a', 'pilot_detail', true), array('plt_id', $plt->getID(), true)));
         }
         $box->addOption('link', 'Logout', edkURI::build(array('a', 'logout', true)));
     }
     event::call('user_menu_create', $box);
     return $box->generate();
 }
Beispiel #23
0
 protected function processStep3Check(sfWebRequest $request)
 {
     $default_airport = AirportPeer::getByIdent(sfConfig::get('app_default_airport_ident'));
     $this->forward404Unless($default_airport);
     $app = $this->application_temp;
     $person = $this->person;
     if (!$person instanceof Person) {
         $person = new Person();
     }
     /* @var $app ApplicationTemp */
     /* @var $person Person */
     // Person
     $tmp_arr = $app->toArray(BasePeer::TYPE_FIELDNAME);
     $tmp_arr['evening_phone'] = $tmp_arr['eve_phone'];
     $tmp_arr['evening_comment'] = $tmp_arr['eve_comment'];
     unset($tmp_arr['id']);
     $person->fromArray($tmp_arr, BasePeer::TYPE_FIELDNAME);
     $person->save();
     // Member
     $member = MemberPeer::getByPersonId($person->getId());
     if (!$member instanceof Member) {
         $member = new Member();
     }
     // Generate external id using last member is and external id
     $c = new Criteria();
     $c->add(MemberPeer::EXTERNAL_ID, NULL, Criteria::ISNOTNULL);
     $c->addDescendingOrderByColumn(MemberPeer::ID);
     $external_member = MemberPeer::doSelectOne($c);
     $external_id = $external_member->getExternalId();
     $currentExternalId = $external_id + 1;
     //print_r($external_id);
     //print_r($currentExternalId);
     $member->setActive(1);
     $member->setCoPilot($app->getApplicantCopilot());
     $member->setContact('By Email');
     $member->setDateOfBirth($app->getDateOfBirth());
     $member->setDriversLicenseState($app->getDriversLicenseState());
     $member->setDriversLicenseNumber($app->getDriversLicenseNumber());
     $member->setEmergencyContactName($app->getEmergencyContactName());
     $member->setEmergencyContactPhone($app->getEmergencyContactPhone());
     $member->setFlightStatus($app->getApplicantPilot() ? 'Verify Orientation' : 'Non-pilot');
     $member->setJoinDate(time());
     $member->setLanguages($app->getLanguagesSpoken());
     //$member->setMasterMemberId($app->getMasterMemberId());
     $member->setMemberClassId($app->getMemberClassId());
     $member->setPersonId($person->getId());
     $member->setRenewedDate(time());
     $member->setRenewalDate(strtotime('+1 year'));
     $member->setSpouseName($app->getSpouseFirstName() . ' ' . $app->getSpouseLastName());
     //external_id generate
     $member->setExternalId($currentExternalId);
     $member->setWingId($app->getWingId());
     $member->save();
     // Pilot
     if ($app->getApplicantPilot()) {
         $pilot = new Pilot();
         $pilot->setMemberId($member->getId());
         $airport = AirportPeer::getByIdent($app->getHomeBase());
         if (!$airport instanceof Airport) {
             $airport = $default_airport;
         }
         $pilot->setPrimaryAirportId($airport->getId());
         $pilot->setTotalHours($app->getTotalHours());
         $pilot->setLicenseType('Private');
         foreach (sfConfig::get('app_pilot_license_types') as $key => $val) {
             if (stripos($app->getRatings(), $key) !== false) {
                 $pilot->setLicenseType($key);
             }
         }
         $pilot->setIfr(stripos($app->getRatings(), 'ifr') !== false ? 1 : 0);
         $pilot->setMultiEngine(stripos($app->getRatings(), 'multi') !== false ? 1 : 0);
         $pilot->setSeInstructor('No');
         // @see ApplicationForm
         foreach (sfConfig::get('app_pilot_se_instructor') as $key => $val) {
             if (stripos($app->getRatings(), $key) !== false) {
                 $pilot->setSeInstructor($key);
             }
         }
         $pilot->setMeInstructor($pilot->getSeInstructor());
         $pilot->save();
         // Availability
         $availability = new Availability();
         $availability->setMemberId($member->getId());
         $availability->setNotAvailable(0);
         $availability->setNoWeekday($app->getAvailabilityWeekdays() == 0);
         $availability->setNoNight($app->getAvailabilityWeeknights() == 0);
         $availability->setLastMinute($app->getAvailabilityLastMinute());
         $availability->setAsMissionMssistant($app->getAvailabilityCopilot());
         $availability->setNoWeekend($app->getAvailabilityWeekends() == 0);
         try {
             $availability->save();
         } catch (Exception $e) {
         }
         // Primary aircraft
         if ($app->getAircraftPrimaryId() && ($aircraft = AircraftPeer::retrieveByPK($app->getAircraftPrimaryId()))) {
             $pilot_aircraft = new PilotAircraft();
             $pilot_aircraft->setMemberId($member->getId());
             $pilot_aircraft->setAircraftId($aircraft->getId());
             $pilot_aircraft->setNNumber($app->getAircraftPrimaryNNumber());
             $pilot_aircraft->setOwn($app->getAircraftPrimaryOwn());
             $pilot_aircraft->setSeats($app->getAircraftPrimarySeats());
             $pilot_aircraft->setKnownIce($app->getAircraftPrimaryIce());
             $pilot_aircraft->save();
         }
         // Secondary aircraft
         if ($app->getAircraftSecondaryId() && ($aircraft = AircraftPeer::retrieveByPK($app->getAircraftSecondaryId()))) {
             $pilot_aircraft = new PilotAircraft();
             $pilot_aircraft->setMemberId($member->getId());
             $pilot_aircraft->setAircraftId($aircraft->getId());
             $pilot_aircraft->setNNumber($app->getAircraftSecondaryNNumber());
             $pilot_aircraft->setOwn($app->getAircraftSecondaryOwn());
             $pilot_aircraft->setSeats($app->getAircraftSecondarySeats());
             $pilot_aircraft->setKnownIce($app->getAircraftSecondaryIce());
             $pilot_aircraft->save();
         }
         // Third aircraft
         if ($app->getAircraftThirdId() && ($aircraft = AircraftPeer::retrieveByPK($app->getAircraftThirdId()))) {
             $pilot_aircraft = new PilotAircraft();
             $pilot_aircraft->setMemberId($member->getId());
             $pilot_aircraft->setAircraftId($aircraft->getId());
             $pilot_aircraft->setNNumber($app->getAircraftThirdNNumber());
             $pilot_aircraft->setOwn($app->getAircraftThirdOwn());
             $pilot_aircraft->setSeats($app->getAircraftThirdSeats());
             $pilot_aircraft->setKnownIce($app->getAircraftThirdIce());
             $pilot_aircraft->save();
         }
     }
     // Application_temp
     $app->setPersonId($person->getId());
     $app->setMemberId($member->getId());
     $app->setProcessedDate(time());
     $app->save();
     // Application
     $tmp_arr = $app->toArray(BasePeer::TYPE_FIELDNAME);
     $tmp_arr['date'] = $tmp_arr['application_date'];
     $tmp_arr['company'] = $tmp_arr['company_name'];
     foreach (sfConfig::get('app_pilot_license_types') as $key => $val) {
         if (stripos($tmp_arr['ratings'], $key) !== false) {
             $tmp_arr['license_type'] = $key;
         }
     }
     $tmp_arr['ifr'] = stripos($tmp_arr['ratings'], 'ifr') !== false ? 1 : 0;
     $tmp_arr['multi_engine'] = stripos($tmp_arr['ratings'], 'multi') !== false ? 1 : 0;
     $tmp_arr['se_instructor'] = 'No';
     // @see ApplicationForm
     foreach (sfConfig::get('app_pilot_se_instructor') as $key => $val) {
         if (stripos($tmp_arr['ratings'], $key) !== false) {
             $tmp_arr['se_instructor'] = $key;
         }
     }
     $tmp_arr['me_instructor'] = $tmp_arr['se_instructor'];
     $tmp_arr['other_ratings'] = $tmp_arr['ratings'];
     $tmp_arr['fbo'] = $tmp_arr['fbo_name'];
     $tmp_arr['member_meetings'] = 0;
     $tmp_arr['executive_board'] = 0;
     $tmp_arr['dues_amount_paid'] = $tmp_arr['dues_amount_paid'] ? $tmp_arr['dues_amount_paid'] : 0;
     unset($tmp_arr['id']);
     $application = new Application();
     $application->fromArray($tmp_arr, BasePeer::TYPE_FIELDNAME);
     $application->save();
     $where = $request->getParameter('step3_redirect');
     //Ziyed  save default role for new member
     $appTemp = $this->application_temp;
     if ($appTemp->getPersonId()) {
         $person_role = new PersonRole();
         $person_role->setPersonId($appTemp->getPersonId());
         if ($appTemp->getApplicantPilot() == 1) {
             $person_role->setRoleId(27);
         } else {
             $person_role->setRoleId(31);
         }
         $person_role->save();
     }
     //Ziyed end save
     if ($where == 1) {
         $this->redirect('@member_view?id=' . $member->getId());
     } else {
         /*
                     if ($application->getEmail()) {
                         # send email failure to payment
                         $this->getComponent('mail', 'memberApplicationProcessed', array('email' => $application->getEmail(),'member_id'=>$member->getId(), 'name' => $application->getFirstName() . ' ' . $application->getLastName()));
         
                     }*/
         $this->redirect('pending_member/processComplete?id=' . $member->getId());
     }
 }
Beispiel #24
0
 /**
  * Declares an association between this object and a Pilot object.
  *
  * @param      Pilot $v
  * @return     MissionLegChange The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setPilot(Pilot $v = null)
 {
     if ($v === null) {
         $this->setPilotId(NULL);
     } else {
         $this->setPilotId($v->getId());
     }
     $this->aPilot = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Pilot object, it will not be re-added.
     if ($v !== null) {
         $v->addMissionLegChange($this);
     }
     return $this;
 }
Beispiel #25
0
 /**
  * @return integer
  */
 function getPilotID()
 {
     return $this->pilot_->getID();
 }
Beispiel #26
0
 protected function processStep3Check(sfWebRequest $request)
 {
     $default_airport = AirportPeer::getByIdent(sfConfig::get('app_default_airport_ident'));
     $this->forward404Unless($default_airport);
     $app = $this->application_temp;
     $person = $this->person;
     if (!$person instanceof Person) {
         $person = new Person();
     }
     /* @var $app ApplicationTemp */
     /* @var $person Person */
     // Person
     $tmp_arr = $app->toArray(BasePeer::TYPE_FIELDNAME);
     $tmp_arr['evening_phone'] = $tmp_arr['eve_phone'];
     $tmp_arr['evening_comment'] = $tmp_arr['eve_comment'];
     unset($tmp_arr['id']);
     $person->fromArray($tmp_arr, BasePeer::TYPE_FIELDNAME);
     $person->save();
     // Member
     $member = MemberPeer::retrieveByPK($app->getMemberId());
     if (!$member instanceof Member) {
         $member = new Member();
     }
     $member->setActive(1);
     $member->setCoPilot($app->getApplicantCopilot());
     $member->setContact('By Email');
     $member->setDateOfBirth($app->getDateOfBirth());
     $member->setDriversLicenseState($app->getDriversLicenseState());
     $member->setDriversLicenseNumber($app->getDriversLicenseNumber());
     $member->setEmergencyContactName($app->getEmergencyContactName());
     $member->setEmergencyContactPhone($app->getEmergencyContactPhone());
     $member->setFlightStatus($app->getApplicantPilot() ? 'Verify Orientation' : 'Non-pilot');
     //$member->setJoinDate(time());
     $member->setLanguages($app->getLanguagesSpoken());
     //Farazi
     //$member->setMasterMemberId($app->getMasterMemberId());
     // Get Last renewal date
     $this->member = MemberPeer::retrieveByPK($app->getMemberId());
     $lastRenewalDate = strtotime($this->member->getRenewalDate());
     $member->setMemberClassId($app->getMemberClassId());
     $member->setPersonId($person->getId());
     $member->setRenewedDate(time());
     ///Farazi Renewal Date From Memberclass
     if ($app->getMemberClassId()) {
         $memclass = MemberClassPeer::retrieveByPK($app->getMemberClassId());
         $renewal_period = $memclass->getRenewalPeriod();
         $renewalTime = strtotime('+' . $renewal_period . ' month', $lastRenewalDate);
         //echo $renewalTime;
         $member->setRenewalDate($renewalTime);
         //$member->setRenewalDate(strtotime('+'.$renewal_period.' month'));
     }
     // Farazi End
     //$member->setRenewalDate(strtotime('+1 year'));
     $member->setSpouseName($app->getSpouseFirstName() . ' ' . $app->getSpouseLastName());
     $member->setWeight($app->getWeight());
     $member->setWingId($app->getWingId());
     $member->save();
     // Pilot
     if ($app->getApplicantPilot()) {
         $pilot = $member->getPilot();
         if (!$pilot instanceof Pilot) {
             $pilot = new Pilot();
         }
         if ($pilot->isNew()) {
             // remove aircrafts
             foreach ($member->getPilotAircrafts() as $p_a) {
                 PilotAircraftPeer::doDelete($p_a);
             }
         }
         $pilot->setMemberId($member->getId());
         $airport = AirportPeer::getByIdent($app->getHomeBase());
         if (!$airport instanceof Airport) {
             $airport = $default_airport;
         }
         $pilot->setPrimaryAirportId($airport->getId());
         $pilot->setTotalHours($app->getTotalHours());
         $pilot->setLicenseType('Private');
         foreach (sfConfig::get('app_pilot_license_types') as $key => $val) {
             if (stripos($app->getRatings(), $key) !== false) {
                 $pilot->setLicenseType($key);
             }
         }
         $pilot->setIfr(stripos($app->getRatings(), 'ifr') !== false ? 1 : 0);
         $pilot->setMultiEngine(stripos($app->getRatings(), 'multi') !== false ? 1 : 0);
         $pilot->setSeInstructor('No');
         // @see ApplicationForm
         foreach (sfConfig::get('app_pilot_se_instructor') as $key => $val) {
             if (stripos($app->getRatings(), $key) !== false) {
                 $pilot->setSeInstructor($key);
             }
         }
         $pilot->setMeInstructor($pilot->getSeInstructor());
         $pilot->save();
         // Availability
         $availability = $member->getAvailability();
         if (!$availability instanceof Availability) {
             $availability = new Availability();
         }
         $availability->setMemberId($member->getId());
         $availability->setNotAvailable(0);
         $availability->setNoWeekday($app->getAvailabilityWeekdays() == 0);
         $availability->setNoNight($app->getAvailabilityWeeknights() == 0);
         $availability->setLastMinute($app->getAvailabilityLastMinute());
         $availability->setAsMissionMssistant($app->getAvailabilityCopilot());
         $availability->setNoWeekend($app->getAvailabilityWeekends() == 0);
         $availability->save();
         //Farazi
         //Delete all aircrafts
         $pilot_aircrafts = PilotAircraftPeer::getByMemberId($member->getId());
         foreach ($pilot_aircrafts as $pilot_aircraft) {
             $pilot_aircraft->delete();
         }
         // Primary aircraft
         if ($app->getAircraftPrimaryId() && ($aircraft = AircraftPeer::retrieveByPK($app->getAircraftPrimaryId()))) {
             $pilot_aircraft = new PilotAircraft();
             $pilot_aircraft->setMemberId($member->getId());
             $pilot_aircraft->setAircraftId($aircraft->getId());
             $pilot_aircraft->setNNumber($app->getAircraftPrimaryNNumber());
             $pilot_aircraft->setOwn($app->getAircraftPrimaryOwn());
             $pilot_aircraft->setSeats($app->getAircraftPrimarySeats());
             $pilot_aircraft->setKnownIce($app->getAircraftPrimaryIce());
             $pilot_aircraft->save();
         }
         // Secondary aircraft
         if ($app->getAircraftSecondaryId() && ($aircraft = AircraftPeer::retrieveByPK($app->getAircraftSecondaryId()))) {
             $pilot_aircraft = new PilotAircraft();
             $pilot_aircraft->setMemberId($member->getId());
             $pilot_aircraft->setAircraftId($aircraft->getId());
             $pilot_aircraft->setNNumber($app->getAircraftSecondaryNNumber());
             $pilot_aircraft->setOwn($app->getAircraftSecondaryOwn());
             $pilot_aircraft->setSeats($app->getAircraftSecondarySeats());
             $pilot_aircraft->setKnownIce($app->getAircraftSecondaryIce());
             $pilot_aircraft->save();
         }
         // Third aircraft
         if ($app->getAircraftThirdId() && ($aircraft = AircraftPeer::retrieveByPK($app->getAircraftThirdId()))) {
             $pilot_aircraft = new PilotAircraft();
             $pilot_aircraft->setMemberId($member->getId());
             $pilot_aircraft->setAircraftId($aircraft->getId());
             $pilot_aircraft->setNNumber($app->getAircraftThirdNNumber());
             $pilot_aircraft->setOwn($app->getAircraftThirdOwn());
             $pilot_aircraft->setSeats($app->getAircraftThirdSeats());
             $pilot_aircraft->setKnownIce($app->getAircraftThirdIce());
             $pilot_aircraft->save();
         }
     }
     // Application_temp
     $app->setPersonId($person->getId());
     $app->setMemberId($member->getId());
     $app->setProcessedDate(time());
     $app->save();
     // Application
     $tmp_arr = $app->toArray(BasePeer::TYPE_FIELDNAME);
     $tmp_arr['date'] = $tmp_arr['application_date'];
     $tmp_arr['company'] = $tmp_arr['company_name'];
     foreach (sfConfig::get('app_pilot_license_types') as $key => $val) {
         if (stripos($tmp_arr['ratings'], $key) !== false) {
             $tmp_arr['license_type'] = $key;
         }
     }
     $tmp_arr['ifr'] = stripos($tmp_arr['ratings'], 'ifr') !== false ? 1 : 0;
     $tmp_arr['multi_engine'] = stripos($tmp_arr['ratings'], 'multi') !== false ? 1 : 0;
     $tmp_arr['se_instructor'] = 'No';
     // @see ApplicationForm
     foreach (sfConfig::get('app_pilot_se_instructor') as $key => $val) {
         if (stripos($tmp_arr['ratings'], $key) !== false) {
             $tmp_arr['se_instructor'] = $key;
         }
     }
     $tmp_arr['me_instructor'] = $tmp_arr['se_instructor'];
     $tmp_arr['other_ratings'] = $tmp_arr['ratings'];
     $tmp_arr['fbo'] = $tmp_arr['fbo_name'];
     $tmp_arr['member_meetings'] = 0;
     $tmp_arr['executive_board'] = 0;
     $tmp_arr['dues_amount_paid'] = $tmp_arr['dues_amount_paid'] ? $tmp_arr['dues_amount_paid'] : 0;
     $tmp_arr['donation_amount_paid'] = $tmp_arr['donation_amount_paid'] ? $tmp_arr['donation_amount_paid'] : 0;
     unset($tmp_arr['id']);
     $application = new Application();
     $application->fromArray($tmp_arr, BasePeer::TYPE_FIELDNAME);
     $application->save();
     $this->getUser()->setFlash('success', 'Membership renewal completed successfully.');
     //$this->redirect('renewal/processComplete?id='.$member->getId());
     $this->redirect('renewal/processStep3?id=' . $this->application_temp->getId());
     //$this->redirect('renewal/index?id='.$member->getId());
 }
<?php

/**
 * @package EDK
 */
/**
 * Made by Agustino and HyperBeanie
 * If you use and like these tools, please donate some isk!
 */
$plt_id = $_GET['plt_id'];
// Make the pilot
$pilot = new Pilot($plt_id);
$page = new Page('Administration - Killmail export - ' . $pilot->getName());
$page->setAdmin();
$corp = $pilot->getCorp();
$alliance = $corp->getAlliance();
// Do the check
if (!$pilot->exists()) {
    $html = "That pilot doesn't exist.";
    $page->generate($html);
    exit;
}
$html .= "<form><textarea class=killmail id=killmail name=killmail cols=\"55\" rows=\"35\" readonly=readonly>";
// Setup the lists
$klist = new KillList();
$klist->setOrdered(true);
$klist->addInvolvedPilot($pilot);
$klist->rewind();
while ($kll_id = $klist->getKill()) {
    $kill = new Kill($kll_id->getID());
    $html .= "\"";
Beispiel #28
0
 /**
  * Declares an association between this object and a Pilot object.
  *
  * @param      Pilot $v
  * @return     Pilot The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setPilotRelatedByMopOrientedMemberId(Pilot $v = null)
 {
     if ($v === null) {
         $this->setMopOrientedMemberId(NULL);
     } else {
         $this->setMopOrientedMemberId($v->getId());
     }
     $this->aPilotRelatedByMopOrientedMemberId = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Pilot object, it will not be re-added.
     if ($v !== null) {
         $v->addPilotRelatedByMopOrientedMemberId($this);
     }
     return $this;
 }
Beispiel #29
0
     config::set('post_permission', implode(',', $conf));
 }
 asort($permissions['a']);
 asort($permissions['c']);
 asort($permissions['p']);
 $permt = array();
 foreach ($permissions as $typ => $ids) {
     foreach ($ids as $id) {
         if ($typ == 'a') {
             $alliance = new Alliance($id);
             $text = $alliance->getName();
             $link = KB_HOST . '/?a=admin_postperm&amp;del=' . $typ . $id . '&amp;akey=' . session::makeKey();
             $permt[$typ][] = array('text' => $text, 'link' => $link);
         }
         if ($typ == 'p') {
             $pilot = new Pilot($id);
             $text = $pilot->getName();
             $link = KB_HOST . '/?a=admin_postperm&amp;del=' . $typ . $id . '&amp;akey=' . session::makeKey();
             $permt[$typ][] = array('text' => $text, 'link' => $link);
         }
         if ($typ == 'c') {
             $corp = new Corporation($id);
             $text = $corp->getName();
             $link = KB_HOST . '/?a=admin_postperm&amp;del=' . $typ . $id . '&amp;akey=' . session::makeKey();
             $permt[$typ][] = array('text' => $text, 'link' => $link);
         }
     }
 }
 $perm = array();
 if ($permt['a']) {
     $perm[] = array('name' => 'Alliances', 'list' => $permt['a']);
Beispiel #30
0
<?php

/**
 * @package EDK
 */
$page = new Page('Signature Listing');
$signatures = array();
$dir = opendir(dirname(__FILE__) . '/signatures');
while ($line = readdir($dir)) {
    if (file_exists(dirname(__FILE__) . '/signatures/' . $line . '/' . $line . '.php')) {
        $signatures[] = $line;
    }
}
$smarty->assign('signatures', $signatures);
$smarty->assign('kb_host', KB_HOST);
if (intval($_GET['ext'])) {
    $pilot = new Pilot(0, $_GET['ext']);
    $smarty->assign('pilot', intval($pilot->getID()));
} else {
    $smarty->assign('pilot', intval($_GET['i']));
}
$page->setContent($smarty->fetch('file:' . dirname(__FILE__) . '/sig_list.tpl'));
$page->generate();