From b9ac3ffdb68cfb48469d49e09c6165513402aedb Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 5 Apr 2011 12:06:35 +0200 Subject: suche in Client & Bootos --- .../modules/user/controllers/BootosController.php | 14 +++++++ .../modules/user/controllers/ClientController.php | 7 ++-- .../modules/user/views/scripts/bootos/index.phtml | 25 ++++++------ .../modules/user/views/scripts/client/index.phtml | 4 +- library/Pbs/Search.php | 46 ++++++++++++---------- public/media/css/style.css | 4 +- 6 files changed, 61 insertions(+), 39 deletions(-) diff --git a/application/modules/user/controllers/BootosController.php b/application/modules/user/controllers/BootosController.php index 8f602fe..e1b4f7b 100644 --- a/application/modules/user/controllers/BootosController.php +++ b/application/modules/user/controllers/BootosController.php @@ -66,6 +66,17 @@ class user_BootosController extends Zend_Controller_Action $this->view->bootoslist = $this->bootosMapper->findBy(array("groupID" => $groupID)); $this->view->update = array(); + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('bootos'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $this->view->bootoslist = $mySearch->search($this->view->bootoslist); + } + // Pagination $pagination = new Pbs_Pagination(); $pagination->setPerPage(5); @@ -92,6 +103,9 @@ class user_BootosController extends Zend_Controller_Action } } + public function searchAction(){ + $this->_redirect('/user/bootos/index/search/'.($_GET['search'])); + } public function createbootosAction() { diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index 87e764d..9fe4b03 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -53,15 +53,16 @@ class User_ClientController extends Zend_Controller_Action $search = $this->_request->getParam('search'); $mySearch = new Pbs_Search(); $mySearch->setSearchTerm($search); + $mySearch->setModule('client'); $this->view->searchform = $mySearch->searchForm(); if($search != ''){ - $this->view->search = $search; + $this->view->search = $mySearch->getSearchTerm(); $clientsInGroup = $mySearch->search($clientsInGroup); } // Pagination $pagination = new Pbs_Pagination(); - $pagination->setPerPage(10); + $pagination->setPerPage(10); $pagination->setElement($clientsInGroup); $pagination->setRequestPage($this->_request->getParam('page')); $pagination->setPageUrl('/user/client/index'.((isset($this->view->search))?'/search/'.$this->view->search:'')); @@ -73,7 +74,7 @@ class User_ClientController extends Zend_Controller_Action } public function searchAction(){ - $this->_redirect('/user/client/index/search/'.$_GET['search']); + $this->_redirect('/user/client/index/search/'.($_GET['search'])); } public function addclientAction() diff --git a/application/modules/user/views/scripts/bootos/index.phtml b/application/modules/user/views/scripts/bootos/index.phtml index 8982fb2..a678cef 100644 --- a/application/modules/user/views/scripts/bootos/index.phtml +++ b/application/modules/user/views/scripts/bootos/index.phtml @@ -1,5 +1,6 @@

BootOS

notification != ''){echo $this->notification;} ?> +searchform; ?> formButton('checkupdate', 'Check for Updates', array( 'onclick' => 'self.location="/user/bootos/index/page/'.$this->page.'/checkupdate/true"', 'class' => 'updatebutton', @@ -10,18 +11,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + bootoslist)==0) diff --git a/application/modules/user/views/scripts/client/index.phtml b/application/modules/user/views/scripts/client/index.phtml index 051ea90..95bf7a2 100644 --- a/application/modules/user/views/scripts/client/index.phtml +++ b/application/modules/user/views/scripts/client/index.phtml @@ -8,8 +8,8 @@ clients): ?>
IDTitleGroupIDMembershipIDConfigIDInitKernelKclDescriptionChangedExpiresPublicID bootosIDTitle titleGroupID groupIDMembershipID membershipIDConfigID configIDInit initKernel kernelKcl kclDescription descriptionChanged ChangedExpires expiresPublic public Actions
- - + + clients as $client): ?> 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 = " + $str = "searchTerm != '')?'value="'.$this->searchTerm.'"':'')."> "; $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 .= "}); "; $str .= ""; 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; diff --git a/public/media/css/style.css b/public/media/css/style.css index 4cd29e9..2057c54 100644 --- a/public/media/css/style.css +++ b/public/media/css/style.css @@ -297,8 +297,8 @@ th { border: 1px solid #999; } th .code{ - font-size: 11px; - font-family:"Courier New",Verdana; + font-size: 9px; + color:#666; display:none; } -- cgit v1.2.3-55-g7522
MAC [macadress]Hardwarehash [hardwarehash]MAC macadressHardwarehash hardwarehash Actions