Projekt

Obecné

Profil

Stáhnout (2.89 KB) Statistiky
| Větev: | Tag: | Revize:
1
<?php
2

    
3
require_once('./inc/all.inc.php');
4

    
5
if (!empty($_REQUEST['work-with-lists']) && $_REQUEST['work-with-lists'] == 'on')
6
 Header("Location: add_to_name_list.php?".get_array_as_get_string_direct($_REQUEST)) ;
7

    
8

    
9

    
10
//aplikacni logika
11
if (!empty($_REQUEST['actione']) && $_REQUEST['actione'] == 'search') {
12
  $exactMatch = (!empty($_REQUEST['exact-match']) && $_REQUEST['exact-match'] == 'on');
13
  $SearchText = new SearchText($exactMatch);
14
  $SearchText->setOffset($_REQUEST['r_offset']);
15
  $SearchText->setLimit($_REQUEST['r_limit']);
16
  $SearchText->setWord($_REQUEST["word1"]);
17
  $SearchText->setWord2($_REQUEST['word2'], $_REQUEST['word2-op']);
18
  $SearchText->setWord3($_REQUEST['word3'], $_REQUEST['word3-op']); 
19
  
20
  $SearchText->addConstrain("book", "book_name", $_REQUEST['book-op'], $_REQUEST['book']);
21
  $SearchText->addConstrain("transliteration", "museum_no", $_REQUEST['museum-no-op'], $_REQUEST['museum-no']);
22
  $SearchText->addConstrain("transliteration", "id_book_type", $_REQUEST['book-type-op'], $_REQUEST['id_book_type']);
23
  $SearchText->addConstrain("transliteration", "id_origin", $_REQUEST['origin-op'], $_REQUEST['id_origin']);
24
  $SearchText->addConstrain("transliteration", "reg_no", $_REQUEST['reg_no-op'], $_REQUEST['reg_no']);
25
  $SearchText->addConstrain("transliteration", "date", $_REQUEST['date-op'], $_REQUEST['date']);
26
  
27
  $SearchText->search();
28
  $SearchText->setLinesAround($_REQUEST['line-count']);
29

    
30
  $Sorter = new Sorter($SearchText->getOffset(), $SearchText->getLimit(), $SearchText->getCount() );
31
}  
32
//konec aplikacni logiky
33

    
34
$tpl = & new Template(INDEX_TMPL);
35

    
36
if (empty($_REQUEST['actione']) || $_REQUEST['actione'] == '') {
37
	$body = & new Template('./tmpl/search-text.tmpl.php');
38
	$body->set('book_type_array', utils_get_book_types());
39
  $body->set('origin_array', utils_get_origins());
40
  $tpl->set('obsah', $body);
41
}
42
else {
43
  $body = & new Template('./tmpl/search-text-result.tmlp.php');
44
  $temp .= "<h1>Search in texts - Results</h1>\n";
45
  $temp .= $Sorter->getLine();
46
  while($SearchText->next_record()) {
47
    $res = $SearchText->getResult();
48
    $body->set('id_transliteration', $res['id_transliteration']);
49
    $body->set('book_abrev', $res['book_abrev']);
50
    $body->set('chapter', $res['chapter']);
51
    $body->set('line_no', $res['line_number']);
52
    $body->set('line_transliteration', $res['transliteration']);
53
    $body->set('found1', $_REQUEST["word1"]);
54
    $body->set('found2', $_REQUEST["word2"]);
55
    $body->set('found3', $_REQUEST["word3"]);
56
    //$around = $SearchText->getLinesAround();
57
    
58
    $body->set('dots_before', $SearchText->getDotsBefore());
59
    $body->set('array_lines_before', $SearchText->getLinesBefore());
60
    $body->set('array_lines_after', $SearchText->getLinesAfter());
61
    $body->set('dots_after', $SearchText->getDotsAfter());
62
    $temp .= $body->fetch();
63
    //p_g($res);
64
  }
65
  $tpl->set('obsah', $temp);
66
  //p_g($SearchText->getResult());
67
}
68

    
69
echo $tpl->fetch();
70

    
71
//p_g($_REQUEST);
(6-6/19)