Esempio n. 1
0
 public function addbid()
 {
     if (!Auth::LoggedIn()) {
         return;
     }
     $routeid = $this->get->id;
     if ($routeid == '') {
         echo 'No route passed';
         return;
     }
     // See if this is a valid route
     $route = SchedulesData::findSchedules(array('s.id' => $routeid));
     if (!is_array($route) && !isset($route[0])) {
         echo 'Invalid Route';
         return;
     }
     CodonEvent::Dispatch('bid_preadd', 'Schedules', $routeid);
     /* Block any other bids if they've already made a bid
      */
     if (Config::Get('DISABLE_BIDS_ON_BID') == true) {
         $bids = SchedulesData::getBids(Auth::$userinfo->pilotid);
         # They've got somethin goin on
         if (count($bids) > 0) {
             echo 'Bid exists!';
             return;
         }
     }
     $ret = SchedulesData::AddBid(Auth::$userinfo->pilotid, $routeid);
     CodonEvent::Dispatch('bid_added', 'Schedules', $routeid);
     if ($ret == true) {
         echo 'Bid added';
     } else {
         echo 'Already in bids!';
     }
 }