function _AdvisingScreen::display_toolbox_substitutions

4.x _AdvisingScreen.php _AdvisingScreen::display_toolbox_substitutions()
5.x _AdvisingScreen.php _AdvisingScreen::display_toolbox_substitutions()

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

Return value

string

File

classes/_AdvisingScreen.php, line 760

Class

_AdvisingScreen

Code

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

  $pC .= fp_render_curved_line(t("Manage Substitutions"));

  $pC .= "<div class='tenpt'>
				" . t("The following substitutions have been made for this student:") . "
				<br><br>
				";
  $is_empty = true;


  $this->student->list_substitutions->reset_counter();
  while ($this->student->list_substitutions->has_more()) 
   {
    $substitution = $this->student->list_substitutions->get_next();

    $course_requirement = $substitution->course_requirement;
    $subbed_course = $substitution->course_list_substitutions->get_first();

    $sub_s_i = $subbed_course->subject_id;
    $sub_c_n = $subbed_course->course_num;

    $cr_s_i = $course_requirement->subject_id;
    $cr_c_n = $course_requirement->course_num;
    $cr_hrs = $course_requirement->get_hours();

    $in_group = ".";
    if ($subbed_course->assigned_to_group_id > 0) 
     {
      $new_group = new Group();
      $new_group->group_id = $subbed_course->assigned_to_group_id;
      $new_group->load_descriptive_data();

      $in_group = " in $new_group->title.";
    }

    $sub_action = t("was substituted for");
    $sub_trans_notice = "";
    if ($substitution->bool_group_addition == true) 
     {
      $sub_action = t("was added to");
      $cr_s_i = $cr_c_n = "";
      $in_group = str_replace("in", "", $in_group);
    }

    if ($subbed_course->bool_transfer == true && is_object($subbed_course->course_transfer)) 
     {
      $sub_s_i = $subbed_course->course_transfer->subject_id;
      $sub_c_n = $subbed_course->course_transfer->course_num;
      $sub_trans_notice = "[" . t("transfer") . "]";
    }

    $by = $remarks = "";
    $temp = $this->db->get_substitution_details($subbed_course->db_substitution_id);
    $by = $this->db->get_faculty_name($temp ["faculty_id"], false);
    $remarks = $temp ["remarks"];
    $ondate = format_date($temp ["posted"]);

    if ($by != "") 
     {
      $by = " <br>&nbsp; &nbsp; " . t("Substitutor:") . " $by. 
						<br>&nbsp; &nbsp; <i>$ondate.</i>";
    }

    if ($remarks != "") 
     {
      $remarks = " <br>&nbsp; &nbsp; " . t("Remarks:") . " <i>$remarks</i>.";
    }


    $extra = "";
    if ($substitution->bool_outdated) 
     {
      $extra = " <span style='color:red'>[OUTDATED: ";
      $extra .= $substitution->outdated_note;
      $extra .= "]</span>";
    }

    $pC .= "<div class='tenpt' style='margin-bottom: 20px;'>
						$sub_s_i $sub_c_n $sub_trans_notice ($subbed_course->substitution_hours hrs) $sub_action
						$cr_s_i $cr_c_n$in_group $by$remarks $extra
						<br>
							<a href='javascript: popupRemoveSubstitution(\"$subbed_course->db_substitution_id\");'>" . t("Remove substitution?") . "</a>
					</div>";

    $is_empty = false;
  }

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

  $pC .= "</div>";

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

  return $pC;
}