$report_exists = userReportExists($w_login, $w_year, $w_week); if (!$report_exists || $is_overwriting) { $w_text = stripslashes($w_text); postUserReport($w_login, $w_year, $w_week, $w_text); if ($report_exists && $is_overwriting) { echo "MSG=report {$w_login}, {$w_week}, {$w_year} : overwrited\n"; } else { echo "MSG=report {$w_login}, {$w_week}, {$w_year} : posted\n"; } } elseif ($report_exists && !$is_overwriting) { echo "ERR=reportExists: for {$w_login}, {$w_week}, {$w_year} : not overwrited\n"; } break; case 'years': echo "MSG=known years\n"; $ys = listOfKnownYear(); foreach ($ys as $ky => $vy) { echo $ky . "\n"; } break; case 'weeks': $w_year = value_from_POST_GET('year'); $w_login = value_from_POST_GET('login'); if (isset($w_login)) { echo "MSG=reports from {$w_login} (year {$w_year})\n"; $ws = listOfWeekFilesForYearAndUserByWeekNumber($w_year, $w_login); } else { echo "MSG=reports (year {$w_year})\n"; $ws = listOfWeekFilesForYearByWeekNumber($w_year); } if (!empty($ws)) {
$DIS_Application = "Browse Reports"; $DIS_ListYears = array(); // year => [year] // [weeks] => [ // [week] => [file] // [first_day] // [last_day] // [last_modified] // [status] // [style] // [nota] // if (isset($year)) { $reporting_dirs = array($year => yearDirname($year)); } else { $reporting_dirs = listOfKnownYear(); } $current_weeknumber = currentWeekNumber(); $current_year = currentYear(); while (list($k_year, $v_dirpath) = each($reporting_dirs)) { if (!isset($selected_year)) { $selected_year = $k_year; } if ($k_year == $selected_year) { $TMP_Year = array(); $TMP_Year['year'] = $k_year; $week_files = listOfWeekFilesInDirByWeekNumber($v_dirpath); if (count($week_files) > 0) { $TMP_Weeks = array(); while (list($k_week, $v_file) = each($week_files)) { $TMP_ThisWeek = array();
removeReportingWeekFileFor($year, $week); $DIS_AdminMessage .= ob_get_contents(); ob_end_clean(); $fname = weekFilename($year, $week); if (!file_exists($fname)) { $DIS_AdminMessage .= "File [{$fname}] removed\n"; } else { $DIS_AdminMessage .= "File [{$fname}] not removed: ERROR\n"; } } break; case $task_nothing: $DIS_AdminMessage = "Be careful with what you do ...<br/>\n"; break; default: $DIS_AdminMessage = "Task [{$task}] not yet implemented ...<br/>\n"; } $DIS_Weeks = array(); $weeks = listOfWeekFilesForYearByWeekNumber($year); while (list($k_week, $v_file) = each($weeks)) { $TMP_Week = array(); $TMP_Week['week'] = $k_week; if (!is_writeable($v_file)) { $TMP_Week['status'] = "Locked"; } else { $TMP_Week['status'] = ""; } $DIS_Weeks[$k_week] = $TMP_Week; } $DIS_Years = listOfKnownYear(); }