dirroot/mod/questionnaire/lib.php"); $lf = "\n"; /// The survey management form saves the questionnaire data in $mod, before redirecting /// here. If its set, store the data in $form so it will be used. /// *** Are there any other security issues here? *** /// If this came from the survey manager, treat is as an update screen. $from = optional_param('from', '', PARAM_CLEAN); if ($from == 'survey') { $survey_done = true; if (!empty($mod)) { $form = $mod; $form->name = stripslashes_safe($form->name); $form->summary = stripslashes_safe($form->summary); } /// If there was a new survey created, the SID will be in the _GET parameters. $sid = optional_param('sid', 0, PARAM_INT); if ($sid) { $form->sid = $sid; } } else { $survey_done = false; } if (!isset($form->name)) { $form->name = ""; } if (!isset($form->summary)) { $form->summary = ""; } if (!isset($form->useopendate)) { $form->useopendate = ""; } if (!isset($form->opendate)) { $form->opendate = ""; } if (!isset($form->openday)) { $form->openday = ""; } if (!isset($form->openmonth)) { $form->openmonth = ""; } if (!isset($form->openyear)) { $form->openyear = ""; } if (!isset($form->openhour)) { $form->openhour = ""; } if (!isset($form->openminute)) { $form->openminute = ""; } if (!isset($form->useclosedate)) { $form->useclosedate = ""; } if (!isset($form->closedate)) { $form->closedate = ""; } if (!isset($form->closeday)) { $form->closeday = ""; } if (!isset($form->closemonth)) { $form->closemonth = ""; } if (!isset($form->closeyear)) { $form->closeyear = ""; } if (!isset($form->closehour)) { $form->closehour = ""; } if (!isset($form->closeminute)) { $form->closeminute = ""; } if (!isset($form->qtype)) { $form->qtype = ""; } if (!isset($form->respondenttype)) { $form->respondenttype = ""; } if (!isset($form->resp_eligible)) { $form->resp_eligible = ""; } if (!isset($form->resp_view)) { $form->resp_view = $QUESTIONNAIRE_STUDENTVIEWRESPONSES_NEVER; } if (!isset($form->realm)) { $form->realm = ""; } if (!isset($form->resume)) { $form->resume = ""; } if (!isset($form->sid)) { $form->sid = ""; } /// Variable used to return from the phpESP Manager. unset($_SESSION['qpage']); /// If this questionnaire has a survey, get the survey and owner. if ($survey = get_record('questionnaire_survey', 'id', $form->sid)) { $owner = (trim($survey->owner) == trim($form->course)); $form->realm = $survey->realm; } else { $survey = false; $owner = true; } ?>