Guest User

Untitled

a guest
Feb 19th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.45 KB | None | 0 0
  1. $options = array('conditions'=>$final,'order'=>$order,'group'=>array('Project.id'),'joins'=>array(
  2. array(
  3. 'table'=>'project_categories',
  4. 'alias'=>'ProjectCategory',
  5. 'type' => 'LEFT',
  6. 'conditions'=>array('ProjectCategory.project_id = Project.id')
  7. ),
  8. array(
  9. 'table'=>'categories',
  10. 'alias'=>'Category',
  11. 'type' => 'LEFT',
  12. 'conditions'=>array('ProjectCategory.category_id = Category.id')
  13. ),
  14. ));
  15.  
  16.  
  17. $this->paginate = $options;
  18.  
  19.  
  20.  
  21. //VIEW
  22.  
  23.  
  24. <div class="projects index">
  25. <h2><?php __('Projects');?></h2>
  26. <table cellpadding="0" cellspacing="0">
  27. <tr>
  28. <th><?php echo $this->Paginator->sort('id');?></th>
  29. <th><?php echo $this->Paginator->sort('user_id');?></th>
  30. <th><?php echo $this->Paginator->sort('status');?></th>
  31. <th><?php echo $this->Paginator->sort('approval_status');?></th>
  32. <th><?php echo $this->Paginator->sort('project_title');?></th>
  33. <th><?php echo $this->Paginator->sort('project_type');?></th>
  34. <th><?php echo $this->Paginator->sort('budget');?></th>
  35. <th><?php echo $this->Paginator->sort('delivery');?></th>
  36. <th><?php echo $this->Paginator->sort('created');?></th>
  37. <th><?php echo $this->Paginator->sort('favorite');?></th>
  38. <th><?php echo $this->Paginator->sort('top_employer');?></th>
  39. <th><?php echo $this->Paginator->sort('view_counter');?></th>
  40. <th class="actions"><?php __('Actions');?></th>
  41. </tr>
  42. <?php
  43. $i = 0;
  44. foreach ($projects as $project):
  45. $class = null;
  46. if ($i++ % 2 == 0) {
  47. $class = ' class="altrow"';
  48. }
  49. ?>
  50. <tr<?php echo $class;?>>
  51. <td><?php echo $project['Project']['id']; ?>&nbsp;</td>
  52. <td>
  53. <?php echo $this->Html->link($project['User']['username'], array('controller' => 'users', 'action' => 'view', $project['User']['id'])); ?>
  54. </td>
  55. <td><?php echo $project['Project']['status']; ?>&nbsp;</td>
  56. <td><?php echo $project['Project']['approval_status']; ?>&nbsp;</td>
  57. <td><?php echo $project['Project']['project_title']; ?>&nbsp;</td>
  58. <td><?php echo $project['ProjectType']['name']; ?>&nbsp;</td>
  59. <td><?php echo $project['Project']['budget']; ?>&nbsp;</td>
  60. <td><?php echo $project['Project']['delivery']; ?>&nbsp;</td>
  61. <td><?php echo $project['Project']['created']; ?>&nbsp;</td>
  62. <td><?php echo $project['Project']['favorite']; ?>&nbsp;</td>
  63. <td><?php echo $project['Project']['top_employer']; ?>&nbsp;</td>
  64. <td><?php echo $project['Project']['view_counter']; ?>&nbsp;</td>
  65. <td class="actions">
  66. <?php echo $this->Html->link(__('View', true), array('action' => 'view', $project['Project']['id'])); ?>
  67. <?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $project['Project']['id'])); ?>
  68. <?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $project['Project']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $project['Project']['id'])); ?>
  69. </td>
  70. </tr>
  71. <?php endforeach; ?>
  72. </table>
  73. <p>
  74. <?php
  75. echo $this->Paginator->counter(array(
  76. 'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
  77. ));
  78. ?> </p>
  79.  
  80. <div class="paging">
  81. <?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
  82. | <?php echo $this->Paginator->numbers();?>
  83. |
  84. <?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
  85. </div>
  86. </div>
  87. <div class="actions">
  88. <h3><?php __('Actions'); ?></h3>
  89. <ul>
  90. <li><?php echo $this->Html->link(__('New Project', true), array('action' => 'add')); ?></li>
  91. <li><?php echo $this->Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
  92. <li><?php echo $this->Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
  93. <li><?php echo $this->Html->link(__('List Categories', true), array('controller' => 'categories', 'action' => 'index')); ?> </li>
  94. <li><?php echo $this->Html->link(__('New Category', true), array('controller' => 'categories', 'action' => 'add')); ?> </li>
  95. </ul>
  96. </div>
  97.  
  98. $projects = $this->paginate("Project");
  99. $this->set('projects',$projects);
Add Comment
Please, Sign In to add comment