indexController.php 958 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. class indexController extends Staple_Controller
  3. {
  4. private $authLevel;
  5. private $userId;
  6. public function _start()
  7. {
  8. $user = new userModel();
  9. $this->authLevel = $user->getAuthLevel();
  10. $this->userId = $user->getId();
  11. }
  12. public function index()
  13. {
  14. $this->view->authLevel = $this->authLevel;
  15. $messages = array();
  16. $this->view->messages = $messages;
  17. $date = new DateTime();
  18. $date->setTime(0,0,0);
  19. if($date->format('d') >= 26)
  20. {
  21. $date->modify('+1 month');
  22. }
  23. $date->setDate($date->format('Y'),$date->format('m'),1);
  24. $timesheet = new timesheetModel($date->format('Y'),$date->format('m'));
  25. $this->view->timesheet = $timesheet;
  26. $this->view->year = $date->format('Y');
  27. $this->view->month = $date->format('F');
  28. $date = new DateTime();
  29. $week = $date->format('W');
  30. $year = $date->format('Y');
  31. $report = new weeklyReportModel();
  32. $this->view->week = $report->getWeekWorked($this->userId, $week, $year);
  33. }
  34. }
  35. ?>