function admin_display_groups_popup_show_group_use

6.x admin.groups.inc admin_display_groups_popup_show_group_use()
4.x admin.groups.inc admin_display_groups_popup_show_group_use()
5.x admin.groups.inc admin_display_groups_popup_show_group_use()

Displays a popup showing where a particular group is being used in FlightPath.

File

modules/admin/admin.groups.inc, line 1940

Code

function admin_display_groups_popup_show_group_use() {
  $rtn = "";

  $group_id = $_REQUEST ["group_id"];
  $group = new Group();
  $group->group_id = $group_id;
  $group->bool_use_draft = true;
  $group->load_descriptive_data();

  $defs = array();
  if (module_enabled("schools")) {
    $defs = schools_get_school_definitions(TRUE);
  }


  $rtn .= "<b>" . t("Degrees (from draft table) using @group_title (%group_name):", array("@group_title" => $group->title, "%group_name" => $group->group_name)) . "</b>
    <br><br>
    <table border='0' cellspacing='5' width='100%'>
    <tr>
      <th>" . t("Degree") . "</th>
      <th>" . t("Code") . "</th>
      <th>" . t("Block") . "</th>
      <th>" . t("Year") . "</th>
      <th>" . t("School") . "</th>
    </tr>
    ";


  $db = get_global_database_handler();

  $res = db_query("SELECT * FROM draft_degrees a,
                    draft_degree_requirements b
                  WHERE a.degree_id = b.degree_id
                  AND b.group_id = ?
                  ORDER BY a.title, a.major_code, b.semester_num ", $group_id);
  while ($cur = db_fetch_array($res)) 
   {
    extract($cur, 3, "db");

    $school_id = $db->get_school_id_for_degree_id($db_degree_id, TRUE);
    $school_code = @$defs [$school_id]['school_code'];
    if ($school_id === 0) {
      $school_code = "-";
    }
    $rtn .= "<tr>
          <td valign='top' class='tenpt' >
            $db_title
          </td>
          <td valign='top' class='tenpt' >
            $db_major_code
          </td>
          <td valign='top' class='tenpt' >
            " . ($db_semester_num + 1) . "
          </td>
          <td valign='top' class='tenpt'>
            $db_catalog_year
          </td>
          
          <td valign='top' class='tenpt'>
            $school_code
          </td>
          
        </tr>
        ";

  }


  $rtn .= "</table>";



  return $rtn;
}