Exemplo n.º 1
0
function questionnaire_getQuestionnaire($caveID, &$meineHoehlen)
{
    global $config, $params, $no_resource_flag;
    $no_resource_flag = 1;
    $msg = "";
    if (isset($params->POST->question)) {
        $msg = questionnaire_giveAnswers();
    }
    $template = tmpl_open('./templates/' . $config->template_paths[$params->SESSION->user['template']] . '/questionnaire.ihtml');
    // show message
    if ($msg != "") {
        tmpl_set($template, 'MESSAGE/message', $msg);
    }
    // show my credits
    if ($account = questionnaire_getCredits($params->SESSION->user['questionCredits'])) {
        tmpl_set($template, 'ACCOUNT', $account);
    }
    // show the questions
    $questions = questionnaire_getQuestions();
    if (sizeof($questions)) {
        tmpl_set($template, 'QUESTIONS/QUESTION', $questions);
        // set params
        tmpl_set($template, 'QUESTIONS/PARAMS', array(array('name' => "modus", 'value' => QUESTIONNAIRE)));
    } else {
        tmpl_iterate($template, 'MESSAGE');
        tmpl_set($template, 'MESSAGE/message', "Derzeit liegen keine weiteren Fragen vor.");
    }
    // show the link to the present page
    tmpl_set($template, 'QUESTIONNAIRE_PRESENTS', QUESTIONNAIRE_PRESENTS);
    return tmpl_parse($template);
}
Exemplo n.º 2
0
function questionnaire_getQuestionnaire($caveID, &$ownCaves)
{
    global $template;
    // open template
    $template->setFile('questionnaire.tmpl');
    $template->setShowRresource(false);
    //messages
    $messageText = array(-5 => array('type' => 'error', 'message' => _('Probleme beim Eintragen der Bonuspunkte. Bitte wende dich ans UgaAgga Team.')), -4 => array('type' => 'error', 'message' => _('Beim eintragen der Antworten gab es leider Probleme. Bitte probiere es später nochmals.')), -3 => array('type' => 'error', 'message' => _('Fehler beim auslesen der Fragen. Bitte probiere es später nochmals.')), -2 => array('type' => 'error', 'message' => _('Ich bin mir sicher das ich die solche Fragen nicht gestellt habe!')), -1 => array('type' => 'error', 'message' => _('Du hast keine Frage beantwortet.')), 1 => array('type' => 'success', 'message' => _('Deine Fragen wurden erfolgreich eingetragen und du hast deine Schnecken bekommen.')));
    $action = Request::getVar('action', '');
    switch ($action) {
        /****************************************************************************************************
        *
        * eintragen der Antworten
        *
        ****************************************************************************************************/
        case 'answers':
            $answers = Request::getVar('question', array('' => ''));
            if (empty($answers)) {
                $messageID = -1;
            }
            $messageID = questionnaire_giveAnswers($answers);
            break;
    }
    // fragen auslesen
    $questions = questionnaire_getQuestions();
    // show my credits
    $credits = questionnaire_getCredits($_SESSION['player']->questionCredits);
    /****************************************************************************************************
    *
    * Übergeben ans Template
    *
    ****************************************************************************************************/
    $template->addVars(array('credits' => $credits, 'questions' => $questions, 'status_msg' => isset($messageID) ? $messageText[$messageID] : ''));
}