diff options
| author | Simon | 2011-04-04 17:09:57 +0200 |
|---|---|---|
| committer | Simon | 2011-04-04 17:09:57 +0200 |
| commit | 6511fb075385b9fc25ade2d4bd331e742193960e (patch) | |
| tree | 5659fd268ad03c1064d4ee7a00b62545e878822d | |
| parent | Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff) | |
| download | pbs2-6511fb075385b9fc25ade2d4bd331e742193960e.tar.gz pbs2-6511fb075385b9fc25ade2d4bd331e742193960e.tar.xz pbs2-6511fb075385b9fc25ade2d4bd331e742193960e.zip | |
client-suche verändert
| -rw-r--r-- | application/modules/user/controllers/ClientController.php | 11 | ||||
| -rw-r--r-- | application/modules/user/views/scripts/client/index.phtml | 23 | ||||
| -rw-r--r-- | library/Pbs/Search.php | 22 | ||||
| -rw-r--r-- | public/media/css/style.css | 3 | ||||
| -rw-r--r-- | public/media/img/search.png | bin | 0 -> 367 bytes |
5 files changed, 31 insertions, 28 deletions
diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index acb6a65..c722a49 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -49,13 +49,14 @@ class User_ClientController extends Zend_Controller_Action $clientMapper = new Application_Model_ClientMapper(); $clientsInGroup = $clientMapper->findBy('groupID',$this->membership->getGroupID()); + // Search $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $this->view->searchform = $mySearch->searchForm(); if($search != ''){ - $this->view->search = $search; - $mySearch = new Pbs_Search(); - $mySearch->setSearchTerm($search); - $clientsInGroup = $mySearch->search($clientsInGroup); - $this->view->searchterms = $mySearch->getSearchTerms(); + $this->view->search = $search; + $clientsInGroup = $mySearch->search($clientsInGroup); } // Pagination diff --git a/application/modules/user/views/scripts/client/index.phtml b/application/modules/user/views/scripts/client/index.phtml index ca78db1..5a75741 100644 --- a/application/modules/user/views/scripts/client/index.phtml +++ b/application/modules/user/views/scripts/client/index.phtml @@ -1,27 +1,6 @@ <h1>Clients</h1> <?php if($this->notification != ''){echo $this->notification;} ?> -<form action='/user/client/search'> -<input type='text' name='search' <?php echo isset($this->search)?'value="'.$this->search.'"':'';?>> -<input type='submit' value='search'> -<?php -if(isset($this->search)){ - ?> - <a href='/user/client/'><img src='/media/img/delete.png' alt='Delete Client'/></a> - <script type='text/javascript' src='/media/js/jquery.highlight-3.js'></script> - <script> - $(document).ready(function(){ - <?php foreach($this->searchterms as $term){?> - $('table').highlight('<?php echo $term;?>'); - <?php - } - ?> - }); - </script> - - <?php -} -?> -</form> +<?php echo $this->searchform; ?> <?php echo $this->formButton('createbootos', 'Create Client', array( 'onclick' => 'self.location="/user/client/addclient/page/'.$this->page.'"', 'class' => 'addbutton'))?> diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php index 7f6dfa7..e642d66 100644 --- a/library/Pbs/Search.php +++ b/library/Pbs/Search.php @@ -6,6 +6,25 @@ class Pbs_Search{ private $searcha; private $searchb; + public function searchForm(){ + $str = "<form style='text-align:right;' action='/user/client/search'> + <input type='text' name='search' ".(($this->searchTerm != '')?'value="'.$this->searchTerm.'"':'')."> + <button type='submit' class='searchbutton' value='search'> Search</button>"; + if($this->searchTerm != ''){ + $str .= "<a href='/user/client/'><img src='/media/img/delete.png' alt='Delete Client'/></a> + <script type='text/javascript' src='/media/js/jquery.highlight-3.js'></script> + <script> + $(document).ready(function(){"; + foreach($this->getSearchTerms() as $term){ + $str .= "$('table').highlight('".$term."');"; + } + $str .= "}); + </script>"; + } + $str .= "</form>"; + return $str; + } + public function setSearchTerm($search){ $this->searchTerm = $search; @@ -62,7 +81,8 @@ class Pbs_Search{ } if (count($this->searcha) > 0 && count($this->searchb) > 0){ $data = array_intersect($com1,$com2); - } + } + $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 a521aeb..7238472 100644 --- a/public/media/css/style.css +++ b/public/media/css/style.css @@ -313,6 +313,9 @@ td { .addbutton:before { content: url(/media/img/create.png) ' '; } +.searchbutton:before { + content: url(/media/img/search.png) ' '; +} .rightbutton { float: right; diff --git a/public/media/img/search.png b/public/media/img/search.png Binary files differnew file mode 100644 index 0000000..6a0dd1d --- /dev/null +++ b/public/media/img/search.png |
