function audit_comment_form_submit

7.x audit.module audit_comment_form_submit($form, $form_state)
6.x audit.module audit_comment_form_submit($form, $form_state)
1 call to audit_comment_form_submit()

File

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

Code

function audit_comment_form_submit($form, $form_state) {
  global $user, $current_student_id;
  $faculty_id = $form_state ["values"]["faculty_id"];
  $student_id = $form_state ["values"]["student_id"];
  $type = "audit private";
  $comment = trim($form_state ["values"]["comment"]);

  // Perform the save!
  if ($comment) {
    db_query("INSERT INTO advising_comments
              (student_id, faculty_id, term_id,
                comment, posted, access_type)
                VALUES
                (?, ?, ?, ?, ?, ?)
                ", array($student_id, $faculty_id, 0, $comment, time(), $type));

    fp_add_message(t("Audit comment saved successfully."));
  }

  watchdog("audit", "Audit comment saved. student_id:$student_id, comment:$comment");
}