function disable_survey($id)
{
    $question = Question::find_by_id($id);
    $question->is_enabled = 'false';
    $question->update();
    echo "Survey disabled successfully...";
}
Beispiel #2
0
<?php

require_once "initialize.php";
$ja = array("id" => "nothing", "runda" => "nothing", "kategoria" => "nothing", "tresc" => "nothing", "odp_a" => "nothing", "odp_b" => "nothing", "odp_c" => "nothing", "odp_d" => "nothing", "poprawna" => "nothing", "link" => "nothing");
if (isset($_POST['id'])) {
    $question = Question::find_by_id($_POST['id']);
    $arr = array();
    foreach ($question as $key => $value) {
        $arr[] = $value;
    }
    $ja["id"] = $arr[0];
    $ja["runda"] = $arr[4];
    $ja["kategoria"] = $arr[5];
    $ja["tresc"] = $arr[6];
    $ja["odp_a"] = $arr[7];
    $ja["odp_b"] = $arr[8];
    $ja["odp_c"] = $arr[9];
    $ja["odp_d"] = $arr[10];
    $ja["poprawna"] = $arr[11];
    $ja["link"] = $arr[12];
}
// return the value to jQuery via ajax to confirm if the login was succesful
echo json_encode($ja);
$user = User::find_by_id($_SESSION['user_id']);
?>

<?php 
$path = 'assets/images/profile_pic/' . $user->profile_pic;
echo envapi_get_html_for_reg_user('176644-3EaSQ9JhWGaxqDH2EJ91XS3smNIPajiD', $user->first_name, $user->last_name, $path, false, "HI");
?>

<?php 
//Count the no. of unread messages...
$count = User::count_unread_messages($_SESSION['user_id']);
?>

<?php 
if (isset($_GET['id'])) {
    $question = Question::find_by_id($_GET['id']);
    if ($question == '') {
        redirect_to('extra-404');
    }
}
?>

<?php 
if (isset($_POST['submit_option'])) {
    $survey_data_obj = new SurveyData();
    $survey_data_obj->respondent_id = $_SESSION['user_id'];
    $survey_data_obj->question_id = $_GET['id'];
    $survey_data_obj->option_id = $_POST['user_response'];
    $survey_data_obj->create();
}
?>