Example #1
0
function getSchedulesByUserDate($idUsers, $dtStart, $dtEnd)
{
    $users = "";
    foreach ($idUsers as $u) {
        $users .= $u . ",";
    }
    $users = substr($users, 0, -1);
    $schedule = new schedule();
    $data = array();
    $i = 0;
    $list_schedules = $schedule->getByUserDate($users, $dtStart, $dtEnd);
    $html .= '<table id="datatables" class="table table-bordered table-striped responsive">';
    $html .= '   <thead>';
    $html .= '       <tr>';
    $html .= '           <th class="head0">User</th>';
    $html .= '           <th class="head1">Date</th>';
    $html .= '           <th class="head0">Month</th>';
    $html .= '           <th class="head1">Day</th>';
    $html .= '           <th class="head0">Hours</th>';
    $html .= '       </tr>';
    $html .= '   </thead>';
    $html .= '   <tbody>';
    foreach ($list_schedules as $value) {
        $i = $i + 1;
        $html .= '       <tr src="schedule-report">';
        $html .= '           <td>' . $value['user'] . '</td><input name="hdId" type="hidden" value="' . $value['id'] . '"/>';
        $html .= '           <td>' . $value['date'] . '</td><input name="hdDate" type="hidden" value="' . $value['date'] . '"/>';
        $html .= '           <td>' . $value['month'] . '</td>';
        $html .= '           <td>' . $value['day'] . '</td>';
        $html .= '           <td><a href="#myModalScheduleDetails" role="button" class="btn btn-link" data-toggle="modal" id="aHours">' . $value['hours'] . '</a></td>';
        $html .= '       </tr>';
    }
    $html .= '   </tbody>';
    $html .= '</table>';
    $data['html'] = $html;
    $data['count'] = $i;
    echo json_encode($data);
}