[svn r10603] replacing <? with <?php

removing useless dbname, cidreq
removing unused variables
coding standards
skala
Patrick Cool 19 years ago
parent 1e6357257b
commit f952c23d06
  1. 53
      main/survey/addanother.php
  2. 7
      main/survey/attach_existingsurvey.php
  3. 7
      main/survey/attach_question.php
  4. 7
      main/survey/attach_survey.php
  5. 45
      main/survey/create_new_group.php
  6. 52
      main/survey/create_new_survey.php
  7. 9
      main/survey/create_survey.php
  8. 4
      main/survey/existing_surveys_new.php
  9. 4
      main/survey/group_add_question.php
  10. 4
      main/survey/group_edit.php
  11. 39
      main/survey/mcma.php
  12. 3
      main/survey/new_survey.php
  13. 4
      main/survey/preview_mcma.php
  14. 4
      main/survey/preview_open.php
  15. 4
      main/survey/preview_yesno.php
  16. 8
      main/survey/select_question_group-uploaded.php
  17. 168
      main/survey/select_question_group.php
  18. 69
      main/survey/survey_edit.php

@ -23,7 +23,7 @@
============================================================================== ==============================================================================
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: addanother.php 10583 2007-01-02 14:47:19Z pcool $ * @version $Id: addanother.php 10603 2007-01-06 17:01:47Z pcool $
============================================================================== ==============================================================================
*/ */
@ -73,11 +73,6 @@ $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');
// 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 // Language variables
$tool_name = get_lang('CreateNewSurvey'); $tool_name = get_lang('CreateNewSurvey');
$tool_name1 = get_lang('AddAnotherQuestion'); $tool_name1 = get_lang('AddAnotherQuestion');
@ -91,18 +86,19 @@ $course_id = $_SESSION['_course']['id'];
// $_GET and $_POST // $_GET and $_POST
/** @todo replace $_REQUEST with $_GET or $_POST */ /** @todo replace $_REQUEST with $_GET or $_POST */
$cidReq = $_GET['cidReq']; $group_id = $_GET['newgroupid'];
/** @todo use $_course array */
$curr_dbname = $_REQUEST['curr_dbname'];
$group_id = $_GET['newgroupid'];
if(isset($_REQUEST['surveyid']))
$surveyid=$_REQUEST['surveyid'];
if(isset($_REQUEST['groupid'])) if(isset($_REQUEST['groupid']))
$groupid=$_REQUEST['groupid']; {
if(isset($_REQUEST['cidReq'])) $groupid=$_REQUEST['groupid'];
$cidReq=$_REQUEST['cidReq']; }
if(isset($_GET['cidReq']))
{
$cidReq=$_GET['cidReq'];
}
if(isset($_REQUEST['newgroupid'])) if(isset($_REQUEST['newgroupid']))
$groupid=$_REQUEST['newgroupid']; {
$groupid=$_REQUEST['newgroupid'];
}
@ -110,7 +106,7 @@ $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=".$_GET['surveyid']."&cidReq=$cidReq");
} }
if(isset($_POST['next'])) if(isset($_POST['next']))
@ -121,24 +117,23 @@ if(isset($_POST['next']))
{ {
$groupid=$_POST['exiztinggroup']; $groupid=$_POST['exiztinggroup'];
$add_question=$_POST['add_question']; $add_question=$_POST['add_question'];
$curr_dbname = $_REQUEST['curr_dbname'];
/** @todo it seems a bad idea to use language strings for switch statements and $_POST variables */ /** @todo it seems a bad idea to use language strings for switch statements and $_POST variables */
switch ($_POST['add_question']) switch ($_POST['add_question'])
{ {
case get_lang('YesNo'): case get_lang('YesNo'):
header("location:yesno.php?add_question=$add_question&groupid=$groupid&surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname"); header("location:yesno.php?add_question=$add_question&groupid=$groupid&surveyid=".$_GET['surveyid']."&cidReq=$cidReq");
break; break;
case get_lang('MultipleChoiceSingle'): case get_lang('MultipleChoiceSingle'):
header("location:mcsa.php?add_question=$add_question&groupid=$groupid&surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname"); header("location:mcsa.php?add_question=$add_question&groupid=$groupid&surveyid=".$_GET['surveyid']."&cidReq=$cidReq");
break; break;
case get_lang('MultipleChoiceMulti'): case get_lang('MultipleChoiceMulti'):
header("location:mcma.php?add_question=$add_question&groupid=$groupid&surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname"); header("location:mcma.php?add_question=$add_question&groupid=$groupid&surveyid=".$_GET['surveyid']."&cidReq=$cidReq");
break; break;
case get_lang('Open'): case get_lang('Open'):
header("location:open.php?add_question=$add_question&groupid=$groupid&surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname"); header("location:open.php?add_question=$add_question&groupid=$groupid&surveyid=".$_GET['surveyid']."&cidReq=$cidReq");
break; break;
case get_lang('Numbered'): case get_lang('Numbered'):
header("location:numbered.php?add_question=$add_question&groupid=$groupid&surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname"); header("location:numbered.php?add_question=$add_question&groupid=$groupid&surveyid=".$_GET['surveyid']."&cidReq=$cidReq");
break; break;
default : default :
header("location:select_question_type.php?cidReq=$cidReq"); header("location:select_question_type.php?cidReq=$cidReq");
@ -155,7 +150,7 @@ if(isset($_POST['next']))
$error_message=get_lang('PleaseSelectQuestionAndGroup'); $error_message=get_lang('PleaseSelectQuestionAndGroup');
} }
Display::display_header($tool_name1); Display::display_header($tool_name1);
$query="SELECT * FROM $table_survey WHERE survey_id='$surveyid'"; $query="SELECT * FROM $table_survey WHERE survey_id='".mysql_real_escape_string($_GET['surveyid'])."'";
$result=api_sql_query($query); $result=api_sql_query($query);
$surveyname=mysql_result($result,0,'title'); $surveyname=mysql_result($result,0,'title');
//$surveyname=get_lang('SurveyName').$surveyname; //$surveyname=get_lang('SurveyName').$surveyname;
@ -171,16 +166,14 @@ if(isset($group_id))
$obj= mysql_fetch_object($res); $obj= mysql_fetch_object($res);
?> ?>
<div align="center"><strong><font color="#FF0000"><?php echo "Group";?>&nbsp;&nbsp;<font color="#0000CC"><u><?php echo $obj->groupname;?></u>&nbsp;&nbsp;</font><?php echo get_lang('GroupCreated');?></font></strong></div> <div align="center"><strong><font color="#FF0000"><?php echo "Group";?>&nbsp;&nbsp;<font color="#0000CC"><u><?php echo $obj->groupname;?></u>&nbsp;&nbsp;</font><?php echo get_lang('GroupCreated');?></font></strong></div>
<? <?php
} }
?> ?>
<form name="question" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>?cidReq=<?php echo $cidReq; ?>"> <form name="question" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>?cidReq=<?php echo $cidReq; ?>">
<input type="hidden" name="groupid" value="<?php echo $groupid; ?>"> <input type="hidden" name="groupid" value="<?php echo $groupid; ?>">
<input type="hidden" name="surveyid" value="<?php echo $surveyid; ?>"> <input type="hidden" name="surveyid" value="<?php echo $_GET['surveyid']; ?>">
<input type="hidden" name="newgroupid" value="<?php echo $group_id; ?>"> <input type="hidden" name="newgroupid" value="<?php echo $group_id; ?>">
<input type="hidden" name="curr_dbname" value="<?php echo $curr_dbname; ?>">
<!--<input type="hidden" name="cidReq" value="<?php echo $cidReq; ?>">-->
<table> <table>
<tr> <tr>
<td> <td>
@ -208,12 +201,12 @@ if(isset($group_id))
</td> </td>
<td> <td>
<?php <?php
echo SurveyManager::select_group_list($surveyid, $groupid, $extra_script); echo SurveyManager::select_group_list($_GET['surveyid'], $groupid, $extra_script);
?> ?>
<!--<select name="select_group" >--> <!--<select name="select_group" >-->
<?php <?php
/*$query="SELECT * FROM $table_group WHERE survey_id='$surveyid'"; /*$query="SELECT * FROM $table_group WHERE survey_id='$_GET['surveyid']'";
//echo $query; //echo $query;
$result=api_sql_query($query); $result=api_sql_query($query);
$num=mysql_num_rows($result); $num=mysql_num_rows($result);

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: attach_existingsurvey.php 10596 2007-01-05 14:09:55Z elixir_inter $ * @version $Id: attach_existingsurvey.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
/* /*
@ -72,11 +72,6 @@ $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 // 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')); $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');

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: attach_question.php 10596 2007-01-05 14:09:55Z elixir_inter $ * @version $Id: attach_question.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
/* /*
@ -72,11 +72,6 @@ $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 // 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')); $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');

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: attach_survey.php 10596 2007-01-05 14:09:55Z elixir_inter $ * @version $Id: attach_survey.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
/* /*
@ -72,11 +72,6 @@ $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 // 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')); $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');

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: create_new_group.php 10596 2007-01-05 14:09:55Z elixir_inter $ * @version $Id: create_new_group.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
/* /*
@ -41,6 +41,7 @@ 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)."/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 */ /** @todo replace this with the correct code */
/* /*
@ -60,11 +61,17 @@ if (!api_is_allowed_to_edit())
exit; exit;
} }
require_once (api_get_path(LIBRARY_PATH)."/usermanager.lib.php"); // Database table definitions
/** @todo use database constants for the survey tables */
$table_survey = Database :: get_course_table('survey');
$table_group = Database :: get_course_table('survey_group');
$table_question = Database :: get_course_table('questions');
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_survey_group = Database :: get_course_table('survey_group');
$cidReq=$_GET['cidReq']; $cidReq=$_GET['cidReq'];
$curr_dbname = $_REQUEST['curr_dbname'];
$table_group = Database :: get_course_table('survey_group');
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$tool_name1 = get_lang('CreateNewGroup'); $tool_name1 = get_lang('CreateNewGroup');
$tool_name = get_lang('CreateNewGroup'); $tool_name = get_lang('CreateNewGroup');
$header1 = get_lang('GroupList'); $header1 = get_lang('GroupList');
@ -98,20 +105,18 @@ if(isset($_REQUEST['delete']))
{ {
$group_id = $_REQUEST['group_delete']; $group_id = $_REQUEST['group_delete'];
$surveyid = $_REQUEST['surveyid']; $surveyid = $_REQUEST['surveyid'];
$curr_dbname = $_REQUEST['curr_dbname']; SurveyManager::delete_group($group_id);
SurveyManager::delete_group($group_id,$curr_dbname); header("Location:create_new_group.php?surveyid=$surveyid&cidReq=$cidReq");
header("Location:create_new_group.php?surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname");
exit; exit;
} }
if ($_POST['action'] == 'new_group') if ($_POST['action'] == 'new_group')
{ {
$surveyid = $_POST['surveyid']; $surveyid = $_POST['surveyid'];
$groupname = $_POST['groupname']; $groupname = $_POST['groupname'];
$curr_dbname = $_REQUEST['curr_dbname'];
$surveyintroduction = $_POST['content']; $surveyintroduction = $_POST['content'];
if(isset($_POST['back'])) if(isset($_POST['back']))
{ {
header("location:select_question_group.php?surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname"); header("location:select_question_group.php?surveyid=$surveyid&cidReq=$cidReq");
exit; exit;
} }
@ -128,7 +133,7 @@ if ($_POST['action'] == 'new_group')
if(isset($_POST['next']) && $groupid) if(isset($_POST['next']) && $groupid)
{ {
header("location:addanother.php?surveyid=$surveyid&newgroupid=$groupid&cidReq=$cidReq&curr_dbname=$curr_dbname"); header("location:addanother.php?surveyid=$surveyid&newgroupid=$groupid&cidReq=$cidReq");
exit; exit;
}elseif(isset($_POST['saveandexit']) && $groupid){ }elseif(isset($_POST['saveandexit']) && $groupid){
@ -150,18 +155,17 @@ Display::display_header($tool_name1);
<tr> <tr>
<td><?php api_display_tool_title($header1); ?></td> <td><?php api_display_tool_title($header1); ?></td>
</tr> </tr>
<? <?php
if( isset($error_message) ) if( isset($error_message) )
{ {
Display::display_error_message($error_message); Display::display_error_message($error_message);
} }
$table_group = Database :: get_course_table('survey_group');
$sql = "SELECT * FROM $curr_dbname.survey_group Where survey_id='$surveyid' ORDER BY sortby ASC"; $sql = "SELECT * FROM $table_survey_group WHERE survey_id='$surveyid' ORDER BY sortby ASC";
$parameters = array (); $parameters = array ();
$parameters['curr_dbname']=$curr_dbname;
$parameters['surveyid']=$surveyid; $parameters['surveyid']=$surveyid;
$parameters['groupid']=$groupid; $parameters['groupid']=$groupid;
$parameters['cidReq']=$cidReq; $parameters['cidReq']=$cidReq;
@ -185,21 +189,21 @@ $table_group = Database :: get_course_table('survey_group');
$survey[] = $author; $survey[] = $author;
$directions = '<table cellpadding="0" cellspacing="0" border="0" style="border:0px"><tr>'; $directions = '<table cellpadding="0" cellspacing="0" border="0" style="border:0px"><tr>';
if($i < $countGroups-1){ if($i < $countGroups-1){
$directions .= '<td><a href="'.$_SERVER['PHP_SELF'].'?surveyid='.$surveyid.'&cidReq='.$cidReq.'&curr_dbname='.$curr_dbname.'&direction=down&id_group='.$gid.'"><img src="../img/down.gif" border="0" title="lang_move_down"></a></td>'; $directions .= '<td><a href="'.$_SERVER['PHP_SELF'].'?surveyid='.$surveyid.'&cidReq='.$cidReq.'&direction=down&id_group='.$gid.'"><img src="../img/down.gif" border="0" title="lang_move_down"></a></td>';
} }
else { else {
$directions .= '<td width="20"></td>'; $directions .= '<td width="20"></td>';
} }
if($i > 0){ if($i > 0){
$directions .= '<td><a href="'.$_SERVER['PHP_SELF'].'?surveyid='.$surveyid.'&cidReq='.$cidReq.'&curr_dbname='.$curr_dbname.'&direction=up&id_group='.$gid.'"><img src="../img/up.gif" border="0" title="lang_move_up"></a></td>'; $directions .= '<td><a href="'.$_SERVER['PHP_SELF'].'?surveyid='.$surveyid.'&cidReq='.$cidReq.'&direction=up&id_group='.$gid.'"><img src="../img/up.gif" border="0" title="lang_move_up"></a></td>';
} }
else { else {
$directions .= '<td></td>'; $directions .= '<td></td>';
} }
$directions .= '</tr></table>'; $directions .= '</tr></table>';
$survey[] = $directions; $survey[] = $directions;
$survey[] = '<a href="group_edit.php?groupid='.$obj->group_id.'&cidReq='.$cidReq.'&curr_dbname='.$curr_dbname.'&surveyid='.$surveyid.'"><img src="../img/edit.gif" border="0" align="absmiddle" alt="'.get_lang('Edit').'"/></a>' $survey[] = '<a href="group_edit.php?groupid='.$obj->group_id.'&cidReq='.$cidReq.'&&surveyid='.$surveyid.'"><img src="../img/edit.gif" border="0" align="absmiddle" alt="'.get_lang('Edit').'"/></a>'
.'<a href="create_new_group.php?cidReq='.$cidReq.'&curr_dbname='.$curr_dbname.'&delete=1&group_delete='.$gid.'&surveyid='.$surveyid.'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang('ConfirmYourChoice')))."'".')) return false;"><img src="../img/delete.gif" border="0" align="absmiddle" alt="'.get_lang('Delete').'"/></a>' .'<a href="create_new_group.php?cidReq='.$cidReq.'&delete=1&group_delete='.$gid.'&surveyid='.$surveyid.'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang('ConfirmYourChoice')))."'".')) return false;"><img src="../img/delete.gif" border="0" align="absmiddle" alt="'.get_lang('Delete').'"/></a>'
; ;
$surveys[] = $survey; $surveys[] = $survey;
$i++; $i++;
@ -216,7 +220,7 @@ $table_group = Database :: get_course_table('survey_group');
{ {
echo get_lang('NoSearchResults'); echo get_lang('NoSearchResults');
} }
echo '<a href="select_question_group.php?surveyid='.$surveyid.'&cidReq='.$cidReq.'&curr_dbname='.$curr_dbname.'">'.get_lang('BackToQuestions').'</a><br><br>'; echo '<a href="select_question_group.php?surveyid='.$surveyid.'&cidReq='.$cidReq.'">'.get_lang('BackToQuestions').'</a><br><br>';
api_display_tool_title($tool_name); api_display_tool_title($tool_name);
?> ?>
<script src=tbl_change.js type="text/javascript" language="javascript"></script> <script src=tbl_change.js type="text/javascript" language="javascript"></script>
@ -224,7 +228,6 @@ api_display_tool_title($tool_name);
<input type="hidden" name="action" value="new_group"> <input type="hidden" name="action" value="new_group">
<input type="hidden" name="surveyid" value="<?php echo $surveyid; ?>"> <input type="hidden" name="surveyid" value="<?php echo $surveyid; ?>">
<input type="hidden" name="groupid" value="<?php echo $groupid; ?>"> <input type="hidden" name="groupid" value="<?php echo $groupid; ?>">
<input type="hidden" name="curr_dbname" value="<?php echo $curr_dbname; ?>">
<!--<input type="hidden" name="cidReq" value="<?php echo $_REQUEST['cidReq']; ?>">--> <!--<input type="hidden" name="cidReq" value="<?php echo $_REQUEST['cidReq']; ?>">-->
<table> <table>
<tr> <tr>

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: create_new_survey.php 10596 2007-01-05 14:09:55Z elixir_inter $ * @version $Id: create_new_survey.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
// name of the language file that needs to be included // name of the language file that needs to be included
@ -28,6 +28,7 @@ $language_file = 'survey';
// including the global dokeos file // including the global dokeos file
require_once ('../inc/global.inc.php'); require_once ('../inc/global.inc.php');
// including additional libraries // including additional libraries
/** @todo check if these are all needed */ /** @todo check if these are all needed */
/** @todo check if the starting / is needed. api_get_path probably ends with an / */ /** @todo check if the starting / is needed. api_get_path probably ends with an / */
@ -240,17 +241,25 @@ if($surveyid = $_REQUEST['surveyid'])
<!-- month: january -> <!-- month: january ->
december --> december -->
<select name="fmonth"> <select name="fmonth">
<? <?php
for($i=1;$i<=count($MonthsLong);$i++) for($i=1;$i<=count($MonthsLong);$i++)
{ {
if($i<=9) if($i<=9)
$val = "0".$i; {
$val = "0".$i;
}
else else
$val = $i; {
$val = $i;
}
if($val == $avail_month_from) if($val == $avail_month_from)
echo "<option value=\"$val\" selected>".$MonthsLong[$i-1]."</option>\n"; {
echo "<option value=\"$val\" selected>".$MonthsLong[$i-1]."</option>\n";
}
else else
echo "<option value=\"$val\">".$MonthsLong[$i-1]."</option>\n"; {
echo "<option value=\"$val\">".$MonthsLong[$i-1]."</option>\n";
}
} }
?> ?>
</select> </select>
@ -558,26 +567,27 @@ else
<!-- month: january -> <!-- month: january ->
december --> december -->
<select name="fmonth"> <select name="fmonth">
<? <?php
for($i=1;$i<=count($MonthsLong);$i++) for($i=1; $i<=12; $i++)
{ {
if($i<=9) if($i<=9)
{ {
$val = "0".$i; $val = "0".$i;
} }
else else
{ {
$val = $i; $val = $i;
} }
if($val == $curr_month) if($val == $curr_month)
{ {
echo "<option value=\"$val\" selected>".$MonthsLong[$i-1]."</option>\n"; echo "<option value=\"$val\" selected>".$MonthsLong[$i-1]."</option>\n";
} }
else else
{ {
echo "<option value=\"$val\">".$MonthsLong[$i-1]."</option>\n"; echo "<option value=\"$val\">".$MonthsLong[$i-1]."y</option>\n";
}
} }
}
?> ?>
</select> </select>
<select name="fyear"> <select name="fyear">
@ -628,7 +638,7 @@ else
<!-- month: january -> <!-- month: january ->
december --> december -->
<select name="end_fmonth"> <select name="end_fmonth">
<? <?php
for($i=1;$i<=count($MonthsLong);$i++) for($i=1;$i<=count($MonthsLong);$i++)
{ {
if($i<=9) if($i<=9)

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: create_survey.php 10584 2007-01-02 15:09:21Z pcool $ * @version $Id: create_survey.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
/* /*
@ -60,14 +60,13 @@ if (!api_is_allowed_to_edit())
exit; exit;
} }
// Database table definitions
//$table_category = Database :: get_main_table(TABLE_MAIN_CATEGORY); /** @todo use database constants for the survey tables */
$table_survey = Database :: get_main_table(MAIN_SURVEY_IFA_TABLE); $table_survey = Database :: get_main_table(MAIN_SURVEY_IFA_TABLE);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE); $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tool_name = get_lang('CreateSurvey'); $tool_name = get_lang('CreateSurvey');
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('AdministrationTools')); $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('AdministrationTools'));
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
$newsurvey = '0'; $newsurvey = '0';
if ($_POST['action'] == 'add_survey') if ($_POST['action'] == 'add_survey')

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: existing_surveys_new.php 10583 2007-01-02 14:47:19Z pcool $ * @version $Id: existing_surveys_new.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
/* /*
@ -140,7 +140,7 @@ function displayTemplate(url) {
$table_header[] = array (' ', false); $table_header[] = array (' ', false);
if(!empty($surveys)) if(!empty($surveys))
{ {
Display :: display_sortable_table($table_header, $surveys, array (), array (), $parameters); Display :: display_sortable_table($table_header, $surveys, array (), array (), $parameters);
} }
else else
{$flag=1;} {$flag=1;}

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: group_add_question.php 10584 2007-01-02 15:09:21Z pcool $ * @version $Id: group_add_question.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
/* /*
@ -50,8 +50,6 @@ $table_user = Database :: get_main_table(TABLE_MAIN_USER);
$tool_name1 = get_lang('AddQuestion'); $tool_name1 = get_lang('AddQuestion');
$tool_name = get_lang('AddQuestion'); $tool_name = get_lang('AddQuestion');
$interbreadcrumb[] = array ("url" => "survey.php", "name" => get_lang('CreateSurvey')); $interbreadcrumb[] = array ("url" => "survey.php", "name" => get_lang('CreateSurvey'));
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
$surveyid=$_GET['surveyid']; $surveyid=$_GET['surveyid'];
$groupid = $_GET['groupid']; $groupid = $_GET['groupid'];
if (isset($_POST['back'])) if (isset($_POST['back']))

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: group_edit.php 10596 2007-01-05 14:09:55Z elixir_inter $ * @version $Id: group_edit.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
/* /*
@ -68,8 +68,6 @@ $table_user = Database :: get_main_table(TABLE_MAIN_USER);
$tool_name1 = get_lang('CreateNewGroup'); $tool_name1 = get_lang('CreateNewGroup');
$tool_name = get_lang('ModifyGroupInformation'); $tool_name = get_lang('ModifyGroupInformation');
$interbreadcrumb[] = array ("url" => "survey_list.php?", "name" => get_lang('Survey')); $interbreadcrumb[] = array ("url" => "survey_list.php?", "name" => get_lang('Survey'));
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
$groupid = $_GET['groupid']; $groupid = $_GET['groupid'];
$surveyid = $_GET['surveyid']; $surveyid = $_GET['surveyid'];
if($_POST['action'] == 'new_group') if($_POST['action'] == 'new_group')

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: mcma.php 10596 2007-01-05 14:09:55Z elixir_inter $ * @version $Id: mcma.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
// name of the language file that needs to be included // name of the language file that needs to be included
@ -207,7 +207,7 @@ if ($_POST['action'] == 'addquestion')
} }
} }
?> ?>
<? <?php
$tool = get_lang('AddAnotherQuestion'); $tool = get_lang('AddAnotherQuestion');
Display::display_header($tool); Display::display_header($tool);
?> ?>
@ -219,7 +219,7 @@ function changeAction()
return true; return true;
} }
</script> </script>
<? <?php
select_question_type($add_question12,$groupid,$surveyid,$cidReq,$curr_dbname); select_question_type($add_question12,$groupid,$surveyid,$cidReq,$curr_dbname);
?> ?>
<table> <table>
@ -499,33 +499,34 @@ function checkLength(form){
</td> </td>
<td width="10" class="form_text"><img src="../img/blank.gif" width="10" height="8"> <td width="10" class="form_text"><img src="../img/blank.gif" width="10" height="8">
</td> </td>
<? if($i>$start) <?php
if($i>$start)
{ {
?> ?>
<td width="30" align="center" class="form_text1"> <td width="30" align="center" class="form_text1">
<input type="image" src="../img/up.gif" width="24" height="24" border="0" onclick="this.form.submit();" name="<?echo "up".$i;?>" style="cursor:hand"> <input type="image" src="../img/up.gif" width="24" height="24" border="0" onclick="this.form.submit();" name="<?php echo "up".$i;?>" style="cursor:hand">
</td> </td>
<? } <?php }
else else
{ {
?> <td width="30" align="center" class="form_text1"> ?> <td width="30" align="center" class="form_text1">
</td> </td>
<? } <?php }
$sn++; $sn++;
?> ?>
<? if($i<$end) <?php if($i<$end)
{ {
?> ?>
<td width="30" align="center" class="form_text"> <td width="30" align="center" class="form_text">
<input type="image" src="../img/down.gif" width="24" height="24" border="0" onclick="this.form.submit();" name="<?echo "down".$i;?>" style="cursor:hand"> <input type="image" src="../img/down.gif" width="24" height="24" border="0" onclick="this.form.submit();" name="<?php echo "down".$i;?>" style="cursor:hand">
</td> </td>
<? } <?php }
else else
{ {
?> <td width="30" align="center" class="form_text1"> ?> <td width="30" align="center" class="form_text1">
</td> </td>
<? } <?php }
?> ?>
<td width="30" align="center" class="form_text"> <td width="30" align="center" class="form_text">
@ -533,7 +534,7 @@ function checkLength(form){
<input type="image" src="../img/delete.gif" width="24" height="24" border="0" style="cursor:hand" name="<?php echo "id".$i;?>" value="<?php echo $end;?>" onclick="this.form.submit();"> <input type="image" src="../img/delete.gif" width="24" height="24" border="0" style="cursor:hand" name="<?php echo "id".$i;?>" value="<?php echo $end;?>" onclick="this.form.submit();">
</tr> </tr>
<? } <?php }
} }
?> ?>
@ -544,11 +545,11 @@ function checkLength(form){
<td height="30"><span class="form_text1">Add&nbsp;&nbsp;</span> <td height="30"><span class="form_text1">Add&nbsp;&nbsp;</span>
<select name="addnewrows" class="text_field_small" style="width:100px" onChange="this.form.submit();"> <select name="addnewrows" class="text_field_small" style="width:100px" onChange="this.form.submit();">
<!--<option value="1" <?if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="1")echo "selected";}?>>1</option> <!--<option value="1" <?php if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="1")echo "selected";}?>>1</option>
<option value="2" <?if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="2")echo "selected";}?>>2</option> <option value="2" <?php if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="2")echo "selected";}?>>2</option>
<option value="3" <?if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="3")echo "selected";}?>>3</option> <option value="3" <?php if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="3")echo "selected";}?>>3</option>
<option value="4" <?if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="4")echo "selected";}?>>4</option> <option value="4" <?php if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="4")echo "selected";}?>>4</option>
<option value="5" <?if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="5")echo "selected";}?>>5</option>--> <option value="5" <?php if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="5")echo "selected";}?>>5</option>-->
<option value="0" >0</option> <option value="0" >0</option>
<option value="1" >1</option> <option value="1" >1</option>
@ -576,10 +577,10 @@ function checkLength(form){
<input type="HIDDEN" name="end1" value="<?php echo $end; ?>"> <input type="HIDDEN" name="end1" value="<?php echo $end; ?>">
<? if(isset($_POST['add_question'])) <?php if(isset($_POST['add_question']))
{ {
?> <input type="hidden" name="add_question" value="<?php echo $_POST['add_question'];?>" > ?> <input type="hidden" name="add_question" value="<?php echo $_POST['add_question'];?>" >
<? } <?php }
$sql = "SELECT * FROM $curr_dbname.survey WHERE survey_id='$surveyid'"; $sql = "SELECT * FROM $curr_dbname.survey WHERE survey_id='$surveyid'";
$res=api_sql_query($sql); $res=api_sql_query($sql);

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: new_survey.php 10559 2006-12-27 10:52:50Z pcool $ * @version $Id: new_survey.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
// name of the language file that needs to be included // name of the language file that needs to be included
@ -72,6 +72,7 @@ $group_table = Database :: get_main_table(TABLE_MAIN_GROUP);
$table_header[] = array ('', false); $table_header[] = array ('', false);
echo '<form method="post" action="new_survey.php">'; echo '<form method="post" action="new_survey.php">';
/** @todo remove $curr_dbname from the parameters. This is not used. */
Display :: display_sortable_table($table_header, $users, array (), array (), $parameters); Display :: display_sortable_table($table_header, $users, array (), array (), $parameters);
echo '<input type="submit" value="'.get_lang('Ok').'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang('ConfirmYourChoice')))."'".')) return false;"/>'; echo '<input type="submit" value="'.get_lang('Ok').'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang('ConfirmYourChoice')))."'".')) return false;"/>';
echo '</form>'; echo '</form>';

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: preview_mcma.php 10584 2007-01-02 15:09:21Z pcool $ * @version $Id: preview_mcma.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
/* /*
@ -53,8 +53,6 @@ $header1 = get_lang('SurveyName');
$header2 = get_lang('GroupName'); $header2 = get_lang('GroupName');
$header3 = get_lang('Type'); $header3 = get_lang('Type');
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('Survey')); $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('Survey'));
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
$questionid = '1'; $questionid = '1';
$enterquestion = $_REQUEST['enterquestion']; $enterquestion = $_REQUEST['enterquestion'];
$mutlichkboxtext = $_REQUEST['mutlichkboxtext']; $mutlichkboxtext = $_REQUEST['mutlichkboxtext'];

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: preview_open.php 10584 2007-01-02 15:09:21Z pcool $ * @version $Id: preview_open.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
/* /*
@ -52,8 +52,6 @@ $header1 = get_lang('SurveyName');
$header2 = get_lang('GroupName'); $header2 = get_lang('GroupName');
$header3 = get_lang('Type'); $header3 = get_lang('Type');
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('Survey')); $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('Survey'));
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
$questionid = '1'; $questionid = '1';
$surveyid = $_REQUEST['surveyid']; $surveyid = $_REQUEST['surveyid'];
$groupid = $_REQUEST['groupid']; $groupid = $_REQUEST['groupid'];

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: preview_yesno.php 10584 2007-01-02 15:09:21Z pcool $ * @version $Id: preview_yesno.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
/* /*
@ -72,8 +72,6 @@ $header1 = get_lang('SurveyName');
$header2 = get_lang('GroupName'); $header2 = get_lang('GroupName');
$header3 = get_lang('Type'); $header3 = get_lang('Type');
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('Survey')); $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('Survey'));
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
$questionid = '1'; $questionid = '1';
$surveyid = $_REQUEST['surveyid']; $surveyid = $_REQUEST['surveyid'];
$groupid = $_REQUEST['groupid']; $groupid = $_REQUEST['groupid'];

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: select_question_group-uploaded.php 10584 2007-01-02 15:09:21Z pcool $ * @version $Id: select_question_group-uploaded.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
@ -80,8 +80,6 @@ else
{ {
$interbreadcrumb[] = array ("url" => "create_new_survey.php?surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname&page=$page", "name" => get_lang('CreateFromExistingSurvey')); $interbreadcrumb[] = array ("url" => "create_new_survey.php?surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname&page=$page", "name" => get_lang('CreateFromExistingSurvey'));
}*/ }*/
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
$default_group = '0'; $default_group = '0';
$new_group = '1'; $new_group = '1';
$existing_group = '2'; $existing_group = '2';
@ -364,8 +362,8 @@ $result=api_sql_query($query);*/
<? <?
if(!empty($courses)) if(!empty($courses))
{ {
/** @todo remove $curr_dbname from the parameters. This is not used. */
SurveyManager :: display_sortable_table($groupid,$surveyid,$curr_dbname,$table_header, $courses, array (), array (), $parameters); SurveyManager :: display_sortable_table($groupid,$surveyid,$curr_dbname,$table_header, $courses, array (), array (), $parameters);
?> ?>
<!--<input type="submit" name="delete" value="<?php echo get_lang('Delete');?>">--> <!--<input type="submit" name="delete" value="<?php echo get_lang('Delete');?>">-->

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: select_question_group.php 10584 2007-01-02 15:09:21Z pcool $ * @version $Id: select_question_group.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
@ -61,27 +61,21 @@ if (!api_is_allowed_to_edit())
exit; exit;
} }
$table_survey = Database :: get_course_table('survey'); // Database table definitions
$table_group = Database :: get_course_table('survey_group'); /** @todo use database constants for the survey tables */
$table_question = Database :: get_course_table('questions'); $table_survey = Database :: get_course_table('survey');
$table_course = Database::get_main_table(TABLE_MAIN_COURSE); $table_group = Database :: get_course_table('survey_group');
$table_question = Database :: get_course_table('questions');
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_survey_group = Database :: get_course_table('survey_group');
$cidReq = $_GET['cidReq']; $cidReq = $_GET['cidReq'];
$db_name = $_REQUEST['db_name']; $db_name = $_REQUEST['db_name'];
$curr_dbname = $_REQUEST['curr_dbname'];
//$table_survey = Database :: get_course_table('survey');
$tool_name1 = get_lang('AddQuestionGroup'); $tool_name1 = get_lang('AddQuestionGroup');
$tool_name = get_lang('AddQuestionGroup'); $tool_name = get_lang('AddQuestionGroup');
$interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey')); $interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey'));
/*if($page = $_REQUEST['page'])
{
$interbreadcrumb[] = array ("url" => "create_new_survey.php?surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname&page=$page", "name" => get_lang('CreateNewSurvey'));
}
else
{
$interbreadcrumb[] = array ("url" => "create_new_survey.php?surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname&page=$page", "name" => get_lang('CreateFromExistingSurvey'));
}*/
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
$default_group = '0'; $default_group = '0';
$new_group = '1'; $new_group = '1';
$existing_group = '2'; $existing_group = '2';
@ -94,20 +88,22 @@ $flag = $_REQUEST['flag'];
$action1 = $_REQUEST['action1']; $action1 = $_REQUEST['action1'];
$sort = $_REQUEST['sortby']; $sort = $_REQUEST['sortby'];
if(!isset($page_nr)||!isset($column)||!isset($per_page)) if(!isset($page_nr)||!isset($column)||!isset($per_page))
{ {
$page_nr =1; $page_nr =1;
$column =0; $column =0;
$per_page = 10; $per_page = 10;
} }
else else
{ {
$page_nr = $_REQUEST['page_nr']; $page_nr = $_REQUEST['page_nr'];
$column = $_REQUEST['column']; $column = $_REQUEST['column'];
$per_page = $_REQUEST['per_page']; $per_page = $_REQUEST['per_page'];
} }
/* /*
$sql="SELECT * FROM $curr_dbname.questions WHERE gid='$groupid' AND survey_id = '$surveyid'"; $sql="SELECT * FROM $table_question WHERE gid='$groupid' AND survey_id = '$surveyid'";
$res=api_sql_query($sql,__FILE__,__LINE__); $res=api_sql_query($sql,__FILE__,__LINE__);
$obj=mysql_fetch_object($res); $obj=mysql_fetch_object($res);
$number=mysql_num_rows($res); $number=mysql_num_rows($res);
@ -166,38 +162,38 @@ for($i=1;$i<=$number;$i++)
} }
} }
*/ */
if ($_POST['action'] == 'selectquestion_group') if ($_POST['action'] == 'selectquestion_group')
{ {
$surveyid = $_POST['newsurveyid']; $surveyid = $_POST['newsurveyid'];
$questiongroup = $_POST['question_group']; $questiongroup = $_POST['question_group'];
if (isset($questiongroup)) if (isset($questiongroup))
{ {
$cidReq=$_REQUEST['cidReq']; $cidReq=$_REQUEST['cidReq'];
$exiztinggroup = $_POST['exiztinggroup']; $exiztinggroup = $_POST['exiztinggroup'];
$curr_dbname = $_REQUEST['curr_dbname']; header("Location:existing_surveys_new.php?cidReq=$cidReq&surveyid=$surveyid");
header("Location:existing_surveys_new.php?cidReq=$cidReq&surveyid=$surveyid&curr_dbname=$curr_dbname");
exit; exit;
} }
} }
//from question_added //from question_added
if (isset($_POST['back'])) if (isset($_POST['back']))
{ {
$groupid = $_POST['groupid']; $groupid = $_POST['groupid'];
$surveyid = $_POST['surveyid']; $surveyid = $_POST['surveyid'];
$cidReq=$_REQUEST['cidReq']; $cidReq=$_REQUEST['cidReq'];
$curr_dbname = $_REQUEST['curr_dbname'];
$page = $_REQUEST['page']; $page = $_REQUEST['page'];
header("Location:create_new_survey.php?surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname&page=$page"); header("Location:create_new_survey.php?surveyid=$surveyid&cidReq=$cidReq&page=$page");
//header("Location:select_question_type.php?groupid=$groupid&surveyid=$surveyid&cidReq=$cidReq"); //header("Location:select_question_type.php?groupid=$groupid&surveyid=$surveyid&cidReq=$cidReq");
exit; exit;
} }
if (isset($_POST['addanother'])) if (isset($_POST['addanother']))
{ {
$groupid = $_POST['groupid']; $groupid = $_POST['groupid'];
$surveyid = $_POST['surveyid']; $surveyid = $_POST['surveyid'];
$cidReq=$_REQUEST['cidReq']; $cidReq=$_REQUEST['cidReq'];
$curr_dbname = $_REQUEST['curr_dbname']; header("Location:addanother.php?surveyid=$surveyid&cidReq=$cidReq");
header("Location:addanother.php?surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname");
//header("Location:select_question_type.php?groupid=$groupid&surveyid=$surveyid&cidReq=$cidReq"); //header("Location:select_question_type.php?groupid=$groupid&surveyid=$surveyid&cidReq=$cidReq");
exit; exit;
} }
@ -206,13 +202,11 @@ if (isset($_POST['addanotherg']))
//$groupid = $_POST['groupid']; //$groupid = $_POST['groupid'];
$surveyid = $_POST['surveyid']; $surveyid = $_POST['surveyid'];
$cidReq=$_REQUEST['cidReq']; $cidReq=$_REQUEST['cidReq'];
$curr_dbname = $_REQUEST['curr_dbname']; header("Location:create_new_group.php?surveyid=$surveyid&cidReq=$cidReq");
header("Location:create_new_group.php?surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname");
exit; exit;
} }
if(isset($_REQUEST['delete'])) if(isset($_REQUEST['delete']))
{ {
$curr_dbname = $_REQUEST['curr_dbname'];
if(isset($_REQUEST['qid'])) if(isset($_REQUEST['qid']))
{ {
$endloop=count($_REQUEST['qid']); $endloop=count($_REQUEST['qid']);
@ -220,13 +214,14 @@ if(isset($_REQUEST['delete']))
for($i=0;$i<$endloop;$i++) for($i=0;$i<$endloop;$i++)
{ {
$qid2=$qid1[$i]; $qid2=$qid1[$i];
$query="DELETE FROM $curr_dbname.questions WHERE qid='$qid2'"; $query="DELETE FROM $table_question WHERE qid='$qid2'";
api_sql_query($query); api_sql_query($query);
header("Location:select_question_group.php?surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname"); header("Location:select_question_group.php?surveyid=$surveyid&cidReq=$cidReq");
exit; exit;
} }
} }
} }
if (isset($_POST['finish'])) if (isset($_POST['finish']))
{ {
$cidReq=$_REQUEST['cidReq']; $cidReq=$_REQUEST['cidReq'];
@ -236,54 +231,52 @@ if (isset($_POST['finish']))
if(isset($action1)) if(isset($action1))
{ {
$curr_dbname = $_REQUEST['curr_dbname']; $groupid = $_REQUEST['gid'];
$groupid = $_REQUEST['gid']; $surveyid = $_REQUEST['surveyid'];
$surveyid = $_REQUEST['surveyid']; $qid = $_GET['qid'];
$qid = $_GET['qid']; $pre_qid = $_GET['pre_qid'];
$pre_qid = $_GET['pre_qid']; $post_qid = $_GET['post_qid'];
$post_qid = $_GET['post_qid']; $direction = $_GET['direction'];
$direction = $_GET['direction']; $pre_sort = $_GET['pre_sort'];
$pre_sort = $_GET['pre_sort']; $sort = $_GET['sortby'];
$sort = $_GET['sortby']; $post_sort = $_GET['post_sort'];
$post_sort = $_GET['post_sort']; if($direction=="up")
if($direction=="up") {
{ $sql_update2="UPDATE $table_question SET sortby='".$sort."' WHERE qid='".$pre_qid."'";
$sql_update2="UPDATE $curr_dbname.questions SET sortby='".$sort."' WHERE qid='".$pre_qid."'"; mysql_query($sql_update2);
mysql_query($sql_update2); $sql_update1="UPDATE $table_question SET sortby='".$pre_sort."' WHERE qid='".$qid."'";
$sql_update1="UPDATE $curr_dbname.questions SET sortby='".$pre_sort."' WHERE qid='".$qid."'"; mysql_query($sql_update1);
}
else
{
$sql_update1="UPDATE $table_question SET sortby='".$sort."' WHERE qid='".$post_qid."'";
mysql_query($sql_update1); mysql_query($sql_update1);
$sql_update2="UPDATE $table_question SET sortby='".$post_sort."' WHERE qid='".$qid."'";
} mysql_query($sql_update2);
else }
{ //surveymanager::move_question($direction,$qid,$pre_sort,$sort,$post_sort,$curr_dbname);
$sql_update1="UPDATE $curr_dbname.questions SET sortby='".$sort."' WHERE qid='".$post_qid."'";
mysql_query($sql_update1);
$sql_update2="UPDATE $curr_dbname.questions SET sortby='".$post_sort."' WHERE qid='".$qid."'";
mysql_query($sql_update2);
} }
//surveymanager::move_question($direction,$qid,$pre_sort,$sort,$post_sort,$curr_dbname);
}
Display::display_header($tool_name1); Display::display_header($tool_name1);
api_display_tool_title("Survey Name : ".$sname); api_display_tool_title("Survey Name : ".$sname);
api_display_tool_title($tool_name); api_display_tool_title($tool_name);
if($flag==1) if($flag==1)
{ {
?> ?>
<div align="center"><strong><font color="#FF0000"><?echo get_lang('AlreadyImported');?></font></strong></div> <div align="center"><strong><font color="#FF0000"><?php echo get_lang('AlreadyImported');?></font></strong></div>
<? <?php
} }
if(isset($messege) && $messege ) if(isset($messege) && $messege )
{ {
?> ?>
<div align="center"><strong><font color="#FF0000">Already Imported !</font></strong></div> <div align="center"><strong><font color="#FF0000"><?php echo get_lang('AlreadyImported');?></font></strong></div>
<? <?php
} }
?> ?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>?cidReq=<?php echo $cidReq; ?>"> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>?cidReq=<?php echo $cidReq; ?>">
<input type="hidden" name="action" value="selectquestion_group"> <input type="hidden" name="action" value="selectquestion_group">
<input type="hidden" name="newsurveyid" value="<?php echo $surveyid;?>"> <input type="hidden" name="newsurveyid" value="<?php echo $surveyid;?>">
<input type="hidden" name="curr_dbname" value="<?php echo $curr_dbname; ?>">
<input type="hidden" name="cidReq" value="<?php echo $_REQUEST['cidReq']; ?>"> <input type="hidden" name="cidReq" value="<?php echo $_REQUEST['cidReq']; ?>">
<!--<input type="hidden" name="qid" value="<?php echo $_REQUEST['qid']; ?>"> <!--<input type="hidden" name="qid" value="<?php echo $_REQUEST['qid']; ?>">
<input type="hidden" name="direction" value="<?php echo $_REQUEST['direction']; ?>">--> <input type="hidden" name="direction" value="<?php echo $_REQUEST['direction']; ?>">-->
@ -306,12 +299,9 @@ if(isset($messege) && $messege )
</table> </table>
</form> </form>
<?php <?php
/*$query="SELECT * FROM $curr_dbname.survey WHERE survey_id='$surveyid'"; $sql="SELECT * FROM $table_survey_group WHERE survey_id='$surveyid' ORDER BY sortby";
$result=api_sql_query($query);*/
$sql="SELECT * FROM $curr_dbname.survey_group WHERE survey_id='$surveyid' ORDER BY sortby";
$res = api_sql_query($sql,__FILE__,__LINE__); $res = api_sql_query($sql,__FILE__,__LINE__);
$num=mysql_num_rows($res); $num=mysql_num_rows($res);
$parameters['curr_dbname']=$curr_dbname;
$parameters['surveyid']=$surveyid; $parameters['surveyid']=$surveyid;
$parameters['cidReq']=$cidReq; $parameters['cidReq']=$cidReq;
//$table_header[] = array (' ', false); //$table_header[] = array (' ', false);
@ -324,13 +314,13 @@ $result=api_sql_query($query);*/
$table_header[]=array('',true); $table_header[]=array('',true);
$courses = array (); $courses = array ();
$question_number = 0; $question_number = 0;
if($num){ if($num)
{
for($i=0;$i<$num;$i++) for($i=0;$i<$num;$i++)
{ {
$groupid=@mysql_result($res,$i,'group_id'); $groupid=@mysql_result($res,$i,'group_id');
$gname=@mysql_result($res,$i,'groupname'); $gname=@mysql_result($res,$i,'groupname');
$sql="SELECT * FROM $curr_dbname.questions WHERE gid='$groupid' AND survey_id = '$surveyid' order by `sortby` asc"; $sql="SELECT * FROM $table_question WHERE gid='$groupid' AND survey_id = '$surveyid' order by `sortby` asc";
$res1=api_sql_query($sql,__FILE__,__LINE__); $res1=api_sql_query($sql,__FILE__,__LINE__);
$num1=mysql_num_rows($res1); $num1=mysql_num_rows($res1);
@ -358,19 +348,19 @@ $result=api_sql_query($query);*/
$course[] = $question_number.' - '.$question; $course[] = $question_number.' - '.$question;
if($num1==1) if($num1==1)
{ {
$course[] = '<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&curr_dbname='.$curr_dbname.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=down></a>&nbsp;&nbsp;&nbsp;'.'<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&curr_dbname='.$curr_dbname.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=up></a>'; $course[] = '<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=down></a>&nbsp;&nbsp;&nbsp;'.'<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=up></a>';
} }
elseif($k==0){ elseif($k==0){
$course[] = '<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&curr_dbname='.$curr_dbname.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=down><img src="../img/down.gif" border="0" title="lang_move_down"></a>&nbsp;&nbsp;&nbsp;'.'<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&curr_dbname='.$curr_dbname.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=up></a>'; $course[] = '<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=down><img src="../img/down.gif" border="0" title="lang_move_down"></a>&nbsp;&nbsp;&nbsp;'.'<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=up></a>';
}elseif($k==$num1-1){ }elseif($k==$num1-1){
$course[] = '<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&curr_dbname='.$curr_dbname.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=down></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.'<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&curr_dbname='.$curr_dbname.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=up><img src="../img/up.gif" border="0" title="lang_move_up"></a>'; $course[] = '<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=down></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.'<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=up><img src="../img/up.gif" border="0" title="lang_move_up"></a>';
} }
else{ else{
$course[] = '<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&curr_dbname='.$curr_dbname.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=down><img src="../img/down.gif" border="0" title="lang_move_down"></a>&nbsp;&nbsp;&nbsp;'.'<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&curr_dbname='.$curr_dbname.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=up><img src="../img/up.gif" border="0" title="lang_move_up"></a>'; $course[] = '<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=down><img src="../img/down.gif" border="0" title="lang_move_down"></a>&nbsp;&nbsp;&nbsp;'.'<a href='.$_SERVER['PHP_SELF'].'?gid='.$groupid.'&pre_sort='.$pre_sort.'&sortby='.$sort.'&post_sort='.$post_sort.'&surveyid='.$surveyid.'&pre_qid='.$pre_qid.'&qid='.$qid.'&post_qid='.$post_qid.'&cidReq='.$cidReq.'&page_nr='.$page_nr.'&per_page='.$per_page.'&column='.$column.'&action1=moveitem&direction=up><img src="../img/up.gif" border="0" title="lang_move_up"></a>';
} }
$course[] = mysql_result($res1,$k,'qtype');//$obj->qtype; $course[] = mysql_result($res1,$k,'qtype');//$obj->qtype;
$course[] = @mysql_result($res,$i,'groupname'); $course[] = @mysql_result($res,$i,'groupname');
$course[]='<a href="question_edit.php?qid='.$qid.'&cidReq='.$cidReq.'&curr_dbname='.$curr_dbname.'&qtype='.$q_type.'&groupid='.$groupid.'&surveyid='.$surveyid.'"><img src="../img/edit.gif" border="0" align="absmiddle" alt="'.get_lang('Edit').'"/></a>'.'<a href="select_question_group.php?delete=1&qid[]='.$qid.'&cidReq='.$cidReq.'&curr_dbname='.$curr_dbname.'&qtype='.$q_type.'&groupid='.$groupid.'&surveyid='.$surveyid.'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang('ConfirmYourChoice')))."'".')) return false;"><img src="../img/delete.gif" border="0" align="absmiddle" alt="'.get_lang('Delete').'"/></a>'; $course[]='<a href="question_edit.php?qid='.$qid.'&cidReq='.$cidReq.'&qtype='.$q_type.'&groupid='.$groupid.'&surveyid='.$surveyid.'"><img src="../img/edit.gif" border="0" align="absmiddle" alt="'.get_lang('Edit').'"/></a>'.'<a href="select_question_group.php?delete=1&qid[]='.$qid.'&cidReq='.$cidReq.'&qtype='.$q_type.'&groupid='.$groupid.'&surveyid='.$surveyid.'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang('ConfirmYourChoice')))."'".')) return false;"><img src="../img/delete.gif" border="0" align="absmiddle" alt="'.get_lang('Delete').'"/></a>';
$courses[] = $course; $courses[] = $course;
$x++; $x++;
@ -381,13 +371,13 @@ $result=api_sql_query($query);*/
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>?cidReq=<?php echo $cidReq; ?>"> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>?cidReq=<?php echo $cidReq; ?>">
<input type="hidden" name="groupid" value="<?php echo $groupid; ?>"> <input type="hidden" name="groupid" value="<?php echo $groupid; ?>">
<input type="hidden" name="surveyid" value="<?php echo $surveyid; ?>"> <input type="hidden" name="surveyid" value="<?php echo $surveyid; ?>">
<input type="hidden" name="curr_dbname" value="<?php echo $curr_dbname;?>">
<input type="hidden" name="page" value="<?php echo $page; ?>"> <input type="hidden" name="page" value="<?php echo $page; ?>">
<? <?
if(!empty($courses)) if(!empty($courses))
{ {
SurveyManager :: display_sortable_table($groupid,$surveyid,$curr_dbname,$table_header, $courses, array (), array (), $parameters); /** @todo remove $curr_dbname from the parameters. This is not used. */
SurveyManager :: display_sortable_table($groupid,$surveyid,$curr_dbname,$table_header, $courses, array (), array (), $parameters);
?> ?>
<!--<input type="submit" name="delete" value="<?php echo get_lang('Delete');?>">--> <!--<input type="submit" name="delete" value="<?php echo get_lang('Delete');?>">-->
@ -400,19 +390,13 @@ if(!empty($courses))
else else
{ {
?> ?>
<input type="submit" name="back" value="<?echo get_lang('Back');?>"> <input type="submit" name="back" value="<?php echo get_lang('Back');?>">
<input type="submit" name="addanother" value="<?echo get_lang('AddAnotherQuestion');?>"> <input type="submit" name="addanother" value="<?php echo get_lang('AddAnotherQuestion');?>">
<input type="submit" name="addanotherg" value="<?echo get_lang('AddNewGroup');?>"> <input type="submit" name="addanotherg" value="<?php echo get_lang('AddNewGroup');?>">
<? <?
} }
?> ?>
</form> </form>
<!-- question_added-->
<?php <?php
/*
==============================================================================
FOOTER
==============================================================================
*/
Display :: display_footer(); Display :: display_footer();
?> ?>

@ -20,7 +20,7 @@
/** /**
* @package dokeos.survey * @package dokeos.survey
* @author * @author
* @version $Id: survey_edit.php 10596 2007-01-05 14:09:55Z elixir_inter $ * @version $Id: survey_edit.php 10603 2007-01-06 17:01:47Z pcool $
*/ */
/* /*
============================================================================== ==============================================================================
@ -30,9 +30,11 @@
// 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
include ('../inc/global.inc.php'); include ('../inc/global.inc.php');
//api_protect_admin_script();
include (api_get_path(LIBRARY_PATH).'/fileManage.lib.php'); // including additional libraries
require_once (api_get_path(LIBRARY_PATH).'/fileManage.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"); require_once (api_get_path(LIBRARY_PATH)."/usermanager.lib.php");
@ -54,32 +56,33 @@ if (!api_is_allowed_to_edit())
exit; exit;
} }
// the variables for the days and the months // Database table definitions
// Defining the months of the year to allow translation of the months /** @todo use database constants for the survey tables */
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_course_survey_rel = Database :: get_main_table(TABLE_MAIN_COURSE_SURVEY);
$table_survey = Database :: get_course_table('survey');
$tbl_category = Database :: get_main_table(TABLE_MAIN_CATEGORY);
// 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')); $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('ModifySurveyInformation');
$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];
$cidReq=$_GET['cidReq'];
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_course_survey_rel = Database :: get_main_table(TABLE_MAIN_COURSE_SURVEY);
$table_survey = Database :: get_course_table('survey');
$tbl_category = Database :: get_main_table(TABLE_MAIN_CATEGORY);
$noPHP_SELF = true; $noPHP_SELF = true;
$tool_name = get_lang('ModifySurveyInformation');
$interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey')); $interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Survey'));
$coursePathWeb = api_get_path(WEB_COURSE_PATH);
$coursePathSys = api_get_path(SYS_COURSE_PATH);
$maxFilledSpace = get_setting('default_document_quotum'); $maxFilledSpace = get_setting('default_document_quotum');
$course_code = $id; //note confusion again: int id - string id - string code... $course_code = $id; //note confusion again: int id - string id - string code...
$surveyid = $_REQUEST['surveyid'];
$formSent=0; $formSent=0;
if ($_POST['action'] == 'update_survey') if ($_POST['action'] == 'update_survey')
{ {
$formSent=1; $formSent=1;
$cidReq=$_GET['cidReq'];
$surveyid=$_REQUEST['surveyid'];
$surveycode=$_POST['survey_code']; $surveycode=$_POST['survey_code'];
$surveytitle = $_POST['survey_title']; $surveytitle = $_POST['survey_title'];
$surveysubtitle = $_POST['survey_subtitle']; $surveysubtitle = $_POST['survey_subtitle'];
@ -95,9 +98,10 @@ if ($_POST['action'] == 'update_survey')
$savailabletill=mktime(0,0,0,$_POST['end_fmonth'],$_POST['end_fday'], $_POST['end_fyear']); $savailabletill=mktime(0,0,0,$_POST['end_fmonth'],$_POST['end_fday'], $_POST['end_fyear']);
$surveytitle=trim($surveytitle); $surveytitle=trim($surveytitle);
$surveycode=trim($surveycode); $surveycode=trim($surveycode);
if(isset($_POST['back'])){ if(isset($_POST['back']))
header("location:survey_list.php?cidReq=$cidReq"); {
exit; header('location:survey_list.php');
exit;
} }
if(empty ($surveytitle)) if(empty ($surveytitle))
{ {
@ -111,16 +115,15 @@ if ($_POST['action'] == 'update_survey')
} }
else else
{ {
$cidReq = $_GET['cidReq']; $curr_dbname=SurveyManager::update_survey($_GET['survey_id'],$surveycode,$surveytitle,$surveysubtitle,$author,$survey_language,$availablefrom,$availabletill,$isshare,$surveytemplate,$surveyintroduction,$surveythanks,$cidReq,$table_course);
$table_survey = Database :: get_course_table('survey'); $curr_dbname=SurveyManager::update_survey($surveyid,$surveycode,$surveytitle,$surveysubtitle,$author,$survey_language,$availablefrom,$availabletill,$isshare,$surveytemplate,$surveyintroduction,$surveythanks,$cidReq,$table_course);
if(isset($_POST['next'])) if(isset($_POST['next']))
{ {
header("location:select_question_group.php?surveyid=$surveyid&cidReq=$cidReq&curr_dbname=$curr_dbname"); header("location:select_question_group.php?surveyid=".$_GET['survey_id']."&cidReq=$cidReq&curr_dbname=$curr_dbname");
exit; exit;
} }
else else
{ {
header("location:survey_list.php?cidReq=$cidReq"); header('location:survey_list.php');
exit; exit;
} }
} }
@ -151,7 +154,11 @@ window.open(inf+".htm", 'popup', 'width=600,height=600,toolbar = no, status = no
</script> </script>
<script src=tbl_change.js type="text/javascript" language="javascript"></script> <script src=tbl_change.js type="text/javascript" language="javascript"></script>
<?php <?php
$sql = "select * from $table_survey where survey_id='$surveyid'"; /**
* Finding the survey we are editing
* @todo use a function for this because this is probably a very common functionality
*/
$sql = "SELECT * FROM $table_survey WHERE survey_id='".$_GET['survey_id']."'";
$res = api_sql_query($sql); $res = api_sql_query($sql);
$obj = mysql_fetch_object($res); $obj = mysql_fetch_object($res);
$arr_avail_from = explode("-",$obj->avail_from); $arr_avail_from = explode("-",$obj->avail_from);
@ -167,8 +174,8 @@ $template = $obj->template;
$lang=$obj->lang; $lang=$obj->lang;
?> ?>
<form name="new_calendar_item" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>?cidReq=<?php echo $cidReq; ?>"> <form name="new_calendar_item" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<input type="hidden" name="surveyid" value="<?php echo $surveyid; ?>"> <input type="hidden" name="surveyid" value="<?php echo $_GET['survey_id']; ?>">
<input type="hidden" name="action" value="update_survey"> <input type="hidden" name="action" value="update_survey">
<table> <table>
<tr> <tr>
@ -195,9 +202,9 @@ $lang=$obj->lang;
<td><?php echo get_lang('SurveyLanguage'); ?>&nbsp;</td> <td><?php echo get_lang('SurveyLanguage'); ?>&nbsp;</td>
<td> <td>
<select name="survey_language"> <select name="survey_language">
<option value="english" <?if($lang=='english') echo "selected";?>>English</option> <option value="english" <?php if($lang=='english') echo "selected";?>>English</option>
<option value="french" <?if($lang=='french') echo "selected";?>>Fran&ccedil;ais</option> <option value="french" <?php if($lang=='french') echo "selected";?>>Fran&ccedil;ais</option>
<option value="dutch" <?if($lang=='dutch') echo "selected";?>>Nederlands</option> <option value="dutch" <?php if($lang=='dutch') echo "selected";?>>Nederlands</option>
</select> </select>
</td> </td>
</tr> </tr>
@ -219,7 +226,7 @@ $lang=$obj->lang;
<!-- month: january -> <!-- month: january ->
december --> december -->
<select name="fmonth"> <select name="fmonth">
<? <?php
for($i=1;$i<count($MonthsLong);$i++) for($i=1;$i<count($MonthsLong);$i++)
{ {
if($i<=9) if($i<=9)
@ -264,7 +271,7 @@ december -->
<!-- month: january -> <!-- month: january ->
december --> december -->
<select name="end_fmonth"> <select name="end_fmonth">
<? <?php
for($i=1;$i<count($MonthsLong);$i++) for($i=1;$i<count($MonthsLong);$i++)
{ {
if($i<=9) if($i<=9)

Loading…
Cancel
Save