if (isset($_GET['send'])) { $action = SEND_OUT_REPORTCARD; } else { $action = SHOW_BLANK_ENTRY_FORM; } } $projectid = validate_projectID('project', @$_REQUEST['project']); $project = new Project($projectid); $nameofwork = $project->nameofwork; $authorsname = $project->authorsname; $language = $project->language; $difficulty_level = $project->difficulty; $pages = $project->n_pages; $subdate = date('jS \\o\\f F, Y'); // number of books post-processed by this PPer (including this one). $psd = get_project_status_descriptor('PPd'); $result = mysql_query("\n SELECT COUNT(*) AS num_post_processed\n FROM projects\n WHERE {$psd->state_selector}\n AND postproofer = '{$project->postproofer}'\n"); $number_post_processed = mysql_result($result, 0, "num_post_processed"); mysql_free_result($result); // Compute the date of PP upload. We must take into account cases when // the project is being sent back to the PPer, and also when a PPer // takes back a project from the PPV pool before a PPV has picked // up the project. // // So, the date we are looking for is the latest transition to PPV.avail // before the earliest transition from PPV.avail to PPV.checked out... $pp_date = ""; // earliest transition from PPV.avail to PPV.checked out $result = mysql_query("SELECT timestamp FROM project_events\n WHERE projectid = '{$projectid}'\n AND event_type = 'transition'\n AND details1 = '" . PROJ_POST_SECOND_AVAILABLE . "'\n AND details2 = '" . PROJ_POST_SECOND_CHECKED_OUT . "'\n ORDER BY timestamp ASC\n LIMIT 1"); if (mysql_num_rows($result) != 0) { $earliest_in_ppv = mysql_result($result, 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
<?php $relPath = "./../../pinc/"; include_once $relPath . 'base.inc'; include_once $relPath . 'dpsql.inc'; include_once $relPath . 'project_states.inc'; include_once 'common.inc'; $which = get_enumerated_param($_GET, 'which', null, $project_status_descriptors); // Initialize the graph before anything else. // This makes use of the jpgraph cache if enabled. // Argument to init_projects_graph is the cache timeout in minutes. $graph = init_projects_graph(60); // Create "projects Xed per day" graph for current month $psd = get_project_status_descriptor($which); $todaysTimeStamp = time(); $year = date("Y", $todaysTimeStamp); $month = date("m", $todaysTimeStamp); $monthVar = _(date("F", $todaysTimeStamp)); $timeframe = "{$monthVar} {$year}"; $maxday = get_number_of_days_in_current_month(); //query db and put results into arrays $result = mysql_query("\n SELECT day, SUM(num_projects)\n FROM project_state_stats\n WHERE month = '{$month}' AND year = '{$year}' AND ({$psd->state_selector})\n GROUP BY day\n ORDER BY day\n"); list($datax, $y_cumulative) = dpsql_fetch_columns($result); $datay1 = array_successive_differences($y_cumulative); // Pad out the rest of the month for ($i = count($datay1); $i < $maxday; $i++) { $datax[$i] = $i + 1; $datay1[$i] = 0; } draw_projects_graph($graph, $datax, $datay1, 'increments', $psd->color, "{$psd->per_day_title} ({$timeframe})"); // vim: sw=4 ts=4 expandtab
$colspecs = array('title' => array('label' => _('Title'), 'sql' => 'nameofwork'), 'manager' => array('label' => _('Project Manager'), 'sql' => 'username'), 'state' => array('label' => _('Current State'), 'sql' => sql_collater_for_project_state('state'))); // By default, order by state, descending. $default_order_col = $order_col = 'state'; $default_order_dir = $order_dir = 'D'; if ($sorting == 'reserved') { list($order_col, $order_dir) = get_sort_col_and_dir(); } $sql_order = sql_order_spec($order_col, $order_dir); if ($order_col != $default_order_col) { // Add the default ordering as a secondary ordering. $sql_order .= ", " . sql_order_spec($default_order_col, $default_order_dir); } // We're interested in projects that have been created, but haven't *finished* // being proofread. $psd = get_project_status_descriptor('created'); $antipsd = get_project_status_descriptor('proofed'); $query = "\n\tSELECT\n projectid,\n nameofwork,\n username,\n\t\t state\n\tFROM projects\n\tWHERE checkedoutby='{$username}'\n\t\tAND {$psd->state_selector}\n\t\tAND NOT {$antipsd->state_selector}\n\tORDER BY {$sql_order}"; $result = dpsql_query($query); if (mysql_num_rows($result) > 0) { echo "<a name='reserved' id='reserved'></a><h2>{$heading_reserved}</h2>\n"; echo sprintf("(%d projects)", mysql_num_rows($result)); echo "<table border='1'>"; show_headings($colspecs, 'reserved', $username); while ($row = mysql_fetch_object($result)) { echo "<tr>\n"; echo "<td>"; echo "<a href='{$code_url}/project.php?id={$row->projectid}'>{$row->nameofwork}</a>"; echo "</td>\n"; echo "<td align='center'>"; echo $row->username; echo "</td>\n";