Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //User Listing template file
- <!--Search Form Start-->
- <div id="searchForm">
- <?php echo $this->Form->create('Search'); ?>
- <table><tr><td>Filter:</td>
- <td>
- <?php
- echo $this->Form->input('company_id', array('options'=>$companies_list,'empty'=>'Select Company','label' => false,'div'=>false,'class'=>'select'),array('escape' => false));
- ?>
- </td><td>
- <?php
- echo $this->Form->input('job_id', array('options'=>$fjobs_list,'value'=>$fjobId,'empty'=>'Select Job','label' => false,'div'=>false,'class'=>'select'),array('escape' => false)); ?>
- </td><td>
- <?php echo $this->Form->input('status', array('options'=>array('1'=>'Active','2'=>'Deleted'),'empty'=>'Select Status','label' => false,'div'=>false,'class'=>'select'),array('escape' => false)); ?>
- </td><td>
- <?php echo $this->Form->text('state',array('class'=>'input_text','value'=>'State') ); ?>
- </td></tr>
- <tr>
- <td>Tags</td>
- <td colspan=3><?php echo $this->Form->input('tags'); ?></td>
- <td><button class="submit" type="submit" id="sBtn">Search</button></td>
- </tr>
- </table>
- <?php echo $this->Form->end(); ?>
- </div>
- <!--Search Form End-->
- <table>
- <thead>
- <tr role="row">
- <th class="sorting_asc"><?php echo $this->Form->checkbox(''); ?></th>
- <th class="sorting">Candidate</th>
- <th class="sorting">Title</th>
- <th class="sorting">Tags</th>
- <th class="sorting">Location</th>
- </tr>
- </thead>
- <tbody>
- <?php if($candidates){ foreach($candidates as $key=>$candidate){?>
- <tr>
- <td><input type="checkbox" name="ids[]" value="<?php echo $candidate['Candidate']['id']; ?>"></td>
- <td><?php echo $candidate['Candidate']['name'] ?></td>
- <td><?php echo $candidate['Candidate']['title'] ?></td>
- <td><?php echo $candidate['Candidate']['tags'] ?></td>
- <td><?php echo $candidate['Candidate']['city'].', '.$candidate['Candidate']['state'] ?></td>
- </tr>
- <?php }} ?>
- </tbody>
- </table>
- <!-- pagination starts -->
- <div class="pagination">
- <?php echo $this->Paginator->first('First'); ?>
- <?php echo $this->Paginator->prev('Previous',null,null,array('class' => 'disabled')); ?>
- <?php echo $this->Paginator->numbers(array('separator'=>false)); ?>
- <?php echo $this->Paginator->next('Next',null,null,array('class' => 'disabled')); ?>
- <?php echo $this->Paginator->last('Last'); ?>
- </div>
- //Listing Function of User controller
- <?php
- public function listing(){
- $this->set('page_title','Candidates List');
- $cond = array();
- $candidates = array();
- if(!empty($this->request->data)){
- $sData = $this->request->data['Search'];
- $tags = explode(',',$sData['tags']);
- if(array_filter($tags)){
- $tags_s = array();
- foreach($tags as $t){
- $tags_s[] = array('tags like'=>'%'.$t.'%');
- }
- $cond['or'] = $tags_s;
- }
- if($sData['status']!="")
- $cond['status'] = 1;
- if(isset($sData['state']) && $sData['state']!='' && $sData['state']!='State')
- $cond['state'] = trim($sData['state']);
- }
- $this->paginate = array('limit' =>1,'recursive'=>1, 'order'=>array('Candidate.created desc'));
- try{
- $candidates = $this->Paginator->paginate('Candidate',$cond);
- }catch(NotFoundException $e){
- $this->redirect(array('controller' => 'candidates', 'action' => 'list','admin'=>true));
- }
- $this->set('candidates',$candidates);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement