diff options
| author | Simon | 2011-04-06 16:48:57 +0200 |
|---|---|---|
| committer | Simon | 2011-04-06 16:48:57 +0200 |
| commit | 9c80c4ed11776549d7e6e2e846c5da19cbd899e3 (patch) | |
| tree | 7cee120c7b8b489b95d6550720f16fa1a401f81a | |
| parent | Suche in Elementen in Person, Role und Group komplett implementiert (diff) | |
| download | pbs2-9c80c4ed11776549d7e6e2e846c5da19cbd899e3.tar.gz pbs2-9c80c4ed11776549d7e6e2e846c5da19cbd899e3.tar.xz pbs2-9c80c4ed11776549d7e6e2e846c5da19cbd899e3.zip | |
suche gefixt
| -rw-r--r-- | library/Pbs/Search.php | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php index 611c5e2..fc05213 100644 --- a/library/Pbs/Search.php +++ b/library/Pbs/Search.php @@ -13,24 +13,47 @@ class Pbs_Search{ $str = "<form style='float:left;' action='/user/".$this->module."/search'> <input type='text' id='search' name='search' ".(($this->searchTerm != '')?'value="'.htmlentities($this->searchTerm, ENT_QUOTES).'"':'')."> <button type='submit' class='searchbutton' value='search'> Search</button>"; + $highlight = array(); if($this->searchTerm != ''){ $str .= "<a href='/user/".$this->module."/'><img src='/media/img/delete.png' alt='Delete Client'/></a>"; - $str .= "<div class='searchresult'>$this->countresult result".(($this->countresult==1)?'':'s')." found</div>"; + $str .= "<div class='searchsub'>$this->countresult result".(($this->countresult==1)?'':'s')." found</div>"; $str .="<script type='text/javascript' src='/media/js/jquery.highlight-3.js'></script>"; foreach($this->getSearchTerms() as $term){ - $highlight[] = "$('table').highlight('".$term."');"; + $highlight[] = "$('table').highlight('".$term."');"; + $highlight[] = "$('.element .number').highlight('".$term."');"; + $highlight[] = "$('.element .title').highlight('".$term."');"; + $highlight[] = "$('.element .item').highlight('".$term."');"; } } + $str .= "<div class='searchsub dsf'>Display searchfilter</div>"; $str .= "<script> $(document).ready(function(){"; $str .= implode("\n",$highlight); + $str .= "$('.searchvars').data('m','0');\n"; + + $str .= "$('.dsf') + .click(function(){ + if($('.searchvars').is(':visible') == false){ + $('.searchvars').data('m','1').slideDown(); + } + else{ + $('.searchvars').data('m','0').slideUp(); + } + });"; + $str .= "$('.searchvars .code').click(function(){ + $('#search').val($('#search').val()+' '+$(this).text()+':'); + });"; $str .= "$('#search') .focus(function() { $('table th .code').show(); + $('.searchvars').slideDown(); }).focusout(function() { - $('table th .code').hide(); + $('table th .code').hide(); + if($('.searchvars').data('m') == '0'){ + $('.searchvars').slideUp(); + } }); $('table th').click(function(){ $('#search').val($('#search').val()+' '+$(this).find('.code').text()+':'); @@ -72,6 +95,7 @@ class Pbs_Search{ } $this->searcha = $searcha; $this->searchb = $searchb; + #print_a($searcha, $searchb); } public function getSearchTerm(){ return $this->searchTerm; @@ -90,9 +114,9 @@ class Pbs_Search{ } foreach($cig as $k => $v){ if(count($this->searcha) > 0){ - foreach($this->searcha as $sk => $sv){ + foreach($this->searcha as $sk => $sv){ if($k == $sk){ - if(stristr($v,$sv)){ + if(stristr($v,$sv) || $v == $sv){ $com1[$counter] += 1; } } @@ -101,12 +125,13 @@ class Pbs_Search{ if(count($this->searchb) >= 0){ foreach($this->searchb as $sk => $sv){ $comm = stristr($v,$sv); - if($comm != false){ + if($comm != false || $v == $sv){ $com2[$counter] += 1; } } } } + # print_a($com2[$counter]." >= ".count($this->searchb)." && ".$com1[$counter]." >= ".count($this->searcha)); if($com2[$counter] >= count($this->searchb) && $com1[$counter] >= count($this->searcha)){ // add item in resultlist $data[] = $counter; |
