Projekt

Obecné

Profil

« Předchozí | Další » 

Revize d52846b0

Přidáno uživatelem Jan Šedivý před téměř 6 roky(ů)

Re #7580 nový test v osobní zóně

Zobrazit rozdíly:

old/html/multidic/app/webroot/examination/new_test.php
1 1
<?php
2 2
require_once("./examination/test.php");
3 3

  
4
$source = @$_REQUEST['source'];
5
$test = @$_REQUEST['test'];
6

  
4 7
if (Empty($source) || $source == "") {
5 8
  $krok = 0;
6 9
}
......
86 89
  case (1):
87 90
?>
88 91
 <h3 class="nadpis2"><?php printf(lang("Vyberte ze seznamu test (krok %d ze 2)"), $krok+1) ?></h3> 
89
       <?php echo $language;
92
       <?php echo @$_REQUEST['language'];
90 93
        echo(get_test_chooser($source))?>
91 94

  
92 95

  
old/html/multidic/app/webroot/examination/test.php
53 53
        //pr($answers);
54 54
        
55 55
        $pocitadlo = 0;
56
        while(ereg('\{', $text)) {
57
            $found = ereg ( "^([^\{]*)\{([^\}]*)\}(.*)" , $text, $tokens);
56
        while(preg_match('#\{#', $text)) {
57
            $found = preg_match( "#^([^\{]*)\{([^\}]*)\}(.*)#" , $text, $tokens);
58 58
            $parsed .= $tokens[1];
59 59
            $parsed .= $this->buildAnswer($tokens[2], $answers[$pocitadlo]);
60 60
            $text = $tokens[3];
......
67 67
    
68 68
    function buildAnswer($selectString, $odpoved) {
69 69
        $answer = '';
70
        $pole = split('/', $selectString);
70
        $pole = preg_split('#/#', $selectString);
71 71
        
72 72
        //pr('pole 0');
73 73
        //pr($pole[0]);
......
90 90
function get_test_chooser($source) {
91 91
  require_once("./classes/db.php");
92 92
  $spojeni = new DB_Sql();
93
  $dotaz  = "SELECT * FROM test WHERE source = '$source' ";
93
  $dotaz  = "SELECT * FROM test WHERE `source` = '$source' ";
94 94
  $radky = $spojeni->query($dotaz);
95 95
  $navrat = " ";
96 96
  
97
  while ($spojeni->next_record()) {
98
    $navrat .= "  <a href=\"examination.php?nav_id=do_test&test=".$spojeni->Record['IDtest']."\"> lekce ".$spojeni->Record['lection'].": ".$spojeni->Record['title']."  </a> <br/>";
97
  while ($record = $spojeni->next_record()) {
98
    $navrat .= "  <a href=\"examination.php?nav_id=do_test&test=".$record['IDtest']."\"> lekce ".$record['lection'].": ".$record['title']."  </a> <br/>";
99 99
  }
100 100
  $navrat .= '';
101 101
  return $navrat;
......
115 115
function get_tests_by_category($category_id) {
116 116
  require_once("./classes/db.php");
117 117
  $spojeni = new DB_Sql();
118
  $dotaz  = "SELECT * FROM test WHERE \"test_category_id\" = '".pg_escape_string($category_id)."' ";
118
  $dotaz  = "SELECT * FROM test WHERE `test_category_id` = ".$spojeni->escape_string($category_id);
119 119
  $radky = $spojeni->query($dotaz);
120 120
  
121 121
  $data = array();
122 122
  
123
  while ($spojeni->next_record()) {
124
    $data[] = $spojeni->Record;
123
  while ($record = $spojeni->next_record()) {
124
    $data[] = $record;
125 125
  }
126 126
  
127 127
  return $data;
old/html/multidic/app/webroot/examination/test_by_category.php
1 1
<?php require_once("./examination/test.php");?>
2 2
<?php require_once("./administration/test_category.php");?>
3 3

  
4
<?php if(empty($test_category)) die("Nebyla zadána kategorie.") ?>
4
<?php
5
$test_category = $_REQUEST['test_category'];
6
if(empty($test_category))
7
    die("Nebyla zadána kategorie.")
8
?>
5 9

  
6 10
<?php $tests = get_tests_by_category($test_category)?>
7 11
<?php $kategorie = get_test_category($test_category)?>
......
19 23
            <?php endforeach; ?>
20 24
        </ul>
21 25

  
22
<?endif; ?> 
26
<?php endif; ?>

Také k dispozici: Unified diff