function AdvisingScreen::display_toolbox_transfers

7.x AdvisingScreen.php AdvisingScreen::display_toolbox_transfers()
6.x AdvisingScreen.php AdvisingScreen::display_toolbox_transfers()

Used in the Toolbox popup, this will display content of the tab which shows a student's transfers

Return value

string

File

classes/AdvisingScreen.php, line 1304

Class

AdvisingScreen

Code

function display_toolbox_transfers() 
 {
  $pC = "";
  // This will display the substitution management screen.

  $pC .= fp_render_section_title(t("Manage Transfer Equivalencies"));

  $pC .= "<div class=' '>
        " . t("This student has the following transfer credits and equivalencies.") . "
        <br><br>
        ";
  $is_empty = true;


  $student_id = $this->student->student_id;
  $school_id = db_get_school_id_for_student_id($student_id);


  $retake_grades = csv_to_array(variable_get_for_school("retake_grades", "F,W", $school_id));


  $this->student->list_courses_taken->sort_alphabetical_order(false, true);
  $this->student->list_courses_taken->reset_counter();
  while ($this->student->list_courses_taken->has_more()) 
   {
    $c = $this->student->list_courses_taken->get_next();

    // Skip non transfer credits.
    if ($c->bool_transfer != true) 
     {
      continue;
    }

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

    $course->load_descriptive_transfer_data();

    $l_s_i = $c->subject_id;
    $l_c_n = $c->course_num;
    $l_title = $this->fix_course_title($c->title);

    $t_s_i = $course->subject_id;
    $t_c_n = $course->course_num;
    $t_term = $c->get_term_description(true);
    $grade = $c->grade;
    if (in_array($grade, $retake_grades)) {
      $grade = "<span style='color: red;'>$grade</span>";
    }

    $t_inst = $this->fix_institution_name($course->institution_name);

    $pC .= "<div class=' ' style='padding-bottom: 15px;'>
              <b>$t_s_i $t_c_n</b> (" . $c->get_hours_awarded() . " " . t("hrs") . ") - $grade - $t_term - $t_inst
                ";
    if (isset($c->bool_substitution) && $c->bool_substitution_split == true) 
     {
      $pC .= "<div class=' '><b> +/- </b> This course's hours were split in a substitution.</div>";
    }
    $initials = variable_get_for_school("school_initials", "DEMO", $school_id);
    // Does this course NOT have an equivalency?
    if ($c->course_id == 0) 
     {
      // But, has the eqv been removed?  If so, display a link to restore it,
      // if not, show a link to remove it!
      if ($rC = $this->student->list_transfer_eqvs_unassigned->find_match($course)) 
       {
        // Yes, the eqv WAS removed (or unassigned)
        $pC .= "<div class=' '>" . t("This course's @initials equivalency was removed for this student.", array("@initials" => $initials)) . "<br>
              <a href='javascript: popupRestoreTransferEqv(\"$rC->db_unassign_transfer_id\")'>" . t("Restore?") . "</a></div>";
      }
      else {
        $pC .= "<div class=' '>" . t("@initials equivalency not yet entered (or is not applicable).", array("@initials" => $initials)) . "</div>";
      }
    }
    else {
      // This course *DOES* have an equivalency.
      $pC .= "<div class=' '>$initials eqv: $l_s_i $l_c_n - $l_title</div>";

      $pC .= "<div>
              <a href='javascript: popupUnassignTransferEqv(\"" . $course->course_id . "\");'>" . t("Remove this equivalency?") . "</a>
              </div>";

    }

    $pC .= "</div>";

    $is_empty = false;
  }

  if ($is_empty == true) {
    $pC .= "<div align='center'>" . t("There are no transfer equivalencies for this student.") . "</div>";
  }

  $pC .= "</div>";

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

  return $pC;
}