I have a function like the one below to give me the number of working days. I want to send this information to the view, so I can display there on the top.
After this, I will show a simple report. Showing this report is not an issue. The issue is to pass the information from the function below to the view.
thanks
function number_of_working_dates($from, $days) {
$workingDays = [1, 2, 3, 4, 5]; # date format = N (1 = Monday, ...)
$holidayDays = ['*-12-25', '*-01-01', '2013-12-24', '2013-12-25']; # variable and fixed holidays
$from = new DateTime($from);
$dates = [];
$dates[] = $from->format('Y-m-d');
while ($days) {
$from->modify('+1 day');
if (!in_array($from->format('N'), $workingDays)) continue;
if (in_array($from->format('Y-m-d'), $holidayDays)) continue;
if (in_array($from->format('*-m-d'), $holidayDays)) continue;
$dates[] = $from->format('Y-m-d');
$days--;
}
return $dates;
}
print_r( number_of_working_dates('2013-12-23', 3) );