function admin_display_groups

7.x admin.groups.inc admin_display_groups()
6.x admin.groups.inc admin_display_groups()
4.x admin.groups.inc admin_display_groups()
5.x admin.groups.inc admin_display_groups()

This function will display a list of all our groups.

File

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

Code

function admin_display_groups() {
  $rtn = "";

  $de_catalog_year = admin_get_de_catalog_year();

  fp_add_css(fp_get_module_path("admin") . "/css/admin.css");
  fp_add_js(fp_get_module_path("admin") . "/js/admin.js");

  $db2 = new DatabaseHandler();

  fp_set_title(t("Edit Groups for") . " $de_catalog_year");

  $rtn .= "
      <h2 class='title'>" . t("Edit Groups for @de_catalog_year", array("@de_catalog_year" => $de_catalog_year)) . "</h2>
        Options:
        <ul style='margin-top: 5px;'>          
          <li>" . l(t("Add a new group to this year"), "admin/groups/edit-group", "de_catalog_year=$de_catalog_year&group_id=new") . "</li>
          <li>" . l(t("Process all group definitions for this year"), "admin/groups/process-all-definitions", "de_catalog_year=$de_catalog_year") . "</li>
          </li>
        </ul>
          <div align='center'>" . t("Hint: use CTRL-F to search groups quickly") . "</div>
        <table border='0' cellpadding='2' width='100%' class='admin-groups-list'>
        <tr>
          <th>" . t("Title") . "</th>
          <th>" . t("Internal Name") . "</th>
          <th align='center'>Pri</th>
          <th align='center'>i</th>
          <th align='center'>" . t("Used") . "</th>
        </tr>
      ";

  $on_mouse_over = " onmouseover=\"style.backgroundColor='#FFFF99'\"
              onmouseout=\"style.backgroundColor='white'\" ";

  $res = db_query("SELECT * FROM draft_groups
              WHERE catalog_year = '?'
              AND delete_flag = '0'
              ORDER BY title, group_name ", $de_catalog_year);
  while ($cur = db_fetch_array($res)) {
    extract($cur, 3, "db");

    $use_count = 0;
    // Find out how many degree plans are using this particular group...

    $res2 = db_query("SELECT count(id) AS count FROM draft_degree_requirements
                WHERE group_id = '?' ", $db_group_id);
    if (db_num_rows($res2) > 0) {
      $cur2 = db_fetch_array($res2);
      $use_count = $cur2 ["count"];
    }

    $def_flag = "";
    if (trim($db_definition) != "") {
      $def_flag = " (*)";
    }

    if ($db_title == "") {
      $db_title = "[" . t("NO TITLE SPECIFIED") . "]";
    }

    $rtn .= "<tr $on_mouse_over>
          <td valign='top' class='tenpt'><a name='group_$db_group_id'></a>
            " . l($db_title, "admin/groups/edit-group", "group_id=$db_group_id&de_catalog_year=$de_catalog_year") . "
          </td>
          <td valign='top' class='tenpt'>
            <i>$db_group_name</i>$def_flag
          </td>
          <td valign='top' class='tenpt'>
            $db_priority
          </td>
          <td valign='top' class='tenpt'>
            <img src='" . fp_theme_location() . "/images/icons/$db_icon_filename' width='19'>
          </td>
          <td valign='top' class='tenpt'>
            $use_count <a href='javascript: adminPopupWindow(\"" . base_path() . "/admin/groups/popup-show-group-use&group_id=$db_group_id\");'><img src='" . fp_theme_location() . "/images/popup.gif' border='0'></a>
          </td>

          
        </tr>";
  }

  $rtn .= "</table>";




  return $rtn;
}