isError()) { exit_no_group(); } $sh = new SurveyHTML(); $title = _('Survey Complete'); $sh->header(array('title'=>$title)); if (!$survey_id) { /* Quit if params are not provided */ echo $HTML->error_msg(_('For some reason, the Project ID or Survey ID did not make it to this page')); $sh->footer(); exit; } if (!session_loggedin()) { exit_not_logged_in(); } echo '
' . _('Thank you for taking time to complete this survey.') . '
'; echo '' . _('Regards,') . '
'; echo ''; printf(_('-- the %s staff'), forge_get_config ('forge_name')); echo '
'; /* Delete this customer's responses in case they had back-arrowed */ $result = db_query_params ('DELETE FROM survey_responses WHERE survey_id=$1 AND group_id=$2 AND user_id=$3', array($survey_id, $group_id, user_getid())); /* Select this survey from the database */ $s = new Survey($g, $survey_id); $quest_array= & $s->getQuestionArray(); $count=count($quest_array); $now=time(); /* Make a dummy SurveyResponses for creating */ $sr = new SurveyResponse($g); for ($i=0; $i<$count; $i++) { /* Insert each form value into the responses table */ $val="_" . $quest_array[$i]; $response = getStringFromRequest($val); $sr->create(user_getid(), $survey_id, $quest_array[$i], $response); if ($sr->isError()) { echo $sr->getErrorMessage(); } } $sh->footer();