function DatabaseHandler::get_school_id_for_group_id

7.x DatabaseHandler.php DatabaseHandler::get_school_id_for_group_id($group_id, $bool_use_draft = FALSE)
6.x DatabaseHandler.php DatabaseHandler::get_school_id_for_group_id($group_id, $bool_use_draft = FALSE)

File

classes/DatabaseHandler.php, line 1086

Class

DatabaseHandler

Code

function get_school_id_for_group_id($group_id, $bool_use_draft = FALSE) {

  // Always override if the global variable is set.
  if (@$GLOBALS ["fp_advising"]["bool_use_draft"] == true) {
    $bool_use_draft = true;
  }

  $table_name = "groups";
  if ($bool_use_draft) {
    $table_name = "draft_$table_name";
  }

  return intval(db_result(db_query("SELECT school_id FROM $table_name WHERE group_id = ? ", array($group_id))));
}