Advertisement
Guest User

Untitled

a guest
Jul 5th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. //User Listing template file
  2.  
  3. <!--Search Form Start-->
  4. <div id="searchForm">
  5. <?php echo $this->Form->create('Search'); ?>
  6. <table><tr><td>Filter:</td>
  7. <td>
  8. <?php
  9. echo $this->Form->input('company_id', array('options'=>$companies_list,'empty'=>'Select Company','label' => false,'div'=>false,'class'=>'select'),array('escape' => false));
  10. ?>
  11. </td><td>
  12. <?php
  13. echo $this->Form->input('job_id', array('options'=>$fjobs_list,'value'=>$fjobId,'empty'=>'Select Job','label' => false,'div'=>false,'class'=>'select'),array('escape' => false)); ?>
  14. </td><td>
  15. <?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)); ?>
  16. </td><td>
  17. <?php echo $this->Form->text('state',array('class'=>'input_text','value'=>'State') ); ?>
  18. </td></tr>
  19. <tr>
  20. <td>Tags</td>
  21. <td colspan=3><?php echo $this->Form->input('tags'); ?></td>
  22. <td><button class="submit" type="submit" id="sBtn">Search</button></td>
  23. </tr>
  24. </table>
  25. <?php echo $this->Form->end(); ?>
  26. </div>
  27. <!--Search Form End-->
  28.  
  29.  
  30. <table>
  31. <thead>
  32. <tr role="row">
  33. <th class="sorting_asc"><?php echo $this->Form->checkbox(''); ?></th>
  34. <th class="sorting">Candidate</th>
  35. <th class="sorting">Title</th>
  36. <th class="sorting">Tags</th>
  37. <th class="sorting">Location</th>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. <?php if($candidates){ foreach($candidates as $key=>$candidate){?>
  42. <tr>
  43. <td><input type="checkbox" name="ids[]" value="<?php echo $candidate['Candidate']['id']; ?>"></td>
  44. <td><?php echo $candidate['Candidate']['name'] ?></td>
  45. <td><?php echo $candidate['Candidate']['title'] ?></td>
  46. <td><?php echo $candidate['Candidate']['tags'] ?></td>
  47. <td><?php echo $candidate['Candidate']['city'].', '.$candidate['Candidate']['state'] ?></td>
  48. </tr>
  49. <?php }} ?>
  50. </tbody>
  51. </table>
  52. <!-- pagination starts -->
  53. <div class="pagination">
  54. <?php echo $this->Paginator->first('First'); ?>
  55. <?php echo $this->Paginator->prev('Previous',null,null,array('class' => 'disabled')); ?>
  56. <?php echo $this->Paginator->numbers(array('separator'=>false)); ?>
  57. <?php echo $this->Paginator->next('Next',null,null,array('class' => 'disabled')); ?>
  58. <?php echo $this->Paginator->last('Last'); ?>
  59. </div>
  60.  
  61.  
  62. //Listing Function of User controller
  63.  
  64. <?php
  65. public function listing(){
  66. $this->set('page_title','Candidates List');
  67.  
  68. $cond = array();
  69. $candidates = array();
  70.  
  71. if(!empty($this->request->data)){
  72.  
  73. $sData = $this->request->data['Search'];
  74.  
  75. $tags = explode(',',$sData['tags']);
  76.  
  77. if(array_filter($tags)){
  78. $tags_s = array();
  79. foreach($tags as $t){
  80. $tags_s[] = array('tags like'=>'%'.$t.'%');
  81. }
  82. $cond['or'] = $tags_s;
  83. }
  84.  
  85. if($sData['status']!="")
  86. $cond['status'] = 1;
  87.  
  88. if(isset($sData['state']) && $sData['state']!='' && $sData['state']!='State')
  89. $cond['state'] = trim($sData['state']);
  90. }
  91. $this->paginate = array('limit' =>1,'recursive'=>1, 'order'=>array('Candidate.created desc'));
  92.  
  93. try{
  94. $candidates = $this->Paginator->paginate('Candidate',$cond);
  95. }catch(NotFoundException $e){
  96. $this->redirect(array('controller' => 'candidates', 'action' => 'list','admin'=>true));
  97. }
  98. $this->set('candidates',$candidates);
  99. }
  100. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement