function comments_get_comments

6.x comments.module comments_get_comments($student_id, $bool_included_deleted = FALSE, $access_types = array())
4.x comments.module comments_get_comments($student_id, $bool_included_deleted = FALSE, $access_types = array())
5.x comments.module comments_get_comments($student_id, $bool_included_deleted = FALSE, $access_types = array())

Returns an array of comments for this student, sorted most recent first.

4 calls to comments_get_comments()
advise_display_history in modules/advise/advise.history.inc
Displays the history tab on screen.
audit_display_audit in modules/audit/audit.module
comments_display_main in modules/comments/comments.module
This displays the primary Comments tab, where we see past comments and can enter a new one (with the right permissions).
comments_popup_display_all_comments in modules/comments/comments.module
Displays all comments for a student in a popup window, meant for printing.

File

modules/comments/comments.module, line 393

Code

function comments_get_comments($student_id, $bool_included_deleted = FALSE, $access_types = array()) {
  $rtn = array();


  $deleted_line = "AND delete_flag = 0";
  if ($bool_included_deleted) {
    $deleted_line = "";
  }

  $access_type_line = "";

  // Build up the "access_type_line" for the query, based on the values
  // in the access_types array.
  if (count($access_types) > 0) {
    $access_type_line = "AND ( ";
    foreach ($access_types as $access_type) {
      $access_type_line .= " access_type = '$access_type' OR";
    }

    // remove the last OR
    $access_type_line = substr($access_type_line, 0, -2);

    $access_type_line .= ")";
  }

  //if ($access_type == "public" || $access_type == "faculty") {
  //  $access_type_line = "AND access_type = '$access_type' ";
  //}

  $res = db_query("SELECT * FROM advising_comments
                   WHERE student_id = ?
                   $deleted_line
                   $access_type_line
                   ORDER BY posted DESC", array($student_id));
  while ($cur = db_fetch_array($res)) {
    $rtn [$cur ["id"]] = $cur;
  }

  return $rtn;
}