function AdvisingScreen::display_toolbox_courses

6.x AdvisingScreen.php AdvisingScreen::display_toolbox_courses()

Used in the Toolbox popup, this will display content of the tab which shows a student's courses which they have taken.

Return value

string

File

classes/AdvisingScreen.php, line 1404

Class

AdvisingScreen

Code

function display_toolbox_courses() 
 {
  $pC = "";
  $ns = $os = $fan = $fat = "";
  $pC .= fp_render_section_title(t("All Student Courses"));

  $csid = @$_REQUEST ["current_student_id"];
  $school_id = db_get_school_id_for_student_id($csid);
  $order = @$_REQUEST ["order"];
  if ($order == "name") 
   {
    $ns = "font-weight: bold; text-decoration: none;";
    $fan = " <i class='fa fa-angle-up' style='font-weight:bold;'></i>";
  }
  else {
    $os = "font-weight: bold; text-decoration: none;";
    $fat = " <i class='fa fa-angle-down' style='font-weight:bold;'></i>";
  }

  /*
    $pC .= "<div class=' '>
        " . t("This window displays all of the student's courses
        which FlightPath is able to load.") . "         
        <br><br>
        " . t("Order by:") . " &nbsp; &nbsp;";
    $pC .= l(t("Name"), "advise/popup-toolbox/courses", "order=name&current_student_id=$csid", array("style" => $ns)) . "&nbsp; &nbsp;";
    $pC .= l(t("Term"), "advise/popup-toolbox/courses", "order=date&current_student_id=$csid", array("style" => $os));
*/
  $pC .= "
        <table border='0' cellpadding='2' cellspacing='3'>
          <tr>
            <th colspan='2'>" . l(t("Name") . $fan, "advise/popup-toolbox/courses", "order=name&current_student_id=$csid", array("style" => $ns)) . "</th>
            <th>Hr</th>
            <th>Gr</th>
            <th width=50>" . l(t("Term") . $fat, "advise/popup-toolbox/courses", "order=date&current_student_id=$csid", array("style" => $os)) . "</th>
            <th>Attributes</th>
          </tr>
          ";
  $is_empty = true;
  if ($order == "name") 
   {
    $this->student->list_courses_taken->sort_alphabetical_order();
  }
  else {
    $this->student->list_courses_taken->sort_most_recent_first();
  }
  $this->student->list_courses_taken->reset_counter();
  while ($this->student->list_courses_taken->has_more()) 
   {
    $c = $this->student->list_courses_taken->get_next();

    if ($c->course_id > 0) 
     {
      $c->load_descriptive_data();
    }

    $l_s_i = $c->subject_id;
    $l_c_n = $c->course_num;
    $eqv_line = "";

    if (isset($c->course_transfer) && $c->course_transfer->course_id > 0) 
     {
      if ($c->course_id > 0) 
       {
        $eqv_line = "<tr>
              <td colspan='8' class=' '
                style='padding-left: 20px;'>
                <i>*eqv to " . variable_get_for_school("school_initials", "DEMO", $school_id) . " $l_s_i $l_c_n</i></td>
              </tr>";
      }
      $l_s_i = $c->course_transfer->subject_id;
      $l_c_n = $c->course_transfer->course_num;

    }


    $l_title = $this->fix_course_title($c->title);
    $l_term = $c->get_term_description(true);

    $h = $c->get_hours_awarded();
    if ($c->bool_ghost_hour) {
      $h .= "(" . t("ghost") . "<a href='javascript:alertSubGhost()'>?</a>)";
    }

    $pC .= "<tr>
            <td valign='top' class=' '>$l_s_i</td>
            <td valign='top' class=' '>$l_c_n</td>
            <td valign='top' class=' '>$h</td>
            <td valign='top' class=' '>$c->grade</td>
            <td valign='top' class=' '>$c->term_id</td>
            ";
    $pC .= "<td valign='top' class=' '>";

    if ($c->bool_transfer) {
      $pC .= "T ";
    }


    //if ($c->bool_substitution) {$pC .= "S ";}
    if ($c->get_bool_substitution()) {
      $pC .= "S ";
    }



    if ($c->get_has_been_assigned_to_any_degree()) 
     {
      $pC .= "A:";
      //////////////////////////////
      // List all the groups/degrees this course has been assigned to!        
      if ($c->get_first_assigned_to_group_id() == "") 
       {
        $pC .= "degree plan";
      }
      else {
        $temp_group = new Group();
        //$temp_group->group_id = $c->assigned_to_group_id;
        $temp_group->group_id = $c->get_first_assigned_to_group_id();
        $temp_group->load_descriptive_data();
        $pC .= $temp_group->title;
      }


    }
    $pC .= "</td>";



    $pC .= "</tr>$eqv_line";

    $is_empty = false;
  }

  if ($is_empty == true) 
   {
    $pC .= "<div align='center'>" . t("No courses have been moved for this student.") . "</div>";
  }

  $pC .= "</table>";

  $pC .= "</div>";

  $pC .= "<hr><p>" . t("Attrib Legend: T = Transfer credit, A = Assigned to (group or degree plan)") . "</p>";


  watchdog("toolbox", "courses", array(), WATCHDOG_DEBUG);

  return $pC;
}