function GraphResult($result, $title) { // Takes a database result set. // The first column should be the name, // and the second column should be the values $rows = mysql_num_rows($result); if (!$result || $rows < 1) { echo "None Found.\n"; } else { for ($j = 0; $j < mysql_num_rows($result); $j++) { if (mysql_result($result, $j, 0) != "" && mysql_result($result, $j, 1) != "") { $names[$j] = mysql_result($result, $j, 0); $values[$j] = mysql_result($result, $j, 1); } } //This is another function detailed below GraphIt($names, $values, $title); } }
$sql = "SELECT count(*) " . "FROM patch " . "WHERE open_date >= {$start} " . "AND open_date <= {$end} " . "AND group_id='{$group_id}'"; $result = db_query($sql); $names[$counter - 1] = date("Y-m-d", $start) . " to " . date("Y-m-d", $end); $values[$counter - 1] = db_result($result, 0, 0); } GraphIt($names, $values, "Number of Patches Submitted"); echo "<P>"; for ($counter = 1; $counter <= $span; $counter++) { $start = $time_now - $counter * $sub_duration; $end = $time_now - ($counter - 1) * $sub_duration; $sql = "SELECT count(*) " . "FROM patch " . "WHERE open_date <= {$end} " . "AND (close_date >= {$end} OR close_date < 1 OR close_date is null) " . "AND group_id='{$group_id}'"; $result = db_query($sql); $names[$counter - 1] = date("Y-m-d", $end); $values[$counter - 1] = db_result($result, 0, 0); } GraphIt($names, $values, "Number of Patches Still Open"); echo "<P>"; patch_footer(array()); } else { if ($what == "category") { $sql1 = "SELECT patch_category.category_name AS Category, count(*) AS Count " . "FROM patch_category,patch " . "WHERE patch_category.patch_category_id=patch.patch_category_id " . "AND patch.patch_status_id = '1' " . "AND patch.group_id='{$group_id}' " . $period_clause . "GROUP BY Category"; $sql2 = "SELECT patch_category.category_name AS Category, count(*) AS Count " . "FROM patch_category,patch " . "WHERE patch_category.patch_category_id=patch.patch_category_id " . "AND patch.patch_status_id <> '3' " . "AND patch.group_id='{$group_id}' " . $period_clause . "GROUP BY Category"; patch_quick_report($group_id, "Patches By Category", "Open Patches By Category", $sql1, "All Patches By Category", $sql2); } else { if ($what == "tech") { $sql1 = "SELECT users.user_name AS Technician, count(*) AS Count " . "FROM users,patch " . "WHERE users.user_id=patch.assigned_to " . "AND patch.patch_status_id = '1' " . "AND patch.group_id='{$group_id}' " . $period_clause . "GROUP BY Technician"; $sql2 = "SELECT users.user_name AS Technician, count(*) AS Count " . "FROM users,patch " . "WHERE users.user_id=patch.assigned_to " . "AND patch.patch_status_id <> '3' " . "AND patch.group_id='{$group_id}' " . $period_clause . "GROUP BY Technician"; patch_quick_report($group_id, "Patches By Technician", "Open Patches By Technician", $sql1, "All Patches By Technician", $sql2); } else { exit_missing_param(); }
/** * stats_sf_stats() - Get SourceForge stats */ function stats_sf_stats() { /* pages/day */ $sql = "SELECT * FROM stats_agg_pages_by_day"; $result = db_query($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { echo '<h1>Stats Problem</h1>'; echo db_error(); } else { $j = 0; for ($i = 0; $i < $rows; $i++) { //echo $i." - ".($i%7)."<br />"; if ($i % 7 == 0) { //echo $i."<br />"; //increment the new weekly array //and set the beginning date for this week $j++; $name_string[$j] = db_result($result, $i, 'day'); $vals[$j] = 0; } //add today to the week $vals[$j] += db_result($result, $i, 'count'); } $j++; $vals[$j] = ''; $name_string[$j] = ''; GraphIt($name_string, $vals, 'Page Views By Week'); } echo '<p> </p>'; /* pages/hour * / $sql="SELECT * FROM stats_agg_pages_by_hour"; $result = db_query ($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { echo '<h1>Stats Problem</h1>'; echo db_error(); } else { GraphResult($result,'Page Views By Hour'); } echo '<p>'; */ /* Groups added by week */ $sql = "select (round((register_time/604800),0)*604800) AS time ,count(*) from groups group by time"; $result = db_query($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { echo '<h1>Stats Problem</h1>'; echo db_error(); } else { $count = array(); $dates = array(); $count = util_result_column_to_array($result, 1); for ($i = 0; $i < $rows; $i++) { //convert the dates and add to an array $dates[$i] = date(_('Y-m-d H:i'), db_result($result, $i, 0)); } GraphIt($dates, $count, 'New Projects Added Each Week'); } echo '<p> </p>'; /* Users added by week */ $sql = "select (round((add_date/604800),0)*604800) AS time ,count(*) from users group by time"; $result = db_query($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { echo '<h1>Stats Problem</h1>'; echo db_error(); } else { $count = array(); $dates = array(); $count = util_result_column_to_array($result, 1); for ($i = 0; $i < $rows; $i++) { //convert the dates and add to an array $dates[$i] = date(_('Y-m-d H:i'), db_result($result, $i, 0)); } GraphIt($dates, $count, 'New Users Added Each Week'); } echo '<p> </p>'; }
$name_array[0] = _('Yes'); if (!$result2 || db_numrows($result2) < 1) { $value_array[0] = 0; } else { $value_array[0] = db_result($result2, 0, "count"); } // Get the NO responses $sql = "SELECT count(*) AS count FROM survey_responses WHERE survey_id='{$survey_id}' AND question_id='{$quest_array[$i]}' AND group_id='{$group_id}' AND response='5'"; $result2 = db_query($sql); $name_array[1] = _('No'); if (!$result2 || db_numrows($result2) < 1) { $value_array[1] = 0; } else { $value_array[1] = db_result($result2, 0, "count"); } GraphIt($name_array, $value_array, stripslashes(db_result($result, 0, "question"))); } else { if ($question_type == "4") { echo " <p><strong>" . db_result($result, 0, "question") . "</strong></p>\n"; echo "<input type=\"hidden\" name=\"_" . $quest_array[$i] . "\" value=\"-666\" />"; } else { if ($question_type == "5") { // This is a text-field question. echo db_result($result, 0, "question") . "<br />\n"; echo "<a href=\"show_results_comments.php?survey_id={$survey_id}&question_id={$quest_array[$i]}&group_id={$group_id}\">" . _('View All Comments') . "</a>"; } } } } } echo "</td></tr>";
$sql = "SELECT count(*) " . "FROM project_task,project_group_list " . "WHERE start_date >= {$start} " . "AND start_date <= {$end} " . "AND project_group_list.group_project_id=project_task.group_project_id " . "AND project_group_list.group_id='{$group_id}' "; $result = db_query($sql); $names[$counter - 1] = date("Y-m-d", $start) . " to " . date("Y-m-d", $end); $values[$counter - 1] = db_result($result, 0, 0); } GraphIt($names, $values, "Number of Tasks Started"); echo "<P>"; for ($counter = 1; $counter <= $span; $counter++) { $start = $time_now - $counter * $sub_duration; $end = $time_now - ($counter - 1) * $sub_duration; $sql = "SELECT count(*) " . "FROM project_task,project_group_list " . "WHERE start_date <= {$end} " . "AND (end_date >= {$end} OR end_date < 1 OR end_date is null) " . "AND project_group_list.group_project_id=project_task.group_project_id " . "AND project_group_list.group_id='{$group_id}' "; $result = db_query($sql); $names[$counter - 1] = date("Y-m-d", $end); $values[$counter - 1] = db_result($result, 0, 0); } GraphIt($names, $values, "Number of Tasks Still Not Completed"); echo "<P>"; pm_footer(array()); } else { if ($what == "subproject") { $sql1 = "SELECT project_group_list.project_name AS Subproject, count(*) AS Count " . "FROM project_group_list,project_task " . "WHERE project_group_list.group_project_id=project_task.group_project_id " . "AND project_task.status_id = '1' " . "AND project_group_list.group_id='{$group_id}' " . $period_clause . "GROUP BY Subproject"; $sql2 = "SELECT project_group_list.project_name AS Subproject, count(*) AS Count " . "FROM project_group_list,project_task " . "WHERE project_group_list.group_project_id=project_task.group_project_id " . "AND project_task.status_id <> '3' " . "AND project_group_list.group_id='{$group_id}' " . $period_clause . "GROUP BY Subproject"; pm_quick_report($group_id, "Tasks By Category", "Open Tasks By Category", $sql1, "All Tasks By Category", $sql2); } else { if ($what == "tech") { $sql1 = "SELECT users.user_name AS Technician, count(*) AS Count " . "FROM users,project_group_list,project_task,project_assigned_to " . "WHERE users.user_id=project_assigned_to.assigned_to_id " . "AND project_assigned_to.project_task_id=project_task.project_task_id " . "AND project_task.group_project_id=project_group_list.group_project_id " . "AND project_task.status_id = '1' " . "AND project_group_list.group_id='{$group_id}' " . $period_clause . "GROUP BY Technician"; $sql2 = "SELECT users.user_name AS Technician, count(*) AS Count " . "FROM users,project_group_list,project_task,project_assigned_to " . "WHERE users.user_id=project_assigned_to.assigned_to_id " . "AND project_assigned_to.project_task_id=project_task.project_task_id " . "AND project_task.group_project_id=project_group_list.group_project_id " . "AND project_task.status_id <> '3' " . "AND project_group_list.group_id='{$group_id}' " . $period_clause . "GROUP BY Technician"; pm_quick_report($group_id, "Tasks By Technician", "Open Tasks By Technician", $sql1, "All Tasks By Technician", $sql2, "<p>Note that same task can be " . "assigned to several technicians. " . "Such task will be counted for " . "each of them.</p>"); } else { exit_missing_param(); }
/** * GraphResult() - Takes a database result set and builds a graph. * The first column should be the name, and the second column should be the values * Be sure to include HTL_Graphs.php before using this function * * @author Tim Perdue tperdue@valinux.com * @param int The databse result set ID * @param string The title of the graph * */ function GraphResult($result, $title) { $rows = db_numrows($result); if (!$result || $rows < 1) { echo 'None Found.'; } else { $names = array(); $values = array(); for ($j = 0; $j < db_numrows($result); $j++) { if (db_result($result, $j, 0) != '' && db_result($result, $j, 1) != '') { $names[$j] = db_result($result, $j, 0); $values[$j] = db_result($result, $j, 1); } } /* This is another function detailed below */ GraphIt($names, $values, $title); } }
function GraphResult($result, $title) { /* GraphResult by Tim Perdue, PHPBuilder.com Takes a database result set. The first column should be the name, and the second column should be the values #### #### Be sure to require(HTML_Graphs.php) before hitting these graphing functions #### */ /* db_ should be replaced with your database, aka mysql_ or pg_ */ $rows = db_numrows($result); if (!$result) { echo 'None Found.'; } else { $names = array(); $values = array(); for ($j = 0; $j < db_numrows($result); $j++) { if (db_result($result, $j, 0) != '' && db_result($result, $j, 1) != '') { $names[$j] = db_result($result, $j, 0); $values[$j] = db_result($result, $j, 1); } } /* This is another function detailed below */ GraphIt($names, $values, $title); } }
$sql = "SELECT count(*) " . "FROM feature " . "WHERE open_date >= {$start} " . "AND open_date <= {$end} " . "AND group_id='{$group_id}'"; $result = db_query($sql); $names[$counter - 1] = date("Y-m-d", $start) . " to " . date("Y-m-d", $end); $values[$counter - 1] = db_result($result, 0, 0); } GraphIt($names, $values, "Number of Feature Requests Submitted"); echo "<P>"; for ($counter = 1; $counter <= $span; $counter++) { $start = $time_now - $counter * $sub_duration; $end = $time_now - ($counter - 1) * $sub_duration; $sql = "SELECT count(*) " . "FROM feature " . "WHERE open_date <= {$end} " . "AND (close_date >= {$end} OR close_date < 1 OR close_date is null) " . "AND group_id='{$group_id}'"; $result = db_query($sql); $names[$counter - 1] = date("Y-m-d", $end); $values[$counter - 1] = db_result($result, 0, 0); } GraphIt($names, $values, "Number of Feature Requests Still Open"); echo "<P>"; feature_footer(array()); } else { if ($what == "category") { $sql1 = "SELECT feature_category.category_name AS Category, count(*) AS Count " . "FROM feature_category,feature " . "WHERE feature_category.feature_category_id=feature.feature_category_id " . "AND feature.feature_status_id = '1' " . "AND feature.group_id='{$group_id}' " . $period_clause . "GROUP BY Category"; $sql2 = "SELECT feature_category.category_name AS Category, count(*) AS Count " . "FROM feature_category,feature " . "WHERE feature_category.feature_category_id=feature.feature_category_id " . "AND feature.feature_status_id <> '3' " . "AND feature.group_id='{$group_id}' " . $period_clause . "GROUP BY Category"; feature_quick_report($group_id, "Feature Requests By Category", "Open Feature Requests By Category", $sql1, "All Feature Requests By Category", $sql2); } else { if ($what == "tech") { $sql1 = "SELECT users.user_name AS Technician, count(*) AS Count " . "FROM users,feature " . "WHERE users.user_id=feature.assigned_to " . "AND feature.feature_status_id = '1' " . "AND feature.group_id='{$group_id}' " . $period_clause . "GROUP BY Technician"; $sql2 = "SELECT users.user_name AS Technician, count(*) AS Count " . "FROM users,feature " . "WHERE users.user_id=feature.assigned_to " . "AND feature.feature_status_id <> '3' " . "AND feature.group_id='{$group_id}' " . $period_clause . "GROUP BY Technician"; feature_quick_report($group_id, "Feature Requests By Technician", "Open Feature Requests By Technician", $sql1, "All Feature Requests By Technician", $sql2); } else { exit_missing_param(); }
function stats_sf_stats() { global $Language; /* pages/day */ $sql = "SELECT * FROM stats_agg_pages_by_day"; $result = db_query($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { echo '<H1>' . $Language->getText('include_stats_function', 'stats_problem') . '</H1>'; echo db_error(); } else { $j = 0; for ($i = 0; $i < $rows; $i++) { //echo $i." - ".($i%7)."<BR>"; if ($i % 7 == 0) { //echo $i."<BR>"; //increment the new weekly array //and set the beginning date for this week $j++; $name_string[$j] = db_result($result, $i, 'day'); $vals[$j] = 0; } //add today to the week $vals[$j] += db_result($result, $i, 'count'); } $j++; $vals[$j] = ''; $name_string[$j] = ''; GraphIt($name_string, $vals, $Language->getText('include_stats_function', 'view_by_week')); } echo '<P>'; /* pages/hour * / $sql="SELECT * FROM stats_agg_pages_by_hour"; $result = db_query ($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { echo '<H1>'.$Language->getText('include_stats_function','stats_problem').'</H1>'; echo db_error(); } else { GraphResult($result,$Language->getText('include_stats_function','view_by_hour')); } echo '<P>'; */ /* Groups added by week */ $sql = "select (round((register_time/604800),0)*604800) AS time ,count(*) from groups group by time"; $result = db_query($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { echo '<H1>' . $Language->getText('include_stats_function', 'stats_problem') . '</H1>'; echo db_error(); } else { $count = array(); $dates = array(); $count = result_column_to_array($result, 1); for ($i = 0; $i < $rows; $i++) { //convert the dates and add to an array $dates[$i] = format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 0)); } GraphIt($dates, $count, $Language->getText('include_stats_function', 'new_proj_added')); } echo '<P>'; /* Users added by week */ $sql = "select (round((add_date/604800),0)*604800) AS time ,count(*) from user group by time"; $result = db_query($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { echo '<H1>' . $Language->getText('include_stats_function', 'stats_problem') . '</H1>'; echo db_error(); } else { $count = array(); $dates = array(); $count = result_column_to_array($result, 1); for ($i = 0; $i < $rows; $i++) { //convert the dates and add to an array $dates[$i] = format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 0)); } GraphIt($dates, $count, $Language->getText('include_stats_function', 'new_user_added')); } echo '<P>'; }
$value_array[0] = 0; } else { $value_array[0] = db_result($result2, 0, "count"); } /* Get the NO responses */ $sql = "SELECT count(*) AS count FROM survey_responses WHERE survey_id='" . db_ei($survey_id) . "' AND question_id='" . db_ei($quest_array[$i]) . "' AND group_id='" . db_ei($group_id) . "' AND response='5'"; $result2 = db_query($sql); $name_array[1] = $Language->getText('global', 'no'); if (!$result2 || db_numrows($result2) < 1) { $value_array[1] = 0; } else { $value_array[1] = db_result($result2, 0, "count"); } GraphIt($name_array, $value_array, $purifier->purify(db_result($result, 0, "question"))); } else { if ($question_type == "4") { /* This is a comment only. */ echo " <P><B>" . $purifier->purify(db_result($result, 0, "question")) . "</B>\n"; echo "<INPUT TYPE=\"HIDDEN\" NAME=\"_" . $quest_array[$i] . "\" VALUE=\"-666\">"; } else { if ($question_type == "5") { /* This is a text-field question. */ $sql = "SELECT count(*) AS count FROM survey_responses WHERE survey_id='" . db_ei($survey_id) . "' " . "AND question_id='" . db_ei($quest_array[$i]) . "' AND group_id='" . db_ei($group_id) . "' AND response<>'' "; $result2 = db_query($sql); $sql = "SELECT count(*) AS count FROM survey_responses WHERE survey_id='" . db_ei($survey_id) . "' " . "AND question_id='" . db_ei($quest_array[$i]) . "' AND group_id='" . db_ei($group_id) . "' AND response='' ";
$sql = "SELECT count(*) " . "FROM support " . "WHERE open_date >= {$start} " . "AND open_date <= {$end} " . "AND group_id='{$group_id}'"; $result = db_query($sql); $names[$counter - 1] = date("Y-m-d", $start) . " to " . date("Y-m-d", $end); $values[$counter - 1] = db_result($result, 0, 0); } GraphIt($names, $values, "Number of Support Requests Submitted"); echo "<P>"; for ($counter = 1; $counter <= $span; $counter++) { $start = $time_now - $counter * $sub_duration; $end = $time_now - ($counter - 1) * $sub_duration; $sql = "SELECT count(*) " . "FROM support " . "WHERE open_date <= {$end} " . "AND (close_date >= {$end} OR close_date < 1 OR close_date is null) " . "AND group_id='{$group_id}'"; $result = db_query($sql); $names[$counter - 1] = date("Y-m-d", $end); $values[$counter - 1] = db_result($result, 0, 0); } GraphIt($names, $values, "Number of Support Requests Still Open"); echo "<P>"; support_footer(array()); } else { if ($what == "category") { $sql1 = "SELECT support_category.category_name AS Category, count(*) AS Count " . "FROM support_category,support " . "WHERE support_category.support_category_id=support.support_category_id " . "AND support.support_status_id = '1' " . "AND support.group_id='{$group_id}' " . $period_clause . "GROUP BY Category"; $sql2 = "SELECT support_category.category_name AS Category, count(*) AS Count " . "FROM support_category,support " . "WHERE support_category.support_category_id=support.support_category_id " . "AND support.support_status_id <> '3' " . "AND support.group_id='{$group_id}' " . $period_clause . "GROUP BY Category"; support_quick_report($group_id, "Support Requests By Category", "Open Support Requests By Category", $sql1, "All Support Requests By Category", $sql2); } else { if ($what == "tech") { $sql1 = "SELECT users.user_name AS Technician, count(*) AS Count " . "FROM users,support " . "WHERE users.user_id=support.assigned_to " . "AND support.support_status_id = '1' " . "AND support.group_id='{$group_id}' " . $period_clause . "GROUP BY Technician"; $sql2 = "SELECT users.user_name AS Technician, count(*) AS Count " . "FROM users,support " . "WHERE users.user_id=support.assigned_to " . "AND support.support_status_id <> '3' " . "AND support.group_id='{$group_id}' " . $period_clause . "GROUP BY Technician"; support_quick_report($group_id, "Support Requests By Technician", "Open Support Requests By Technician", $sql1, "All Support Requests By Technician", $sql2); } else { exit_missing_param(); }
$sql = "SELECT count(*) FROM bug WHERE date >= {$start} AND date <= {$end} AND resolution_id <> '2' AND group_id='{$group_id}'"; $result = db_query($sql); $names[$counter - 1] = date("Y-m-d", $start) . " to " . date("Y-m-d", $end); $values[$counter - 1] = db_result($result, 0, 0); } GraphIt($names, $values, "Number of Bugs Submitted"); echo "<P>"; for ($counter = 1; $counter <= $span; $counter++) { $start = $time_now - $counter * $sub_duration; $end = $time_now - ($counter - 1) * $sub_duration; $sql = "SELECT count(*) FROM bug WHERE date <= {$end} AND (close_date >= {$end} OR close_date < 1 OR close_date is null) AND resolution_id <> '2' AND group_id='{$group_id}'"; $result = db_query($sql); $names[$counter - 1] = date("Y-m-d", $end); $values[$counter - 1] = db_result($result, 0, 0); } GraphIt($names, $values, "Number of Bugs Still Open"); echo "<P>"; bug_footer(array()); } else { if ($what == "category") { $sql1 = "SELECT bug_category.category_name AS Category, count(*) AS Count FROM bug_category,bug " . "WHERE bug_category.bug_category_id=bug.category_id AND bug.status_id <> '3' AND bug.resolution_id <> '2' AND bug.group_id='{$group_id}' " . $period_clause . "GROUP BY Category"; $sql2 = "SELECT bug_category.category_name AS Category, count(*) AS Count FROM bug_category,bug " . "WHERE bug_category.bug_category_id=bug.category_id AND bug.resolution_id <> '2' AND bug.group_id='{$group_id}' " . $period_clause . "GROUP BY Category"; bugs_quick_report($group_id, "Bugs By Category", "Open Bugs By Category", $sql1, "All Bugs By Category", $sql2); } else { if ($what == "tech") { $sql1 = "SELECT users.user_name AS Technician, count(*) AS Count FROM users,bug " . "WHERE users.user_id=bug.assigned_to AND bug.status_id <> '3' AND bug.resolution_id <> '2' AND bug.group_id='{$group_id}' " . $period_clause . "GROUP BY Technician"; $sql2 = "SELECT users.user_name AS Technician, count(*) AS Count FROM users,bug " . "WHERE users.user_id=bug.assigned_to AND bug.resolution_id <> '2' AND bug.group_id='{$group_id}' " . $period_clause . "GROUP BY Technician"; bugs_quick_report($group_id, "Bugs By Technician", "Open Bugs By Technician", $sql1, "All Bugs By Technician", $sql2); } else { if ($what == "bug_group") { $sql1 = "SELECT bug_group.group_name AS Bug_Group_Name, count(*) AS Count FROM bug_group,bug " . "WHERE bug_group.bug_group_id=bug.bug_group_id AND bug.status_id <> '3' AND bug.resolution_id <> '2' AND bug.group_id='{$group_id}' " . $period_clause . "GROUP BY Bug_Group_Name";
$sql = "SELECT count(*) " . "FROM project_task,project_group_list " . "WHERE start_date >= '{$start}' " . "AND start_date <= '{$end}' " . "AND project_group_list.group_project_id=project_task.group_project_id " . "AND project_group_list.group_id='{$group_id}' "; $result = db_query($sql); $names[$counter - 1] = date("Y-m-d", $start) . " to " . date("Y-m-d", $end); $values[$counter - 1] = db_result($result, 0, 0); } GraphIt($names, $values, _('Number of started tasks')); echo "<p />"; for ($counter = 1; $counter <= $span; $counter++) { $start = $time_now - $counter * $sub_duration; $end = $time_now - ($counter - 1) * $sub_duration; $sql = "SELECT count(*) " . "FROM project_task,project_group_list " . "WHERE start_date <= '{$end}' " . "AND (end_date >= '{$end}' OR end_date < 1 OR end_date is null) " . "AND project_group_list.group_project_id=project_task.group_project_id " . "AND project_group_list.group_id='{$group_id}' "; $result = db_query($sql); $names[$counter - 1] = date("Y-m-d", $end); $values[$counter - 1] = db_result($result, 0, 0); } GraphIt($names, $values, _('Number of tasks still not completed')); echo "<p />"; pm_footer(array()); } else { if ($what == "subproject") { $sql1 = "SELECT project_group_list.project_name AS Subproject, count(*) AS Count " . "FROM project_group_list,project_task " . "WHERE project_group_list.group_project_id=project_task.group_project_id " . "AND project_task.status_id = '1' " . "AND project_group_list.group_id='{$group_id}' " . $period_clause . "GROUP BY Subproject"; $sql2 = "SELECT project_group_list.project_name AS Subproject, count(*) AS Count " . "FROM project_group_list,project_task " . "WHERE project_group_list.group_project_id=project_task.group_project_id " . "AND project_task.status_id <> '3' " . "AND project_group_list.group_id='{$group_id}' " . $period_clause . "GROUP BY Subproject"; pm_quick_report($group_id, _('Tasks By Category'), _('Open Tasks By Category'), $sql1, _('All Tasks By Category'), $sql2); } else { if ($what == "tech") { $sql1 = "SELECT users.user_name AS Technician, count(*) AS Count " . "FROM users,project_group_list,project_task,project_assigned_to " . "WHERE users.user_id=project_assigned_to.assigned_to_id " . "AND project_assigned_to.project_task_id=project_task.project_task_id " . "AND project_task.group_project_id=project_group_list.group_project_id " . "AND project_task.status_id = '1' " . "AND project_group_list.group_id='{$group_id}' " . $period_clause . "GROUP BY Technician"; $sql2 = "SELECT users.user_name AS Technician, count(*) AS Count " . "FROM users,project_group_list,project_task,project_assigned_to " . "WHERE users.user_id=project_assigned_to.assigned_to_id " . "AND project_assigned_to.project_task_id=project_task.project_task_id " . "AND project_task.group_project_id=project_group_list.group_project_id " . "AND project_task.status_id <> '3' " . "AND project_group_list.group_id='{$group_id}' " . $period_clause . "GROUP BY Technician"; pm_quick_report($group_id, _('Tasks By Assignee'), _('Open Tasks By Assignee'), $sql1, _('All Tasks By Assignee'), $sql2, _('<p>Note that same task can be assigned to several technicians. Such task will be counted for each of them.</p>')); } else { exit_missing_param(); }
$value_array[0] = 0; } else { $value_array[0] = db_result($result2, 0, "count"); } /* Get the NO responses */ $sql = "SELECT count(*) AS count FROM survey_responses WHERE survey_id='{$survey_id}' AND question_id='{$quest_array[$i]}' AND group_id='{$group_id}' AND response='5'"; $result2 = db_query($sql); $name_array[1] = $Language->getText('global', 'no'); if (!$result2 || db_numrows($result2) < 1) { $value_array[1] = 0; } else { $value_array[1] = db_result($result2, 0, "count"); } GraphIt($name_array, $value_array, util_unconvert_htmlspecialchars(db_result($result, 0, "question"))); } else { if ($question_type == "4") { /* This is a comment only. */ echo " <P><B>" . util_unconvert_htmlspecialchars(db_result($result, 0, "question")) . "</B>\n"; echo "<INPUT TYPE=\"HIDDEN\" NAME=\"_" . $quest_array[$i] . "\" VALUE=\"-666\">"; } else { if ($question_type == "5") { /* This is a text-field question. */ $sql = "SELECT count(*) AS count FROM survey_responses WHERE survey_id='{$survey_id}' " . "AND question_id='{$quest_array[$i]}' AND group_id='{$group_id}' AND response<>'' "; $result2 = db_query($sql); $sql = "SELECT count(*) AS count FROM survey_responses WHERE survey_id='{$survey_id}' " . "AND question_id='{$quest_array[$i]}' AND group_id='{$group_id}' AND response='' ";