예제 #1
0
 public static function send_all_pireps()
 {
     if (!self::central_enabled()) {
         return false;
     }
     if (self::$debug === false) {
         $within_timelimit = CronData::check_hoursdiff('update_pireps', self::$limits['update_pireps']);
         if ($within_timelimit == true) {
             return false;
         }
     }
     self::set_xml('update_pireps');
     //$allpireps = PIREPData::GetAllReports();
     $params = array('DATE_SUB(CURDATE(), INTERVAL 6 MONTH) <= p.submitdate');
     $allpireps = PIREPData::findPIREPS($params);
     if (!$allpireps) {
         return false;
     }
     // Set them all to have not been exported
     PIREPData::setAllExportStatus(false);
     self::$xml->addChild('total', count($allpireps));
     foreach ($allpireps as $pirep) {
         # Skip erronious entries
         if ($pirep->aircraft == '') {
             continue;
         }
         self::get_pirep_xml($pirep);
     }
     CronData::set_lastupdate('update_pireps');
     $resp = self::send_xml();
     // Only if we get a valid response, set the PIREPs to exported
     if ($resp === true) {
         PIREPData::setAllExportStatus(true);
         return true;
     }
 }
예제 #2
0
 /**
  * CentralData::send_all_pireps()
  * 
  * @return
  */
 public static function send_all_pireps()
 {
     if (!self::central_enabled()) {
         return false;
     }
     if (self::$debug === false) {
         $within_timelimit = CronData::check_hoursdiff('update_pireps', self::$limits['update_pireps']);
         if ($within_timelimit == true) {
             return false;
         }
     }
     $allpireps = PIREPData::findPIREPS(array());
     if (!$allpireps) {
         return false;
     }
     // Set them all to have not been exported
     PIREPData::setAllExportStatus(false);
     self::startBody('update_pireps');
     self::addElement(null, 'total', count($allpireps));
     foreach ($allpireps as $pirep) {
         # Skip erronious entries
         if ($pirep->aircraft == '') {
             continue;
         }
         self::get_pirep_xml($pirep);
     }
     CronData::set_lastupdate('update_pireps');
     $resp = self::sendToCentral();
     // Only if we get a valid response, set the PIREPs to exported
     if ($resp === true) {
         PIREPData::setAllExportStatus(true);
         return true;
     }
 }