function showCompletedSurvey() { global $survey; echo $this->redirect(""); doExit(); }
function doEnd($savestate = false) { /* if already state of other sections before this one, then this is not the first section * if it is, then do the end part */ if ($this->isMainSection() == true) { $this->endofsurvey = true; $this->setAnswer(VARIABLE_END, date("Y-m-d H:i:s", time())); /* check if we need to reset non-keep variable answers */ if ($this->survey->getDataKeepOnly() == DATA_KEEP_ONLY_YES) { $vars = $this->state->getVariableNames(); $this->currentaction = ACTION_SURVEY_END; foreach ($vars as $var) { //echo "<br>CHECK: " . $var; $vd = $this->getVariableDescriptive(getBasicName($var)); if ($vd->getDataKeep() == DATA_KEEP_NO) { //echo 'everybody do their share'; $this->setAnswer($var, null); } } } doCommit(); /* save data record */ $this->getDataRecord()->saveRecord(); /* $savestate == true if we are reaching doEnd by going next on a last action in the base module * and there are no more actions left in the _next table. */ if ($savestate == true) { $this->saveState(false); } else { /* get any last things we did from the current state */ $assign = $this->state->getAssignments(); $data = $this->state->getAllData(); /* load the last state we had, update it with any actions we did and save it */ if ($this->loadLastState()) { $this->state->setAllData($data); $this->state->setAssignments($assign); $this->saveState(false); } } /* set interview data as completed */ $this->getDataRecord()->setToComplete(); /* unlock */ $this->unlock(); if ($this->getFlooding()) { $this->stop = true; return; } /* show end and exit */ echo $this->display->showEndSurvey(); doExit(); } else { /* get current state */ $seid = $this->getParentSeid(); $mainseid = $this->getMainSeid(); $assign = $this->state->getAssignments(); $data = $this->state->getAllData(); $prefix = ""; $this->getDataRecord()->saveRecord(); $this->datarecord = null; unset($this->datarecord); $this->clearContext(); /* get engine */ global $engine; $engine = loadEngine($this->getSuid(), $this->primkey, $this->phpid, $this->version, $seid, false, true); /* transfer current state with updated details for section we are going back to */ $engine->setState($this->state); $engine->setSeid($seid); $engine->setMainSeid($mainseid); $engine->setPrefix($this->getParentPrefix()); $engine->setForward($this->getForward()); $engine->setFlooding($this->getFlooding()); /* go into parent section again */ $engine->endSection(); if ($this->getFlooding()) { $this->stop = true; return; } doExit(); } }
function getSurvey() { /* SMS */ if ($_SESSION['SYSTEM_ENTRY'] == USCIC_SMS) { if (loadvar(SMS_POST_SURVEY) != "") { $_SESSION['SUID'] = loadvar(SMS_POST_SURVEY); } if (isset($_SESSION['SUID'])) { return $_SESSION['SUID']; } $surveys = new Surveys(); $suid = $surveys->getFirstSurvey(true); if (isSurvey($l)) { $_SESSION['SUID'] = $suid; return $suid; } $_SESSION['SUID'] = 1; return 1; } /* SURVEY */ // check for new survey global $engine, $suid; /* get from loadvar */ $l = loadvarSurvey(POST_PARAM_SUID); if (isSurvey($l)) { $suid = $l; $_SESSION["PARAMS"][SESSION_PARAM_SURVEY] = $l; return $suid; } $l = getFromSessionParams(SESSION_PARAM_NEWSURVEY); if (isSurvey($l)) { $_SESSION["PARAMS"][SESSION_PARAM_SURVEY] = $l; unset($_SESSION["PARAMS"][SESSION_PARAM_NEWSURVEY]); $suid = $l; return $suid; } // check for old survey $l = getFromSessionParams(SESSION_PARAM_SURVEY); if (isSurvey($l)) { $suid = $l; $_SESSION["PARAMS"][SESSION_PARAM_SURVEY] = $l; return $suid; } /* global suid has been set (via setting below, so no need to repeat) */ if (isSurvey($suid)) { return $suid; } /* check for default survey */ $l = getDefaultSurvey(); if (isSurvey($l)) { $suid = $l; $_SESSION["PARAMS"][SESSION_PARAM_SURVEY] = $l; return $suid; } /* everything else failed */ $surveys = new Surveys(); $suid = $surveys->getFirstSurvey(true); if ($suid == "") { $display = new Display(); echo $display->displayError(Language::messageSurveyUnavailable()); doExit(); } $_SESSION["PARAMS"][SESSION_PARAM_SURVEY] = $suid; return $suid; }
} /* survey entry */ if ($_SESSION['SYSTEM_ENTRY'] != USCIC_SMS) { $_SESSION['PARAMETER_RETRIEVAL'] = PARAMETER_SURVEY_RETRIEVAL; $engine = null; // global $engine object } else { $_SESSION['PARAMETER_RETRIEVAL'] = PARAMETER_ADMIN_RETRIEVAL; $l = getSMSLanguage(); if (file_exists("language/language" . getSMSLanguagePostFix($l) . ".php")) { require_once 'language_' . getSMSLanguagePostFix($l) . '.php'; } else { require_once 'language_en.php'; // fall back on english language file } } if (loadvar(POST_PARAM_SMS_AJAX) == SMS_AJAX_CALL) { // sms ajax call require_once 'smsajax.php'; $ajax = new SmsAjax(); echo $ajax->getPage(loadvar('p')); } else { // handle action $action = new Action($sesid); echo $action->getAction(); // clear session locking (if not already done by earlier script exit) doExit(); } ?>
function showCompletedSurvey() { echo $this->redirect("survey.return.alreadycompleted"); doExit(); }
function __construct($page = '') { echo $this->mainPage($page); doExit(); }
// Decode JSON and add data to spreadsheet if (isset($_REQUEST['json'])) { $portal = json_decode($_REQUEST['json']); // TODO check if $portal->entityType == 'portal'; //Check that the portal is within the boundaries (this is done to prevent overloading Google) if ($portal->lat > $northBoundary) { doExit('Portal too far north. Exiting.'); } if ($portal->lat < $southBoundary) { doExit('Portal too far south. Exiting.'); } if ($portal->lng > $eastBoundary) { doExit('Portal too far east. Exiting.'); } if ($portal->lng < $westBoundary) { doExit('Portal too far west. Exiting.'); } //Create the $row array, which will be added to the spreadsheet $row = array('portalname' => htmlspecialchars($portal->title), 'team' => $portal->team->displayName, 'updatetime' => $portal->lastUpdated, 'lastupdated' => gmdate("Y-m-d H:i:s \\E\\S\\T", $portal->lastUpdated / 1000 + $timeZoneAdjust), 'latitude' => $portal->lat, 'longitude' => $portal->lng, 'link' => "http://www.ingress.com/intel?ll={$portal->lat},{$portal->lng}&z=18", 'level' => $portal->level, 'resonatorcount' => $portal->resonatorCount, 'health' => $portal->health); if ($portal->team->displayName == "Neutral") { $row['lastupdated--'] = gmdate("Y-m-d H:i:s \\E\\S\\T", $portal->lastUpdated / 1000 + $timeZoneAdjust); $row['ownsince'] = ''; $row['own150days'] = ''; $row['own90days'] = ''; $row['daysowned'] = ''; $row['owner'] = 'Neutral'; } if (isset($portal->capturedTimeExact)) { // $row['json'] = $_REQUEST['json']; // For debugging - make sure to add to spreadsheet $row['lastupdated--'] = gmdate("Y-m-d H:i:s \\E\\S\\T", $portal->lastUpdated / 1000 + $timeZoneAdjust); $row['ownsince'] = gmdate("Y-m-d H:i:s \\E\\S\\T", $portal->capturedTimeExact / 1000 + $timeZoneAdjust);