"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 */ $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']; $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']); $qids=$_REQUEST['qids']; $surveyid = $_REQUEST['surveyid']; if(isset($_POST['back'])) { $surveyid = $_REQUEST['surveyid']; header("location:create_from_existing_survey.php?surveyid=$surveyid"); } $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); $curr_dbname=SurveyManager::create_course_survey_rel($cidReq,$survey_id,$table_course,$table_course_survey_rel); $qids=$_REQUEST['qids']; $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&message=$message_me"); exit; } else { header("location:select_question_group.php?surveyid=$survey_id&message=$message_me"); exit; } } else { header("location:survey_list.php"); 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); } ?>