Exemplo n.º 1
0
        $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)) {
            foreach ($ws as $kw => $vw) {
                echo "{$kw}\n";
            }
        }
        break;
    case 'fetch':
        $w_login = value_from_POST_GET('login');
        $w_week = value_from_POST_GET('week');
        $w_year = value_from_POST_GET('year');
        if (userReportExists($w_login, $w_year, $w_week)) {
            echo "MSG=reports from {$w_login} (week {$w_week} of year {$w_year})\n";
            echo userReportContent($w_login, $w_year, $w_week);
        } else {
            echo "ERR=NotFound: report for {$w_login}, {$w_week}, {$w_year}.\n";
        }
        break;
    case 'none':
    default:
        echo "ERR=UnknownOperation: {$operation}\n";
        break;
}
echo '</pre>';
<?php

require INC_DIR . "reporting_lib.inc";
require LIB_DIR . "date.inc";
include INC_DIR . "layout_helper.inc";
$current_year = currentYear();
// Get value from _POST or _GET
$selected_user = value_from_POST_GET('selected_user');
$selected_year = value_from_POST_GET('selected_year', $current_year);
// Assign value for Display
$DIS_Application = "Browse User Reports";
$DIS_ListYears = array();
$reporting_dirs = listOfKnownYear();
$listUserReports = array();
$weeks_range = range(1, 52);
while (list($k_week, $v) = each($weeks_range)) {
    if (strlen($k_week) < 2) {
        $k_week = '0' . $k_week;
    }
    if (userReportExists($selected_user, $selected_year, $k_week)) {
        $ufn = userFilename($selected_user, $selected_year, $k_week);
        $listUserReports[$k_week] = ContentOfFile($ufn);
    }
}
krsort($listUserReports);
$DIS_AllUsers = active_users() + inactive_users();
@($DIS_PostUsername_HTML_SELECT = userList_HTML_SELECT('selected_user', $DIS_AllUsers, 'Select username', $selected_user));