stats.module
Search API
- 7.x modules/stats/stats.module
- 6.x modules/stats/stats.module
- 4.x modules/stats/stats.module
- 5.x modules/stats/stats.module
This module displays statistics and reports for FlightPath
File
modules/stats/stats.moduleView source
- <?php
-
- /**
- * @file
- * This module displays statistics and reports for FlightPath
- *
- * @return unknown
- */
-
-
-
-
- /**
- * Implementation of hook_menu
- *
- * @return unknown
- */
- function stats_menu() {
- $items = array();
-
- $items["stats"] = array(
- "title" => "Analytics & Reports",
- "page_callback" => "stats_display_main",
- "access_arguments" => array("can_access_stats"),
- "page_settings" => array(
- "page_show_title" => TRUE,
- ),
- "type" => MENU_TYPE_NORMAL_ITEM,
- );
-
-
- $items["stats/select-school"] = array(
- "title" => "Select School",
- "page_callback" => "fp_render_form",
- "page_arguments" => array("stats_select_school_form"),
- "access_arguments" => array("can_access_stats"),
- "page_settings" => array(
- "page_show_title" => TRUE,
- "bool_print" => FALSE,
- "menu_links" => array(
- 0 => array(
- "text" => t("Analytics"),
- "path" => "stats",
- ),
- ),
- ),
- "type" => MENU_TYPE_CALLBACK,
- );
-
-
-
- $items["stats/reports/access"] = array(
- "title" => "Access Stats",
- "description" => "See recent access within the system. This can be useful to see if anyone is currently using the system.",
- "page_callback" => "stats_report_access_stats",
- "access_arguments" => array("can_access_stats"),
- "page_settings" => array(
- "page_show_title" => TRUE,
- "menu_links" => array(
- 0 => array(
- "text" => t("Analytics"),
- "path" => "stats",
- ),
- ),
- ),
- "type" => MENU_TYPE_NORMAL_ITEM,
- "weight" => 100,
- );
-
-
- $items["stats/reports/major-counts"] = array(
- "title" => "Major Counts",
- "description" => "Displays the number of students within each major or major/concentration.",
- "page_callback" => "stats_report_major_counts",
- "access_arguments" => array("can_access_stats"),
- "page_settings" => array(
- "page_show_title" => TRUE,
- "menu_links" => array(
- 0 => array(
- "text" => t("Analytics"),
- "path" => "stats",
- ),
- ),
- ),
- "type" => MENU_TYPE_NORMAL_ITEM,
- "weight" => 150,
- );
-
-
-
-
- $items["stats/reports/major-students-progress"] = array(
- "title" => "Major Students Progress",
- "description" => "Students in a major, and their progress percentages in that major.",
- "page_callback" => "fp_render_form",
- "page_arguments" => array("stats_report_major_students_progress_form"),
- "access_arguments" => array("can_access_stats"),
- "page_settings" => array(
- "bool_print" => FALSE,
- "menu_links" => array(
- 0 => array(
- "text" => t("Analytics"),
- "path" => "stats",
- ),
- ),
- ),
- "type" => MENU_TYPE_NORMAL_ITEM,
- "weight" => 170,
- "file" => menu_get_module_path("stats") . "/reports.major-students-progress.inc",
- );
-
-
-
-
-
-
-
- $items["stats/reports/advisor-use"] = array(
- "title" => "Advisor Use",
- "description" => "How many students an advisor has advised over a specified time range.",
- "page_callback" => "stats_report_advisor_use",
- "access_arguments" => array("can_access_stats"),
- "page_settings" => array(
- "page_show_title" => TRUE,
- "bool_print" => FALSE,
- "menu_links" => array(
- 0 => array(
- "text" => t("Analytics"),
- "path" => "stats",
- ),
- ),
- ),
- "type" => MENU_TYPE_NORMAL_ITEM,
- "weight" => 250,
- );
-
- $system_name = variable_get("system_name", "FlightPath");
-
- $items["stats/reports/student-course-list"] = array(
- "title" => "Student Course List",
- "description" => "List courses a student has taken, which $system_name is aware of.",
- "page_callback" => "stats_report_student_course_list",
- "access_arguments" => array("can_access_stats"),
- "page_settings" => array(
- "page_show_title" => TRUE,
- "menu_links" => array(
- 0 => array(
- "text" => t("Analytics"),
- "path" => "stats",
- ),
- ),
- ),
- "type" => MENU_TYPE_NORMAL_ITEM,
- "weight" => 300,
- );
-
-
-
-
- $items["stats/reports/flightpath-use-summary"] = array(
- "title" => "$system_name Use Summary",
- "description" => "A detailed report on how $system_name is being used over a specified time range.",
- "page_callback" => "stats_report_flightpath_use_summary",
- "access_arguments" => array("can_access_stats"),
- "page_settings" => array(
- "page_show_title" => TRUE,
- "menu_links" => array(
- 0 => array(
- "text" => t("Analytics"),
- "path" => "stats",
- ),
- ),
- ),
- "type" => MENU_TYPE_NORMAL_ITEM,
- "weight" => 350,
- );
-
-
-
-
-
- $items["stats/reports/course-use-summary"] = array(
- "title" => "Course Use Summary",
- "description" => "A report of everywhere a particular course is used in $system_name (groups or degrees).",
- "page_callback" => "stats_report_course_use_summary",
- "access_arguments" => array("can_access_stats"),
- "page_settings" => array(
- "page_show_title" => TRUE,
- "menu_links" => array(
- 0 => array(
- "text" => t("Analytics"),
- "path" => "stats",
- ),
- ),
- ),
- "type" => MENU_TYPE_NORMAL_ITEM,
- "weight" => 450,
- );
-
-
-
-
-
- // Lets the user download a CSV file stored in the batch_queue table, with a batch_id.
- $items["stats/download-csv-from-batch/%"] = array(
- "page_callback" => "stats_download_csv_from_batch",
- "page_arguments" => array(2),
- "access_arguments" => array("can_access_stats"),
- "type" => MENU_TYPE_CALLBACK,
- );
-
-
-
-
-
- return $items;
- }
-
-
-
- /**
- * Lets the user download a CSV file from a completed batch.
- *
- * There are no permissions on this, except the can_access_stats permission.
- *
- * @param unknown_type $batch_id
- */
- function stats_download_csv_from_batch($batch_id) {
-
- $filename = fp_get_machine_readable(strtolower($_REQUEST["filename"]));
-
- $batch = batch_get($batch_id);
-
- watchdog('stats', "download_csv_from_batch batch_id:$batch_id, filename:$filename.csv", array());
-
- // Give it to the browser...
- header('Content-type: text/csv');
- header('Content-Disposition: attachment; filename="' . $filename . '.csv"');
- print $batch["csv"];
-
- die;
-
- }
-
-
-
-
-
-
-
-
- /**
- * Implementation of hook_perm().
- * Expects to return an array of permissions recognized by
- * this module.
- *
- * Ex: $a = array(
- * "deCanDoSomething" => array (
- * "title" => "Can Do Something",
- * "description" => "Allow the user to do something."
- * )
- * );
- *
- */
- function stats_perm() {
-
- $perms = array (
- "can_access_stats" => array(
- "title" => t("Access/view stats & analytics"),
- "description" => t("This allows the user to access the stats module, letting them run
- reports on usage."),
- ),
- );
-
- return $perms;
-
- }
-
-
-
-
- /**
- * Return the HTML for a pulldown containing the catalog years available for selection.
- *
- * @param unknown_type $selected
- * @param unknown_type $display_submit
- */
- function stats_draw_catalog_year_pulldown($selected = "", $display_submit = FALSE) {
-
- $rtn = "";
-
-
- $rtn .= "
- <table border='0'>
-
- <td valign='middle'>
-
- <select name='catalog_year' id='catalog_year'><option value=''>
- " . t("Please select a catalog year") . "</option>
- <option value=''>-----------------------------------</option>";
-
-
- $current_catalog_year = variable_get("current_catalog_year", ""); // TODO: school_id?
-
- if ($selected == "") $selected = $current_catalog_year;
-
- $res = db_query("SELECT DISTINCT (catalog_year) FROM degrees
- WHERE exclude = '0'
- ORDER BY catalog_year DESC");
- while ($cur = db_fetch_array($res)) {
- $sel = ($cur["catalog_year"] == $selected) ? "selected=selected" : "";
- $rtn .= "<option value='{$cur["catalog_year"]}' $sel>{$cur["catalog_year"]}-" . ($cur["catalog_year"] + 1) . "</option>";
- }
-
- $rtn .= " </select> </td>";
- if ($display_submit == true)
- {
- $rtn .= "<td valign='middle'><input type='submit' value='" . t("Select") . "'></td>";
- }
-
- $rtn .= "</table>";
-
- return $rtn;
-
- }
-
-
-
- /**
- * This report will display everywhere a particular course is used in FlightPath (groups and degrees)
- *
- */
- function stats_report_course_use_summary() {
- $rtn = "";
-
- $draft = "";
- $use_draft = FALSE;
-
- $school_id = 0; // TODO: school is selectable / based on user's school?
-
- $subject_id = $course_num = $draft_check = "";
-
- if (isset($_GET["subject_id"])) {
- $subject_id = trim($_GET["subject_id"]);
- $course_num = trim($_GET["course_num"]);
- // $school_id = intval($_GET["school_id"]); // TODO: not supported yet.
- if (isset($_GET['draft'])) {
- $draft_check = $_GET["draft"];
- }
- }
-
- if ($draft_check == "checked") {
- $draft = "draft_";
- $use_draft = TRUE;
- }
-
- $rtn .= "<form action='" . fp_url("stats/reports/course-use-summary") . "' method='GET' >";
- $rtn .= "Please enter a course's subject ID and course number to search:<br>";
-
- if (module_enabled("schools")) {
- $options = schools_get_schools_for_fapi();
- $rtn .= "<select name='school_id'>";
- foreach ($options as $k => $v) {
- $sel = "";
- if (intval($k) === $school_id) $sel = "selected";
- $rtn .= "<option value='$k' $sel>" . t("School: ") . $v . "</option>";
- }
- $rtn .= "</select> ";
- }
-
-
- $rtn .= "
- <input type='text' name='subject_id' placeholder='Subject ID' size='10' value='$subject_id'>
- <input type='text' name='course_num' placeholder='Course Num' size='10' value='$course_num'>
- <input type='checkbox' name='draft' value='checked' $draft_check>Check draft tables?
- <input type='submit' value='Search'>
- <br><b>Note:</b> This may take up to a minute to run, please be patient.";
-
- $rtn .= "</form>";
-
- if ($subject_id && $course_num) {
- $rtn .= "<hr>";
-
- // First, look up this course's ID.
- $db = get_global_database_handler();
- $course_id = $db->get_course_id($subject_id, $course_num, '', $use_draft, $school_id);
-
- if ($course_id) {
- $rtn .= "<h2>Course $subject_id $course_num (id is $course_id)</h2>";
-
- // Groups
- $rtn .= "<div><b>Groups:</b></div>
- <table border='1'>
- <tr>
- <th>ID</th>
- <th>Name</th>
- <th>Title</th>
- <th>Year</th>
-
- </tr>";
- $res = db_query("SELECT * FROM {$draft}group_requirements WHERE course_id = ?
- order by `id`", $course_id);
- while ($cur = db_fetch_array($res)) {
- $group_id = $cur["group_id"];
- $group = new Group($group_id, $db, -1, false, $use_draft);
- if (!$group->title) {
- // This is possibly a child group. Look for its parent.
- $res2 = db_query("SELECT * FROM {$draft}group_requirements WHERE child_group_id = ?", $group_id);
- $cur2 = db_fetch_array($res2);
- if ($cur2["group_id"] != "") {
- $group_id = $cur2["group_id"];
- $group = new Group($group_id, $db, -1, false, $use_draft);
- }
- }
- $rtn .= "<tr>
- <td>$group_id</td>
- <td>$group->group_name</td>
- <td>$group->title</td>
- <td>$group->catalog_year</td>
- </tr>";
- }
- $rtn .= "</table>";
-
- // Now, look for degrees...
-
- $rtn .= "<br><br><br>
- <b>Degrees:</b>
- <table border='1'>
- <tr>
- <th>ID</th>
- <th>Title</th>
- <th>MAJR</th>
- <th>Track</th>
- <th>Sem</th>
- <th>Year</th>
- </tr>";
-
- $res = db_query("SELECT * FROM {$draft}degree_requirements WHERE course_id = ? ORDER BY `id`", $course_id);
- while ($cur = db_fetch_array($res)) {
- $degree_id = $cur["degree_id"];
- $degree = new DegreePlan($degree_id, $db, TRUE, FALSE, $use_draft);
-
- $rtn .= "<tr>
- <td>$degree_id</td>
- <td>$degree->title</td>
- <td>$degree->major_code</td>
- <td>$degree->track_code</td>
- <td>" . $cur["semester_num"] . "</td>
- <td>$degree->catalog_year</td>
- </tr>";
- }
-
-
-
- $rtn .= '</table>';
-
- } // if course_id
- else {
- $rtn .= "<div>Course could not be found. Check spelling.";
- }
-
- }
-
-
- watchdog('stats', "report_course_use_summary subject_id:$subject_id, course_num:$course_num, school_id:$school_id, draft_check:$draft_check", array());
-
-
- return $rtn;
-
- }
-
-
-
-
-
-
- /**
- * This report will show which degree options are being selected for degrees which offer options.
- *
- * @return unknown
- */
- function z__stats_report_selected_degree_options() {
- $rtn = "";
-
-
- // What major have they selected?
- $major = trim(@$_GET["major"]);
-
- $rtn .= "<form action='" . fp_url("stats/reports/selected-degree-options") . "' method='GET' >";
- $rtn .= stats_draw_majors_pulldown($major, TRUE, TRUE, t("Please select a major with degree options"));
- $rtn .= "</form>";
-
- $db = get_global_database_handler();
-
- if ($major != "")
- {
- $count_in_major = 0;
- $degree_option_count = array();
-
- $sql = "SELECT * FROM students a, student_degrees b
- WHERE substring_index(major_code, '|', 1) = '?'
- AND rank_code IN %RANKIN%
- AND a.cwid = b.student_id
- %EXTRA_STUDENTSEARCH_CONDITIONS%
- GROUP BY a.cwid";
-
-
- $rank_in = "( '" . join("', '", csv_to_array(variable_get("allowed_student_ranks",''))) . "' )";
- $sql = str_replace("%RANKIN%", $rank_in, $sql);
- $sql = str_replace("%EXTRA_STUDENTSEARCH_CONDITIONS%", variable_get("extra_student_search_conditions",''), $sql);
-
- $result = db_query($sql, $major);
-
- while($cur = db_fetch_array($result))
- {
- extract($cur, 3, "db");
- $count_in_major++;
-
- $track = "";
- // Does this student have a track (degree option) specified?
- //$student_settings = $db->get_student_settings($db_cwid);
-
- $student_major_codes = $db->get_student_majors_from_db($db_cwid);
- // Look through all the major codes for this student, and see if any
- // have a |_ in them. If they do, that means they are a track.
- foreach ($student_major_codes as $mc) {
- if (strstr($mc, $major . "|_")) {
- $track = $mc; // Yes, so this is a track for this major.
-
- // Init if not already...
- if (!isset($degree_option_count[$track])) {
- $degree_option_count[$track] = 0;
- }
-
- $degree_option_count[$track]++;
-
- }
- }
-
-
-
- // No track found. Add that one, too.
- if ($track == "")
- {
- $track = t("None selected");
- // Init if not already...
- if (!isset($degree_option_count[$track])) {
- $degree_option_count[$track] = 0;
- }
-
- $degree_option_count[$track]++;
-
- }
-
-
-
-
-
- } // while db_fetch_array
-
- arsort($degree_option_count);
-
-
-
- $rtn .= "<table border='1'>
- <tr>
- <th>" . t("Degree Option") . "</th>
- <th>" . t("Count") . "</th>
- <th>" . t("Description") . "</th>
- </tr>";
-
- foreach($degree_option_count as $d_option => $value)
- {
- //$desc = get_track_title($major,$d_option);
- // figure out the title of the track...
- $temp = explode("-", $db_catalog_year);
- $cy = $temp[0];
- $degree_id = $db->get_degree_id($d_option, $cy);
-
- $dp = new DegreePlan();
- $dp->degree_id = $degree_id;
- $dp->load_descriptive_data();
- $desc = $dp->get_title2(TRUE, TRUE);
-
-
- $rtn .= "<tr><td valign='top'>
- $d_option
- </td>
- <td valign='top'>
- $value
- </td>
- <td valign='top'>
- $desc
- </td>
-
- </tr>";
- }
-
- $rtn .= "</table>" . t("Total number of students:") . " $count_in_major.";
-
- }
-
-
-
- return $rtn;
- }
-
-
-
-
- /**
- * Display a major selection pulldown, used by other reports.
- *
- * If bool_only_majors_with_tracks == TRUE, then we will only display the majors which
- * have tracks associated with them.
- *
- * If bool_exclude_tracks == TRUE, then we will skip over any major_code with a "_" in it,
- * meaning, this code describes a track and not the base major.
- *
- * If bool_only_current_catalog_year == TRUE, then only degrees from the current catalog year
- * will be displayed.
- *
- */
- function stats_draw_majors_pulldown($smajor = "", $display_submit = FALSE, $bool_only_majors_with_tracks = FALSE, $label = "Please select a major", $bool_exclude_tracks = FALSE, $bool_only_current_catalog_year = TRUE, $bool_return_options_array = FALSE, $school_id = 0)
- {
-
- $rtn = "";
- $db = get_global_database_handler();
- $major_array = array();
-
- $options_array = array();
-
-
- $current_catalog_year = variable_get_for_school("current_catalog_year", "", $school_id);
-
- $m_a_count = 0;
- if ($bool_only_current_catalog_year) {
- $query = "SELECT * FROM degrees
- WHERE catalog_year = ?
- AND school_id = ?
- AND `exclude`='0'
- ORDER BY major_code ";
- $result = db_query($query, $current_catalog_year, $school_id);
- }
- else { // current catalog year not important.
- $query = "SELECT * FROM degrees
- WHERE `exclude`='0'
- AND school_id = ?
- GROUP BY major_code
- ORDER BY major_code ";
- $result = db_query($query, $school_id);
- }
- while ($cur_row = $db->db_fetch_array($result)) {
- $major = trim($cur_row["major_code"]);
-
- if ($bool_exclude_tracks && strpos($major, "_")) {
- continue;
- }
-
- if ($bool_only_majors_with_tracks && !$db->get_degree_tracks($major, $current_catalog_year))
- { // only get majors that also have tracks!
- continue;
- }
-
- $description = trim($cur_row["title"]);
- $type = trim($cur_row["degree_type"]);
- $school_id = intval($cur_row['school_id']);
-
- $major_array[$m_a_count]["description"] = $description;
- $major_array[$m_a_count]["major"] = $major;
- $major_array[$m_a_count]["type"] = $type;
- $major_array[$m_a_count]["school_id"] = $school_id;
- if (module_enabled("schools")) {
- $major_array[$m_a_count]["school_name"] = t("School: ") . schools_get_school_name_for_id($school_id);
- }
-
- $m_a_count++;
-
-
- }
-
-
- $rtn .= "
- <table border='0'>
-
- <td valign='middle'>
-
- <select name='major' id='major'>
- <option value=''>" . $label . "</option>
- <option value=''>-----------------------------------</option>";
-
- for ($t = 0; $t < $m_a_count; $t++)
- {
- $sel = "";
- if ($major_array[$t]["major"] == $smajor && $smajor != "")
- {
- $sel = "selected";
- }
- $hyph = "-";
- if ($major_array[$t]["type"] == "" || $major_array[$t]["type"] == "NA")
- {
- $hyph = "";
- $major_array[$t]["type"] = "";
- }
-
- $rtn .= "<option value='" . $major_array[$t]["major"] . "' $sel>(" . $major_array[$t]["major"] . ")
- " . $major_array[$t]["description"] . " $hyph " . $major_array[$t]["type"] . "
- </option>";
-
- if (module_enabled("schools")) {
- // Create an options array multi-dimentional, organized by school name.
- $options_array[$major_array[$t]["school_name"]][$major_array[$t]["major"]] = "(" . $major_array[$t]["major"] . ") " . $major_array[$t]["description"] . " $hyph " . $major_array[$t]["type"];
- }
- else {
- // Just create a "flat" options array
- $options_array[$major_array[$t]["major"]] = "(" . $major_array[$t]["major"] . ") " . $major_array[$t]["description"] . " $hyph " . $major_array[$t]["type"];
- }
-
- }
-
-
- $rtn .= " </select> </td>";
- if ($display_submit == true)
- {
- $rtn .= "<td valign='middle'><input type='submit' value='" . t("Select") . "'></td>";
- }
-
- $rtn .= "</table>";
-
- if ($bool_return_options_array) return $options_array;
-
-
-
- return $rtn;
-
- }
-
-
-
-
-
-
- /**
- * Draws a simple form for entering a student's CWID, used by other reports.
- *
- * @param unknown_type $path
- * @param unknown_type $student_cwid
- * @return unknown
- */
- function z__stats_draw_student_cwid_form($path, $student_cwid = "") {
- $rtn = "";
-
- $rtn .= "<form action='" . fp_url($path) . "' method='GET' >
- " . t("Enter a student's CWID to see their courses") . "
- <br>
- <span class='form-element element-type-textfield'>
- <input type='textfield' value='$student_cwid' name='student_cwid'>
- </span>
-
- <span class='buttons form-element element-type-submit'>
- <input type='submit' value='" . t("Submit") . "'>
- </span>
- </form> <hr>
- ";
-
-
- return $rtn;
- }
-
-
-
-
-
- function stats_select_school_form() {
-
- $form = array();
-
- if (isset($_REQUEST['title'])) {
- fp_set_title(strip_tags($_REQUEST['title']));
- }
- $redirect_path = $_REQUEST['redirect'];
-
- $options = schools_get_schools_for_fapi();
- $form['school_id'] = array(
- 'type' => 'select',
- 'label' => t("Please select a school:"),
- 'options' => $options,
- 'hide_please_select' => TRUE,
- );
- $form['select_school'] = array(
- 'type' => 'hidden',
- 'value' => 'yes',
- );
-
- $form['redirect'] = array(
- 'type' => 'hidden',
- 'value' => base64_encode($redirect_path),
- );
-
- $form['submit_btn'] = array(
- 'type' => 'submit',
- 'value' => t("Continue"),
- );
-
- // change breadcrumbs based on REQUEST
- if (isset($_REQUEST['crumbs'])) {
- $crumbs = unserialize(base64_decode($_REQUEST['crumbs']));
-
- fp_set_breadcrumbs($crumbs);
- }
-
-
- return $form;
- }
-
-
-
- function stats_select_school_form_submit($form, $form_state) {
-
- // We are simply trying to select the school. Return to the form with our selection.
- $school_id = intval($form_state['values']['school_id']);
- $redirect_path = base64_decode($form_state['values']['redirect']);
- fp_goto($redirect_path, 'school_id=' . $school_id);
- return;
-
- }
-
-
-
-
-
-
-
-
-
-
- /**
- * This report shows how many students are in each major.
- *
- * @return unknown
- */
- function stats_report_major_counts() {
- $rtn = "";
-
-
- $rtn .= "<p>" . t("This report shows number of students in each major or concentration, as defined in FlightPath.") . "</p>";
-
-
-
- $rtn .= "<table border='1'>
- <tr>";
- if (module_enabled('schools')) {
- $rtn .= "<th>" . t("School") . "</th>";
- }
- $rtn .= "
- <th>" . t("Major") . "</th>
- <th>" . t("Count") . "</th>
- <th colspan='2'>" . t("Description") . "</th>
- </tr>";
-
- $total = 0;
-
- $result = db_query("SELECT * FROM degrees
- GROUP BY major_code
- ORDER BY school_id, major_code, title ");
- while ($cur = db_fetch_array($result)) {
- $count = 0;
- $major_code = $cur["major_code"];
- $title = $cur["title"];
- $degree_type = $cur["degree_type"];
- $school_id = intval($cur['school_id']);
- $school_code = "#$school_id";
- if ($school_id === 0) $school_code = "-";
- if (module_enabled("schools")) {
- $school_code = schools_get_school_code_for_id($school_id);
- }
-
- // Find out how many students have this major code.
-
- $sql = "SELECT count(cwid) AS count FROM students a, student_degrees b
- WHERE b.major_code = ?
- AND a.cwid = b.student_id
- AND rank_code IN %RANKIN%
- %EXTRA_STUDENTSEARCH_CONDITIONS% ";
-
- $rank_in = "( '" . join("', '", csv_to_array(variable_get("allowed_student_ranks", "FR,SO,JR,SR"))) . "' )";
- $sql = str_replace("%RANKIN%", $rank_in, $sql);
- $sql = str_replace("%EXTRA_STUDENTSEARCH_CONDITIONS%", variable_get("extra_student_search_conditions",""), $sql);
-
- $res2 = db_query($sql, $major_code);
- $cur2 = db_fetch_array($res2);
-
- if (is_numeric($cur2["count"])) {
- $total += $cur2["count"];
- }
- $res_array[$major_code]["count"] = $cur2["count"] * 1;
- $res_array[$major_code]["desc"] = $title;
- $res_array[$major_code]["type"] = $degree_type;
- $res_array[$major_code]["school_code"] = $school_code;
-
- }
-
-
- foreach($res_array as $major => $value) {
-
- $rtn .= "<tr>";
- if (module_enabled('schools')) {
- $rtn .= "<td valign='top' class='tenpt'>{$value["school_code"]}</td>";
- }
- $rtn .= "
- <td valign='top' class='tenpt'>$major</td>
- <td valign='top' class='tenpt'>{$value["count"]}</td>
- <td valign='top' class='tenpt'>{$value["type"]}</td>
- <td valign='top' class='tenpt'>{$value["desc"]}</td>
- </tr>";
- }
-
- $rtn .= "</table>
- " . t("Total student records:") . " $total.";
-
-
- watchdog('stats', "report_major_counts", array());
-
- return $rtn;
- }
-
-
-
- /**
- * This report shows common usages in FlightPath by all users.
- *
- * This is a helpful report for determining which functionality is most popular
- * in FlightPath
- *
- * @return unknown
- */
- function stats_report_flightpath_use_summary() {
- $rtn = "";
-
- $start_date = @$_REQUEST["start_date"];
- $end_date = @$_REQUEST["end_date"];
-
- $rtn .= stats_draw_date_range_form("stats/reports/flightpath-use-summary", $start_date, $end_date);
-
- if ($start_date == "" || $end_date == "") {
- return $rtn;
- }
- $start_date .= " 00:00:00"; // make it start at midnight of the startDate.
- $end_date .= " 23:59:59"; // make it go through to midnight of the endDate.
- // Okay, now we get our various counts....
-
- // Logins...
- $u_student = stats_get_log_count("display_dashboard","",true,$start_date,$end_date,true);
- $t_student = stats_get_log_count("display_dashboard","",false,$start_date,$end_date,true);
- $u_staff = stats_get_log_count("display_dashboard","",true,$start_date,$end_date,false);
- $t_staff = stats_get_log_count("display_dashboard","",false,$start_date,$end_date,false);
- $rtn .= "<b>System Logins / Access</b>
- <blockquote>
- Unique student logins: $u_student<br>
- Total student views of dashboard: $t_student<br>
- ------- <br>
- Unique faculty/staff logins: $u_staff<br>
- Total faculty/staff views of dashboard: $t_staff
- </blockquote>
- ";
-
- // Advisings...
- /* // This legacy code is not accurate. Going to use the "advisor use report" to get this data". - RP 11/30/2023
- $regular_advisings = stats_get_log_count("save_adv_active","",false,$start_date,$end_date,false);
- $wi_advisings = stats_get_log_count("save_adv_active_whatif","",false,$start_date,$end_date,false);
- $total_advisings = $regular_advisings + $wi_advisings;
- $rtn .= "<b>Advisings</b>
- <blockquote>
- Total student advisings: $total_advisings <br>
- ------- <br>
- Regular advisings: $regular_advisings<br>
- What If advisings: $wi_advisings
- </blockquote>
- ";
- */
-
- // Advisings
- $_REQUEST['report_type'] = 'unique';
- $_REQUEST['is_whatif'] = 'no';
- $regular_advisings = stats_report_advisor_use(TRUE);
-
- $_REQUEST['report_type'] = 'unique';
- $_REQUEST['is_whatif'] = 'yes';
- $wi_advisings = stats_report_advisor_use(TRUE);
- $total_advisings = $regular_advisings + $wi_advisings;
- $rtn .= "<b>Advisings</b>
- <blockquote>
- Total unique student advisings: $total_advisings <br>
- ------- <br>
- Regular unique advisings: $regular_advisings<br>
- What If advisings: $wi_advisings
- </blockquote>
- ";
-
-
- // Comments...
- $total = stats_get_log_count("save_comment","",false,$start_date,$end_date,false);
- $unique = stats_get_log_count("save_comment","",true,$start_date,$end_date,false);
- $rtn .= "<b>Comments</b>
- <blockquote>
- Total comments saved: $total <br>
- ------- <br>
- Unique faculty/staff commentors: $unique
- </blockquote>
- ";
-
- // Course search...
- $u_student = stats_get_log_count("course_search","",true,$start_date,$end_date,true);
- //$um_student = stats_get_log_count("course_search","",true,$start_date,$end_date,true,true);
- $t_student = stats_get_log_count("course_search","",false,$start_date,$end_date,true);
- //$tm_student = stats_get_log_count("course_search","",false,$start_date,$end_date,true, true);
-
- $u_staff = stats_get_log_count("course_search","",true,$start_date,$end_date,false);
- $t_staff = stats_get_log_count("course_search","",false,$start_date,$end_date,false);
- //$tm_staff = stats_get_log_count("course_search","",false,$start_date,$end_date,false, true);
- $rtn .= "<b>Course Search</b>
- <blockquote>
- Unique student users: $u_student <br>
- Total student uses: $t_student <br>
- ------- <br>
- Unique faculty/staff users: $u_staff<br>
- Total faculty/staff (and anonymous) uses: $t_staff </span>
- </blockquote>
- ";
-
-
- // Degree search...
- $u_student = stats_get_log_count("blank_degrees","",true,$start_date,$end_date,true);
- //$um_student = stats_get_log_count("blank_degrees","",true,$start_date,$end_date,true,true);
- $t_student = stats_get_log_count("blank_degrees","",false,$start_date,$end_date,true);
- //$tm_student = stats_get_log_count("blank_degrees","",false,$start_date,$end_date,true, true);
- $u_staff = stats_get_log_count("blank_degrees","",true,$start_date,$end_date,false);
- $t_staff = stats_get_log_count("blank_degrees","",false,$start_date,$end_date,false);
- //$tm_staff = stats_get_log_count("blank_degrees","",false,$start_date,$end_date,false, true);
- $rtn .= "<b>Degree Search (blank degrees)</b>
- <blockquote>
- Unique student users: $u_student <br>
- Total student uses: $t_student <br>
- ------- <br>
- Unique faculty/staff users: $u_staff<br>
- Total faculty/staff (and anonymous) uses: $t_staff </span>
- </blockquote>
- ";
-
-
- // View preferences
- $t_student_y = stats_get_log_count("view_by_year","",false,$start_date,$end_date,true);
- //$tm_student_y = stats_get_log_count("view_by_year","",false,$start_date,$end_date,true, true);
- $u_student_y = stats_get_log_count("view_by_year","",true,$start_date,$end_date,true);
- //$um_student_y = stats_get_log_count("view_by_year","",true,$start_date,$end_date,true, true);
-
- $t_staff_y = stats_get_log_count("view_by_year","",false,$start_date,$end_date,false);
-
- $t_student_t = stats_get_log_count("view_by_type","",false,$start_date,$end_date,true);
- //$tm_student_t = stats_get_log_count("view_by_type","",false,$start_date,$end_date,true, true);
- $u_student_t = stats_get_log_count("view_by_type","",true,$start_date,$end_date,true);
- //$um_student_t = stats_get_log_count("view_by_type","",true,$start_date,$end_date,true, true);
-
-
- $t_staff_t = stats_get_log_count("view_by_type","",false,$start_date,$end_date,false);
- $rtn .= "<b>View Preferences</b>
- <blockquote>
- Unique student view-by-year: $u_student_y <br>
- Total student view-by-year: $t_student_y <br>
- Total faculty/staff view-by-year: $t_staff_y<br>
- ------- <br>
- Unqiue student view-by-type: $u_student_t <br>
- Total student view-by-type: $t_student_t <br>
- Total faculty/staff view-by-type: $t_staff_t<br>
- </blockquote>
- ";
-
- // Substitutions
- $t_staff = stats_get_log_count("save_substitution","",false,$start_date,$end_date,false);
- $u_staff = stats_get_log_count("save_substitution","",true,$start_date,$end_date,false);
- $rtn .= "<b>Substitutions</b>
- <blockquote>
- Unique substitutors: $u_staff<br>
- Total substitutions: $t_staff<br>
- </blockquote>
- ";
-
-
-
- watchdog('stats', "report_flightpath_use_summary start_date:$start_date, end_date:$end_date", array());
-
-
- return $rtn;
- }
-
-
-
-
- /**
- * Used by the use_summary report. This function will simply return log counts
- * for the specified parameters in the watchdog table.
- *
- * @param unknown_type $action
- * @param unknown_type $action_array
- * @param unknown_type $bool_distinct
- * @param unknown_type $start_date
- * @param unknown_type $end_date
- * @param unknown_type $bool_students
- * @param unknown_type $bool_mobile_only
- * @return unknown
- */
- function stats_get_log_count($action = "", $action_array = "", $bool_distinct = false, $start_date = '', $end_date = '', $bool_students = true, $bool_mobile_only = false)
- {
-
- $action_line = " `type` = '$action' ";
- if (is_array($action_array) && count($action_array) > 1)
- {
- $action_line = "";
- $action_line .= "( ";
- foreach($action_array as $action)
- {
- $action_line .= " `type`='$action' OR";
- }
- $action_line = substr($action_line, 0, -2);
- $action_line .= ") ";
- }
-
- $count = "count(wid)";
- if ($bool_distinct)
- {
- $count = "count(distinct `user_id`)";
- }
-
- $user_type = "";
- if ($bool_students)
- {
- $user_type = " `is_student` = '1' ";
- } else {
- $user_type = " `is_faculty` = '1' ";
- }
-
- if ($bool_mobile_only) {
- $action_line .= " AND is_mobile = '1' ";
- }
-
- $start_ts = strtotime($start_date);
- $end_ts = strtotime($end_date);
-
- $res = db_query("SELECT $count AS count FROM watchdog
- WHERE
- `timestamp` > '$start_ts' AND `timestamp` < '$end_ts'
- AND $user_type
- AND
- $action_line
- ");
- $cur = db_fetch_array($res);
- return $cur["count"] * 1;
-
-
- }
-
-
-
-
-
- /**
- * Displays the HTML for the date range form used by several reports.
- * $path is what is the form's ACTION sending to.
- *
- * start and end date expected in YYYY-MM-DD format
- *
- */
- function stats_draw_date_range_form($path, $start_date = "", $end_date = "", $additional_form_elements = "") {
- $rtn = "";
-
- $rtn .= "<form action='" . fp_url($path) . "' method='GET' >
- " . t("Select a date range to begin:") . "
- <br>
- " . t("Start date:") . "
- <span class='form-element element-type-date element-size-smaller'>
- <input type='date' name='start_date' value='$start_date' id='start_date'>
- </span>
-
- " . t("End date:") . "
- <span class='form-element element-type-date'>
- <input type='date' name='end_date' value='$end_date' id='end_date'>
- </span>
- ";
-
-
- if ($additional_form_elements != "") {
- $rtn .= $additional_form_elements;
- }
-
- fp_add_css(fp_get_module_path("system") . "/css/style.css");
- fp_add_js(fp_get_module_path("system") . "/js/spinner.js");
-
- $name = fp_get_machine_readable($path);
-
- $rtn .= "
-
- <span class='buttons form-element element-type-submit'>
- <input type='submit' value='" . t("Submit") . "' onclick='$(\".loading-spinner\").show();'>
- </span>
-
- <span class='loading-spinner loading-spinner-$name' style='display:none;'></span>
-
- </form> <hr>
- ";
-
-
- return $rtn;
- }
-
-
- /**
- * This report shows which advisors are using FlightPath most often.
- *
- *
- * @return unknown
- */
- function stats_report_advisor_use($bool_only_return_total_number = FALSE) {
- $rtn = "";
-
- $start_date = $end_date = $report_type = $whatif = $report_type = "";
-
- if (isset($_REQUEST["start_date"])) {
- $start_date = trim(addslashes(@$_REQUEST["start_date"]));
- $end_date = trim(addslashes(@$_REQUEST["end_date"]));
- $report_type = trim(addslashes(@$_REQUEST["report_type"]));
- }
- if (isset($_REQUEST['is_whatif'])) {
- $whatif = trim(@$_REQUEST['is_whatif']);
- }
-
- $selall = $selunique = "";
- if ($report_type == 'unique') $selunique = 'selected';
-
- $additional_form_elements = t("Report Type:") . "
- <span class='form-element element-type-select-smaller'>
- <select name='report_type' id='report_type'>
- <option value='all' $selall>" . t("All saved advisings") . "</option>
- <option value='unique' $selunique>" . t("Unique student advisings") . "</option>
- </select>
- </span>
- ";
-
-
- $rtn .= stats_draw_date_range_form("stats/reports/advisor-use", $start_date, $end_date, $additional_form_elements);
-
- if ($start_date == "" || $end_date == "") {
- return $rtn;
- }
-
- $start_date .= " 00:00:00"; // make it start at midnight of the startDate.
- $end_date .= " 23:59:59"; // make it go through to midnight of the endDate.
-
- $start_ts = strtotime($start_date);
- $end_ts = strtotime($end_date);
-
- // Now, what we're doing here is we want the names of the advisors,
- // and how many advisings they actually completed for each,
- // as well as which college or department they belong to. They need
- // to be sorted by college/department.
- $f_array = array();
- $s_array = array();
- $terms = array();
-
- $already_found_student_and_term = array();
-
- // TODO: get by school that user belongs to?
- $departments = fp_get_departments();
-
- $s_array = array();
-
-
- $whatif_line = "";
- if ($whatif == 'yes') {
- $whatif_line = "AND a.is_whatif = 1 ";
- }
- else if ($whatif == 'no') {
- $whatif_line = "AND a.is_whatif != 1 ";
- }
-
-
- $res = db_query("SELECT *
- FROM advising_sessions a, users u, faculty f
- WHERE
- (`posted` > ? AND `posted` < ?)
- AND a.is_empty != 1
- AND a.is_draft != 1
- AND a.delete_flag != 1
- $whatif_line
- AND is_faculty = 1
- AND a.faculty_id = u.cwid
- AND u.cwid = f.cwid
- ORDER BY l_name, f_name
- ", array($start_ts, $end_ts));
- while ($cur = db_fetch_array($res)) {
-
- $faculty_id = $cur['faculty_id'];
- $student_id = $cur['student_id'];
- $term_id = $cur['term_id'];
-
- $is_whatif = intval($cur['is_whatif']);
-
-
- if ($report_type == 'unique') {
- if (in_array("$faculty_id~$student_id~$term_id~$is_whatif", $already_found_student_and_term)) continue;
- $already_found_student_and_term[] = "$faculty_id~$student_id~$term_id~$is_whatif";
- }
-
- if (!isset($f_array[$faculty_id])) $f_array[$faculty_id] = 0;
-
-
- $school_id = intval($cur['school_id']);
- $dept_name = @$departments[$cur['department_code']];
- if (!$dept_name) $dept_name = $cur['department_code'];
-
-
- $f_array[$faculty_id] = intval($f_array[$faculty_id]); // make it a number.
- $f_array[$faculty_id]++;
-
- $s_array[$faculty_id]["dept_name"] = $dept_name;
- $s_array[$faculty_id]["college_name"] = ucwords(strtolower(trim($cur["college"])));
-
- $s_array[$faculty_id]["school_id"] = $school_id;
- $s_array[$faculty_id]["name"] = ucwords(strtolower(trim($cur["f_name"]) . " " . trim($cur["l_name"]))) . " ($faculty_id)";
-
-
-
-
-
- if (!isset($s_array[$faculty_id][$term_id])) $s_array[$faculty_id][$term_id] = 0;
- $s_array[$faculty_id][$term_id]++;
-
- $terms[$term_id] = get_term_description($term_id);
- }
-
-
-
-
-
-
- ksort($terms);
-
-
- // Sort based on who has advised the most...
- //arsort($f_array);
-
- $start_date = trim(addslashes($_REQUEST["start_date"]));
- $end_date = trim(addslashes($_REQUEST["end_date"]));
-
- $grand_total = 0;
-
- // Now, output the results...
- if ($report_type == 'all') {
- $rtn .= "<p><b>Note:</b> This Report Type (selected above) shows the total number of advising sessions saved by the advisor, <em>including</em> sessions which were saved
- more than once. Deleted advising sessions are not counted.</p>";
- }
- else if ($report_type == 'unique') {
-
- $rtn .= "<p><b>Note:</b> This Report Type (selected above) shows the number of advising sessions saved by the advisor,
- <em>unique to a student AND What If mode</em>. It ignores sessions which were saved
- more than once, unless the second time was in What If mode. Deleted advising sessions are not counted.</p>";
- }
-
- $rtn .= "
- <table border='1' cellpadding='10' style='min-width:700px;'>
- <tr>";
-
- if (module_enabled('schools')) {
- $rtn .= "<th>" . t("School") . "</th>";
- }
-
- $rtn .= "<th>" . t("Name") . "</th>
- <th>" . t("Dept") . "</th>
- <th>Total #</th>";
-
- // loop through and add in the terms
- foreach ($terms as $term_id => $term_desc) {
- $rtn .= "<td>$term_desc</td>";
- }
-
-
- $rtn .= "</tr>";
- foreach($f_array as $faculty_id => $value)
- {
- $name = $s_array[$faculty_id]["name"];
- $college_name = $s_array[$faculty_id]["college_name"];
- $dept_name = $s_array[$faculty_id]["dept_name"];
- $school_id = $s_array[$faculty_id]["school_id"];
-
- $grand_total = $grand_total + intval($value);
-
- $rtn .= "<tr>";
-
- if (module_enabled('schools')) {
- $rtn .= "<td valign='top'>" . schools_get_school_name_for_id($school_id) . "</td>";
- }
-
- $rtn .= "
- <td valign='top'>$name</td>
- <td valign='top'>$dept_name</td>
- <td valign='top' align='center'>$value</td>";
-
- // loop through and add in the terms
- foreach ($terms as $term_id => $term_desc) {
- $rtn .= "<td align='center'>" . $s_array[$faculty_id][$term_id] . "</td>";
- }
-
-
-
- $rtn .= "
- </tr>
-
- ";
- }
- $rtn .= "</table>";
- $rtn .= "<p><b>Total in selected date range:</b> $grand_total</p>";
-
- if ($bool_only_return_total_number) {
- return intval($grand_total);
- }
-
-
- return $rtn;
- }
-
-
-
- /**
- * This report shows recent activity in FlightPath. It can also be used to see
- * if anyone is "online" in that they would have activity less than 5 minutes old.
- *
- * @return unknown
- */
- function stats_report_access_stats() {
- $rtn = "";
-
-
- fp_add_css(fp_get_module_path("admin") . '/css/admin.css');
-
- $min = intval(@$_REQUEST["min"]);
- if ($min < 1 || $min > 2000)
- {
- $min = "20";
- }
-
-
- $rtn .= "
- <form action='" . fp_url("stats/reports/access") . "' method='GET'>
- " . t("Activity over the last") . "
- <input type='text' name='min' value='$min' size='2'>
- ";
-
-
-
- $rtn .= t("minutes") . ": <input type='submit' value='>'>
- </form>
- " . t("Unique students in time frame") . ": <!--STUDENTS-->. " . t("Unique faculty/staff in time frame") . ": <!--STAFF--> <br>";
-
- $rtn .= "<hr>
- <table class='watchdog-table' cellspacing='0' cellpadding='4'>
- <tr>
- <th>" . t("ID") . "</th>
- <th>" . t("User") . "</th>
- <th>" . t("User Type") . "</th>
- <th>" . t("Action") . "</th>
- <th>" . t("Msg") . "</th>
- <th>" . t("Time") . "</th>
-
- </tr>";
-
- $cwid_array = array();
- $student_actions = $staff_actions = 0;
-
- $interval = time() - ($min * 60);
- $pol = "";
- $res = db_query("SELECT * FROM watchdog
- WHERE `timestamp` > ?
- ORDER BY `timestamp` DESC
- ", $interval);
- while ($cur = db_fetch_array($res)) {
- extract ($cur, 3, "db");
- $wid = $cur['wid'];
- $account = fp_load_user($db_user_id);
-
- $pol = ($pol == "even") ? "odd" : "even";
-
- $minago = round((time() - $db_timestamp) / 60, 0);
-
- $vars = @unserialize($db_variables);
- if (!$vars) $vars = '';
-
- $message = strip_tags(t($db_message, $vars));
- if (strlen($message) > 100) {
- $message = trim(substr($message, 0, 100)) . "...";
- }
-
-
- $pretty_date = format_date(convert_time($db_timestamp));
-
- $user_type = "";
- if ($account->is_student) {
- $user_type .= "<span>" . t("Student") . "</span>";
- }
- if ($account->is_faculty) {
- $user_type .= "<span style='background-color: lightyellow;'>" . t("Faculty") . "</span>";
- }
-
- $rtn .= "<tr class='row-$pol'>
- <td valign='top'>" . l($wid, "admin/config/watchdog/$wid") . "</td>
- <td valign='top'>$account->name</td>
- <td valign='top'>$user_type</td>
- <td valign='top'>$db_type</td>
- <td valign='top'>$message</td>
- <td valign='top'>$minago " . t("min ago") . " <em>($pretty_date)</em></td>
- </tr>";
-
- // Let's increase our counters, if this is a new CWID.
- if (!in_array($db_user_id, $cwid_array)) {
- $cwid_array[] = $db_user_id;
- if ($account->is_student) {
- $student_actions++;
- } else if ($account->is_faculty) {
- $staff_actions++;
- }
- }
-
-
- }
-
- // Add in our student and staff action counts
- $rtn = str_replace("<!--STUDENTS-->",$student_actions,$rtn);
- $rtn = str_replace("<!--STAFF-->",$staff_actions,$rtn);
-
-
- $rtn .= "</table>";
-
-
- return $rtn;
- }
-
-
- /**
- * This report shows a list of all of a student's courses which FlightPath is aware of.
- *
- * @return unknown
- */
- function stats_report_student_course_list() {
-
- $rtn = "";
-
- $student_cwid = "";
-
- if (isset($_REQUEST["student_cwid"])) {
- $student_cwid = trim(addslashes($_REQUEST["student_cwid"]));
- }
- $student_pidm = 0;
- //$rtn .= stats_draw_student_cwid_form("stats/reports/student-course-list", $student_cwid);
-
- $rtn .= "<form action='" . fp_url("stats/reports/student-course-list") . "' method='GET' >
- " . t("Enter a student's CWID to see their courses:") . "
- <br>
- <span class='form-element element-type-textfield'>
- <input type='textfield' value='$student_cwid' name='student_cwid'>
- </span>
-
- <span class='buttons form-element element-type-submit'>
- <input type='submit' value='" . t("Submit") . "'>
- </span>
- </form> <hr>";
-
-
- if ($student_cwid == "") {
- return $rtn;
- }
-
- // If we have the banner_integration module installed, then get the pidm from banner too
- if (function_exists("banner_integration_get_pidm_for_cwid")) {
- $student_pidm = intval(banner_integration_get_pidm_for_cwid($student_cwid));
- }
- $student_name = fp_get_student_name($student_cwid);
- $student = new Student($student_cwid);
-
- $school_id = db_get_school_id_for_student_id($student_cwid);
- $school_name = "";
- if (module_enabled("schools")) {
- $school_name = schools_get_school_name_for_id($school_id);
- }
-
-
- $rtn .= "
-
- <style>
- .zebra-even {
- background-color: white;
- }
- .zebra-odd {
- background-color: #eee;
- }
- </style>
-
- <h2>$student_name ($student_cwid)
- ";
- if ($student_pidm > 0) {
- $rtn .= "<br>PIDM: $student_pidm";
- }
- if ($school_name) {
- $rtn .= "<br>" . t("School:") . "<em>$school_name</em>";
- }
- $rtn .= "</h2>
- <table border='0' cellspacing='0' cellpadding='6'>
- <tr>
- <th>Subject</th>
- <th>Number</th>
- <th>Grade</th>
- <th>Hours</th>
- <th>Term</th>
- <th>Transfer?</th>
- </tr>";
-
-
- // So that we can sort our list of courses, we will add them to
- // 2 arrays, one for local courses, one for transfer.
- $local_array = array();
- $transfer_array = array();
-
- $pol = "even";
-
- $local_hours = 0;
- $transfer_hours = 0;
-
-
-
- while($student->list_courses_taken->has_more()) {
- $course = $student->list_courses_taken->get_next();
-
- $subjectID = $course->subject_id;
- $courseNum = $course->course_num;
- $grade = $course->grade;
- $hours = $course->get_hours_awarded();
-
- $rnd = mt_rand(0,9999);
-
- if (is_object($course->course_transfer)) {
- $subjectID = $course->course_transfer->subject_id;
- $courseNum = $course->course_transfer->course_num;
- $grade = $course->course_transfer->grade;
- $hours = $course->course_transfer->get_hours_awarded();
-
- $transfer_hours += $hours;
-
- }
- else {
- // local course
- $local_hours += $hours;
- }
-
- $html_line = "
- <td>$subjectID</td>
- <td>$courseNum</td>
- <td>$grade</td>
- <td>$hours</td>
- <td>$course->term_id</td>
- <td>" . (($course->bool_transfer) ? "T" : "") . "</td>
- ";
-
- if ($course->bool_transfer) {
- // The $rnd makes sure this is unique, in case a course is showing as repeated in the same term.
- $transfer_array["$course->term_id~$subjectID~$courseNum~$rnd"] = $html_line;
- }
- else {
- // The $rnd makes sure this is unique, in case a course is showing as repeated in the same term.
- $local_array["$course->term_id~$subjectID~$courseNum~$rnd"] = $html_line;
- }
-
-
- }
-
-
- // Okay, now let's sort our arrays and display them.
- ksort($transfer_array);
- ksort($local_array);
-
- foreach($local_array as $line) {
- $rtn .= "<tr class='zebra-$pol'>$line</tr>";
- $pol = ($pol == "even")?"odd":"even";
- }
-
- foreach($transfer_array as $line) {
- $rtn .= "<tr class='zebra-$pol'>$line</tr>";
- $pol = ($pol == "even")?"odd":"even";
- }
-
-
-
- $rtn .= "</table>
- <hr>
- ";
-
- $rtn .= "<p>" . count($local_array) . " local courses, with $local_hours hours.</p>";
- $rtn .= "<p>" . count($transfer_array) . " transfer courses, with $transfer_hours hours.</p>";
-
-
- watchdog('stats', "report_student_course_list student_id:$student_cwid, school_id:$school_id, student_name:$student_name", array());
-
-
- return $rtn;
-
-
- }
-
-
-
- /**
- * Main menu screen for this module.
- *
- * We will simply display the "menu block" for "stats/reports". That is,
- * any path that begins with stats/reports will show up here.
- *
- * You can create a report in your custom module, and as long as the url begins
- * with stats/reports, and the menu item is of type "MENU_TYPE_NORMAL_ITEM"
- * it will appear on this page. Set the weight to be > 1000 to appear below this list,
- * set weight < 100 to appear above.
-
- *
- * @return unknown
- */
- function stats_display_main() {
- $rtn = "";
-
-
-
- $rtn .= "<div class='stats-main-menu'>";
- $rtn .= fp_render_menu_block("System Reports", "stats/reports");
- $rtn .= "</div>";
-
- // If we have other reports which have been exposed using the hook_stats_additional_menublocks function,
- // display them here.
-
- $reports = invoke_hook('stats_additional_menublocks');
- if ($reports) {
- foreach ($reports as $module_name => $temp) {
- $extraclass = "";
-
- $extraclass .= "stats-menublock-path-" . strtolower(fp_get_machine_readable(current($reports[$module_name])));
-
- $rtn .= "<div class='stats-main-menu stats-additional-menublocks $extraclass'>";
- foreach($reports[$module_name] as $title => $menu_block_path) {
- $rtn .= fp_render_menu_block($title, $menu_block_path);
- }
- $rtn .= "</div>";
- }
- }
-
-
-
-
-
- return $rtn;
- }
Functions
Name![]() |
Description |
---|---|
stats_display_main | Main menu screen for this module. |
stats_download_csv_from_batch | Lets the user download a CSV file from a completed batch. |
stats_draw_catalog_year_pulldown | Return the HTML for a pulldown containing the catalog years available for selection. |
stats_draw_date_range_form | Displays the HTML for the date range form used by several reports. $path is what is the form's ACTION sending to. |
stats_draw_majors_pulldown | Display a major selection pulldown, used by other reports. |
stats_get_log_count | Used by the use_summary report. This function will simply return log counts for the specified parameters in the watchdog table. |
stats_menu | Implementation of hook_menu |
stats_perm | Implementation of hook_perm(). Expects to return an array of permissions recognized by this module. |
stats_report_access_stats | This report shows recent activity in FlightPath. It can also be used to see if anyone is "online" in that they would have activity less than 5 minutes old. |
stats_report_advisor_use | This report shows which advisors are using FlightPath most often. |
stats_report_course_use_summary | This report will display everywhere a particular course is used in FlightPath (groups and degrees) |
stats_report_flightpath_use_summary | This report shows common usages in FlightPath by all users. |
stats_report_major_counts | This report shows how many students are in each major. |
stats_report_student_course_list | This report shows a list of all of a student's courses which FlightPath is aware of. |
stats_select_school_form | |
stats_select_school_form_submit | |
z__stats_draw_student_cwid_form | Draws a simple form for entering a student's CWID, used by other reports. |
z__stats_report_selected_degree_options | This report will show which degree options are being selected for degrees which offer options. |