include_once $relPath . 'user_project_info.inc';
require_login();
$title = _("Most Requested Books");
output_header($title);
echo "<br><h2 style='color: {$theme['color_headerbar_bg']};'>{$title}</h2><br>\n";
echo "<p>" . _("You can sign up for notifications in the Event Subscriptions section of the Project Comments page when proofreading.") . "</p>";
echo "<br><br><h3 style='color: {$theme['color_headerbar_bg']};'>" . _("Most Requested Books Being Proofread") . "</h3><br>\n";
create_temporary_project_event_subscription_summary_table();
$comments_url1 = mysql_escape_string("<a href='{$code_url}/project.php?id=");
$comments_url2 = mysql_escape_string("'>");
$comments_url3 = mysql_escape_string("</a>");
// Looking at the other two queries, you might expect the first one to use
// SQL_CONDITION_BRONZE. However, that would exclude the WAITING_FOR_RELEASE
// states, which we apparently want to include here.
// Instead, custom-build a project-state condition that includes the
// WAITING and AVAILABLE states from each round.
$state_condition = '0';
for ($rn = 1; $rn <= MAX_NUM_PAGE_EDITING_ROUNDS; $rn++) {
    $round = get_Round_for_round_number($rn);
    $state_condition .= "\n        OR state='{$round->project_waiting_state}'\n        OR state='{$round->project_available_state}'\n    ";
}
dpsql_dump_themed_query("\n    SELECT\n        CONCAT('{$comments_url1}',projects.projectid,'{$comments_url2}', nameofwork, '{$comments_url3}') AS '" . mysql_real_escape_string(_("Title")) . "', \n        authorsname AS '" . mysql_real_escape_string(_("Author")) . "', \n        genre AS '" . mysql_real_escape_string(_("Genre")) . "',\n        language AS '" . mysql_real_escape_string(_("Language")) . "',\n        pesgbp.nouste_posted AS '" . mysql_real_escape_string(_("Notification Requests")) . "'\n    FROM project_event_subscriptions_grouped_by_project AS pesgbp, projects\n    WHERE pesgbp.projectid = projects.projectid\n        AND ({$state_condition})\n    ORDER BY 5 DESC \n    LIMIT 50\n", 1, DPSQL_SHOW_RANK);
echo "<br>\n";
echo "<br><br><h3 style='color: {$theme['color_headerbar_bg']};'>" . _("Most Requested Books In Post-Processing") . "</h3><br>\n";
//        $post_url1 = mysql_escape_string("<a href='$code_url/project.php?id=");
dpsql_dump_themed_query("\n    SELECT\n        CONCAT('{$comments_url1}',projects.projectid,'{$comments_url2}', nameofwork, '{$comments_url3}') AS '" . mysql_real_escape_string(_("Title")) . "', \n        authorsname AS '" . mysql_real_escape_string(_("Author")) . "', \n        genre AS '" . mysql_real_escape_string(_("Genre")) . "',\n        language AS '" . mysql_real_escape_string(_("Language")) . "',\n        pesgbp.nouste_posted AS '" . mysql_real_escape_string(_("Notification Requests")) . "'\n    FROM project_event_subscriptions_grouped_by_project AS pesgbp, projects\n    WHERE pesgbp.projectid = projects.projectid\n        AND " . SQL_CONDITION_SILVER . "\n    ORDER BY 5 DESC \n    LIMIT 50\n", 1, DPSQL_SHOW_RANK);
echo "<br>\n";
echo "<br><br><h3 style='color: {$theme['color_headerbar_bg']};'>" . _("Most Requested Books Posted to Project Gutenberg") . "</h3><br>\n";
$pg_url1 = mysql_escape_string("<a href='http://www.gutenberg.org/ebooks/");
dpsql_dump_themed_query("\n    SELECT\n        CONCAT('{$pg_url1}',postednum,'{$comments_url2}', nameofwork, '{$comments_url3}') AS '" . mysql_real_escape_string(_("Title")) . "', \n        authorsname AS '" . mysql_real_escape_string(_("Author")) . "', \n        genre AS '" . mysql_real_escape_string(_("Genre")) . "',\n        language AS '" . mysql_real_escape_string(_("Language")) . "',\n        int_level AS '" . mysql_real_escape_string(_("Notification Requests")) . "' \n    FROM projects \n    WHERE " . SQL_CONDITION_GOLD . "\n        AND int_level !=0\n    ORDER BY 5 DESC \n    LIMIT 50\n", 1, DPSQL_SHOW_RANK);
// vim: sw=4 ts=4 expandtab
include_once $relPath . 'prefs_options.inc';
// PRIVACY_*
include_once $relPath . 'theme.inc';
include_once $relPath . 'user_is.inc';
include_once $relPath . 'page_tally.inc';
require_login();
$valid_tally_names = array_keys($page_tally_names);
$tally_name = get_enumerated_param($_GET, 'tally_name', null, $valid_tally_names);
$title = sprintf(_('Top 100 Proofreaders for Round %s'), $tally_name);
output_header($title);
echo "<br><h2>{$title}</h2>\n";
echo "<br>\n";
echo "<br>\n";
// the
$sql_anonymous = mysql_real_escape_string(_("Anonymous"));
if (isset($GLOBALS['pguser'])) {
    // hide names of users who don't want even logged on people to see their names
    $proofreader_expr = "IF(u_privacy = " . PRIVACY_ANONYMOUS . ",'{$sql_anonymous}', username)";
} else {
    // hide names of users who don't want unlogged on people to see their names
    $proofreader_expr = "IF(u_privacy != " . PRIVACY_PUBLIC . ",'{$sql_anonymous}', username)";
}
$subtitle = sprintf(_('Users with the Highest Number of Pages Saved-as-Done in Round %s'), $tally_name);
echo "<h3>{$subtitle}</h3>\n";
$users_tallyboard = new TallyBoard($tally_name, 'U');
list($joined_with_user_page_tallies, $user_page_tally_column) = $users_tallyboard->get_sql_joinery_for_current_tallies('users.u_id');
$sql_upt_column_name = mysql_real_escape_string(sprintf(_("%s Pages Completed"), $tally_name));
dpsql_dump_themed_query("\n        SELECT\n            {$proofreader_expr} AS '" . mysql_real_escape_string(_("Proofreader")) . "',\n            {$user_page_tally_column} AS '{$sql_upt_column_name}'\n        FROM users {$joined_with_user_page_tallies}\n        WHERE {$user_page_tally_column} > 0\n        ORDER BY 2 DESC, 1 ASC\n        LIMIT 100\n    ", 1, DPSQL_SHOW_RANK);
echo "<br>\n";
echo "<br>\n";
// vim: sw=4 ts=4 expandtab
Example #3
0
include_once $relPath . 'base.inc';
include_once $relPath . 'dpsql.inc';
include_once $relPath . 'project_states.inc';
include_once $relPath . 'theme.inc';
require_login();
$title = _("Post-Processing Statistics");
output_header($title);
echo "<br><br><h2>{$title}</h2><br>\n";
echo "<a href='projects_Xed_graphs.php?which=PPd'>" . _("Projects PPd Graphs") . "</a><br>";
echo "<a href='PP_unknown.php'>" . _("Books with Mystery PPers") . "</a>";
echo "<br>\n";
echo "<h3>" . _("Total Projects Post-Processed Since Statistics were Kept") . "</h3>\n";
$psd = get_project_status_descriptor('PPd');
dpsql_dump_themed_query("\n    SELECT\n        SUM(num_projects) as '" . mysql_real_escape_string(_("Total Projects Post-Processed So Far")) . "'\n    FROM project_state_stats WHERE {$psd->state_selector}\n    GROUP BY date ORDER BY date DESC LIMIT 1\n");
echo "<br>\n";
echo "<br>\n";
echo "<h3>" . _("Number of Distinct Post-Processors") . "</h3>\n";
dpsql_dump_themed_query("\n    SELECT\n        count(distinct postproofer) as '" . mysql_real_escape_string(_("Different PPers")) . "'\n    FROM projects\n");
echo "<br>\n";
echo "<h3>" . _("Most Prolific Post-Processors") . "</h3>\n";
echo "<h4>" . _("(Number of Projects Finished PPing)") . "</h4>\n";
$psd = get_project_status_descriptor('PPd');
dpsql_dump_themed_query("\n    SELECT\n        postproofer as '" . mysql_real_escape_string(_("PPer")) . "',\n        count(*) as '" . mysql_real_escape_string(_("Projects Finished PPing")) . "',\n        cast(sum(n_pages) as unsigned) as '" . mysql_real_escape_string(_("Pages Finished PPing")) . "'\n    FROM projects\n    WHERE {$psd->state_selector}\n        AND postproofer is not null\n    GROUP BY postproofer\n    ORDER BY 2 DESC\n", 1, DPSQL_SHOW_RANK);
echo "<br>\n";
echo "<h3>" . _("Most Prolific Post-Processors") . "</h3>\n";
echo "<h4>" . _("(Number of Projects Posted to PG)") . "</h4>\n";
$psd = get_project_status_descriptor('posted');
dpsql_dump_themed_query("\n    SELECT\n        postproofer as '" . mysql_real_escape_string(_("PPer")) . "',\n        count(*) as '" . mysql_real_escape_string(_("Projects Posted to PG")) . "',\n        cast(sum(n_pages) as unsigned) as '" . mysql_real_escape_string(_("Pages Posted to PG")) . "'\n    FROM projects\n    WHERE {$psd->state_selector}\n    AND postproofer is not null\n    GROUP BY postproofer\n    ORDER BY 2 DESC\n", 1, DPSQL_SHOW_RANK);
echo "<br>\n";
echo "<br>\n";
// vim: sw=4 ts=4 expandtab
    echo "<br>\n";
} else {
    $qd = mysql_fetch_object(mysql_query("\n        SELECT *\n        FROM queue_defns\n        WHERE round_id='{$round_id}' AND name='{$name}'\n    "));
    if (!$qd) {
        die(html_safe("No such release queue '{$name}' in {$round_id}."));
    }
    $cooked_project_selector = cook_project_selector($qd->project_selector);
    $comment = $qd->comment;
    //// TRANSLATORS: %s is the name of this release queue.
    $title = sprintf(_("\"%s\" Release Queue"), html_safe($name));
    $title = preg_replace('/(\\\\)/', "", $title);
    // Unescape apostrophes, etc.
    // Suppress stats since this page is very wide
    output_header($title, NO_STATSBAR);
    echo "<br><h2>{$title}</h2>";
    if ($user_can_see_queue_settings) {
        echo "<h4>", _("project_selector"), ": {$qd->project_selector}</h4>\n\n";
        if ($cooked_project_selector != $qd->project_selector) {
            echo "({$cooked_project_selector})\n\n";
        }
        echo "<h4>{$comment}</h4>\n";
    }
    // Add Back to to Release Queues link
    echo "<p><a href='" . $code_url . "/stats/release_queue.php?round_id={$round_id}'>" . _("Back to Release Queues") . "</a></p>\n";
    $comments_url1 = mysql_escape_string("<a href='{$code_url}/project.php?id=");
    $comments_url2 = mysql_escape_string("'>");
    $comments_url3 = mysql_escape_string("</a>");
    dpsql_dump_themed_query("\n        SELECT\n\n            concat('{$comments_url1}',projectID,'{$comments_url2}', nameofwork, '{$comments_url3}') as '" . mysql_real_escape_string(_("Name of Work")) . "',\n            authorsname as '" . mysql_real_escape_string(_("Author's Name")) . "',\n            language    as '" . mysql_real_escape_string(_("Language")) . "',\n            genre       as '" . mysql_real_escape_string(_("Genre")) . "',\n            difficulty  as '" . mysql_real_escape_string(_("Difficulty")) . "',\n            username    as '" . mysql_real_escape_string(_("Project Manager")) . "',\n            FROM_UNIXTIME(modifieddate) as '" . mysql_real_escape_string(_("Date Last Modified")) . "',\n            IF(ISNULL(project_holds.state),'&nbsp;','Y') AS '" . mysql_real_escape_string(_("Hold?")) . "'\n        FROM projects\n            LEFT OUTER JOIN project_holds USING (projectid, state)\n        WHERE ({$cooked_project_selector})\n            AND state='{$round->project_waiting_state}'\n        ORDER BY modifieddate, nameofwork\n    ");
    echo "<br>\n";
}
// vim: sw=4 ts=4 expandtab
function show_months_with_most_days_over($n)
{
    global $tally_name, $curr_year_month;
    $sub_title = sprintf(_('Months with most days over %s pages'), number_format($n));
    echo "<h3>{$sub_title}</h3>\n";
    dpsql_dump_themed_query(select_from_site_past_tallies_and_goals($tally_name, "SELECT\n                {year_month} as '" . mysql_real_escape_string(_("Month")) . "',\n                count(*) as '" . mysql_real_escape_string(_("Number of Days")) . "',\n                IF({year_month} = '{$curr_year_month}', '******',' ') as '" . mysql_real_escape_string(_("This Month?")) . "'", "WHERE tally_delta >= {$n}", "GROUP BY 1", "ORDER BY 2 DESC", "LIMIT 10"), 1, DPSQL_SHOW_RANK);
    echo "<br>\n";
}
Example #6
0
<?php

