, Ghent University: cleanup, refactoring and rewriting large parts of the code * @version $Id: survey_invite.php 10680 2007-01-11 21:26:23Z pcool $ * * @todo the answered column */ // name of the language file that needs to be included $language_file = 'survey'; // including the global dokeos file require ('../inc/global.inc.php'); // including additional libraries //require_once (api_get_path(LIBRARY_PATH)."/survey.lib.php"); require_once('survey.lib.php'); require_once (api_get_path(LIBRARY_PATH)."course.lib.php"); require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); require_once (api_get_path(LIBRARY_PATH)."mail.lib.inc.php"); /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/ if (!api_is_allowed_to_edit()) { Display :: display_header(); Display :: display_error_message(get_lang('NotAllowed'), false); Display :: display_footer(); exit; } // Database table definitions $table_survey = Database :: get_course_table(TABLE_SURVEY); $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_course = Database :: get_main_table(TABLE_MAIN_COURSE); $table_user = Database :: get_main_table(TABLE_MAIN_USER); $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); // getting the survey information $survey_data = survey_manager::get_survey($_GET['survey_id']); $urlname = substr(strip_tags($survey_data['title']), 0, 40); if (strlen(strip_tags($survey_data['title'])) > 40) { $urlname .= '...'; } // breadcrumbs $interbreadcrumb[] = array ('url' => 'survey_list.php', 'name' => get_lang('SurveyList')); $interbreadcrumb[] = array ('url' => 'survey.php?survey_id='.$_GET['survey_id'], 'name' => $urlname); $tool_name = get_lang('SurveyInvitations'); // Displaying the header Display::display_header($tool_name); // Checking the parameters if (!is_numeric($_GET['survey_id'])) { Display::display_error_message(get_lang('Error'), false); Display::display_footer(); exit; } // Getting all the people who have filled this survey $answered_data = survey_manager::get_people_who_filled_survey($_GET['survey_id']); if ($survey_data['anonymous'] == 1) { Display::display_normal_message(get_lang('AnonymousSurveyCannotKnowWhoAnswered').' '.count($answered_data).' '.get_lang('PeopleAnswered')); $answered_data = array(); } // if (!isset($_GET['view']) OR $_GET['view'] == 'invited') { echo get_lang('ViewInvited'). ' | '; } else { echo ' '.get_lang('ViewInvited').' |'; } if ($_GET['view'] == 'answered') { echo get_lang('ViewAnswered').' | '; } else { echo ' '.get_lang('ViewAnswered').' |'; } if ($_GET['view'] == 'unanswered') { echo get_lang('ViewUnanswered'); } else { echo ' '.get_lang('ViewUnanswered').''; } // table header echo '
'.get_lang('User').' | '; echo ''.get_lang('InvitationCode').' | '; echo ''.get_lang('InvitationDate').' | '; echo ''.get_lang('Answered').' | '; echo '||
---|---|---|---|---|---|
'.$row['firstname'].' '.$row['lastname'].' | '; } else { echo ''.$row['user'].' | '; } /** @todo this is temporary to allow the developer to quickly fill a survey as a different user */ // echo ''.$row['invitation_code'].' | '; echo ''.$row['invitation_code'].' | '; echo ''.$row['invitation_date'].' | '; echo ''; if (in_array($row['user'], $answered_data)) { echo ''.get_lang('ViewAnswers').''; } else { echo '-'; } echo ' | '; echo '