|
|
|
@ -25,6 +25,7 @@ $table_course = Database::get_main_table(TABLE_MAIN_COURSE); |
|
|
|
$table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
$table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
$table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION); |
|
|
|
$table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION); |
|
|
|
$tool_name = get_lang('SurveyInvitations'); |
|
|
|
$tool_name = get_lang('SurveyInvitations'); |
|
|
|
|
|
|
|
$courseInfo = api_get_course_info(); |
|
|
|
|
|
|
|
|
|
|
|
// Getting the survey information |
|
|
|
// Getting the survey information |
|
|
|
$survey_id = Security::remove_XSS($_GET['survey_id']); |
|
|
|
$survey_id = Security::remove_XSS($_GET['survey_id']); |
|
|
|
@ -33,6 +34,8 @@ if (empty($survey_data)) { |
|
|
|
api_not_allowed(true); |
|
|
|
api_not_allowed(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$view = isset($_GET['view']) ? $_GET['view'] : 'invited'; |
|
|
|
|
|
|
|
|
|
|
|
$urlname = strip_tags( |
|
|
|
$urlname = strip_tags( |
|
|
|
api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40) |
|
|
|
api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40) |
|
|
|
); |
|
|
|
); |
|
|
|
@ -65,20 +68,20 @@ if ($survey_data['anonymous'] == 1 && !api_get_configuration_value('survey_anony |
|
|
|
} |
|
|
|
} |
|
|
|
$url = api_get_self().'?survey_id='.$survey_id.'&'.api_get_cidreq(); |
|
|
|
$url = api_get_self().'?survey_id='.$survey_id.'&'.api_get_cidreq(); |
|
|
|
|
|
|
|
|
|
|
|
if (!isset($_GET['view']) || $_GET['view'] == 'invited') { |
|
|
|
if ($view == 'invited') { |
|
|
|
echo get_lang('ViewInvited').' | '; |
|
|
|
echo get_lang('ViewInvited').' | '; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
echo ' <a href="'.$url.'&view=invited">'. |
|
|
|
echo ' <a href="'.$url.'&view=invited">'. |
|
|
|
get_lang('ViewInvited').'</a> |'; |
|
|
|
get_lang('ViewInvited').'</a> |'; |
|
|
|
} |
|
|
|
} |
|
|
|
if ($_GET['view'] == 'answered') { |
|
|
|
if ($view == 'answered') { |
|
|
|
echo get_lang('ViewAnswered').' | '; |
|
|
|
echo get_lang('ViewAnswered').' | '; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
echo ' <a href="'.$url.'&view=answered">'. |
|
|
|
echo ' <a href="'.$url.'&view=answered">'. |
|
|
|
get_lang('ViewAnswered').'</a> |'; |
|
|
|
get_lang('ViewAnswered').'</a> |'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($_GET['view'] == 'unanswered') { |
|
|
|
if ($view == 'unanswered') { |
|
|
|
echo get_lang('ViewUnanswered'); |
|
|
|
echo get_lang('ViewUnanswered'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
echo ' <a href="'.$url.'&view=unanswered">'. |
|
|
|
echo ' <a href="'.$url.'&view=unanswered">'. |
|
|
|
@ -91,8 +94,13 @@ echo ' <tr>'; |
|
|
|
echo ' <th>'.get_lang('User').'</th>'; |
|
|
|
echo ' <th>'.get_lang('User').'</th>'; |
|
|
|
echo ' <th>'.get_lang('InvitationDate').'</th>'; |
|
|
|
echo ' <th>'.get_lang('InvitationDate').'</th>'; |
|
|
|
|
|
|
|
|
|
|
|
if ($_GET['view'] != 'answered') { |
|
|
|
switch ($view) { |
|
|
|
echo ' <th>'.get_lang('Answered').'</th>'; |
|
|
|
case 'unanswered': |
|
|
|
|
|
|
|
echo ' <th>'.get_lang('SurveyInviteLink').'</th>'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 'invited': |
|
|
|
|
|
|
|
echo ' <th>'.get_lang('Answered').'</th>'; |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
echo ' </tr>'; |
|
|
|
echo ' </tr>'; |
|
|
|
@ -103,9 +111,10 @@ $sessionId = api_get_session_id(); |
|
|
|
$sentIntitations = SurveyUtil::getSentInvitations($survey_data['code'], $course_id, $sessionId); |
|
|
|
$sentIntitations = SurveyUtil::getSentInvitations($survey_data['code'], $course_id, $sessionId); |
|
|
|
|
|
|
|
|
|
|
|
foreach ($sentIntitations as $row) { |
|
|
|
foreach ($sentIntitations as $row) { |
|
|
|
if (!$_GET['view'] || $_GET['view'] == 'invited' || |
|
|
|
$id = $row['iid']; |
|
|
|
($_GET['view'] == 'answered' && in_array($row['user'], $answered_data) && count($answered_data) > 1) || |
|
|
|
if ($view == 'invited' || |
|
|
|
($_GET['view'] == 'unanswered' && !in_array($row['user'], $answered_data) && count($answered_data) > 1) |
|
|
|
($view == 'answered' && in_array($row['user'], $answered_data) && count($answered_data) > 1) || |
|
|
|
|
|
|
|
($view == 'unanswered' && !in_array($row['user'], $answered_data) && count($answered_data) > 1) |
|
|
|
) { |
|
|
|
) { |
|
|
|
echo '<tr>'; |
|
|
|
echo '<tr>'; |
|
|
|
if (is_numeric($row['user'])) { |
|
|
|
if (is_numeric($row['user'])) { |
|
|
|
@ -131,14 +140,33 @@ foreach ($sentIntitations as $row) { |
|
|
|
if (in_array($row['user'], $answered_data)) { |
|
|
|
if (in_array($row['user'], $answered_data)) { |
|
|
|
$answered = Display::url( |
|
|
|
$answered = Display::url( |
|
|
|
get_lang('ViewAnswers'), |
|
|
|
get_lang('ViewAnswers'), |
|
|
|
api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&survey_id='.$survey_id.'&user='.$row['user'].'&'.api_get_cidreq() |
|
|
|
api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&survey_id='.$survey_id.'&user='.$row['user'].'&'.api_get_cidreq(), |
|
|
|
|
|
|
|
['class' => 'btn btn-primary'] |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
switch ($view) { |
|
|
|
if ($_GET['view'] != 'answered') { |
|
|
|
case 'unanswered': |
|
|
|
echo ' <td>'; |
|
|
|
echo ' <td>'; |
|
|
|
echo $answered; |
|
|
|
$code = $row['invitation_code']; |
|
|
|
echo ' </td>'; |
|
|
|
|
|
|
|
|
|
|
|
$link = api_get_path(WEB_CODE_PATH).'survey/fillsurvey.php?'; |
|
|
|
|
|
|
|
$link .= 'id_session='.$sessionId.'&course='.$courseInfo['code'].'&invitationcode='.$code; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$link = Display::input('text', 'copy_'.$id, $link, ['id' => 'copy_'.$id, 'class' => '']); |
|
|
|
|
|
|
|
$link .= ' '.Display::url( |
|
|
|
|
|
|
|
Display::returnFontAwesomeIcon('copy').get_lang('CopyTextToClipboard'), |
|
|
|
|
|
|
|
'javascript:void()', |
|
|
|
|
|
|
|
['onclick' => "copyTextToClipBoard('copy_".$id."')", 'class' => 'btn btn-primary btn-sm'] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo $link; |
|
|
|
|
|
|
|
echo ' </td>'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 'invited': |
|
|
|
|
|
|
|
echo ' <td>'; |
|
|
|
|
|
|
|
echo $answered; |
|
|
|
|
|
|
|
echo ' </td>'; |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
echo '</tr>'; |
|
|
|
echo '</tr>'; |
|
|
|
|