PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/application/views/administration/time.php

https://github.com/fb83/Project-Pier
PHP | 108 lines | 94 code | 14 blank | 0 comment | 10 complexity | c2bc95f4b4f6251518203515ddd41130 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, AGPL-3.0, LGPL-2.1, GPL-3.0
  1. <?php
  2. set_page_title(lang('time manager'));
  3. administration_tabbed_navigation('time');
  4. administration_crumbs(lang('time manager'));
  5. add_page_action(lang('unbilled time'), get_url('administration', 'time', array('status' => '0')));
  6. add_page_action(lang('billed time'), get_url('administration', 'time', array('status' => '1')));
  7. add_page_action(lang('view by user'), get_url('user', 'time'));
  8. add_page_action(lang('view by project'), get_url('project', 'time'));
  9. $status = (array_var($_GET, 'status')) ? array_var($_GET, 'status') : 0;
  10. $button = ($status) ? lang('unbilled') : lang('billed');
  11. $title = ($status) ? lang('billed time') : lang('unbilled time');
  12. add_stylesheet_to_page('project/time.css');
  13. ?>
  14. <div id="time">
  15. <h2><?php echo $title; ?></h2>
  16. <form action="<?php echo get_url('time', 'setstatus', array('status' => $status, 'redirect_to' => $redirect_to)) ?>" method="post">
  17. <table class="timeLogs blank">
  18. <tr>
  19. <th class="short"></th>
  20. <th><?php echo lang('done date'); ?></th>
  21. <th><?php echo lang('name'); ?></th>
  22. <th><?php echo lang('details'); ?></th>
  23. <th><?php echo lang('hours'); ?></th>
  24. <th><?php echo lang('bill'); ?></th>
  25. <th><?php echo lang('actions'); ?></th>
  26. </tr>
  27. <?php
  28. $total_hours = 0;
  29. if ($times) {
  30. foreach($times as $time) {
  31. $this->assign('time', $time);
  32. ?>
  33. <?php if($time->isToday()) { ?>
  34. <tr class="timeToday">
  35. <?php } elseif($time->isYesterday()) { ?>
  36. <tr class="timeYesterday">
  37. <?php } else { ?>
  38. <tr class="timeOlder">
  39. <?php } // if ?>
  40. <td class="timeCheck">
  41. <input type="checkbox" name="item[<?php echo $time->getId(); ?>]" />
  42. </td>
  43. <td class="timeDate">
  44. <?php if($time->getDoneDate()->getYear() > DateTimeValueLib::now()->getYear()) { ?>
  45. <?php echo format_date($time->getDoneDate(), null, 0) ?>
  46. <?php } else { ?>
  47. <?php echo format_descriptive_date($time->getDoneDate(), 0) ?>
  48. <?php } // if ?>
  49. </td>
  50. <td class="timeUser">
  51. <?php if($time->getAssignedTo() instanceof ApplicationDataObject) { ?>
  52. <?php echo clean($time->getAssignedTo()->getObjectName()) ?>
  53. <?php } // if ?>
  54. </td>
  55. <td class="timeDetailsSmall">
  56. <a href="<?php echo $time->getViewUrl() ?>"><?php echo clean($time->getName()) ?></a>
  57. </td>
  58. <td class="timeHours"><?php echo $time->getHours() ?></td>
  59. <td class="timeFiles">
  60. <?php echo render_object_files_brief($time, $time->canEdit(logged_user())) ?>
  61. </td>
  62. <td class="timeEdit">
  63. <?php
  64. $options = array();
  65. if($time->canEdit(logged_user())) $options[] = '<a href="' . $time->getEditUrl() . '">' . lang('edit') . '</a>';
  66. if($time->canDelete(logged_user())) $options[] = '<a href="' . $time->getDeleteUrl() . '" onclick="return confirm(\'' . lang('confirm delete time') . '\')">' . lang('delete') . '</a>';
  67. ?>
  68. <?php if(count($options)) { ?>
  69. <?php echo implode(' | ', $options) ?>
  70. <?php } else { // if(count ?>
  71. <?php echo '&nbsp;' ?>
  72. <?php } // if ?>
  73. </td>
  74. </tr>
  75. <?php
  76. $total_hours += $time->getHours();
  77. } // foreach
  78. } // if
  79. ?>
  80. <tr class="timeOlder total">
  81. <td class="timeCheck"></td>
  82. <td class="timeDate"></td>
  83. <td class="timeUser"></td>
  84. <td class="timeDetailsSmall" style="text-align:right;"><strong><?php echo lang('total'); ?>:&nbsp;</strong></td>
  85. <td class="timeHours"><strong><?php echo $total_hours; ?></strong></td>
  86. <td class="timeBills"></td>
  87. <td class="timeEdit"></td>
  88. </tr>
  89. </table>
  90. <div class="submitTime">
  91. <?php echo submit_button(lang('mark as'). ' ' . $button) ?>
  92. </div>
  93. </form>
  94. </div>