示例#1
0
文件: holidays.php 项目: hughnguy/php
//============================================================================================
// Load the page requested by the user
//============================================================================================
if (!isset($_GET['page'])) {
    $render = true;
    $thisPage = "Global";
    $services = $hol->listServices();
    $hlist = $hol->listHolidays();
    $l10n->addResource(__DIR__ . '/l10n/holidays.json');
    $l10n->localizeArray($services, 'service_name');
    $l10n->localizeArray($hlist, 'emp_service');
    $l10n->localizeArray($hlist, 'holiday_name');
    $l10n->localizeArray($hlist, 'service_name');
    $viewFile = 'views/holidays.php';
} elseif ($_GET['page'] === "add") {
    $hol->addHoliday($_POST);
    $loggers['audit']->info("Global event added");
} elseif ($_GET['page'] === "delete") {
    $hol->deleteEvent($_POST['event_id']);
    $loggers['audit']->info("Global event {$_POST['event_id']} deleted");
}
/**
 * View rendering
 */
if (isset($render) && $render) {
    require FS_PHP . '/header.php';
    require FS_PHP . '/nav.php';
    if (isset($viewFile) && file_exists($viewFile)) {
        require $viewFile;
    } else {
        require FS_PHP . '/error.php';