summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorSimon2011-04-05 12:06:35 +0200
committerSimon2011-04-05 12:06:35 +0200
commitb9ac3ffdb68cfb48469d49e09c6165513402aedb (patch)
treed13185983e20858cece940ddf5a45bf83b74fa96 /library
parentsuch-aussehen geändert (diff)
downloadpbs2-b9ac3ffdb68cfb48469d49e09c6165513402aedb.tar.gz
pbs2-b9ac3ffdb68cfb48469d49e09c6165513402aedb.tar.xz
pbs2-b9ac3ffdb68cfb48469d49e09c6165513402aedb.zip
suche in Client & Bootos
Diffstat (limited to 'library')
-rw-r--r--library/Pbs/Search.php46
1 files changed, 26 insertions, 20 deletions
diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php
index c06f519..709651a 100644
--- a/library/Pbs/Search.php
+++ b/library/Pbs/Search.php
@@ -5,9 +5,10 @@ class Pbs_Search{
private $searchTerm = '';
private $searcha;
private $searchb;
+ private $module;
public function searchForm(){
- $str = "<form style='text-align:right;' action='/user/client/search'>
+ $str = "<form style='float:left;' action='/user/".$this->module."/search'>
<input type='text' id='search' name='search' ".(($this->searchTerm != '')?'value="'.$this->searchTerm.'"':'').">
<button type='submit' class='searchbutton' value='search'> Search</button>";
$highlight = array();
@@ -24,30 +25,29 @@ class Pbs_Search{
$str .= implode("\n",$highlight);
$str .= "$('#search')
.focus(function() {
- $('table tr .code').show();
+ $('table th .code').show();
}).focusout(function() {
- $('table tr .code').css('verticalAlign','-2px').animate({
- opacity: 0,
- width:0
- }, 1000, function() {
- $(this).attr({'style': 'display:none'});
- });
-
- });";
+ $('table th .code').hide();
+ });
+ $('table th').click(function(){
+ $('#search').val($('#search').val()+' '+$(this).find('.code').text()+':');
+ });";
$str .= "});
</script>";
$str .= "</form>";
return $str;
}
-
+ public function setModule($m){
+ $this->module = $m;
+ }
public function setSearchTerm($search){
- $this->searchTerm = $search;
+ $this->searchTerm = trim($search);
- $parts = explode(" ",$search);
- foreach($parts as $search){
- if(stristr($search,":") && ctype_alpha(substr($search,0,strpos($search,":")))){
- $key = substr($search,0,strpos($search,":"));
- $value = substr($search,strpos($search,":")+1);
+ $parts = explode(" ",$this->searchTerm);
+ foreach($parts as $this->searchTerm){
+ if(stristr($this->searchTerm,":") && ctype_alpha(substr($this->searchTerm,0,strpos($this->searchTerm,":")))){
+ $key = substr($this->searchTerm,0,strpos($this->searchTerm,":"));
+ $value = substr($this->searchTerm,strpos($this->searchTerm,":")+1);
$searcha[$key] = $value;
}
else{
@@ -57,7 +57,9 @@ class Pbs_Search{
$this->searcha = $searcha;
$this->searchb = $searchb;
}
-
+ public function getSearchTerm(){
+ return $this->searchTerm;
+ }
public function getSearchTerms(){
$beta = $this->searcha;
foreach($this->searchb as $b)
@@ -67,6 +69,9 @@ class Pbs_Search{
public function search($array){
foreach($array as $counter => $cig){
+ if(is_object($cig)){
+ $cig = $cig->toArray();
+ }
foreach($cig as $k => $v){
if(count($this->searcha) > 0){
foreach($this->searcha as $sk => $sv){
@@ -86,7 +91,8 @@ class Pbs_Search{
}
}
}
- }
+ }
+
}
if (count($this->searcha) == 0){
$data = $com2;
@@ -97,7 +103,7 @@ class Pbs_Search{
if (count($this->searcha) > 0 && count($this->searchb) > 0){
$data = array_intersect($com1,$com2);
}
- $data = array_unique($data);
+ $data = array_unique($data);
foreach( $data as $c)
$ges[] = $array[$c];
return $ges;