admin_display_degrees

4.x admin.degrees.inc admin_display_degrees()

File

modules/admin/admin.degrees.inc, line 513

Code

function admin_display_degrees() {
  $de_catalog_year = admin_get_de_catalog_year();
  $rtn = "";

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

  $rtn .= "<h2 class='title'>" . t("Degrees for @year", array("@year" => $de_catalog_year)) . "</h2>";

  $rtn .= "<div class='admin-degrees-upper-links'>";
  $rtn .= l("Add new degree plan (major, degree plan, or track)", "admin/degrees/add-degree", "de_catalog_year=$de_catalog_year");
  $rtn .= " &nbsp; &nbsp; | &nbsp; &nbsp; ";
  $rtn .= l("Copy a degree plan", "admin/degrees/copy-degree", "de_catalog_year=$de_catalog_year");
  $rtn .= "</div>";


  $rtn .= "<div class='list-degree-row-excluded'>
        " . t("Majors or Tracks marked as \"exclude\" are shaded.  You may pull up students with these
        majors in FlightPath, but they will not be options in the What If mode.") . "
      </div>
      <br>
      <div class='tenpt' align='center'>
        " . t("Use CTRL-F to find degrees more quickly.") . "
      </div>";


  $res = db_query("SELECT * FROM draft_degrees
              WHERE catalog_year = '?'
             ORDER BY degree_type, major_code, title ", $de_catalog_year);

  while ($cur = db_fetch_array($res)) {
    $db_exclude = 0;
    extract($cur, 3, "db");

    if ($db_degree_type == "NA" && strstr($db_major, "|")) {
      $db_degree_type = " -- ";
    }

    $extra_class = "";
    if ($db_exclude == "1") {
      $extra_class = "list-degree-row-excluded";
    }

    // get JUST the major code...
    $temp = explode("|", $db_major_code);
    $just_major = trim($temp[0]);
    $just_conc = trim($temp[1]);
    $outside = "";

    //if ($just_conc != "" && strstr($just_conc, "_"))
    if (strstr($just_conc, "_")) {
      // If the concentration has an underscore, it's actually
      // a track.  Let's get the track title...
      $temp2 = explode("_", $just_conc);
      $just_track = trim($temp2[1]);
      // Might need to add the first part BACK onto the major...
      if (trim($temp2[0]) != "") {
        $just_major .= "|" . trim($temp2[0]);
      }


      $res2 = db_query("SELECT * FROM draft_degree_tracks
                WHERE catalog_year = '?'
                AND major_code = '?'
                AND track_code = '?' ", $de_catalog_year, $just_major, $just_track);
      if (db_num_rows($res2) > 0) {
        $cur2 = db_fetch_array($res2);

        $db_title = trim($cur2["track_title"]);
        $outside = "----&gt;";
        if (strstr($just_major, "|")) {
          // both a conc AND a track. Denote it special.
          $outside = ">>" . $outside;
        }
        $db_degree_type = "";
      }
    }
    else if ($just_conc != "") {
      // Meaning, this is a concentration, NOT a track.
      $db_degree_type = "";
      $outside = "&gt;&gt;";
    }



    $rtn .= "<div class='admin-degrees-list-degree'>
             <a name='degree_$db_degree_id'></a>";
    $rtn .= "<div class='list-degree-row $extra_class'>
            $outside
            " . l("$db_degree_type $db_title $db_major_code", "admin/degrees/edit-degree", "de_catalog_year=$de_catalog_year&major_code=$db_major_code", array("class" => "degree-$db_degree_class")) . "
            </div>
            </div>";



  }

  return $rtn;

}