function prereqs_form_alter

7.x prereqs.module prereqs_form_alter(&$form, $form_id)
6.x prereqs.module prereqs_form_alter(&$form, $form_id)

Implements hook_form_alter


modules/prereqs/prereqs.module, line 211
This is the module file for the prereqs module.


function prereqs_form_alter(&$form, $form_id) {

  // We want to edit the edit_course form, to inject some fields for adding prereqs to course requirements.
  if ($form_id == "admin_edit_course_form") {

    // Add in our validate and submit handlers...
    $form ["#validate_handlers"][] = "prereqs_edit_course_form_validate";
    $form ["#submit_handlers"][] = "prereqs_edit_course_form_submit";

    $existing_prereqs = (String) db_result(db_query("SELECT prereq_data FROM prereqs_prereqs
                                            WHERE course_id = ?", $form ["course_id"]["value"]));

    // Add in the fields...
    $form ["prereqs_prereqs"] = array(
      "label" => t("Prerequisites:"),
      "type" => "textarea",
      "value" => $existing_prereqs,
      "description" => t("Enter prereqs which must be completed before a student may be advised to take this course.
                          Please note that this
                          data is for <b>ALL CATALOG YEARS</b> of the course.  Also, this is <b>not placed in a draft</b> state.  Any changes
                          to prereqs will be instantly live.
                          Enter data in this format:  SUBJECT_ID  COURSE_NUM  (MIN_GRADE)  -- you may leave off the min grade if any passing grade is acceptable.
                          <br><br>Each row means 'AND this course'.  To have and option of more than one course required, enter on a single line, separated by the word 'or'.  <b>Remember to leave
                          spaces between courses, grades, or's, etc.</b><br>For more details, <a href='' target='_blank'>please refer to the documentation page</a>.
                          &nbsp; &nbsp; ACCT 104 (B)
                          <br>&nbsp; &nbsp; ACCT 101 (C) or  ACCT 102 (C)
                          <br>&nbsp; &nbsp; ACCT 101 or  ACCT 103  
                          <br>The above example means 'The student must take ACCT 104 (earning a B or higher).  They must also take EITHER ACCT 101 or ACCT 102.  Finally, they
                          must also take EITHER ACCT 101 or ACCT 103.<br>
                          Take note in this example that if the student takes only ACCT 104 and ACCT 101, then they will have satisfied all of the prereq requirements, since ACCT 101 is listed
                          in both rows 2 and 3.                              
      "weight" => 85,

  } // if form id == admin_edit_course_form