示例#1
0
 function showQuestion()
 {
     global $survey;
     $showQuestion = $this->getTemplate()->getTemplateContent();
     $patterns = array('/<errorMessage \\/>/', '/<questionName \\/>/', '/<questionText \\/>/', '/<answerOption \\/>/');
     $replacements = array($this->showError($this->validate()), loadFromPostRemoveBrackets($this->getName()), replaceFills($this->getQuestionText($_SESSION['language'])), $this->getQuestionType()->getAnswerOption($this));
     return preg_replace($patterns, $replacements, $showQuestion);
 }
示例#2
0
文件: ajax.php 项目: basweerman/xi
    $_SESSION['buttonClicked'] = $_POST['button'];
}
$_SESSION['lastQuestion'] = array();
if (isset($_SESSION['currentQuestion'])) {
    $_SESSION['lastQuestion'] = $_SESSION['currentQuestion'];
    $currentQuestion = $_SESSION['currentQuestion'];
    //STORE OLD ANSWER
    if (is_array($_SESSION['currentQuestion'])) {
        //always an array
        foreach ($_SESSION['currentQuestion'] as $var) {
            $postvar = '';
            if (isset($_POST[loadFromPostRemoveBrackets($var)]) && $_POST[loadFromPostRemoveBrackets($var)] != '') {
                $postvar = $_POST[loadFromPostRemoveBrackets($var)];
            } elseif (isset($_POST[loadFromPostRemoveBrackets($var) . '_button']) && $_POST[loadFromPostRemoveBrackets($var) . '_button'] != '') {
                //rf/dk clicked
                $postvar = $_POST[loadFromPostRemoveBrackets($var) . '_button'];
            }
            if ($postvar == '') {
                $postvar = '.e';
                //set to empty
            }
            $_SESSION['data'][$var] = $postvar;
            $survey->getDatabase()->insertLogRecord($_SESSION["primkey"], $var, $postvar);
        }
    }
    $survey->getDatabase()->updateRecord($_SESSION["primkey"], $_SESSION['data']);
    //load all questions  LOAD HERE OTHERWISE FILLS FOR THIS Q WON'T BE UPDATED with previous answer!
    //require_once($survey->getQuestionsLocation());
    require_once $survey->getTemplatesLocation();
    require_once $survey->getTypesLocation();
    foreach ($survey->getSections() as $section) {
示例#3
0
文件: type.php 项目: basweerman/xi
 function getDKButton($question, $language = 1)
 {
     if ($this->showDKButton()) {
         if ($this->getAnswerType() != QUESTION_TYPE_NONE) {
             //no dk/rf for none answer types
             $class = $question->isDontKnow() ? ' btn_dkrf_selected' : '';
             global $survey;
             $patterns = array('/<questionName \\/>/', '/<style \\/>/', '/<class \\/>/');
             $replacements = array(loadFromPostRemoveBrackets($question->getName()), '', $class);
             return preg_replace($patterns, $replacements, $survey->getDKButton($language));
         }
     }
     return '';
 }