function _DegreePlan::parse_track_selection_config

5.x _DegreePlan.php _DegreePlan::parse_track_selection_config()

This function will parse through the db_track_selection_config string and populate the track_selection_config_array.

We assume the string looks like this:

CLASS ~ MIN ~ MAX ~ DEFAULT_CSV

ex: CONCENTRATION ~ 0 ~ 1 ~ EMPHASIS ~ 1 ~ 1 ~ ART|_SCULT, ART|_PAINT

2 calls to _DegreePlan::parse_track_selection_config()
_DegreePlan::load_degree_plan in classes/_DegreePlan.php
Load our complete degree plan, including all courses and groups.
_DegreePlan::load_degree_plan_ancillary in classes/_DegreePlan.php
Loads the "ancillary" information about our degree plan, including advising weight, track selection config, etc.

File

classes/_DegreePlan.php, line 726

Class

_DegreePlan

Code

function parse_track_selection_config() {
  $lines = explode("\n", $this->db_track_selection_config);
  foreach ($lines as $line) {
    $line = trim($line);
    if ($line == "") {
      continue; // blank line, skip it.
    }
    if (substr($line, 0, 1) == "#") {
      continue; // this is a comment, skip it.
    }

    $temp = explode("~", $line);
    $machine_name = @trim($temp [0]);
    $min = @intval($temp [1]);
    $max = @intval($temp [2]);
    $default_csv = @trim($temp [3]);

    $this->track_selection_config_array [$machine_name] = array(
      "machine_name" => $machine_name,
      "min_tracks" => $min,
      "max_tracks" => $max,
      "default_tracks" => $default_csv,
    );



  }



}