$page_num = $_REQUEST["page_num"] + 0; if ($page_num == 0) { $page_num = 1; } if ($cat == 0) { $where_clause = ""; } else { $where_clause = " AND cat={$cat} "; } $queryExtraArray = array(); $legend = ""; $legend = "<b>" . _MENU_FLIGHTS . "</b> "; // SEASON MOD if (!$clubID) { // if we are viewing a club, the dates will be taken care wit hthe CLUB code $where_clause .= dates::makeWhereClause(0, $season, $year, $month, $CONF_use_calendar ? $day : 0); } // BRANDS MOD $where_clause .= brands::makeWhereClause($brandID); // take care of exluding flights // 1-> first bit -> means flight will not be counted anywhere!!! $bitMask = 1 & ~($includeMask & 0x1); $where_clause .= " AND ( excludeFrom & {$bitMask} ) = 0 "; if ($pilotID != 0) { $where_clause .= " AND userID='" . $pilotID . "' AND userServerID={$serverID} "; } else { // 0 means all flights BUT not test ones $where_clause .= " AND userID>0 "; } if ($takeoffID) { $where_clause .= " AND takeoffID='" . $takeoffID . "' ";
/** * Patch for reports by The Answer (17-10-2k8) * * * @name reportsPatch * * param * @return void */ function reportsPatch() { require_once 'classes/model/AppDelegation.php'; $oCriteria = new Criteria('workflow'); $del = DBAdapter::getStringDelimiter(); $oCriteria->addSelectColumn(AppDelegationPeer::APP_UID); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); $oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_DURATION); $oDataset = AppDelegationPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oAppDelegation = new AppDelegation(); $aData['APP_UID'] = $aRow['APP_UID']; $aData['DEL_INDEX'] = $aRow['DEL_INDEX']; $aData['DEL_DELEGATE_DATE'] = $aRow['DEL_DELEGATE_DATE']; if ($aRow['DEL_INIT_DATE'] == NULL) { $aData['DEL_INIT_DATE'] = $aRow['DEL_DELEGATE_DATE']; } else { $aData['DEL_INIT_DATE'] = $aRow['DEL_INIT_DATE']; } //$aData['DEL_FINISH_DATE']=$aRow['DEL_FINISH_DATE']; if ($aRow['DEL_DURATION'] != 0) { G::LoadClass('dates'); $oDates = new dates(); $aData['DEL_DURATION'] = $oDates->calculateDuration($aData['DEL_INIT_DATE'], $aRow['DEL_FINISH_DATE'], null, null, $aRow['TAS_UID']); } $oAppDelegation->update($aData); $oDataset->next(); } return; }
private function getTermine($von, $bis, $gebaude) { $termine = array(); for ($i = 0; $von < $bis and $i < 100; $i++) { //date("j",$von_durch) < date("j",$bis) $dates = new dates($von, $gebaude); $tempdates = $dates->getDates(); //$dates->debug($dates->getDates()); $tempdates[]["lauf"] = $i; $termine = array_merge($termine, $tempdates); //ein Tag vor $von = $von + $dates->daysec + 1; } $vorlesungen = array(); $i = 0; $wochentage = $this->getwochentage($von, $bis); foreach ($termine as $termin) { if (!empty($termin["begin"])) { $vorlesungen[$i]["von"] = "(" . $this->raumbelegung->deutscherTag(date('D', $termin["begin"])) . ") " . date("d.m.y - H:i", $termin["begin"]); $vorlesungen[$i]["bis"] = "(" . $this->raumbelegung->deutscherTag(date('D', $termin["end"])) . ") " . date("d.m.y - H:i", $termin["end"]); $vorlesungen[$i]["raum"] = $termin["Raum"]; if ($termin["titel"] == "") { $vlinfos = raumbelegung::getTitel($termin["id"]); $vorlesungen[$i]["titel"] = $vlinfos["Name"]; $vorlesungen[$i]["Dozent"] = raumbelegung::getDozent($vlinfos["Seminar_id"]); } else { if ($termin["begin"] != $termin["repeat_end"] and !empty($termin["repeat_end"])) { $vorlesungen[$i]["titel"] = $termin["titel"] . " (Regelmässiger Termin bis zum " . "(" . $this->raumbelegung->deutscherTag(date('D', $termin["repeat_end"])) . ") " . date("d.m.y", $termin["repeat_end"]) . ")"; } else { $vorlesungen[$i]["titel"] = $termin["titel"]; } $vorlesungen[$i]["Dozent"] = " × "; } $i++; } } return $vorlesungen; }
function toCalculateTime($aData, $iDate = null) { G::LoadClass('dates'); $oDates = new dates(); $iDate = isset($iDate) ? $iDate : date('Y-m-d H:i:s'); $estimatedDuration = $aData['EVN_TAS_ESTIMATED_DURATION']; //task duration $when = $aData['EVN_WHEN']; //how many days $whenOccurs = $aData['EVN_WHEN_OCCURS']; //time on action (AFTER_TIME/TASK_STARTED) if ($whenOccurs == 'TASK_STARTED') { $calculatedDueDateA = $oDates->calculateDate($iDate, $when, 'days', 1); $sActionDate = date('Y-m-d H:i:s', $calculatedDueDateA['DUE_DATE_SECONDS']); } else { $calculatedDueDateA = $oDates->calculateDate($iDate, $estimatedDuration + $when, 'days', 1); $sActionDate = date('Y-m-d H:i:s', $calculatedDueDateA['DUE_DATE_SECONDS']); } return $sActionDate; }
$CONF['seasons']['seasons'] = array(2008 => array('start' => '2007-10-1', 'end' => '2008-09-30'), 2007 => array('start' => '2006-10-1', 'end' => '2007-9-30', 'subseasons' => array('winter' => array('start' => '2006-10-1', 'end' => '2007-3-31', 'localName' => 'winterInLocalLanguage'), 'summer' => array('start' => '2007-3-1', 'end' => '2007-9-30', 'localName' => 'summerInLocalLanguage')))); // The next 4 values will be used in case of $CONF['seasons']['show_only_defined_seasons']=0 $CONF['seasons']['season_default_start'] = '10-1'; $CONF['seasons']['season_default_end'] = '9-31'; // ONLY ONE of the 3 next varibles canbe set to TRUE !!! // if the season 2007 is 2006-10-1 till 2007-9-30 $CONF['seasons']['season_start_year_diff'] = -1; $CONF['seasons']['season_end_year_diff'] = 0; // else if season 2007 is 2007-4-1 till 2008-3-31 //$CONF['seasons']['season_start_year_diff']=0; //$CONF['seasons']['season_end_year_diff']=1; // else if season 2007 is 2007-1-1 till 2007-12-31 //$CONF['seasons']['season_start_year_diff']=0; //$CONF['seasons']['season_end_year_diff']=0; $CONF['seasons']['start_season'] = 2006; $CONF['seasons']['end_season'] = dates::getCurrentSeason(0); // end of seasons config // start of BRANDS MOD $CONF['brands']['filter_brands'] = 0; $CONF['brands']['showAll'] = 0; $CONF['brands']['list'] = array(); $CONF['brands']['filterList'] = array(1, 2, 4); // end of BRANDS MOD // this is the default setting for the user's -> "My settings" $CONF_googleMapsShow = 1; // 1- > western -> firstName - LastName // 2- > eastern -> LastName - firstName $CONF_defaultNameOrder = 1; // USE airspace checking $CONF_airspaceChecks = 0; // airspace infrigments will be show to admins and the owner of the track
'subranks'=>array( 1=>array('id'=>1, 'name'=>'Paraglider', 'localName'=>'Paraglider', ), 2=>array('id'=>2, 'name'=>'Hangglider', 'localName'=>'Drachen', ), ), ), ); */ require_once dirname(__FILE__) . "/../CL_dates.php"; foreach ($ranksList as $tmpRankID => $tmpRank) { $foundCurrentSeason = 0; if ($ranksList[$tmpRankID]['seasons']['end_season'] == 'current') { $foundCurrentSeason = dates::getCurrentSeason($tmpRankID); $ranksList[$tmpRankID]['seasons']['end_season'] = $foundCurrentSeason; } if ($ranksList[$tmpRankID]['datesMenu'] == 'seasons' && $ranksList[$tmpRankID]['menuYear'] == 'current') { if (!$foundCurrentSeason) { $foundCurrentSeason = dates::getCurrentSeason($tmpRankID); } $ranksList[$tmpRankID]['menuYear'] = $foundCurrentSeason; } }
function executeCaseSelfService() { try { global $sFilter; if ($sFilter != "" && strpos($sFilter, "unassigned-case") === false) { return false; } $criteria = new Criteria("workflow"); //SELECT $criteria->addSelectColumn(AppCacheViewPeer::APP_UID); $criteria->addSelectColumn(AppCacheViewPeer::DEL_INDEX); $criteria->addSelectColumn(AppCacheViewPeer::DEL_DELEGATE_DATE); $criteria->addSelectColumn(AppCacheViewPeer::APP_NUMBER); $criteria->addSelectColumn(AppCacheViewPeer::PRO_UID); $criteria->addSelectColumn(TaskPeer::TAS_UID); $criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_TIME); $criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_TIME_UNIT); $criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_TRIGGER_UID); //FROM $condition = array(); $condition[] = array(AppCacheViewPeer::TAS_UID, TaskPeer::TAS_UID); $condition[] = array(TaskPeer::TAS_SELFSERVICE_TIMEOUT, 1); $criteria->addJoinMC($condition, Criteria::LEFT_JOIN); //WHERE $criteria->add(AppCacheViewPeer::USR_UID, ""); $criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"); //QUERY $rsCriteria = AppCacheViewPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); setExecutionMessage("Unassigned case"); saveLog("unassignedCase", "action", "Unassigned case", "c"); $date = new dates(); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $appcacheAppUid = $row["APP_UID"]; $appcacheDelIndex = $row["DEL_INDEX"]; $appcacheDelDelegateDate = $row["DEL_DELEGATE_DATE"]; $appcacheAppNumber = $row["APP_NUMBER"]; $appcacheProUid = $row["PRO_UID"]; $taskUid = $row["TAS_UID"]; $taskSelfServiceTime = intval($row["TAS_SELFSERVICE_TIME"]); $taskSelfServiceTimeUnit = $row["TAS_SELFSERVICE_TIME_UNIT"]; $taskSelfServiceTriggerUid = $row["TAS_SELFSERVICE_TRIGGER_UID"]; $dueDate = $date->calculateDate($appcacheDelDelegateDate, $taskSelfServiceTime, $taskSelfServiceTimeUnit, 1); if (time() > $dueDate["DUE_DATE_SECONDS"]) { $sessProcess = null; $sessProcessSw = 0; //Load data $case = new Cases(); $appFields = $case->loadCase($appcacheAppUid); $appFields["APP_DATA"]["APPLICATION"] = $appcacheAppUid; if (isset($_SESSION["PROCESS"])) { $sessProcess = $_SESSION["PROCESS"]; $sessProcessSw = 1; } $_SESSION["PROCESS"] = $appFields["PRO_UID"]; //Execute trigger $criteriaTgr = new Criteria(); $criteriaTgr->add(TriggersPeer::TRI_UID, $taskSelfServiceTriggerUid); $rsCriteriaTgr = TriggersPeer::doSelectRS($criteriaTgr); $rsCriteriaTgr->setFetchmode(ResultSet::FETCHMODE_ASSOC); if ($rsCriteriaTgr->next()) { $row = $rsCriteriaTgr->getRow(); if (is_array($row) && $row["TRI_TYPE"] == "SCRIPT") { $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); $arrayCron["processcTimeProcess"] = 60; //Minutes $arrayCron["processcTimeStart"] = time(); @file_put_contents(PATH_DATA . "cron", serialize($arrayCron)); //Trigger global $oPMScript; $oPMScript = new PMScript(); $oPMScript->setFields($appFields["APP_DATA"]); $oPMScript->setScript($row["TRI_WEBBOT"]); $oPMScript->execute(); $appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], $oPMScript->aFields); $case->updateCase($appFields["APP_UID"], $appFields); saveLog("unassignedCase", "action", "OK Executed tigger to the case {$appcacheAppNumber}"); } } unset($_SESSION["PROCESS"]); if ($sessProcessSw == 1) { $_SESSION["PROCESS"] = $sessProcess; } } } setExecutionResultMessage("DONE"); } catch (Exception $e) { setExecutionResultMessage("WITH ERRORS", "error"); eprintln(" '-" . $e->getMessage(), "red"); saveLog("unassignedCase", "error", "Error in unassigned case: " . $e->getMessage()); } }
public function validatePassword($sPassword, $sLastUpdate, $iChangePasswordNextTime) { if (!defined('PPP_MINIMUM_LENGTH')) { define('PPP_MINIMUM_LENGTH', 5); } if (!defined('PPP_MAXIMUM_LENGTH')) { define('PPP_MAXIMUM_LENGTH', 20); } if (!defined('PPP_NUMERICAL_CHARACTER_REQUIRED')) { define('PPP_NUMERICAL_CHARACTER_REQUIRED', 0); } if (!defined('PPP_UPPERCASE_CHARACTER_REQUIRED')) { define('PPP_UPPERCASE_CHARACTER_REQUIRED', 0); } if (!defined('PPP_SPECIAL_CHARACTER_REQUIRED')) { define('PPP_SPECIAL_CHARACTER_REQUIRED', 0); } if (!defined('PPP_EXPIRATION_IN')) { define('PPP_EXPIRATION_IN', 0); } if (!defined('PPP_CHANGE_PASSWORD_AFTER_NEXT_LOGIN')) { define('PPP_CHANGE_PASSWORD_AFTER_NEXT_LOGIN', 0); } if (function_exists('mb_strlen')) { $iLength = mb_strlen($sPassword); } else { $iLength = strlen($sPassword); } $aErrors = array(); if ($iLength < PPP_MINIMUM_LENGTH) { $aErrors[] = 'ID_PPP_MINIMUM_LENGTH'; } if ($iLength > PPP_MAXIMUM_LENGTH) { $aErrors[] = 'ID_PPP_MAXIMUM_LENGTH'; } if (PPP_NUMERICAL_CHARACTER_REQUIRED == 1) { if (preg_match_all('/[0-9]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) == 0) { $aErrors[] = 'ID_PPP_NUMERICAL_CHARACTER_REQUIRED'; } } if (PPP_UPPERCASE_CHARACTER_REQUIRED == 1) { if (preg_match_all('/[A-Z]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) == 0) { $aErrors[] = 'ID_PPP_UPPERCASE_CHARACTER_REQUIRED'; } } if (PPP_SPECIAL_CHARACTER_REQUIRED == 1) { if (preg_match_all('/[��\\!|"@�#$~%�&�\\/()=\'?��*+\\-_.:,;]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) == 0) { $aErrors[] = 'ID_PPP_SPECIAL_CHARACTER_REQUIRED'; } } if (PPP_EXPIRATION_IN > 0) { G::LoadClass('dates'); $oDates = new dates(); $fDays = $oDates->calculateDuration(date('Y-m-d H:i:s'), $sLastUpdate); if ($fDays > PPP_EXPIRATION_IN * 24) { $aErrors[] = 'ID_PPP_EXPIRATION_IN'; } } if (PPP_CHANGE_PASSWORD_AFTER_NEXT_LOGIN == 1) { if ($iChangePasswordNextTime == 1) { $aErrors[] = 'ID_PPP_CHANGE_PASSWORD_AFTER_NEXT_LOGIN'; } } return $aErrors; }
if ($sortOrder == "") { $sortOrder = "CountryCode"; } $page_num = $_REQUEST["page_num"] + 0; if ($page_num == 0) { $page_num = 1; } if ($cat == 0) { $where_clause = ""; } else { $where_clause = " AND cat={$cat} "; } $queryExtraArray = array(); $legend = _MENU_TAKEOFFS; // SEASON MOD $where_clause .= dates::makeWhereClause(0, $season, $year, $month, 0); // BRANDS MOD $where_clause .= brands::makeWhereClause($brandID); // take care of exluding flights // 1-> first bit -> means flight will not be counted anywhere!!! $bitMask = 1 & ~($includeMask & 0x1); $where_clause .= " AND ( excludeFrom & {$bitMask} ) = 0 "; if ($pilotID != 0) { $where_clause .= " AND userID='" . $pilotID . "' AND userServerID={$serverID} "; } else { // 0 means all flights BUT not test ones $where_clause .= " AND userID>0 "; } if ($country) { $where_clause_country .= " AND " . $waypointsTable . ".countryCode='" . $country . "' "; //$legend.=" (".$countries[$country].") | ";
function getFlightFromIGC($filename) { if (!is_file($filename)) { DEBUG("IGC", 1, "getFlightFromIGC: File was not found:{$filename}<br>"); return 0; } set_time_limit(100); if ($this->forceBounds) { $startTime = $this->START_TIME; $endTime = $this->END_TIME; } $this->resetData(); if ($this->forceBounds) { $this->START_TIME = $startTime; $this->END_TIME = $endTime; } $this->setAllowedParams(); $this->filename = basename($filename); $this->checkForOLCfile($filename); $done = 0; $try_no_takeoff_detection = 0; $tm1 = time() + 3600 * 24 * 30; $tm2 = 0; while (!$done) { $lines = file($filename); $linesNum = count($lines); DEBUG("IGC", 1, "File has total {$linesNum} lines<br>"); $points = 0; $outputBuffer = ""; // process points // filter bad ones $p = 0; $Brecords = 0; $getPointsNum = 5; // + 4 points + this one for ($i = 0; $i < count($lines) - 10; $i++) { $pointOK = 1; $line = trim($lines[$i]); if (strlen($line) == 0) { continue; } if ($line[0] != 'B') { continue; } /* if ($i>2){ $prevline=trim($lines[$i-1]); if (!substr_compare($line,$prevline,1,6)) continue; //throw out Brecords with same time signatures P. Wild 4.11.2012 } */ $Brecords++; // also check for bad points // 012345678901234567890123456789 // B1522144902558N00848090EV0058400000 if (strlen($line) < 23 || $line[24] == 'V') { $lines[$i][1] = 'X'; continue; } $neighboors = array(); $nextPointPos = $i; for ($t1 = 0; $t1 < $getPointsNum; $t1++) { $thisPoint = new gpsPoint(trim($lines[$nextPointPos]), $this->timezone); $neighboors[$t1] = $thisPoint; $nextPointPos = $this->getNextPointPos($lines, $nextPointPos); } // got all next points // find mean values $mean_speed = 0; $mean_vario = 0; for ($t1 = 1; $t1 < $getPointsNum; $t1++) { // for 4 (5-1) points in a row // create arrays $T_distance[$t1] = $neighboors[$t1]->calcDistance($neighboors[$t1 - 1]); $T_alt[$t1] = $neighboors[$t1]->getAlt(); $T_deltaseconds[$t1] = $neighboors[$t1]->getTime() - $neighboors[$t1 - 1]->getTime(); $T_speed[$t1] = $T_deltaseconds[$t1] ? $T_distance[$t1] * 3.6 / $T_deltaseconds[$t1] : 0.0; /* in km/h */ if ($T_deltaseconds[$t1]) { $T_vario[$t1] = ($T_alt[$t1] - $neighboors[$t1 - 1]->getAlt()) / $T_deltaseconds[$t1]; } $mean_speed += $T_speed[$t1]; $mean_vario += $T_vario[$t1]; } $mean_speed = $mean_speed / ($getPointsNum - 1); $mean_vario = ($neighboors[$getPointsNum - 1]->getAlt() - $neighboors[0]->getAlt()) / ($neighboors[$getPointsNum - 1]->getTime() - $neighboors[0]->getTime()); //if ($mean_vario<0) { // DEBUG("IGC",8,"[$Brecords-$p] mean_vario :$mean_vario <0 <br>"); //} $data_speed[$i] = $mean_speed; $data_vario[$i] = $mean_vario; // $mean_vario = $mean_vario/($getPointsNum-1); // mean vario is wrong if ($neighboors[0]->getTime() < $tm1) { $tm1 = $neighboors[0]->getTime(); } if ($neighboors[0]->getTime() > $tm2) { $tm2 = $neighboors[0]->getTime(); } if ($neighboors[0]->getTime() - $neighboors[1]->getTime() > 0) { // the next point is more than one hour in the past // echo "#"; $pointOK=0; } if ($T_distance[1] < 0.5 && $T_deltaseconds[1] > 2) { // less than 0.5 m distance $pointOK = 0; DEBUG("IGC", 8, "[{$Brecords}-{$p}] Distance <0.5 m <br>"); $REJ_T_distance++; // we dont go through the other tests //echo "{$lines[$i]} =>"; $lines[$i][1] = 'X'; //echo "{$lines[$i]}<br>"; continue; //echo $T_distance[1]."*<br>"; } if (abs($mean_speed - $T_speed[1]) > 40) { // diff more than 40 km/h $pointOK = 0; $REJ_T_mean_speed++; DEBUG("IGC", 8, "[{$Brecords}-{$p}] Mean speed > 40 km/h <br>"); //echo "@"; } //if ( abs ($mean_vario - $T_vario[1] ) > 6 ) { // diff more than 6 m/sec // $pointOK=0; //echo "#"; //} if ($T_deltaseconds[1] == 0) { $pointOK = 0; $REJ_T_zero_time_diff++; DEBUG("IGC", 8, "[{$Brecords}-{$p}] No time Diff<br>"); } if ($T_alt[1] > $this->maxAllowedHeight) { $pointOK = 0; $REJ_max_alt++; } if (abs($T_speed[1]) > $this->maxAllowedSpeed) { $pointOK = 0; $REJ_max_speed++; DEBUG("IGC", 8, "[{$Brecords}-{$p}] > " . abs($T_speed[1]) . "km/h max allowed speed<br>"); // echo "S"; } if (abs($T_vario[1]) > $this->maxAllowedVario) { $pointOK = 0; $REJ_max_vario++; // echo "V"; DEBUG("IGC", 8, "[{$Brecords}-{$p}] > " . abs($T_vario[1]) . "m/sec > max allowed vario<br>"); } if ($p < 5 && !$try_no_takeoff_detection && !$this->forceBounds) { // first 5 points need special care $takeoffMaxSpeed = $this->maxAllowedSpeed * 0.5; DEBUG("IGC", 8, "[{$Brecords}-{$p}] TAKEOFF sequence SPEED: " . abs($T_speed[1]) . " max:{$takeoffMaxSpeed}<br>"); if (abs($T_speed[1]) > $takeoffMaxSpeed) { $pointOK = 0; $REJ_max_speed_start++; // echo "s"; } if (abs($T_vario[1]) > $this->maxAllowedVario * 0.4) { $pointOK = 0; $REJ_max_vario_start++; //echo "v"; } } if (!$pointOK) { $lines[$i][1] = 'X'; } else { $p++; if ($p == 5) { DEBUG("IGC", 1, "Passed the strict testing (p=5)<br>"); } } } DEBUG("IGC", 1, "REJ: [{$REJ_T_distance}] <0.5 distance<br>"); DEBUG("IGC", 1, "REJ: [{$REJ_T_zero_time_diff}] zero_time_diff<br>"); DEBUG("IGC", 1, "REJ: [{$REJ_T_mean_speed}] mean_speed diff >40km/h<br>"); DEBUG("IGC", 1, "REJ: [{$REJ_max_alt}] >max_alt<br>"); DEBUG("IGC", 1, "REJ: [{$REJ_max_speed}] >max_speed<br>"); DEBUG("IGC", 1, "REJ: [{$REJ_max_vario}] >max_vario<br>"); DEBUG("IGC", 1, "REJ: [{$REJ_max_speed_start}] >max_speed_start<br>"); DEBUG("IGC", 1, "REJ: [{$REJ_max_vario_start}] >max_vario_start<br>"); DEBUG("IGC", 1, "Found {$p} valid B records out of {$Brecords} total<br>"); if ($p > 0) { $done = 1; } else { if ($Brecords > 0 && $REJ_T_zero_time_diff / $Brecords > 0.9) { // more than 90% stopped points $lines = file($filename); $done = 1; $garminSpecialCase = 1; $p = $Brecords; DEBUG("IGC", 1, "Many Stopped points, it is a Garmin Special Case<br>"); } else { if (!$try_no_takeoff_detection) { $try_no_takeoff_detection = 1; DEBUG("IGC", 1, "Will try no_takeoff_detection<br>"); } else { $done = 1; } } } } // while not done // if ($p == 0) { DEBUG("IGC", 1, "NO VALID POINTS FOUND"); return 0; // no valid points found } $mod = 0; if ($p > $this->maxPointNum) { $reduceArray = getReduceArray($p, $this->maxPointNum); // print_r($recudeArray); $mod = count($reduceArray); // $mod= ceil( $p / $this->maxPointNum ); } DEBUG("IGC", 1, "will use a reduce array of length {$mod}<br>"); $duration = $tm2 - $tm1; $intervalSecs = round($duration / $p); // echo "<hr>good points: $p duration:$duration, intervalSecs:$intervalSecs<hr>"; $pointsNeededForTakeoff = 5; if ($intervalSecs >= 8) { $pointsNeededForTakeoff = 2; } $alreadyInPoints = 0; $stopReadingPoints = 0; $this->timezone = 1000; $day_offset = 0; $foundNewTrack = 0; $slow_points = 0; $slow_points_dt = 0; $stillOnGround = 1; $tmpDate = 0; foreach ($lines as $iii => $line) { if ($foundNewTrack) { break; } $outputLine = $line; $line = trim($line); if (strlen($line) == 0) { continue; } // if (strtoupper(substr($line,0,1)) !="B" ) echo "@$line<BR>"; if (strtoupper(substr($line, 0, 3)) == "OLC") { continue; } // it is an olc file , dont put the OLC... line in to the saned file if (strtoupper(substr($line, 0, 5)) == "HFDTE" || strtoupper(substr($line, 0, 5)) == "HPDTE") { // HFDTE170104 OR HPDTE310805 if ($alreadyInPoints && $points > 0) { if ($prevPoint->gpsTime < 86200) { // if last good point is > 86200 (200 secs before day change at 86400) we dont treat this as a new track $stopReadingPoints = 1; DEBUG("IGC", 1, "[{$points}] {$line}<br>"); DEBUG("IGC", 1, "[{$points}] Found a new track (NEW HFDTE)<br>"); } } else { $this->DATE = substr($line, 5, 6); $yr_last = substr($this->DATE, 4, 2); // case of YY=0 (1 digit) HFDTE08070 if ($yr_last == "0") { $yr_last = "00"; } if ($yr_last > 80) { $yr = "19" . $yr_last; } else { $yr = "20" . $yr_last; } $this->DATE = $yr . "-" . substr($this->DATE, 2, 2) . "-" . substr($this->DATE, 0, 2); $alreadyInPoints = 1; } } else { if (strtoupper(substr($line, 0, 13)) == "HFTZOTIMEZONE") { // HFTZOTimezone:3 OR HFTZOTimezone:-8 $this->timezone = substr($line, 14) + 0; // echo $this->timezone."#^^"; } else { if (strtoupper(substr($line, 2, 13)) == "GTYGLIDERTYPE") { // HOGTYGLIDERTYPE: Gradient Bliss 26 OR HPGTYGliderType:Gradient Nevada if (!$this->glider) { $this->glider = trim(substr($line, 16)); } // HFGTYGLIDERTYPE // HOGTYGLIDERTYPE } else { if ($line[0] == 'B') { if ($stopReadingPoints) { continue; } if ($line[1] == 'X') { DEBUG("IGC", 1, "[{$points}] BAD : {$line}<br>"); continue; // MARKED BAD from BEFORE } if (strlen($line) < 23 || strlen($line) > 100) { continue; } if ($points == 0) { // first point // echo "######## first point <br>"; $firstPoint = new gpsPoint($line, $this->timezone); if ($this->timezone == 1000) { // no timezone in the file // echo "calc timezone<br>"; $this->timezone = getUTMtimeOffset($firstPoint->lat, $firstPoint->lon, $this->DATE); $this->timezone = getTZ($firstPoint->lat, $firstPoint->lon, $this->DATE); // echo $this->timezone; $firstPoint->timezone = $this->timezone; } $tmpTime = $firstPoint->gpsTime + $this->timezone * 3600; // Now also check if we are one day minus (for US flights ) if ($tmpTime < 0 && $tmpDate == 0) { // one day before! $this->DATE = dates::moveDaysFromDate($this->DATE, -1); $tmpDate = 1; } // take care of day change for timezones in australia/nz etc if ($tmpTime > 86400 && $tmpDate == 0) { // UTC date in the igc file needs to be +1 $this->DATE = dates::moveDaysFromDate($this->DATE, 1); $tmpDate = 1; } // sanity checks if ($firstPoint->getAlt() > $this->maxAllowedHeight) { continue; } // echo "times: ".$firstPoint->gpsTime.", ".$firstPoint->getTime()." start_time: ".$this->START_TIME ."<BR> "; if ($this->forceBounds && !$this->checkBound($firstPoint->getTime())) { continue; } // not inside time window //$this->FIRST_POINT=$line; $this->firstPointTM = $firstPoint->gpsTime; $this->firstLat = $firstPoint->lat(); $this->firstLon = $firstPoint->lon(); $this->TAKEOFF_ALT = $firstPoint->getAlt(); $this->MIN_ALT = $firstPoint->getAlt(); if (!$this->forceBounds) { $this->START_TIME = $firstPoint->getTime(); } $prevPoint = new gpsPoint($line, $this->timezone); $prevPoint2 = new gpsPoint($line, $this->timezone); } else { $lastPoint = new gpsPoint($line, $this->timezone); $lastPoint->gpsTime += $day_offset; if ($this->forceBounds && !$this->checkBound($lastPoint->getTime())) { $lastPoint = $prevPoint; continue; // not inside time window } $time_diff = $lastPoint->getTime() - $prevPoint->getTime(); $time_diff2 = $lastPoint->getTime() - $prevPoint2->getTime(); // echo "time diff: $time_diff # $line<br>"; if ($time_diff < 0 && $time_diff > -36000) { // if the time is less than 10 hours in the past we just ignore it // $day_offset = 86400; // if time seems to have gone backwards, add a day DEBUG("IGC", 1, "[{$points}] {$line}<br>"); DEBUG("IGC", 1, "[{$points}] Point in the past<br>"); continue; } else { if ($time_diff < 0 && $time_diff > -86000) { // CHANGING DAY , means the flight is at night $lastPoint = $prevPoint; $foundNewTrack = 1; DEBUG("IGC", 1, "[{$points}] {$line}<br>"); DEBUG("IGC", 1, "[{$points}] Flight at night ????<br>"); continue; } else { if ($time_diff > $this->max_allowed_time_gap) { // found time gap // if we are forceBounds check to see if inside window if ($this->forceBounds && !$this->checkBound($lastPoint->getTime()) || !$this->forceBounds) { // if we are still on the ground we dont care about time gap if (!$stillOnGround) { // not inside time window OR not checking go ahead $lastPoint = $prevPoint; $foundNewTrack = 1; DEBUG("IGC", 1, "[{$points}] {$line}<br>"); DEBUG("IGC", 1, "[{$points}] Found a new track (Time diff of {$time_diff} secs)<br>"); continue; } } else { // inside the window, forced to continue } } } } $this->LAST_POINT = $line; // compute some things $tmp = $lastPoint->calcDistance($prevPoint); $alt = $lastPoint->getAlt(); // GUS begin $deltaseconds = $lastPoint->getTime() - $prevPoint->getTime(); $speedDeltaSecs = $deltaseconds + ($deltaseconds < -85000 ? 86400 : 0); $speed = $speedDeltaSecs ? $tmp * 3.6 / $speedDeltaSecs : 0.0; /* in km/h */ if ($speedDeltaSecs) { $vario = ($alt - $prevPoint->getAlt()) / $speedDeltaSecs; } // GUS end if (!$garminSpecialCase && !$this->forceBounds) { if (($fast_points >= $pointsNeededForTakeoff || $fast_points_dt > 30) && $stillOnGround) { // found 5 flying points or 30 secs $stillOnGround = 0; DEBUG("IGC", 1, "[{$points}] {$line}<br>"); DEBUG("IGC", 1, "[{$points}] Found Takeoff <br>"); } if ($stillOnGround) { //takeoff scan // either speed >= 15 or if we already have 2 fast points settle with speed>=10 if ($speed >= 15 || $speed >= 10 && $fast_points >= 2) { $fast_points++; $fast_points_dt += $speedDeltaSecs; DEBUG("IGC", 1, "[{$points}] {$line}<br>"); DEBUG("IGC", 1, "[{$points}] Found a fast speed point <br>"); } else { // reset takeoff scan DEBUG("IGC", 1, "[{$points}] {$line}<br>"); DEBUG("IGC", 1, "[{$points}] takeoff scan: speed: {$speed} time_diff: {$time_diff}<br>"); $fast_points = 0; $fast_points_dt = 0; } $points = 0; continue; } else { //landing scan if ($speed < 5) { $slow_points++; $slow_points_dt += $speedDeltaSecs; DEBUG("IGC", 1, "[{$points}] {$line}<br>"); DEBUG("IGC", 1, "[{$points}] Found a slow speed point (speed, dt)=({$speed},{$speedDeltaSecs})<br>"); } else { $slow_points = 0; $slow_points_dt = 0; } } // found landing (5 stopped points and >2mins) or 5 mins (300 secs) if ($slow_points > $pointsNeededForTakeoff && $slow_points_dt > 180 || $slow_points_dt > 300) { $foundNewTrack = 1; DEBUG("IGC", 1, "[{$points}] {$line}<br>"); DEBUG("IGC", 1, "[{$points}] Found a new track /landing <br>"); } } // sanity checks if ($deltaseconds == 0 && !$garminSpecialCase) { continue; } if ($alt > $this->maxAllowedHeight) { continue; } if (abs($speed) > $this->maxAllowedSpeed) { continue; } if (abs($vario) > $this->maxAllowedVario) { continue; } $takeoffDistance = $lastPoint->calcDistance($firstPoint); if ($takeoffDistance > $this->LINEAR_DISTANCE) { $this->LINEAR_DISTANCE = $takeoffDistance; } if ($time_diff2 > 10) { $tmp = $lastPoint->calcDistance($prevPoint2); $alt = $lastPoint->getAlt(); $deltaseconds = $time_diff2; // GUS begin $speedDeltaSecs = $deltaseconds + ($deltaseconds < -85000 ? 86400 : 0); $speed = $speedDeltaSecs ? $tmp * 3.6 / $speedDeltaSecs : 0.0; /* in km/h */ if ($speedDeltaSecs) { $vario = ($alt - $prevPoint2->getAlt()) / $speedDeltaSecs; } // GUS end $prevPoint2 = new gpsPoint($line, $this->timezone); $prevPoint2->gpsTime += $day_offset; // update maximum speed if ($speed > $this->MAX_SPEED) { $this->MAX_SPEED = $speed; } $this->MEAN_SPEED += $speed; $MEAN_SPEED_POINTS++; // UPDATE MIN-MAX VARIO if ($vario > $this->MAX_VARIO) { $this->MAX_VARIO = $vario; } if ($vario < $this->MIN_VARIO) { $this->MIN_VARIO = $vario; } } //$speed=$data_speed[$iii-1]+0; // $vario=$data_vario[$iii-1]+0; // UPDATE MIN-MAX ALT if ($alt > $this->MAX_ALT) { $this->MAX_ALT = $alt; } if ($alt < $this->MIN_ALT) { $this->MIN_ALT = $alt; } // end computing $prevPoint = new gpsPoint($line, $this->timezone); $prevPoint->gpsTime += $day_offset; if ($mod >= 1) { if ($reduceArray[$points % $mod] == 0) { $outputLine = ""; } } } $points++; } } } } // end else $outputBuffer .= $outputLine; } // end main loop // echo "<HR>MIN VARIO".$this->MIN_VARIO."<HR>"; // if ($stillOnGround && $this->LINEAR_DISTANCE < 50) { DEBUG("IGC", 1, "NO TAKEOFF FOUND: "); return 0; // no valid points found } $path_igc = dirname($this->getIGCFilename(1)); if (!is_dir($path_igc)) { makeDir($path_igc, 0755); } /*write the full saned file */ $fullSanedFile = ''; foreach ($lines as $line) { $line = trim($line); if (strlen($line) == 0) { continue; } if ($line[0] == 'B' && $line[1] == 'X') { continue; } // MARKED BAD from BEFORE // if ( strlen($line) < 23 || strlen($line) > 100 ) continue; $fullSanedFile .= $line . "\n"; } if (!writeFile($this->getIGCFilename(2), $fullSanedFile)) { echo "Problem writing to file (" . $this->getIGCFilename(2) . ")"; } DEBUG("IGC", 1, "<HR>" . $this->getIGCFilename(2) . ' size: ' . strlen($fullSanedFile) . "<HR>"); // echo "<HR><HR>". $this->getIGCFilename(2) .strlen($fullSanedFile)."<HR><HR>"; /* done wrting the full saned file */ // write saned IGC file if (!writeFile($this->getIGCFilename(1), $outputBuffer)) { echo "Problem writing to file (" . $this->getIGCFilename(1) . ")"; } // done write saned IGC file DEBUG("IGC", 1, "<HR>" . $this->getIGCFilename(1) . ' size: ' . strlen($outputBuffer) . "<HR>"); if ($lastPoint) { $this->lastPointTM = $lastPoint->gpsTime; $this->lastLon = $lastPoint->lon(); $this->lastLat = $lastPoint->lat(); $this->LANDING_ALT = $lastPoint->getAlt(); $this->END_TIME = $lastPoint->getTime(); } else { $this->lastPointTM = 0; $this->lastLon = 0; $this->lastLat = 0; $this->LANDING_ALT = 0; $this->END_TIME = 0; } $this->DURATION = $this->END_TIME - $this->START_TIME; if ($this->DURATION < 0) { $this->DURATION += 86400; } $this->MEAN_SPEED = $this->MEAN_SPEED / $MEAN_SPEED_POINTS; return 1; }
* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ require_once 'classes/model/AppDelegation.php'; G::LoadClass('dates'); $oDates = new dates(); $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(AppDelegationPeer::APP_UID); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); $oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); $oDataset = AppDelegationPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(TaskPeer::TAS_UID); $oCriteria->add(TaskPeer::TAS_UID, $aRow['TAS_UID']); $oDataseti = TaskPeer::doSelectRS($oCriteria); $oDataseti->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ( $clubsList[$clubID]['useCustomSeasons'] ) { $CONF['seasons']=$clubsList[$clubID]['seasons']; } //if ( $clubsList[$clubID]['useCustomYears'] ) { // $CONF['years']=$clubsList[$clubID]['years']; //} # Martin Jursa 23.05.2007: support for NacClub Filtering if (!empty($CONF_use_NAC)) { if ($nacid && $nacclubid) { $where_clause.=" AND $flightsTable.NACid=$nacid AND $flightsTable.NACclubID=$nacclubid"; } } // SEASON MOD list($dates_where_clause,$dates_legend) = dates::makeWhereClause(0,$season,$year,$month,0 , 1); if (!$clubID) { $where_clause.=$dates_where_clause; } $legend.=$dates_legend; // BRANDS MOD $where_clause.= brands::makeWhereClause($brandID); // take care of exluding flights // 1-> first bit -> means flight will not be counted anywhere!!! $bitMask=2 & ~( $includeMask & 0x03 ); $where_clause.= " AND ( excludeFrom & $bitMask ) = 0 "; //----------------------------------------------------------
function moveDaysFromDate($date, $days) { // date in yyyy-mm-dd format $tm = dates::date2tm($date) + $days * 3600 * 24; return date("Y-m-d", $tm); }
public function calculateDueDate($sNextTasParam) { //Get Task properties $task = TaskPeer::retrieveByPK($this->getTasUid()); $aData['TAS_UID'] = $this->getTasUid(); //Added to allow User defined Timing Control at Run time from Derivation screen if (isset($sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY']) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') { $aData['TAS_DURATION'] = $sNextTasParam['NEXT_TASK']['TAS_DURATION']; $aData['TAS_TIMEUNIT'] = $sNextTasParam['NEXT_TASK']['TAS_TIMEUNIT']; $aData['TAS_TYPE_DAY'] = $sNextTasParam['NEXT_TASK']['TAS_TYPE_DAY']; if (isset($sNextTasParam['NEXT_TASK']['TAS_CALENDAR']) && $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] != '') { $aCalendarUID = $sNextTasParam['NEXT_TASK']['TAS_CALENDAR']; } else { $aCalendarUID = ''; } //Updating the task Table , so that user will see updated values in the assign screen in consequent cases $oTask = new Task(); $oTask->update($aData); } else { if (is_null($task)) { return 0; } $aData['TAS_DURATION'] = $task->getTasDuration(); $aData['TAS_TIMEUNIT'] = $task->getTasTimeUnit(); $aData['TAS_TYPE_DAY'] = $task->getTasTypeDay(); $aCalendarUID = ''; } //use the dates class to calculate dates $dates = new dates(); $iDueDate = $dates->calculateDate($this->getDelDelegateDate(), $aData['TAS_DURATION'], $aData['TAS_TIMEUNIT'], $aData['TAS_TYPE_DAY'], $this->getUsrUid(), $task->getProUid(), $aData['TAS_UID'], $aCalendarUID); return $iDueDate; }
) , 5=>array( "desc"=>"Danish XC league", "id"=>5, "lang"=>"danish", "areaID"=>0, "addManual"=>0, "adminID"=>76, // extra fields to expand club functionality "noSpecificMembers"=>1, "defaultDisplayLanguage"=>"danish", "defaultDisplayTheme"=>"basic", "countryCodes"=>array("dk"), "pilotNationality"=>array("dk"), "gliderCat"=>array(1), "startYear"=>"2006", "startMonth"=>"0", "startDay"=>"0", "endYear"=>"2006", "endMonth"=>"0", "endDay"=>"0", ) , ); */ foreach ($clubsList as $i => $clubInfo) { if (is_array($clubsList[$i]['seasons'])) { $clubsList[$i]['seasons']['end_season'] = dates::getCurrentSeason(0, $i); } } // uncomment this to disable clubs // $clubsList=array();