"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']; // $_GET and $_POST /** @todo replace $_REQUEST with $_GET or $_POST */ $cidReq = $_REQUEST['cidReq']; $db_name = $_REQUEST['db_name']; $oldsurveyid = $_REQUEST['surveyid']; $qids=$_REQUEST['qid']; $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') { $surveycode=$_POST['survey_code']; $surveytitle = $_POST['survey_title']; $surveysubtitle = $_POST['survey_subtitle']; //$cidReq = $_configuration['db_prefix'].$_POST['cidReq']; $author = $_POST['author']; $survey_language = $_POST['survey_language']; $availablefrom = $_POST['fyear']."-".$_POST['fmonth']."-".$_POST['fday']; $availabletill = $_POST['end_fyear']."-".$_POST['end_fmonth']."-".$_POST['end_fday']; $isshare = $_POST['isshare']; $surveytemplate = $_POST['template']; $surveyintroduction = $_POST['content']; $surveythanks = $_POST['thanks']; $savailablefrom=mktime(0,0,0,$_POST['fmonth'],$_POST['fday'], $_POST['fyear']); $savailabletill=mktime(0,0,0,$_POST['end_fmonth'],$_POST['end_fday'], $_POST['end_fyear']); $cidReq=$_REQUEST['cidReq']; $qids=$_REQUEST['qids']; $db_name = $_REQUEST['db_name']; $surveyid = $_REQUEST['surveyid']; if(isset($_POST['back'])) { $cidReq = $_REQUEST['cidReq']; $surveyid = $_REQUEST['surveyid']; $db_name = $_REQUEST['db_name']; header("location:create_from_existing_survey.php?cidReq=$cidReq&surveyid=$surveyid&db_name=$db_name"); } $surveytitle=trim($surveytitle); $surveycode=trim($surveycode); if(empty ($surveytitle)) { $error_message = get_lang('PleaseEnterSurveyTitle'); } elseif ($savailabletill<=$savailablefrom){ $error_message = get_lang('PleaseEnterValidDate'); } elseif (empty ($surveycode)){ $error_message = get_lang('PleaseEnterValidCode'); } else { $result=SurveyManager::get_survey_code($table_survey,$surveycode); if(!empty($result)) { $error_message=get_lang('ThisCodeAlreadyExist'); } else { $survey_id = SurveyManager::create_survey($surveycode, $surveytitle, $surveysubtitle, $author, $survey_language, $availablefrom, $availabletill, $isshare, $surveytemplate, $surveyintroduction, $surveythanks, $table_survey, $table_group); $cidReq=$_GET['cidReq']; $curr_dbname=SurveyManager::create_course_survey_rel($cidReq,$survey_id,$table_course,$table_course_survey_rel); $qids=$_REQUEST['qids']; //surveymanager::import_existing_question($survey_id,$qids,$table_group,$table_question,"no"); $db_name = $_REQUEST['db_name']; $message_me=surveymanager::question_import($survey_id,$qids,$db_name,$curr_dbname); if (isset($_POST['next'])) { if(isset($message_me) && $message_me) { header("location:select_question_group.php?surveyid=$survey_id&cidReq=$cidReq&curr_dbname=$curr_dbname&message=$message_me"); exit; } else { header("location:select_question_group.php?surveyid=$survey_id&cidReq=$cidReq&curr_dbname=$curr_dbname&message=$message_me"); exit; } } else { $cidReq=$_GET['cidReq']; header("location:survey_list.php?&cidReq=$cidReq"); exit; } } } } Display::display_header($tool_name); api_display_tool_title($tool_name1); //echo "
"; //print_r($_SESSION); //echo ""; if( isset($error_message) ) { Display::display_error_message($error_message); } ?>