From 3ae9f6ab04ec48296a677626794aaf1d7494766a Mon Sep 17 00:00:00 2001 From: Patrick Cool Date: Sun, 31 Dec 2006 18:01:58 +0100 Subject: [PATCH] [svn r10578] a little bit of cleanup Last commit of 2006 ? I wish the Dokeos project good luck in the future! --- main/survey/addanother.php | 5 +-- main/survey/choose_language.php | 43 ++++++++++++++++------- main/survey/complete_report.php | 60 ++++++++++++++++++++------------- 3 files changed, 69 insertions(+), 39 deletions(-) diff --git a/main/survey/addanother.php b/main/survey/addanother.php index d22d1c0435..a036f65f21 100644 --- a/main/survey/addanother.php +++ b/main/survey/addanother.php @@ -23,7 +23,7 @@ ============================================================================== * @package dokeos.survey * @author -* @version $Id: addanother.php 10571 2006-12-29 15:35:13Z pcool $ +* @version $Id: addanother.php 10578 2006-12-31 17:01:58Z pcool $ ============================================================================== */ @@ -231,5 +231,6 @@ if(isset($group_id)) \ No newline at end of file diff --git a/main/survey/choose_language.php b/main/survey/choose_language.php index bcd136378a..2c5858a706 100644 --- a/main/survey/choose_language.php +++ b/main/survey/choose_language.php @@ -20,24 +20,37 @@ /** * @package dokeos.survey * @author -* @version $Id: choose_language.php 10549 2006-12-24 16:08:47Z pcool $ +* @version $Id: choose_language.php 10578 2006-12-31 17:01:58Z pcool $ +* @todo check if this file is used */ // name of the language file that needs to be included $language_file='survey'; -$cidReset=true; -session_start(); -$_SESSION["user_language_choice"]='english'; + +// including the global dokeos file require_once ('../inc/global.inc.php'); -//api_protect_admin_script(); + +// including additional libraries +/** @todo check if these are all needed */ +/** @todo check if the starting / is needed. api_get_path probably ends with an / */ require_once (api_get_path(LIBRARY_PATH).'/fileManage.lib.php'); require_once (api_get_path(CONFIGURATION_PATH) ."/add_course.conf.php"); require_once (api_get_path(LIBRARY_PATH)."/add_course.lib.inc.php"); require_once (api_get_path(LIBRARY_PATH)."/course.lib.php"); -require (api_get_path(LIBRARY_PATH)."/groupmanager.lib.php"); +require_once (api_get_path(LIBRARY_PATH)."/groupmanager.lib.php"); require_once (api_get_path(LIBRARY_PATH)."/surveymanager.lib.php"); require_once (api_get_path(LIBRARY_PATH)."/usermanager.lib.php"); +// Database table definitions +/** @todo use database constants for the survey tables */ + +// Path variables +/** @todo these variables are probably not used here */ + +// breadcrumbs + +// $_GET and $_POST +/** @todo replace $_REQUEST with $_GET or $_POST */ $surveyid = $_REQUEST['surveyid']; $uid = $_REQUEST['uid']; $uid1 = $_REQUEST['uid1']; @@ -46,6 +59,15 @@ $temp = $_REQUEST['temp']; $mail = $_REQUEST['mail']; +/** @todo is this needed? Session probably started in global.inc.php */ +session_start(); + +/** @todo is this needed? */ +$_SESSION["user_language_choice"]='english'; + + + + if(isset($_GET['next'])){ $lang = $_REQUEST['lang']; @@ -61,13 +83,12 @@ if(isset($_GET['next'])){ header('Location:template1.php?'.$_SERVER['QUERY_STRING'].'&surveyid='.$surveyid); } +/** @todo use correct database calls */ $sql_sname = " SELECT survey2.* FROM $db_name.survey as survey1 INNER JOIN $db_name.survey as survey2 ON survey1.code = survey2.code WHERE survey1.survey_id='$surveyid'"; - $res_sname = api_sql_query($sql_sname,__FILE__,__LINE__); - $code_survey = mysql_result($res_sname, 0, 'code'); mysql_data_seek($res_sname,0); @@ -128,10 +149,6 @@ if($error_message) diff --git a/main/survey/complete_report.php b/main/survey/complete_report.php index 962e1576cd..60b3c2a122 100644 --- a/main/survey/complete_report.php +++ b/main/survey/complete_report.php @@ -20,47 +20,58 @@ /** * @package dokeos.survey * @author -* @version $Id: complete_report.php 10223 2006-11-27 14:45:59Z pcool $ +* @version $Id: complete_report.php 10578 2006-12-31 17:01:58Z pcool $ */ // name of the language file that needs to be included $language_file = 'survey'; +// including the global dokeos file require_once ('../inc/global.inc.php'); + + +// including additional libraries +/** @todo check if these are all needed */ +/** @todo check if the starting / is needed. api_get_path probably ends with an / */ require_once (api_get_path(LIBRARY_PATH)."/course.lib.php"); -require (api_get_path(LIBRARY_PATH)."/groupmanager.lib.php"); -$cidReq = $_REQUEST['cidReq']; -$tbl_user_survey = Database::get_main_table(TABLE_MAIN_SURVEY_USER); -$tbl_questions = Database::get_course_table('questions'); -$tbl_questions_groups = Database::get_course_table('survey_group'); -$tbl_answers = Database::get_course_table('survey_report'); +require_once (api_get_path(LIBRARY_PATH)."/groupmanager.lib.php"); require_once (api_get_path(LIBRARY_PATH).'/fileManage.lib.php'); require_once (api_get_path(CONFIGURATION_PATH) ."/add_course.conf.php"); require_once (api_get_path(LIBRARY_PATH)."/add_course.lib.inc.php"); require_once (api_get_path(LIBRARY_PATH)."/surveymanager.lib.php"); + +/** @todo replace this with the correct code */ $status = surveymanager::get_status(); -$surveyid=$_REQUEST['surveyid']; -$db_name = $_REQUEST['db_name']; if($status==5) { -api_protect_admin_script(); + api_protect_admin_script(); } -$tool_name = get_lang('SurveyReporting'); + +// Database table definitions +/** @todo use database constants for the survey tables */ +$tbl_user_survey = Database::get_main_table(TABLE_MAIN_SURVEY_USER); +$tbl_questions = Database::get_course_table('questions'); +$tbl_questions_groups = Database::get_course_table('survey_group'); +$tbl_answers = Database::get_course_table('survey_report'); + +// Path variables +/** @todo these variables are probably not used here */ + +// Language variables + +// breadcrumbs $interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey')); + +// $_GET and $_POST +/** @todo replace $_REQUEST with $_GET or $_POST */ +$cidReq = $_REQUEST['cidReq']; +$surveyid = $_REQUEST['surveyid']; +$db_name = $_REQUEST['db_name']; + +$tool_name = get_lang('SurveyReporting'); + Display::display_header($tool_name); -/* -$sql = 'SELECT * - FROM '.$tbl_user_survey.' as user_survey,'.$tbl_questions.' as questions, '.$tbl_answers.' as answers, '.$tbl_questions_groups.' as groups - WHERE answers.qid = questions.qid - AND answers.user_id = user_survey.user_id - AND user_survey.survey_id='.$surveyid.' - AND user_survey.db_name="'.$db_name.'" - AND groups.group_id = questions.gid - ORDER BY email, groups.sortby, questions.sortby'; - -$rs = api_sql_query($sql, __FILE__, __LINE__); -$answers = api_store_result($rs); -*/ + $users = SurveyManager::listUsers($surveyid, $db_name); $questions = SurveyManager::listQuestions($surveyid); @@ -157,5 +168,6 @@ fwrite($handle, $excel_content); fclose($handle); chmod($archivePath.$excel_file_name, 0755); +// Display the footer Display :: display_footer(); ?> \ No newline at end of file