* (at your option) any later version. */ $checkSession = true; require_once "../includes/library.php"; if ($_SESSION['profilSession'] != 0) { header('Location: ../general/permissiondenied.php'); exit; } $breadcrumbs[] = buildLink('../administration/admin.php', $strings['administration'], LINK_INSIDE); $breadcrumbs[] = $strings['holidays']; $pageSection = 'admin'; require_once '../themes/' . THEME . '/header.php'; $block1 = new block(); $block1->headingForm($strings['delete_holidays']); $block1->openContent(); $block1->contentTitle($strings["delete_following"]); $block1->form = 'hoP'; $block1->openForm("../administration/listholidays.php?action=delete&id={$id}"); $id = str_replace("**", ",", $id); $tmpquery = "WHERE hol.id IN({$id}) ORDER BY hol.comments"; $listHoliday = new request(); $listHoliday->openHoliday($tmpquery); $comptListHoliday = count($listHoliday->hol_id); for ($i = 0; $i < $comptListHoliday; $i++) { echo "<tr class=\"odd\"><td valign=\"top\" class=\"leftvalue\">#" . $listHoliday->hol_id[$i] . "</td><td>" . $listHoliday->hol_comments[$i] . "</td></tr>"; } echo "<tr class=\"odd\"><td valign=\"top\" class=\"leftvalue\"> </td><td><input type=\"submit\" name=\"delete\" \nvalue=\"" . $strings["delete"] . "\"> <input type=\"button\" name=\"cancel\" value=\"" . $strings["cancel"] . "\" \nonClick=\"history.back();\"></td></tr>"; $block1->closeForm(); $block1->closeContent(); $block1->headingForm_close(); require_once "../themes/" . THEME . "/footer.php";
$block1 = new block(); $block1->headingForm($strings['new_holiday']); $block1->openContent(); $block1->form = 'hoT'; $block1->openForm("../administration/listholidays.php?action=add&d=" . $d . "&c=" . $c . "#" . $block1->form . "Anchor"); $block1->contentRow($strings["date"], "<input type=\"text\" style=\"width: 150px;\" name=\"d\" id=\"sel1\" size=\"20\" value=\"{$sd}\"><button type=\"reset\" id=\"trigger_a\">...</button><script type=\"text/javascript\">Calendar.setup({ inputField:\"sel1\", button:\"trigger_a\" });</script>"); $block1->contentRow($strings["comments"], "<textarea rows=\"10\" style=\"width: 400px; height: 160px;\" name=\"c\" cols=\"47\">{$c}</textarea>"); echo "<tr class=\"odd\"><td valign=\"top\" class=\"leftvalue\"> </td><td><input type=\"SUBMIT\" value=\"" . $strings["save"] . "\"></td></tr>"; $block1->closeContent(); $block1->heading($strings["holidays"]); $block1->openPaletteIcon(); $block1->paletteIcon(1, "remove", $strings["delete"]); $block1->closePaletteIcon(); $tmpquery = " ORDER BY hol.date DESC"; $holidayList = new request(); $holidayList->openHoliday($tmpquery); $comptHolidayList = count($holidayList->hol_id); $block1->recordsTotal = $comptHolidayList; if ($comptHolidayList > 0) { $block1->openResults(); $block1->labels($labels = array(0 => $strings['date'], 1 => $strings['comments']), 'true', $sorting = false, $sortingOff = array(0 => '0', 1 => 'DESC')); for ($i = 0; $i < $comptHolidayList; $i++) { $block1->openRow($holidayList->hol_id[$i]); $block1->checkboxRow($holidayList->hol_id[$i]); $block1->cellRow($holidayList->hol_date[$i]); $block1->cellRow($holidayList->hol_comments[$i]); $block1->closeRow(); } $block1->closeResults(); } else { $block1->noresults();
/** * Return date some hours before * * @param string $date1 Date to compare * @param string $hour1 Hours before * @access public */ function hours_before($date1, $hour1) { global $dayHourArray; $timestamp1 = date2timestamp($date1); $diff = 0; while ($diff < $hour1) { $currDate = date("Y-m-d", $timestamp1); $tmpquery = " WHERE hol.date='{$currDate}'"; $listHoliday = new request(); $listHoliday->openHoliday($tmpquery); $comptListHoliday = count($listHoliday->hol_id); if ($comptListHoliday == 0) { $weekDay = date("w", $timestamp1); $diff += $dayHourArray[$weekDay]; if ($diff >= $hour1) { break; } } $timestamp1 -= 3600 * 24; } return date("Y-m-d", $timestamp1); }