You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
50 lines
1.3 KiB
![]()
13 years ago
|
<?php
|
||
![]()
13 years ago
|
/* For licensing terms, see /license.txt */
|
||
![]()
13 years ago
|
|
||
![]()
9 years ago
|
require_once __DIR__.'/../inc/global.inc.php';
|
||
![]()
13 years ago
|
|
||
![]()
8 years ago
|
$surveyId = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : 0;
|
||
|
$sessionId = isset($_REQUEST['s']) ? (int) $_REQUEST['s'] : 0;
|
||
|
$courseId = isset($_REQUEST['c']) ? (int) $_REQUEST['c'] : 0;
|
||
![]()
13 years ago
|
|
||
![]()
8 years ago
|
if (empty($surveyId)) {
|
||
![]()
13 years ago
|
api_not_allowed(true);
|
||
|
}
|
||
![]()
11 years ago
|
if (!SurveyManager::survey_generation_hash_available()) {
|
||
![]()
13 years ago
|
api_not_allowed(true);
|
||
|
}
|
||
![]()
8 years ago
|
$courseInfo = api_get_course_info_by_id($courseId);
|
||
|
$hashIsValid = SurveyManager::validate_survey_hash(
|
||
|
$surveyId,
|
||
|
$courseId,
|
||
|
$sessionId,
|
||
![]()
10 years ago
|
$_REQUEST['g'],
|
||
|
$_REQUEST['h']
|
||
|
);
|
||
![]()
8 years ago
|
if ($hashIsValid && $courseInfo) {
|
||
![]()
10 years ago
|
$survey_data = SurveyManager::get_survey(
|
||
![]()
8 years ago
|
$surveyId,
|
||
![]()
10 years ago
|
null,
|
||
![]()
8 years ago
|
$courseInfo['code']
|
||
![]()
10 years ago
|
);
|
||
![]()
13 years ago
|
|
||
|
$invitation_code = api_get_unique_id();
|
||
![]()
8 years ago
|
$params = [
|
||
![]()
8 years ago
|
'c_id' => $courseId,
|
||
|
'session_id' => $sessionId,
|
||
|
'user' => $invitation_code,
|
||
|
'survey_code' => $survey_data['code'],
|
||
|
'invitation_code' => $invitation_code,
|
||
![]()
8 years ago
|
'invitation_date' => api_get_utc_datetime(),
|
||
![]()
8 years ago
|
];
|
||
![]()
13 years ago
|
$invitation_id = SurveyUtil::save_invitation($params);
|
||
|
|
||
|
if ($invitation_id) {
|
||
![]()
7 years ago
|
$link = SurveyUtil::generateFillSurveyLink($invitation_code, $courseInfo['code'], $sessionId);
|
||
![]()
13 years ago
|
header('Location: '.$link);
|
||
|
exit;
|
||
|
}
|
||
|
} else {
|
||
|
api_not_allowed(true);
|
||
![]()
12 years ago
|
}
|