Exemplo n.º 1
0
 public function index()
 {
     $this->view->authLevel = $this->authLevel;
     $messages = new messagesModel();
     $this->view->messages = $messages;
     if (count($messages->getPrivateMessages()) > 0) {
         $this->layout->addScriptBlock('$(document).ready(function() { $("#privateMessages").foundation("reveal", "open"); }); ');
     }
     $date = new DateTime();
     $date->setTime(0, 0, 0);
     if ($date->format('d') >= 26) {
         $date->modify('+1 month');
     }
     $date->setDate($date->format('Y'), $date->format('m'), 1);
     $timesheet = new timesheetModel($date->format('Y'), $date->format('m'));
     $this->view->timesheet = $timesheet;
     $this->view->year = $date->format('Y');
     $this->view->month = $date->format('F');
     $date = new DateTime();
     $week = $date->format('W');
     $year = $date->format('Y');
     $report = new weeklyReportModel();
     $this->view->week = $report->getWeekWorked($this->userId, $week, $year);
 }
Exemplo n.º 2
0
 public function weekly()
 {
     //Weekly report form
     $form = new weeklyReportForm();
     if ($form->wasSubmitted()) {
         $form->addData($_POST);
         if ($form->validate()) {
             $data = $form->exportFormData();
             $report = new weeklyReportModel();
             $this->view->report = $report->timeWorked($data['account'], $data['year']);
             $account = new userModel();
             $this->view->account = $account->userInfo($data['account']);
             $this->view->year = $data['year'];
         } else {
             $this->view->form = $form;
         }
     } else {
         $this->view->form = $form;
     }
 }