function DegreePlan::parse_track_selection_config
Search API
7.x DegreePlan.php | DegreePlan::parse_track_selection_config() |
6.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 736
Class
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,
);
}
}