= $currentYear) : if ($f_holidays != "") : TA("B"); // To reach more performance, first delete all entries of the year and then store the new list deleteStmt("publicholiday","ph_year = '" . $f_year . "' AND hq_id = '" . $hq_id . "'"); // Iterate all months for ($i_month = 1; $i_month <= 12; $i_month++) : // Get number of days of the month $numOfDays = daysPerMonth($f_year, $i_month); // Iterate all days of the current month for ($i_day = 1; $i_day <= $numOfDays; $i_day++) : // Search for the value in "$f_holidays" and get the key (index) $j = array_search($i_month . "_" . $i_day, $f_holidays); if (!($j === FALSE)) : // insert new public holiday list ($nameOfHoliday) = getHttpVars(array("f_". $i_month . "_" . $i_day)); $tmpFields = array("hq_id", $hq_id, "ph_year", $f_year, "ph_month", $i_month, "ph_day", $i_day, "ph_name", $nameOfHoliday); insertStmt("publicholiday",$tmpFields); endif; endfor; endfor; TA("C"); TA("E"); else : $statusMessage = getLngt("In der Vergangenheit liegende Tage werden nicht gespeichert!"); endif; else : $statusMessage = getLngt("Vergangene Jahre können nicht geändert werden!"); endif; endif; // *** END *************** // Get all public holidays of the specified year if (TRUE) : $sqlquery = "SELECT ph.ph_id, ph.ph_year, ph.ph_month, ph.ph_day, ph.ph_time_from, ph.ph_time_to, ph.ph_name" . " FROM publicholiday AS ph" . " WHERE hq_id = '" . $hq_id . "' AND ph.ph_year = '" . $f_year . "'" . " ORDER BY ph.ph_month, ph.ph_day, ph.ph_time_from"; $result = $db->dbQ($sqlquery); // Get only first row of the result set $row = $result->fetch_assoc(); // If activated, load data for initialization if ($f_act == "load" && $f_year2 != "") : $sqlquery2 = "SELECT ph.ph_id, ph.ph_year, ph.ph_month, ph.ph_day, ph.ph_time_from, ph.ph_time_to, ph.ph_name" . " FROM publicholiday AS ph" . " WHERE hq_id = '" . $hq_id . "' AND ph.ph_year = '" . $f_year2 . "'" . " ORDER BY ph.ph_month, ph.ph_day, ph.ph_time_from"; $result2 = $db->dbQ($sqlquery2); // Get only first row of the result set $row2 = $result2->fetch_assoc(); endif; $output = ""; // Define anchor links $monthAnchorLinks = getMonthAnchorLinks(); // Iterate all months for ($i_month = 1; $i_month <= 12; $i_month++) : // Title of the month $output .= "\n"; $output .= "" . monthName($i_month) . "\n"; $output .= "

"; $output .= defineButtonType10(getLngt("Speichern"), "action_save", "finishPage('save','Wollen Sie die Einträge speichern?');", "100", "left", "3"); $output .= "
" . $monthAnchorLinks . "\n"; $output .= "\n"; // Get number of days of the month $numOfDays = daysPerMonth($f_year, $i_month); // Iterate all days of the current month for ($i_day = 1; $i_day <= $numOfDays; $i_day++) : $output .= "\n"; $output .= " " . $i_day . ".\n"; $output .= " " . weekDayNameMapping(getDateTime("format",array("0","0","0",$i_month,$i_day,$f_year),"l"),"1") . "\n"; $isChecked = ""; $isDisabled = ""; $nameOfHoliday = ""; // Disable fields if date is in the past because they should not to be modified if ($f_year < $currentYear || ($f_year == $currentYear && $i_month < $currentMonth) || ($f_year == $currentYear && $i_month == $currentMonth && $i_day <= $currentDay)) : $isDisabled = " disabled"; endif; // Check single values according to the database result if ($i_month == $row["ph_month"] && $i_day == $row["ph_day"]) : // Get values of the current row $isChecked = " checked"; $nameOfHoliday = $row["ph_name"]; // Get next row $row = $result->fetch_assoc(); if (!is_array($row)) : $row = array(); mcArrIsSet($row, "ph_month"); mcArrIsSet($row, "ph_day"); endif; endif; // If initialization mode is active AND NOT disabled, check single values according to the database result of the second result if ($f_act == "load" && $f_year2 != "") : if ($i_month == $row2["ph_month"] && $i_day == $row2["ph_day"]) : // Get values of the current row if (!$isDisabled && !$isChecked) : $isChecked = " checked"; $nameOfHoliday = $row2["ph_name"]; endif; // Get next row $row2 = $result2->fetch_assoc(); if (!is_array($row2)) : $row2 = array(); mcArrIsSet($row2, "ph_month"); mcArrIsSet($row2, "ph_day"); endif; endif; endif; // Show enabled/disabled checkbox according to an existing db-entry $output .= " \n"; // Optional name of the public holiday $output .= " \n"; $output .= "\n"; endfor; endfor; $result->free(); endif; // Get all years distinct if (TRUE) : $sqlquery = "SELECT DISTINCT ph.ph_year" . " FROM publicholiday AS ph" . " WHERE hq_id = '" . $hq_id . "'" . " ORDER BY ph.ph_year"; $result = $db->dbQ($sqlquery); $currentYearInList = FALSE; $nextYearInList = FALSE; // First pulldown for selecting the year to be displayed $output2 .= "" . getLngt("Auswahl Jahr") . "  "; $output2 .= "\n"; $output3 .= " \n"; // Default option for initialization while ($row = $result->fetch_assoc()): $isSelected = ""; if ($f_year == $row["ph_year"]) : $isSelected = " selected"; endif; $output2 .= " \n"; if ($currentYear == $row["ph_year"]) : $currentYearInList = TRUE; endif; if ($currentYear + 1 == $row["ph_year"]) : $nextYearInList = TRUE; endif; // Second pulldown if ($row["ph_year"] < $f_year) : $isSelected = ""; if ($f_year2 == $row["ph_year"]) : $isSelected = " selected"; endif; $output3 .= " \n"; endif; endwhile; // add option for the current year if necessary if (!$currentYearInList) : $isSelected = ""; if ($f_year == $currentYear) : $isSelected = " selected"; endif; $output2 .= " \n"; endif; // add option for the next year if necessary if (!$nextYearInList) : $isSelected = ""; if ($f_year == $currentYear + 1) : $isSelected = " selected"; endif; $output2 .= " \n"; endif; // First pulldown $output2 .= "\n"; // Second pulldown $output3 .= "\n"; $result->free(); endif; // Only for output $title = ""; if ($f_year == "0") : $title .= getLngt("(Default)"); else : $title .= $f_year; endif; ?> <?php echo $pageTitel ?>