} } if (!empty($_REQUEST['prev']) && $ESPCONFIG['auth_response'] && auth_get_option('navigate')) { if (empty($msg)) { if (auth_get_option('resume')) { response_delete($sid, $_SESSION['rid'], $_SESSION['sec']); } $_SESSION['rid'] = response_insert($sid, $_SESSION['sec'], $_SESSION['rid']); $_SESSION['sec']--; } } // record start statistics // ... increment the attempt // ... assume the user will abandon the survey // ... NOTE: this will be remedied if there is a save or a submit esp_require_once('/lib/espsurveystat'); survey_stat_increment(SURVEY_STAT_ATTEMPTED, $sid); survey_stat_increment(SURVEY_STAT_ABANDONED, $sid); // if resuming a previous survey if ($ESPCONFIG['auth_response'] && auth_get_option('resume') && $_SESSION['rid'] > 0) { response_import_sec($sid, $_SESSION['rid'], $_SESSION['sec']); survey_stat_decrement(SURVEY_STAT_SUSPENDED, $sid); } paint_submission_form_open(); survey_render($sid, $_SESSION['sec'], $_SESSION['rid'], $msg); echo '<fieldset>'; if ($ESPCONFIG['auth_response']) { if (auth_get_option('navigate') && $_SESSION['sec'] > 1) { echo mksubmit("prev", _('Previous Page')); } if (auth_get_option('resume')) {
function get_survey_info(&$surveys, &$responses, &$accessibility) { // initialize return values $surveys = array(); $responses = array(); $accessibility = array(); // everybody gets the public surveys esp_require_once('/lib/espsurvey'); survey_get_public($surveys); $sids = array_keys($surveys); // if we have a current (authenticated) respondent $ok = get_current_respondent($respondent); if ($ok && array_key_exists('realm', $respondent)) { // get the surveys available to that user survey_get_in_realm($respondent['realm'], $private); survey_merge_sets($surveys, $private); $sids = array_keys($surveys); // get the responses and accessibility for those surveys survey_get_responses($responses, $sids, $respondent['username']); survey_get_accessibility($accessibility, $sids, $respondent['username'], $respondent['realm']); } else { // get the accessibility of those surveys survey_get_accessibility($accessibility, $sids); } return true; }