function audit_popup_edit_approval_form

6.x audit.module audit_popup_edit_approval_form($approval_type, $student_id)

This is the actual form that will be used to change an audit approval for a student.

Parameters

unknown_type $approval_type:

unknown_type $student_id:

File

modules/audit/audit.module, line 246
This is the Audit module, which provides functionality relating to degree audits.

Code

function audit_popup_edit_approval_form($approval_type, $student_id) {
  $form = array();

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

  $school_id = db_get_school_id_for_student_id($student_id);


  $types = audit_get_approval_types($school_id);
  $details = $types [$approval_type];
  $approval_type_title = $details ["title"];
  if ($approval_type_title == "") {
    $approval_type_title = $approval_type;
  }


  fp_set_title("Edit approval for " . fp_get_student_name($student_id) . " ($student_id)");

  // Get current value from the database
  $current_value = "";
  $cur = audit_get_approval_record($student_id, $approval_type);
  if ($cur && isset($cur ['approval_value'])) {
    $current_value = $cur ["approval_value"];
  }

  if ($current_value == "") {
    $current_value = "not_complete";
  }

  $options = audit_get_approval_options();
  $options ["in_progress"] = t("In Progress - will be completed when the student's enrolled courses are completed");

  $form ["approval"] = array(
    "type" => "radios",
    "label" => t("Please set the completion status for this type:<br><em style='padding-left: 20px;'>$approval_type_title</em>"),
    "options" => $options,
    "value" => $current_value,
    "no_please_select" => TRUE,
    /*
    "description" => "Legend:<div style='padding-left: 10px;'>Complete - The requirement has been completed.
                              <br>Not Complete - The requirement has not been completed yet.
                              <br>In Progress - The requirement will be completed when the student's enrolled courses are completed.",
                              */
  );

  $form ["comment"] = array(
    "type" => "textarea",
    "label" => t("Optional comment:"),
    "rows" => 3,
    "attributes" => array("style" => "width: 90%;"),
    "description" => t("When you save this form, a brief entry will be made to the audit comment history.
                        If you wish, you may add an optional comment at this time to explain your
                        selection."),
  );


  $form ["submit_btn"] = array(
    "type" => "submit",
    "value" => "Submit",
  );


  $form ["#attributes"] = array("onSubmit" => "return auditPopupEditApprovalFormSubmit(\"$approval_type\",\"$student_id\");");

  watchdog("audit", "popup_edit_approval student_id:$student_id, approval_type:$approval_type", array(), WATCHDOG_DEBUG);

  return $form;
}