printInactiveTimeSheetForm.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. class printInactiveTimeSheetForm extends Staple_Form
  3. {
  4. public function _start()
  5. {
  6. //$this->setLayout('');
  7. $this->setName('printInactiveTimeSheet')
  8. ->setAction($this->link(array('reports','inactive')));
  9. $account = new Staple_Form_FoundationSelectElement('account','Select an account');
  10. $account->setRequired()
  11. ->addOption('','Select an account')
  12. ->addOptionsArray($this->accounts())
  13. ->addValidator(new Staple_Form_Validate_InArray($this->accounts(1)));
  14. $submit = new Staple_Form_FoundationSubmitElement('submit','Submit');
  15. $submit->addClass('button expand radius');
  16. $this->addField($account,$submit);
  17. }
  18. function accounts($ids = null)
  19. {
  20. $user = new userModel();
  21. $id = $user->getId();
  22. $authLevel = $user->getAuthLevel();
  23. $accounts = new userModel();
  24. $users = $accounts->listInactive();
  25. $data = array();
  26. if($ids == null)
  27. {
  28. if(count($users) > 0)
  29. {
  30. foreach($users as $user)
  31. {
  32. if($user['type'] == 'part')
  33. {
  34. $type = 'Part Time';
  35. }
  36. if($user['type'] == 'full')
  37. {
  38. $type = 'Full Time';
  39. }
  40. if($user['supervisorId'] == $id)
  41. {
  42. $data[$user['id']] = $user['lastName'].", ".$user['firstName']." ($type)";
  43. }
  44. elseif($authLevel >= 900)
  45. {
  46. $data[$user['id']] = $user['lastName'].", ".$user['firstName']." ($type)";
  47. }
  48. }
  49. }
  50. }
  51. else
  52. {
  53. if(count($users) > 0)
  54. {
  55. foreach ($users as $user)
  56. {
  57. $data[] = $user['id'];
  58. }
  59. }
  60. }
  61. return $data;
  62. }
  63. }
  64. ?>