/** * Generate the Monthly Project Report for Selected User * @return View */ public function postUserProjectReport() { //Get the selected UserId $userId = \Input::get('userprojectreportid'); //Get Details of User $user = \User::find($userId); $firstName = $user->first_name; $lastName = $user->last_name; //Get selected Project Id $projectId = \Input::get('projectmonth'); //Get the selected Date for the month $selectedMonth = \Input::get('userprojectdate_submit'); //Generate Month from the date $daysArray = \DateAndTime::getMonthDates($selectedMonth); //Get Data $data = $this->report->generateWeeklyProjectReport($daysArray, $projectId, $userId); //Manipulation for View $tempDates = array(); foreach ($daysArray as $day) { $tempDay = new \ExpressiveDate($day); $tempDates[] = $tempDay->format('jS F, Y'); } //Manipulation for Charts $chartWeek = json_encode($tempDates); $tempDate = new \ExpressiveDate($selectedMonth); $year = $tempDate->getYear(); $month = $tempDate->getMonth(); $totalNoOfDays = (int) $tempDate->getDaysInMonth(); $allmonths = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); $chartWeekData = json_encode($data['dayTime'], JSON_NUMERIC_CHECK); return \View::make('dashboard.reports.monthlyproject')->with('data', $data)->with('name', $firstName . $lastName)->with('totalDays', $totalNoOfDays)->with('dates', $daysArray)->with('year', (int) $year)->with('month', $allmonths[(int) $month])->with('chartWeek', $chartWeek)->with('chartWeekData', $chartWeekData); }