function getScheduleDetailsById($id) { $schedule = new schedule(); $html = ""; $schedule->open($id); $count = 0; $html .= '<div id="column1-wrap">'; $html .= '<div id="column1">'; foreach ($schedule->list_hours as $key => $item) { if ($count == 12) { $html .= '</div>'; $html .= '</div>'; $html .= '<div id="column2">'; } $html .= '<label class="checkbox">'; $html .= '<input type="checkbox" data-form="uniform" name="scheDet[]" value="' . $key . '"'; foreach ($schedule->hours as $sd) { if ($key == $sd) { $html .= ' checked '; } } $html .= ' />'; $html .= $key; $html .= '</label>'; $count++; } $html .= '</div>'; $html .= '<div id="clear"></div>'; $data['html'] = $html; if ($schedule->id) { $data['id'] = $schedule->id; } else { $data['id'] = 0; } echo json_encode($data); }
<?php require_once "../config.php"; verify_access($list_modules); $scheAdd = false; $scheUpd = false; $scheDel = false; $newSche = new schedule(); if ($_POST['action'] == 'Save') { if (isset($_POST['hdIdAct'])) { if ($_POST['hdIdAct'] == "") { $newSche->save($_POST['hdIdUser'], $_POST['hdDate'], $_POST['scheDet']); $scheAdd = true; } else { $newSche->open($_POST['hdIdAct']); $newSche->save($_POST['hdIdUser'], $_POST['hdDate'], $_POST['scheDet']); $scheUpd = true; } } } if ($_POST['action'] == 'Delete') { if (isset($_POST['hdIdAct'])) { $newSche->open($_POST['hdIdAct']); $newSche->del(); $scheDel = true; } } ?>
function getSchedulesByIdMonth($idUser, $month) { $query = $this->con->genericQuery("select * from " . $this->table . " where fk_user = "******" and MONTH(date)='" . $month . "'"); $objReturn = array(); foreach ($query as $value) { $sche = new schedule(); $sche->open($value); $objReturn[] = $sche; } return $objReturn; }