Пример #1
0
//
include_once "../config.inc.php";
include_once APP_INC_PATH . "class.template.php";
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.user.php";
include_once APP_INC_PATH . "class.time_tracking.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("manage/index.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$tpl->assign("type", "time_tracking");
$role_id = Auth::getCurrentRole();
if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) {
    if ($role_id == User::getRoleID('administrator')) {
        $tpl->assign("show_setup_links", true);
    }
    if (@$HTTP_POST_VARS["cat"] == "new") {
        $tpl->assign("result", Time_Tracking::insert());
    } elseif (@$HTTP_POST_VARS["cat"] == "update") {
        $tpl->assign("result", Time_Tracking::update());
    } elseif (@$HTTP_POST_VARS["cat"] == "delete") {
        Time_Tracking::remove();
    }
    if (@$HTTP_GET_VARS["cat"] == "edit") {
        $tpl->assign("info", Time_Tracking::getDetails($HTTP_GET_VARS["id"]));
    }
    $tpl->assign("list", Time_Tracking::getList());
} else {
    $tpl->assign("show_not_allowed_msg", true);
}
$tpl->displayTemplate();