$relPath = '../pinc/';
include_once $relPath . 'base.inc';
include_once $relPath . 'dpsql.inc';
include_once $relPath . 'project_states.inc';
include_once $relPath . 'theme.inc';
require_login();
$title = _("Post-Processing Verification Statistics");
output_header($title);
echo "<br><br><h2>{$title}</h2>\n";
echo "<br>\n";
echo "<h3>" . _("Post-Processing Verifiers") . "</h3>\n";
echo "<h4>" . _("(Number of Projects Posted to PG)") . "</h4>\n";
$psd = get_project_status_descriptor('posted');
dpsql_dump_themed_query("\n    SELECT checkedoutby as '" . mysql_real_escape_string(_("PPVer")) . "', \n        count(*) as '" . mysql_real_escape_string(_("Projects PPVd")) . "'\n    FROM  `projects` , usersettings\n    WHERE 1  AND checkedoutby != postproofer AND {$psd->state_selector}\n        and checkedoutby = usersettings.username \n        and setting = 'PPV.access' and value = 'yes' \n    GROUP  BY 1 \n    ORDER  BY 2  DESC ", 1, DPSQL_SHOW_RANK);
echo "<br>\n";
echo _("Note that the above figures are as accurate as possible within the bounds of the current database structure");
echo "<br>\n";
// vim: sw=4 ts=4 expandtab
Example #7
0
<?php

