Example #1
0
function getTopicStatistic($t_id)
{
    // Wertprüfung
    $t_id = abs(intval($t_id));
    echo '<form action="index.php?site=statistic&amp;action=getStatisticQuestions" method="post">';
    $button = Function_getTopic_02;
    $topic = new Topic();
    $topic->getTopic();
    $arrayTopic = $topic->getTopicArray();
    echo "<div>\n";
    // In der Mitte der Inhalt
    showForm($t_id, $button, $arrayTopic);
}
Example #2
0
require 'core/init.php';
?>

<?php 
$topic = new Topic();
$topic_id = $_GET['id'];
if (isset($_POST['do_reply'])) {
    $validate = new Validator();
    $data = array();
    $data['topic_id'] = $_GET['id'];
    $data['user_id'] = getUser()['user_id'];
    $data['body'] = $_POST['body'];
    $field_array = array('body');
    if ($validate->isRequired($field_array)) {
        if ($topic->reply($data)) {
            redirect('topic.php?id=' . $topic_id, 'Your reply has been posted', 'success');
        } else {
            redirect('topic.php?id=' . $topic_id, 'Something went wrong with your reply', 'error');
        }
    } else {
        redirect('topic.php?id=' . $topic_id, 'Your reply from is empty', 'error');
    }
}
//get template & assign vars
$template = new Template('templates/topic.php');
//Assign vars
$template->topic = $topic->getTopic($topic_id);
$template->replies = $topic->getReplies($topic_id);
$template->title = $topic->getTopic($topic_id)->title;
//display templates
echo $template;
Example #3
0
     $question->setID($q_id);
     $question->setActive();
     echo " <meta http-equiv='refresh' content='0; url=?{$site}'>";
     break;
 case 'showDetails':
     // Anzeigen der Fragedetails
     if ($q_id != 0) {
         $_SESSION['values']['question']['q_id'] = $q_id;
     }
     if ($error == 'conflict') {
         echo "<h5>" . Topic_01 . " <br /></h5>";
     }
     $question->setID($_SESSION['values']['question']['q_id']);
     $question->loadQuestion();
     $type = $question->getType();
     $topics->getTopic();
     $topicArray = $topics->getTopicArray();
     $question->setAllTopics($topicArray);
     $question->showQuestionDetails();
     $answer->setQuestionID($_SESSION['values']['question']['q_id']);
     $answer->setAnswerType($_SESSION['values']['question']['qt']);
     $answer->getAnswers();
     $answer->showAnswers();
     break;
 case 'updateQuestion':
     // Question updaten
     // Wertzuweisung
     $questionText = "";
     if (isset($_REQUEST["question"])) {
         $questionText = htmlspecialchars($_REQUEST["question"]);
     }
Example #4
0
         $_SESSION['values']['question']['descriptionText'] = htmlspecialchars($_POST["descriptionText"]);
     }
     // Session Variable setzen
     $_SESSION['values']['question']['new'] = 1;
 }
 $question->setType($_SESSION['values']['question']['qt']);
 $question->setTopic($_SESSION['values']['question']['t_id']);
 if ($_SESSION['values']['question']['descriptionText'] == '') {
     $_SESSION['values']['question']['description'] = 0;
 }
 if ($_SESSION['values']['question']['description'] == 0 && $_SESSION['values']['question']['descriptionText'] != '') {
     $_SESSION['values']['question']['descriptionText'] = '';
 }
 $check = $question->checkQuestion();
 if ($check == 1 && $_SESSION['values']['question']['t_id'] != '') {
     $topic->getTopic();
     $topicArray = $topic->getTopicArray();
     $question->setAllTopics($topicArray);
     $question->showQuestionInfos();
     $answer->setQuestionType($_SESSION['values']['question']['qt']);
     $answer->addAnswer();
     $answer->addAnswer();
     $answer->setType();
 } elseif ($check == 2) {
     echo "<meta http-equiv='refresh' content='0; url=index.php?site=collect_question&amp;error=exists' />";
 } elseif ($check == 0) {
     echo "<meta http-equiv='refresh' content='0; url=index.php?site=collect_question&amp;error=missing' />";
 } elseif ($check == 3) {
     echo " <meta http-equiv='refresh' content='0; url=index.php?site=collect_question&amp;error=blank' />";
 }
 break;