Example #1
0
 function page_output()
 {
     // get selected employee
     $this->employeeid = @security_script_input('/^[0-9]*$/', $_GET["employeeid"]);
     if ($this->employeeid) {
         // save to session vars
         $_SESSION["form"]["timereg"]["employeeid"] = $this->employeeid;
     } else {
         // load from session vars
         if (isset($_SESSION["form"]["timereg"]["employeeid"])) {
             $this->employeeid = $_SESSION["form"]["timereg"]["employeeid"];
         }
     }
     // get selected date
     $this->date = @security_script_input('/^\\S*$/', $_GET["date"]);
     if (!$this->date) {
         // try alternative input syntax
         $this->date = @security_script_input_predefined("date", $_GET["date_yyyy"] . "-" . $_GET["date_mm"] . "-" . $_GET["date_dd"]);
         if ($this->date == "error") {
             $this->date = NULL;
         }
     }
     if ($this->date) {
         // save to session vars
         $_SESSION["timereg"]["date"] = $this->date;
     } else {
         if ($_SESSION["timereg"]["date"]) {
             // load from session vars
             $this->date = $_SESSION["timereg"]["date"];
         } else {
             // use today's date
             $this->date = date("Y-m-d");
         }
     }
     $this->date_split = explode("-", $this->date);
     // define the navigiation menu
     $this->obj_menu_nav = new menu_nav();
     $this->obj_menu_nav->add_item("Weekview", "page=timekeeping/timereg.php&year=" . time_calculate_yearnum($this->date) . "&weekofyear=" . time_calculate_weeknum($this->date) . "");
     $this->obj_menu_nav->add_item("Day View", "page=timekeeping/timereg-day.php&date=" . $this->date . "", TRUE);
     // get future booking config option
     $this->config_timesheet_booktofuture = sql_get_singlevalue("SELECT value FROM config WHERE name='TIMESHEET_BOOKTOFUTURE'");
 }
Example #2
0
 function page_output()
 {
     // get selected employee
     $this->employeeid = @security_script_input('/^[0-9]*$/', $_GET["employeeid"]);
     if ($this->employeeid) {
         // save to session vars
         $_SESSION["form"]["timereg"]["employeeid"] = $this->employeeid;
     } else {
         // load from session vars
         if (isset($_SESSION["form"]["timereg"]["employeeid"]) && $_SESSION["form"]["timereg"]["employeeid"] != NULL) {
             $this->employeeid = $_SESSION["form"]["timereg"]["employeeid"];
         }
     }
     // get the chosen year + week
     $this->date_selected_year = @security_script_input('/^[0-9]*$/', $_GET["year"]);
     $this->date_selected_weekofyear = @security_script_input('/^[0-9]*$/', $_GET["weekofyear"]);
     if (!$this->date_selected_year) {
         if (!empty($_SESSION["timereg"]["year"])) {
             $this->date_selected_year = $_SESSION["timereg"]["year"];
         } else {
             $this->date_selected_year = date("Y");
         }
     }
     if (!$this->date_selected_weekofyear) {
         if (!empty($_SESSION["timereg"]["weekofyear"])) {
             $this->date_selected_weekofyear = $_SESSION["timereg"]["weekofyear"];
         } else {
             $this->date_selected_weekofyear = time_calculate_weeknum();
         }
     }
     // save to session vars
     $_SESSION["timereg"]["year"] = $this->date_selected_year;
     $_SESSION["timereg"]["weekofyear"] = $this->date_selected_weekofyear;
     // get future booking config option
     $this->config_timesheet_booktofuture = sql_get_singlevalue("SELECT value FROM config WHERE name='TIMESHEET_BOOKTOFUTURE'");
 }