$relPath = '../pinc/';
include_once $relPath . 'base.inc';
include_once $relPath . 'dpsql.inc';
include_once $relPath . 'project_states.inc';
include_once $relPath . 'theme.inc';
require_login();
$title = _("Project Manager Statistics");
output_header($title);
echo "<br><h2>{$title}</h2>\n";
echo "<br>\n";
echo "<h3>" . _("Number of Distinct Project Managers") . "</h3>\n";
dpsql_dump_themed_query("\n    SELECT\n        count(distinct username) as '" . mysql_real_escape_string(_("Different PMs")) . "'\n    FROM projects\n", 0, DPSQL_NO_RANK, DPSQL_NO_RIGHT_ALIGN_INTS);
echo "<br>\n";
echo "<h3>" . _("Most Prolific Project Managers") . "</h3>\n";
echo "<h4>" . _("(Number of Projects Created)") . "</h4>\n";
$psd = get_project_status_descriptor('created');
dpsql_dump_themed_query("\n    SELECT\n        username as '" . mysql_real_escape_string(_("PM")) . "',\n        count(*) as '" . mysql_real_escape_string(_("Projects Created")) . "'\n    FROM projects\n    WHERE {$psd->state_selector}\n    GROUP BY username\n    ORDER BY 2 DESC\n", 1, DPSQL_SHOW_RANK);
echo "<br>\n";
echo "<h3>" . _("Most Prolific Project Managers") . "</h3>\n";
echo "<h4>" . _("(Number of Projects Posted to PG)") . "</h4>\n";
$psd = get_project_status_descriptor('posted');
dpsql_dump_themed_query("\n    SELECT\n        username as '" . mysql_real_escape_string(_("PM")) . "',\n        count(*) as '" . mysql_real_escape_string(_("Projects Posted to PG")) . "'\n    FROM projects\n    WHERE {$psd->state_selector}\n    GROUP BY username\n    ORDER BY 2 DESC\n", 1, DPSQL_SHOW_RANK);
echo "<br>\n";
echo "<br>\n";
// vim: sw=4 ts=4 expandtab