function get_term_structures

7.x misc.inc get_term_structures($school_id = 0)
6.x misc.inc get_term_structures($school_id = 0)
5.x misc.inc get_term_structures()

Return an array version of the term_id_structure field from the admin settings

6 calls to get_term_structures()
course_search.edit.inc in modules/course_search/course_search.edit.inc
This file contains functions relating to editing the course info, like rotation schedule and syllabus
course_search.module in modules/course_search/course_search.module
This module allows users to search for courses, descriptions, and, if supported, rotation schedules and sample syllabi.
course_search_display_courses in modules/course_search/course_search.module
Show the user their select of courses.
course_search_edit_course_details_form in modules/course_search/course_search.edit.inc
This form lets the user edit the course's syllabus or rotation schedule
fp_get_terms_by_year_range in includes/misc.inc
Returns back a FAPI-compatible array of all term codes for the specified years, inclusive

... See full list

File

includes/misc.inc, line 1446
This file contains misc functions for FlightPath

Code

function get_term_structures($school_id = 0) {
  $rtn = array();

  $temp = variable_get_for_school("term_id_structure", "", $school_id);
  $structures = explode("\n", $temp);

  foreach ($structures as $structure) {
    $tokens = explode(",", $structure);
    $term_def = trim($tokens [0]);

    // Get rid of the replacement pattern.
    // Looks like:  [Y4]40.  We want the 40.
    // Simply explode on "]"
    $temp = explode("]", $term_def);

    $term_suffix = trim($temp [1]);

    $rtn [$term_suffix] = array(
      "term_suffix" => $term_suffix,
      "term_def" => $term_def,
      "short" => trim(@$tokens [1]),
      "full" => trim(@$tokens [2]),
      "abbr" => trim(@$tokens [3]),
      "disp_adjust" => trim(@$tokens [4]),
    );

  }


  return $rtn;
}