Skip to content
Snippets Groups Projects
Commit 24465aae authored by Tim Steiner's avatar Tim Steiner
Browse files

Fix editting of Essential Studies on Course Admin for new courses.

parent 706b06fc
No related branches found
No related tags found
No related merge requests found
......@@ -180,11 +180,7 @@ class CourseGeneration extends Asset
$this->courseNumber,
$this->courseLetter);
if (is_null($courseCode)) {
if (is_null($college)) {
return array(array());
} else {
return array();
}
return CourseEsDesignations::getInstance()->getEmptyEssentialStudiesArray($college);
}
return CourseEsDesignations::getInstance()->getEssentialStudiesAreas($courseCode, $college);
......
......@@ -63,22 +63,7 @@ class CourseEsDesignations extends Nmc_Db_Table
$where = implode(' AND ', $where);
$results = $this->fetchAll($where);
$areaCodes = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H');
$colleges = Colleges::getInstance()->fetchAll();
$areas = array();
if ($college) {
foreach ($areaCodes as $areaCode) {
$areas[$areaCode] = false;
}
} else {
foreach ($colleges as $collegeRow) {
$areas[$collegeRow->name] = array();
foreach ($areaCodes as $areaCode) {
$areas[$collegeRow->name][$areaCode] = false;
}
}
}
$areas = $this->getEmptyEssentialStudiesArray($college);
foreach ($results as $row) {
if ($college) {
......@@ -113,4 +98,26 @@ class CourseEsDesignations extends Nmc_Db_Table
}
}
}
public function getEmptyEssentialStudiesArray(College $college = null)
{
$areaCodes = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H');
$colleges = Colleges::getInstance()->fetchAll();
$areas = array();
if ($college) {
foreach ($areaCodes as $areaCode) {
$areas[$areaCode] = false;
}
} else {
foreach ($colleges as $collegeRow) {
$areas[$collegeRow->name] = array();
foreach ($areaCodes as $areaCode) {
$areas[$collegeRow->name][$areaCode] = false;
}
}
}
return $areas;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment