Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.8 kB
2
Indexable
Never
<?php

require("../inc/h_utf8.php");
include_once("../inc/inc.php");
//include("../inc/func.php");
include("getfile.php");
include("editor_lib.php");
set_connection($tDatabase, 'utf8');
set_header('Експорт тесту');

$user_id = 888;

var_dump(__DIR__);

for ($i = 1; $i < 10; $i++) {
    $test_code = 'z_p888n' . $i;

    $a = mysqli_query($session, "SELECT test_code FROM z_list WHERE teacher_id='$user_id' AND test_code='$test_code'");
    if (!mysqli_fetch_row($a)) {
        continue;
    }

    $h = getHeaderArr($test_code);
    $total_q = $h[18];
    if ($_GET['num'] == '1') $mode = "<a href='?'>Формат для екcпорту</a>"; else $mode = "<a href='?num=1'>Формат для друкування</a>";
    print "$mode<h2>$h[0]</h2>";
    $num_quest = 1;
    while ($num_quest <= $total_q) {
        $filename = $num_quest . '.php';
        $q = getFileByName($filename, $test_code, $num_quest, 'question');
        $qr = explode('~', $q['script_str']);
        if ($qr[5] == '') $qr[5] = strip_tags($q['filebody']);
//  print "$num_quest. <b>$qr[5]</b><br>";
        if ($_GET['num'] == '1') $n = "$num_quest. "; else $n = "#";
        print "$n <b>$qr[5]</b><br>";
        if ($qr[4] == '') {
            $x = $qr[3];
            $y = explode(' ', $x);
            $k = 1;
            while ($k <= $qr[0]) {
                if (in_array($k, $y)) $p = '+'; else $p = '';
                $filename = $k . '.php';
                $b = getFileByName($filename, $test_code, $num_quest, 'item');
                $item = strip_tags($b['filebody']);
                print "$p $item<br>";
                $k++;
            }
        } else print "$qr[4]<br>";
        unset($qr);
        print "<br>";
        $num_quest++;
    }
}

mysqli_close($session);
?>