Пример #1
0
function export_file_logs($project, $span, $who)
{
    $eol = "\n";
    $sql_file = filedownload_logs_extract($project, $span, $who);
    $col_list_file = array('time', 'user', 'email', 'title', 'local_time');
    $file_title = array('time' => $GLOBALS['Language']->getText('project_stats_source_code_access_utils', 'file_download'), 'user' => '', 'email' => '', 'title' => '', 'local_time' => '');
    $lbl_list_file = array('time' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'time'), 'user' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'user'), 'email' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'email'), 'title' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'file'), 'local_time' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'local_time'));
    $result_file = db_query($sql_file);
    $rows_file = db_numrows($result_file);
    if ($result_file && $rows_file > 0) {
        // Build csv for files access logs
        echo build_csv_header($col_list_file, $file_title) . $eol;
        echo build_csv_header($col_list_file, $lbl_list_file) . $eol;
        while ($arr_file = db_fetch_array($result_file)) {
            prepare_access_logs_record($project->getGroupId(), $arr_file);
            echo build_csv_record($col_list_file, $arr_file) . $eol;
        }
        echo build_csv_header($col_list_file, array()) . $eol;
    }
    $eol = "\n";
    $sql = frs_logs_extract($project, $span, $who);
    $col_list = array('time', 'type', 'user', 'email', 'title', 'local_time');
    $title = array('time' => $GLOBALS['Language']->getText('project_stats_source_code_access_utils', 'frs_actions'), 'type' => '', 'user' => '', 'email' => '', 'title' => '', 'local_time' => '');
    $lbl_list = array('time' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'time'), 'type' => 'Action', 'user' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'user'), 'email' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'email'), 'title' => $GLOBALS['Language']->getText('project_stats_source_code_access_utils', 'frs_elements'), 'local_time' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'local_time'));
    $result = db_query($sql);
    $rows = db_numrows($result);
    if ($result && $rows > 0) {
        // Build csv for files access logs
        echo build_csv_header($col_list, $title) . $eol;
        echo build_csv_header($col_list, $lbl_list) . $eol;
        while ($arr = db_fetch_array($result)) {
            prepare_access_logs_record($project->getGroupId(), $arr);
            echo build_csv_record($col_list, $arr) . $eol;
        }
        echo build_csv_header($col_list, array()) . $eol;
    }
}
function filedownload_logs_daily($project, $span = 7, $who = "allusers")
{
    // check first if service is used by this project
    // if service not used return immediately
    if (!$project->usesFile()) {
        print '<P><B><U>' . $GLOBALS['Language']->getText('project_stats_source_code_access_utils', 'service_disabled', $GLOBALS['Language']->getText('project_stats_source_code_access_utils', 'file_download')) . '</U></B>';
        return;
    }
    $sql = filedownload_logs_extract($project, $span, $who);
    logs_display($sql, $span, $GLOBALS['Language']->getText('project_stats_source_code_access_utils', 'files'), $GLOBALS['Language']->getText('project_stats_source_code_access_utils', 'file_download'));
    $sql = frs_logs_extract($project, $span, $who);
    logs_display($sql, $span, $GLOBALS['Language']->getText('project_stats_source_code_access_utils', 'frs_elements'), $GLOBALS['Language']->getText('project_stats_source_code_access_utils', 'frs_actions'));
}