Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 556ea52a

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

Re #7580 správa testů ve slovníku

Zobrazit rozdíly:

old/html/multidic/app/webroot/administration.php
27 27

  
28 28
   <div class="nadpis_sekce">
29 29
     <i>Přihlášen:</i><br />
30
     <?php echo "".$ses_name." ".$ses_surname."\n"?>
30
     <?php echo "".@$_REQUEST['ses_name']." ".@$_REQUEST['ses_surname']."\n"?>
31 31
     <br />
32 32
     <?php if(kontrola_pristupu(3)) echo "Administrátor";
33 33
           else echo "Uživatel (smí i zapisovat)";?>
......
156 156
   
157 157
  // pr($_);
158 158
   
159
  switch($_REQUEST['nav_id']) {
159
  switch(@$_REQUEST['nav_id']) {
160 160
    case("add_user") :
161 161
      require_once($cesta."add_user.php");
162 162
    break;
old/html/multidic/app/webroot/administration/add_test.php
13 13
      echo $string;
14 14
  }
15 15

  
16
$language = @$_REQUEST['language'];
17
$source = @$_REQUEST['source'];
16 18

  
17 19
if (Empty($language) || $language == "") {
18 20
  $krok = 0;
......
77 79

  
78 80
  case (2):
79 81
  
80
  $zobrazit_znovu = true;  
82
  $zobrazit_znovu = true;
83

  
84
    $action = @$_REQUEST['action'];
85
      $lection = @$_REQUEST['lection'];
86
      $title = @$_REQUEST['title'];
87
      $body = @$_REQUEST['body'];
88
      $note = @$_REQUEST['note'];
89
      $test_category = @$_REQUEST['test_category'];
81 90

  
82 91
    if (!Empty($action) && $action == "insert_new_test") {
83 92

  
old/html/multidic/app/webroot/administration/edit_test.php
1 1
<?php 
2 2
require_once("./administration/test.php");
3 3
$vypis_edit = true;
4

  
5
$action = @$_REQUEST['action'];
6
$test_id = @$_REQUEST['test_id'];
7

  
8
$language = @$_REQUEST['language'];
9
$source = @$_REQUEST['source'];
10

  
11

  
4 12
if (!Empty($action) && $action == "edit_test") {
5
  
6
	if (Empty($lection)) {
13
    $lection = @$_REQUEST['lection'];
14

  
15
    if (Empty($lection)) {
7 16
      print_hlasku("Lekci musíte vyplnit");
8 17
    }
9 18
	else {
19
        $title = @$_REQUEST['title'];
20
        $body = @$_REQUEST['body'];
21
        $note = @$_REQUEST['note'];
22
        $test_category = @$_REQUEST['test_category'];
23

  
10 24
	    update_test($test_id, $title, $body, $note, $lection, $test_category);
11 25
	    //echo_zpet_do_slovniku();
12 26
	    $vypis_edit = false;
old/html/multidic/app/webroot/administration/list_test.php
5 5
else
6 6
  require_once("./administration/test.php");
7 7

  
8
$nav_id = @$_REQUEST['nav_id'];
9
$pomocna = @$_REQUEST['pomocna'];
10
$language = @$_REQUEST['language'];
11
$contrains_source = @$_REQUEST['contrains_source'];
12
$contrains_lection = @$_REQUEST['contrains_lection'];
13
$action = @$_REQUEST['action'];
14
$test_id = @$_REQUEST['test_id'];
15

  
8 16
if (Empty($language)) :
9 17

  
10 18

  
......
81 89

  
82 90
if ($nav_id == "list_test") $pomocna = false;
83 91
else if ($nav_id == "list_nonauthorized_test") $pomocna = true;
84
else  $pomocna = ($nonauthorized == true);
92
else  $pomocna = (@$_REQUEST['nonauthorized'] == true);
85 93
//pr($nav_id);
86 94
//vypis
87
if (!Empty($serad)) {
88
    print_table_of_test($language, $contrains_source, $contrains_lection,$pomocna, $order, $od, $limit);
95
if (!Empty(@$_REQUEST['serad'])) {
96
    print_table_of_test($language, $contrains_source, $contrains_lection,$pomocna, @$_REQUEST['order'], @$_REQUEST['od'], @$_REQUEST['limit']);
89 97
}
90 98
else {
91 99
  print_table_of_test($language, $contrains_source, $contrains_lection, $pomocna);
old/html/multidic/app/webroot/administration/test.php
6 6
  require_once("./classes/db.php");
7 7
  $spojeni = new DB_Sql();
8 8
  $dotaz = "UPDATE test SET autorized = true
9
                        WHERE \"IDtest\" = '$ID'";
10
  $spojeni->query($dotaz);
11
  if ($spojeni->connection->errno != 0) {
9
                        WHERE IDtest = $ID";
10
  $result = $spojeni->query($dotaz);
11
  if (!$result) {
12 12
    return false;
13 13
  }
14 14
  return true;
......
26 26
}
27 27

  
28 28
function get_row_of_table($Record) {
29
  global $language;
30
  global $order;
31
  global $od;
32
  global $limit;
33
  global $contrains_source;
34
  global $contrains_lection;
29
  $language = @$_REQUEST['language'];
30
  $order = @$_REQUEST['order'];
31
  $od = @$_REQUEST['od'];
32
  $limit = @$_REQUEST['limit'];
33
  $contrains_source = @$_REQUEST['contrains_source'];
34
  $contrains_lection = @$_REQUEST['contrains_lection'];
35 35

  
36 36
  $nav_str = "language=$language&contrains_source=$contrains_source&contrains_lection=$contrains_lection";
37 37

  
38
  $navrat .= "  <tr>\n";
38
  $navrat = "  <tr>\n";
39 39
  $navrat .= '    <td>
40 40
                <a href="?nav_id=list_test&action=delete_test&test_id='.$Record[0].'&'.$nav_str.'">smaž</a>
41 41
                  <!--input type="checkbox" name="smaz['.$Record[0].']" /-->';
......
229 229
  else $pomocna = " autorized = true";
230 230

  
231 231
  if ($language != "all")
232
    $dotaz .= " WHERE language = '$language' AND $pomocna ";
232
    $dotaz .= " WHERE language = $language AND $pomocna ";
233 233
  else
234 234
    $dotaz .= " WHERE $pomocna ";
235 235

  
......
239 239
    $dotaz .= "AND lection = '$contrains_lection'";
240 240

  
241 241

  
242
  $dotaz .= " ORDER BY \"$order\" OFFSET $od LIMIT $limit";
243
  
242
  $dotaz .= " ORDER BY $order LIMIT $od,$limit";
243

  
244 244
  //pr($dotaz);
245 245

  
246 246
  $radky = $spojeni->query($dotaz);
247 247

  
248
  while ($spojeni->next_record()) {
249
    $navrat .= get_row_of_table($spojeni->Record);
248
  while ($record = $spojeni->next_record()) {
249
    $navrat .= get_row_of_table($record);
250 250
  }
251 251
  $navrat .= get_foot_of_table();
252 252
  $navrat .= "</table>";
......
256 256
function get_test($id) {
257 257
  require_once("./classes/db.php");
258 258
  $spojeni = new DB_Sql();
259
  $dotaz = "SELECT * FROM test WHERE \"IDtest\" = '$id'";
259
  $dotaz = "SELECT * FROM test WHERE IDtest = $id";
260 260
  $radky = $spojeni->query($dotaz);
261
  $spojeni->next_record();
261
  $record = $spojeni->next_record();
262 262

  
263
  if ($spojeni->connection->errno != 0) {
263
  if (!$radky) {
264 264
    print_hlasku("Test se nepodařilo načíst.");
265 265
  }
266 266

  
267
  return $spojeni->Record;
267
  return $record;
268 268
}
269 269

  
270 270
function delete_test($ID) {
271 271
  require_once("./classes/db.php");
272 272
  $spojeni = new DB_Sql();
273
  $dotaz = "DELETE FROM test WHERE \"IDtest\" = '$ID'";
274
  $spojeni->query($dotaz);
275
  if ($spojeni->connection->errno != 0) {
273
  $dotaz = "DELETE FROM test WHERE `IDtest` = $ID";
274
  $result = $spojeni->query($dotaz);
275
  if (!$result) {
276 276
    return false;
277 277
  }
278 278
  return true;
......
287 287
                            note = '".AddSlashes($note)."',
288 288
                            lection = '".AddSlashes($lection)."',
289 289
                            test_category_id = '".AddSlashes($test_category)."'
290
                            WHERE \"IDtest\" = '".AddSlashes($id)."'";
291
  $spojeni->query($dotaz);
292
  if ($spojeni->connection->errno != 0) {
290
                            WHERE IDtest = ".AddSlashes($id);
291
  $result = $spojeni->query($dotaz);
292
  if (!$result) {
293 293
    print_hlasku("Test se nepodařilo upravit.");
294 294
  }
295 295
  print_hlasku("Test změněn.");
......
303 303
  $spojeni = new DB_Sql();
304 304
  //$NOW = Date("YmdHis");
305 305

  
306
  $dotaz = "INSERT INTO test (\"language\",
307
                              \"source\",
308
                              \"lection\",
309
                              \"inserted_by\",
310
                              \"title\",
311
                              \"body\",
312
                              \"note\",
313
                              \"test_category_id\")
306
  $dotaz = "INSERT INTO test (`language`,
307
                              `source`,
308
                              `lection`,
309
                              `inserted_by`,
310
                              `title`,
311
                              `body`,
312
                              `note`,
313
                              `test_category_id`)
314 314
                    VALUES ('". AddSlashes($language)."',
315 315
                            '". AddSlashes($source)."',
316 316
                            '". AddSlashes($lection)."',
......
319 319
                            '". AddSlashes($body)."',
320 320
                            '". AddSlashes($note)."',
321 321
                            '". AddSlashes($test_category)."')";
322
  $spojeni->query($dotaz);
323
  if ($spojeni->connection->errno != 0) {
322
  $result = $spojeni->query($dotaz);
323
  if (!$result) {
324 324
    return false;
325 325
  }
326 326
  return true;
old/html/multidic/app/webroot/examination/test.php
16 16
        //$found = ereg ( "^(([^\{]*)\{([^\}]*)\})*([^\{]*)" , $this->text, $tokens);
17 17
        $text = $this->text;
18 18
        
19
        while(ereg('\{', $text)) {
20
            $found = ereg ( "^([^\{]*)\{([^\}]*)\}(.*)" , $text, $tokens);
19
        while(preg_match('#\{#', $text)) {
20
            $found = preg_match( "#^([^\{]*)\{([^\}]*)\}(.*)#" , $text, $tokens);
21 21
            $parsed .= $tokens[1];
22 22
            $parsed .= $this->buildSelect($tokens[2]);
23 23
            $text = $tokens[3];
......
29 29
    
30 30
    function buildSelect($selectString) {
31 31
        $select = '';
32
        $pole = split('/', $selectString);
32
        $pole = preg_split('#/#', $selectString);
33 33
        
34 34
        shuffle($pole);//zamichame!!!
35 35
        
......
104 104
function get_test($test_id) {
105 105
    require_once("./classes/db.php");
106 106
  $spojeni = new DB_Sql();
107
  $dotaz  = "SELECT * FROM test WHERE \"IDtest\" = '".pg_escape_string($test_id)."' LIMIT 1 ";
107
  $dotaz  = "SELECT * FROM test WHERE IDtest = '".intval($test_id)."' LIMIT 1 ";
108 108
  $radky = $spojeni->query($dotaz);
109 109
  
110
  $spojeni->next_record();
110
  $record = $spojeni->next_record();
111 111
  
112
  return $spojeni->Record;
112
  return $record;
113 113
}
114 114

  
115 115
function get_tests_by_category($category_id) {
old/html/multidic/app/webroot/functions/dictionary.php
372 372
{
373 373
    require_once("./classes/db.php");
374 374
    $spojeni = new DB_Sql();
375
    $dotaz = "SELECT * FROM \"language\"";
375
    $dotaz = "SELECT * FROM `language`";
376 376
    $radky = $spojeni->query($dotaz);
377 377
    $navrat = "<select name=\"language\" size=\"$size\">";
378
    while ($spojeni->next_record()) {
379
        $navrat .= "  <option value=\"" . $spojeni->Record[0] . "\">  " . $spojeni->Record[1] . "  </option>";
378
    while ($record = $spojeni->next_record()) {
379
        $navrat .= "  <option value=\"" . $record[0] . "\">  " . $record[1] . "  </option>";
380 380
    }
381 381
    $navrat .= '</select>';
382 382
    return $navrat;
......
386 386
{
387 387
    require_once("./classes/db.php");
388 388
    $spojeni = new DB_Sql();
389
    $dotaz = "SELECT * FROM source";
389
    $dotaz = "SELECT * FROM `source`";
390 390
    if (!Empty($language))
391 391
        $dotaz .= " WHERE language = '$language'";
392 392
    $radky = $spojeni->query($dotaz);
393 393

  
394 394
    $navrat = "<select name=\"$nazev\" size=\"1\">";
395
    while ($spojeni->next_record()) {
396
        $navrat .= "  <option value=\"" . $spojeni->row['IDsource'] . "\">  " . $spojeni->row['title'] . " - " . $spojeni->row['subtitle'] . "  </option>";
395
    while ($record = $spojeni->next_record()) {
396
        $navrat .= "  <option value=\"" . $record['IDsource'] . "\">  " . $record['title'] . " - " . $record['subtitle'] . "  </option>";
397 397
    }
398 398
    $navrat .= '</select>';
399 399
    return $navrat;
......
453 453
{
454 454
    require_once("./classes/db.php");
455 455
    $spojeni = new DB_Sql();
456
    $dotaz = "SELECT lection FROM test WHERE source = '$source' GROUP BY lection ORDER BY lection ";
456
    $dotaz = "SELECT lection FROM test WHERE `source` = '$source' GROUP BY lection ORDER BY lection ";
457 457
    $radky = $spojeni->query($dotaz);
458 458
    $navrat = "<select name=\"$nazev\" size=\"$size\">";
459 459
    $i = 0;
460
    while ($spojeni->next_record()) {
461
        $cisla[$i] = 0 + ($spojeni->Record["lection"]);
462
        $hodnoty[$i] = $spojeni->Record["lection"];
460
    while ($record = $spojeni->next_record()) {
461
        $cisla[$i] = 0 + ($record["lection"]);
462
        $hodnoty[$i] = $record["lection"];
463 463
        $i++;
464 464
    }
465 465
    if (count($cisla) <= 0) {
......
477 477
{
478 478
    require_once("./classes/db.php");
479 479
    $spojeni = new DB_Sql();
480
    $dotaz = "SELECT czech FROM dict WHERE source = '$source' AND lection = '$lection' ";
480
    $dotaz = "SELECT czech FROM dict WHERE `source` = '$source' AND lection = '$lection' ";
481 481
    $radky = $spojeni->query($dotaz);
482 482
    $max = $spojeni->num_rows();
483 483
    $navrat = lang("V této lekci je ") . $max . lang(" slovíček ") . " <br /> <br />\n";
......
1129 1129

  
1130 1130
    $ret = array();
1131 1131

  
1132
    while ($spojeni->next_record()) {
1132
    while ($record = $spojeni->next_record()) {
1133 1133
        $ret[] = array(
1134
            'id' => $spojeni->Record['id'],
1135
            'name' => $spojeni->Record['name'],
1136
            'parent_id' => $spojeni->Record['parent_id'],
1137
            'children' => getStrom($spojeni->Record['id']),
1134
            'id' => $record['id'],
1135
            'name' => $record['name'],
1136
            'parent_id' => $record['parent_id'],
1137
            'children' => getStrom($record['id']),
1138 1138
        );
1139 1139
    }
1140 1140

  

Také k dispozici: Unified diff