[svn r10567] a little bit of cleanup

skala
Patrick Cool 19 years ago
parent e5ffd54388
commit 10d22d7b66
  1. 30
      main/survey/addanother.php
  2. 26
      main/survey/attach_existingsurvey.php
  3. 53
      main/survey/attach_question.php
  4. 53
      main/survey/attach_survey.php

@ -23,7 +23,7 @@
============================================================================== ==============================================================================
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: addanother.php 10565 2006-12-28 20:02:15Z pcool $ * @version $Id: addanother.php 10567 2006-12-28 23:10:27Z pcool $
============================================================================== ==============================================================================
*/ */
@ -57,26 +57,33 @@ if($status==5)
} }
// Database table definitions // Database table definitions
/** @todo use database constants for the survey tables */
$table_user = Database :: get_main_table(TABLE_MAIN_USER); $table_user = Database :: get_main_table(TABLE_MAIN_USER);
$table_survey = Database :: get_course_table('survey'); $table_survey = Database :: get_course_table('survey');
$table_group = Database :: get_course_table('survey_group');
// Path variables // Path variables
/** @todo these variables are probably not used here */ /** @todo these variables are probably not used here */
$coursePathWeb = api_get_path(WEB_COURSE_PATH); $coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH); $coursePathSys = api_get_path(SYS_COURSE_PATH);
// Variables // Language variables
//$cidReq = $_SESSION[_course][id];
$cidReq = $_GET['cidReq'];
$curr_dbname = $_REQUEST['curr_dbname'];
$group_id=$_GET['newgroupid'];
$tool_name = get_lang('CreateNewSurvey'); $tool_name = get_lang('CreateNewSurvey');
$tool_name1 = get_lang('AddAnotherQuestion'); $tool_name1 = get_lang('AddAnotherQuestion');
// breadcrumbs
$interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey')); $interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey'));
// Variables
/** @todo use $_course array */
$course_id = $_SESSION['_course']['id']; $course_id = $_SESSION['_course']['id'];
// $_GET and $_POST
/** @todo replace $_REQUEST with $_GET or $_POST */
$cidReq = $_GET['cidReq'];
/** @todo use $_course array */
$curr_dbname = $_REQUEST['curr_dbname'];
$group_id = $_GET['newgroupid'];
if(isset($_REQUEST['surveyid'])) if(isset($_REQUEST['surveyid']))
$surveyid=$_REQUEST['surveyid']; $surveyid=$_REQUEST['surveyid'];
if(isset($_REQUEST['groupid'])) if(isset($_REQUEST['groupid']))
@ -85,6 +92,11 @@ if(isset($_REQUEST['cidReq']))
$cidReq=$_REQUEST['cidReq']; $cidReq=$_REQUEST['cidReq'];
if(isset($_REQUEST['newgroupid'])) if(isset($_REQUEST['newgroupid']))
$groupid=$_REQUEST['newgroupid']; $groupid=$_REQUEST['newgroupid'];
if(isset($_POST['back'])) if(isset($_POST['back']))
{ {
header("location:select_question_group.php?add_question=$add_question&groupid=$groupid&surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname"); header("location:select_question_group.php?add_question=$add_question&groupid=$groupid&surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname");
@ -142,7 +154,7 @@ if(isset($error_message))
Display::display_error_message($error_message); Display::display_error_message($error_message);
if(isset($group_id)) if(isset($group_id))
{ {
$table_group = Database :: get_course_table('survey_group');
$sql = "SELECT * FROM $table_group WHERE group_id='$group_id'"; $sql = "SELECT * FROM $table_group WHERE group_id='$group_id'";
$res = api_sql_query($sql, __FILE__, __LINE__); $res = api_sql_query($sql, __FILE__, __LINE__);
$obj= mysql_fetch_object($res); $obj= mysql_fetch_object($res);

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: attach_existingsurvey.php 10566 2006-12-28 20:06:35Z pcool $ * @version $Id: attach_existingsurvey.php 10567 2006-12-28 23:10:27Z pcool $
*/ */
/* /*
@ -53,6 +53,7 @@ api_protect_admin_script();
} }
// Database table definitions // Database table definitions
/** @todo use database constants for the survey tables */
$table_user = Database :: get_main_table(TABLE_MAIN_USER); $table_user = Database :: get_main_table(TABLE_MAIN_USER);
$table_survey = Database :: get_course_table('survey'); $table_survey = Database :: get_course_table('survey');
$table_group = Database :: get_course_table('survey_group'); $table_group = Database :: get_course_table('survey_group');
@ -65,23 +66,34 @@ $table_course_survey_rel = Database :: get_main_table(TABLE_MAIN_COURSE_SURVEY);
$coursePathWeb = api_get_path(WEB_COURSE_PATH); $coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH); $coursePathSys = api_get_path(SYS_COURSE_PATH);
// Language variables
$MonthsLong = array(get_lang('JanuaryLong'), get_lang('FebruaryLong'), get_lang('"MarchLong'), get_lang('AprilLong'), get_lang('MayLong'), get_lang('JuneLong'), get_lang('JulyLong'), get_lang('AugustLong'), get_lang('SeptemberLong'), get_lang('OctoberLong'), get_lang('NovemberLong'), get_lang('DecemberLong'));
$tool_name = get_lang('CreateNewSurvey');
$tool_name1 = get_lang('CreateNewSurvey');
// Breadcrumbs
$interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey'));
$MonthsLong = array(get_lang('JanuaryLong'), get_lang('FebruaryLong'), get_lang('"MarchLong'), get_lang('AprilLong'), get_lang('MayLong'), get_lang('JuneLong'), get_lang('JulyLong'), get_lang('AugustLong'), get_lang('SeptemberLong'), get_lang('OctoberLong'), get_lang('NovemberLong'), get_lang('DecemberLong')); // Variables
$arr_date = explode("-",date("Y-m-d")); $arr_date = explode("-",date("Y-m-d"));
$curr_year = $arr_date[0]; $curr_year = $arr_date[0];
$curr_month = $arr_date[1]; $curr_month = $arr_date[1];
$curr_day = $arr_date[2]; $curr_day = $arr_date[2];
/** @todo use $_course array */
$course_id = $_SESSION['_course']['id'];
// $_GET and $_POST
/** @todo replace $_REQUEST with $_GET or $_POST */
$cidReq = $_REQUEST['cidReq']; $cidReq = $_REQUEST['cidReq'];
$db_name = $_REQUEST['db_name']; $db_name = $_REQUEST['db_name'];
$tool_name = get_lang('CreateNewSurvey');
$tool_name1 = get_lang('CreateNewSurvey');
$interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey'));
$course_id = $_SESSION['_course']['id'];
$oldsurveyid=$_REQUEST['surveyid']; $oldsurveyid=$_REQUEST['surveyid'];
$survey_name=surveymanager::get_surveyname($db_name,$oldsurveyid); $survey_name=surveymanager::get_surveyname($db_name,$oldsurveyid);
/** @todo this piece of code is duplicated in many scripts. Find out where it is used and remove all other occurences */
if ($_POST['action'] == 'add_survey') if ($_POST['action'] == 'add_survey')
{ {
$surveycode=$_POST['survey_code']; $surveycode=$_POST['survey_code'];

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: attach_question.php 10550 2006-12-24 16:17:25Z pcool $ * @version $Id: attach_question.php 10567 2006-12-28 23:10:27Z pcool $
*/ */
/* /*
@ -31,43 +31,68 @@
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file = 'survey'; $language_file = 'survey';
// including the global dokeos file
require_once ('../inc/global.inc.php'); 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(LIBRARY_PATH).'/fileManage.lib.php');
require_once (api_get_path(CONFIGURATION_PATH) ."/add_course.conf.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)."/add_course.lib.inc.php");
require_once (api_get_path(LIBRARY_PATH)."/course.lib.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)."/surveymanager.lib.php");
require_once (api_get_path(LIBRARY_PATH)."/usermanager.lib.php");
/** @todo replace this with the correct code */
$status = surveymanager::get_status(); $status = surveymanager::get_status();
if($status==5) if($status==5)
{ {
api_protect_admin_script(); api_protect_admin_script();
} }
require_once (api_get_path(LIBRARY_PATH)."/usermanager.lib.php");
$MonthsLong = array(get_lang('JanuaryLong'), get_lang('FebruaryLong'), get_lang('"MarchLong'), get_lang('AprilLong'), get_lang('MayLong'), get_lang('JuneLong'), get_lang('JulyLong'), get_lang('AugustLong'), get_lang('SeptemberLong'), get_lang('OctoberLong'), get_lang('NovemberLong'), get_lang('DecemberLong')); // Database table definitions
$arr_date = explode("-",date("Y-m-d")); /** @todo use database constants for the survey tables */
$curr_year = $arr_date[0];
$curr_month = $arr_date[1];
$curr_day = $arr_date[2];
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
$table_user = Database :: get_main_table(TABLE_MAIN_USER); $table_user = Database :: get_main_table(TABLE_MAIN_USER);
$cidReq = $_REQUEST['cidReq'];
$db_name = $_REQUEST['db_name'];
$table_survey = Database :: get_course_table('survey'); $table_survey = Database :: get_course_table('survey');
$table_group = Database :: get_course_table('survey_group'); $table_group = Database :: get_course_table('survey_group');
$table_question = Database :: get_course_table('questions'); $table_question = Database :: get_course_table('questions');
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE); $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_course_survey_rel = Database :: get_main_table(TABLE_MAIN_COURSE_SURVEY); $table_course_survey_rel = Database :: get_main_table(TABLE_MAIN_COURSE_SURVEY);
// Path variables
/** @todo these variables are probably not used here */
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
// Language variables
$MonthsLong = array(get_lang('JanuaryLong'), get_lang('FebruaryLong'), get_lang('"MarchLong'), get_lang('AprilLong'), get_lang('MayLong'), get_lang('JuneLong'), get_lang('JulyLong'), get_lang('AugustLong'), get_lang('SeptemberLong'), get_lang('OctoberLong'), get_lang('NovemberLong'), get_lang('DecemberLong'));
$tool_name = get_lang('CreateNewSurvey'); $tool_name = get_lang('CreateNewSurvey');
$tool_name1 = get_lang('CreateNewSurvey'); $tool_name1 = get_lang('CreateNewSurvey');
// breadcrumbs
$interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey')); $interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey'));
// Variables
$arr_date = explode("-",date("Y-m-d"));
$curr_year = $arr_date[0];
$curr_month = $arr_date[1];
$curr_day = $arr_date[2];
/** @todo use $_course array */
$course_id = $_SESSION['_course']['id']; $course_id = $_SESSION['_course']['id'];
// $_GET and $_POST
/** @todo replace $_REQUEST with $_GET or $_POST */
$cidReq = $_REQUEST['cidReq'];
$db_name = $_REQUEST['db_name'];
$oldsurveyid = $_REQUEST['surveyid']; $oldsurveyid = $_REQUEST['surveyid'];
$survey_name = surveymanager::get_surveyname($db_name,$oldsurveyid);
$qids=$_REQUEST['qid']; $qids=$_REQUEST['qid'];
$groupid=$_REQUEST['groupid']; $groupid=$_REQUEST['groupid'];
$survey_name = surveymanager::get_surveyname($db_name,$oldsurveyid);
/** @todo this piece of code is duplicated in many scripts. Find out where it is used and remove all other occurences */
if ($_POST['action'] == 'add_survey') if ($_POST['action'] == 'add_survey')
{ {
$surveycode=$_POST['survey_code']; $surveycode=$_POST['survey_code'];

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: attach_survey.php 10550 2006-12-24 16:17:25Z pcool $ * @version $Id: attach_survey.php 10567 2006-12-28 23:10:27Z pcool $
*/ */
/* /*
@ -31,43 +31,68 @@
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file = 'survey'; $language_file = 'survey';
// including the global dokeos file
require_once ('../inc/global.inc.php'); 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(LIBRARY_PATH).'/fileManage.lib.php');
require_once (api_get_path(CONFIGURATION_PATH) ."/add_course.conf.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)."/add_course.lib.inc.php");
require_once (api_get_path(LIBRARY_PATH)."/course.lib.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)."/surveymanager.lib.php");
require_once (api_get_path(LIBRARY_PATH)."/usermanager.lib.php");
/** @todo replace this with the correct code */
$status = surveymanager::get_status(); $status = surveymanager::get_status();
if($status==5) if($status==5)
{ {
api_protect_admin_script(); api_protect_admin_script();
} }
require_once (api_get_path(LIBRARY_PATH)."/usermanager.lib.php");
$MonthsLong = array(get_lang('JanuaryLong'), get_lang('FebruaryLong'), get_lang('"MarchLong'), get_lang('AprilLong'), get_lang('MayLong'), get_lang('JuneLong'), get_lang('JulyLong'), get_lang('AugustLong'), get_lang('SeptemberLong'), get_lang('OctoberLong'), get_lang('NovemberLong'), get_lang('DecemberLong')); // Database table definitions
$arr_date = explode("-",date("Y-m-d")); /** @todo use database constants for the survey tables */
$curr_year = $arr_date[0];
$curr_month = $arr_date[1];
$curr_day = $arr_date[2];
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$cidReq = $_REQUEST['cidReq'];
$db_name = $_REQUEST['db_name'];
$table_survey = Database :: get_course_table('survey'); $table_survey = Database :: get_course_table('survey');
$table_group = Database :: get_course_table('survey_group'); $table_group = Database :: get_course_table('survey_group');
$table_question = Database :: get_course_table('questions'); $table_question = Database :: get_course_table('questions');
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE); $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_course_survey_rel = Database :: get_main_table(TABLE_MAIN_COURSE_SURVEY); $table_course_survey_rel = Database :: get_main_table(TABLE_MAIN_COURSE_SURVEY);
// Path variables
/** @todo these variables are probably not used here */
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
// Language variables
$MonthsLong = array(get_lang('JanuaryLong'), get_lang('FebruaryLong'), get_lang('"MarchLong'), get_lang('AprilLong'), get_lang('MayLong'), get_lang('JuneLong'), get_lang('JulyLong'), get_lang('AugustLong'), get_lang('SeptemberLong'), get_lang('OctoberLong'), get_lang('NovemberLong'), get_lang('DecemberLong'));
$tool_name = get_lang('CreateNewSurvey'); $tool_name = get_lang('CreateNewSurvey');
$tool_name1 = get_lang('CreateNewSurvey'); $tool_name1 = get_lang('CreateNewSurvey');
// breadcrumbs
$interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey')); $interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey'));
// Variables
$arr_date = explode("-",date("Y-m-d"));
$curr_year = $arr_date[0];
$curr_month = $arr_date[1];
$curr_day = $arr_date[2];
/** @todo use $_course array */
$course_id = $_SESSION['_course']['id']; $course_id = $_SESSION['_course']['id'];
// $_GET and $_POST
/** @todo replace $_REQUEST with $_GET or $_POST */
$cidReq = $_REQUEST['cidReq'];
$db_name = $_REQUEST['db_name'];
$oldsurveyid=$_REQUEST['surveyid']; $oldsurveyid=$_REQUEST['surveyid'];
$gids = $_REQUEST['gids']; $gids = $_REQUEST['gids'];
$survey_name=surveymanager::get_surveyname($db_name,$oldsurveyid); $survey_name=surveymanager::get_surveyname($db_name,$oldsurveyid);
/** @todo this piece of code is duplicated in many scripts. Find out where it is used and remove all other occurences */
if ($_POST['action'] == 'add_survey') if ($_POST['action'] == 'add_survey')
{ {
$surveycode=$_POST['survey_code']; $surveycode=$_POST['survey_code'];

Loading…
Cancel
Save