diff --git a/application/modules/bulletin/models/ApprovalActionBulletinCollegeRouterModel.php b/application/modules/bulletin/models/ApprovalActionBulletinCollegeRouterModel.php index b8845b6a778a7d812e481bd78c12f3912c57a685..4f6c9628dbca1d0088a9cb6b12453e146d4ee7ae 100644 --- a/application/modules/bulletin/models/ApprovalActionBulletinCollegeRouterModel.php +++ b/application/modules/bulletin/models/ApprovalActionBulletinCollegeRouterModel.php @@ -105,7 +105,7 @@ class Bulletin_ApprovalActionBulletinCollegeRouterModel extends Requests_Approva $requestSections = Bulletin_SectionModel::findWithRequest($requests); foreach ($requests as $request) { $section = $requestSections[$request->getId()]; - $college = $section->getCollege(); + $college = $section->getCollegeLong(); $request->setState($college); } Requests_RequestModel::save($requests); diff --git a/application/modules/bulletin/models/RepositoryModel.php b/application/modules/bulletin/models/RepositoryModel.php index d82ccca71a1d4946fd44a927c43126dfdd9280f2..e731825f303d3bd7eeb86aadee1b9d820918c13f 100644 --- a/application/modules/bulletin/models/RepositoryModel.php +++ b/application/modules/bulletin/models/RepositoryModel.php @@ -205,7 +205,7 @@ class Bulletin_RepositoryModel public function getFilePathForSection(Bulletin_SectionModel $section) { return $this->getFilePathForCollegeMajorYear( - $section->getCollege(), + $section->getCollegeLong(), $section->getMajor(), $section->getYear() ); diff --git a/application/modules/bulletin/models/SectionModel.php b/application/modules/bulletin/models/SectionModel.php index effe7bfb084115a01001adbc76cb18fedff3978d..39e2822cb580e8dc68f145f2d97ed7b1ecc65540 100644 --- a/application/modules/bulletin/models/SectionModel.php +++ b/application/modules/bulletin/models/SectionModel.php @@ -81,12 +81,14 @@ class Bulletin_SectionModel extends Unl_Model $db = Zend_Registry::get('db'); $select = new Zend_Db_Select($db); $select->from(array('b' => 'creqBulletinSections'), array()); + $select->join(array('c' => 'creqColleges'), 'b.collegeId = c.collegeId', array('college' => 'c.description')); $select->join(array('r' => 'creqRequests'), 'b.request = r.requestId', array('requestId')); - $select->where('college = ?', $college); + $select->where('c.description = ?', $college); if ($major) { - $select->where('major = ?', $major); + $select->join(array('m' => 'creqMajors'), 'b.majorId = m.majorId', array('major' => 'm.name')); + $select->where('m.name = ?', $major); } else { - $select->where('major IS NULL'); + $select->where('majorId IS NULL'); } $select->where('r.complete = ?', 'no'); @@ -110,9 +112,7 @@ class Bulletin_SectionModel extends Unl_Model 'bulletinSectionId' => NULL, 'request' => NULL, 'collegeId' => NULL, - 'college' => NULL, 'majorId' => NULL, - 'major' => NULL, 'year' => NULL, ); @@ -188,9 +188,7 @@ class Bulletin_SectionModel extends Unl_Model $sqlParts[] = $db->quoteInto('(?, ', $model->_data['bulletinSectionId']) . $db->quoteInto('?, ' , $model->_data['request']) . $db->quoteInto('?, ' , $model->_data['collegeId']) - . $db->quoteInto('?, ' , $model->_data['college']) . $db->quoteInto('?, ' , $model->_data['majorId']) - . $db->quoteInto('?, ' , $model->_data['major']) . $db->quoteInto('?) ' , $model->_data['year']); } $sql .= implode(', ', $sqlParts); @@ -200,9 +198,7 @@ class Bulletin_SectionModel extends Unl_Model . ' creqBulletinSectionsUpdate AS b ' . 'SET a.request = b.request, ' . ' a.collegeId = b.collegeId, ' - . ' a.college = b.college, ' . ' a.majorId = b.majorId, ' - . ' a.major = b.major, ' . ' a.year = b.year ' . 'WHERE a.bulletinSectionId = b.bulletinSectionId '; $db->query($sql); @@ -213,14 +209,12 @@ class Bulletin_SectionModel extends Unl_Model { $db = Zend_Registry::get('db'); - $sql = 'INSERT INTO creqBulletinSections (`request`, `collegeId`, `college`, `majorId`, `major`, `year`) VALUES '; + $sql = 'INSERT INTO creqBulletinSections (`request`, `collegeId`, `majorId`, `year`) VALUES '; $sqlParts = array(); foreach ($models as $model) { $sqlParts[] = $db->quoteInto('(?, ', $model->_data['request']) . $db->quoteInto('?, ' , $model->_data['collegeId']) - . $db->quoteInto('?, ' , $model->_data['college']) . $db->quoteInto('?, ' , $model->_data['majorId']) - . $db->quoteInto('?, ' , $model->_data['major']) . $db->quoteInto('?)' , $model->_data['year']); } $sql .= implode(', ', $sqlParts); @@ -290,6 +284,20 @@ class Bulletin_SectionModel extends Unl_Model return NULL; } + public function getCollegeLong() + { + if (!$this->_data['collegeId'] && $this->_data['college']) { + return $this->_data['college']; + } + + $colleges = Courses_CourseModel::getCollegeNames(); + if (isset($colleges[$this->_data['collegeId']])) { + return $colleges[$this->_data['collegeId']]; + } + + return NULL; + } + public function setCollegeId($collegeId) { $colleges = Courses_CourseModel::getCollegeNames(); @@ -297,7 +305,6 @@ class Bulletin_SectionModel extends Unl_Model throw new Exception('College not found.'); } $this->_data['collegeId'] = $collegeId; - $this->_data['college'] = $colleges[$collegeId]; } public function setCollege($college) @@ -310,7 +317,6 @@ class Bulletin_SectionModel extends Unl_Model } $this->_data['collegeId'] = $collegeId; - $this->_data['college'] = $college; } public function getMajor() @@ -467,11 +473,11 @@ class Bulletin_SectionModel extends Unl_Model if ($section->getMajor()) { $title = $section->getMajor() . ' ' . substr($section->getYear(), -2) . '-' . substr($section->getYear() + 1, -2); } else { - $title = $section->getCollege() . ' Main Page ' . substr($section->getYear(), -2) . '-' . substr($section->getYear() + 1, -2); + $title = $section->getCollegeLong() . ' Main Page ' . substr($section->getYear(), -2) . '-' . substr($section->getYear() + 1, -2); } $hyphenatedTitle = preg_replace('/[^a-zA-Z0-9]+/', '-', strtolower($title)); - $majorName = $section->getMajor() ? $section->getMajor() : $section->getCollege(); + $majorName = $section->getMajor() ? $section->getMajor() : $section->getCollegeLong(); $html = <<<EOF <?xml version="1.0" encoding="utf-8"?> diff --git a/application/modules/bulletin/models/UtilityModel.php b/application/modules/bulletin/models/UtilityModel.php index fecad40248eb6cc30976d5431028d2586b8580ed..136e16e47287725c898385cc98738c21b1cd7ad9 100644 --- a/application/modules/bulletin/models/UtilityModel.php +++ b/application/modules/bulletin/models/UtilityModel.php @@ -13,7 +13,7 @@ class Bulletin_UtilityModel foreach ($data as $i => &$record) { $section = $requestSections[$record['request']->getId()]; - $record['extra']['Section'] = $section->getMajor() ? $section->getMajor() : $section->getCollege(); + $record['extra']['Section'] = $section->getMajor() ? $section->getMajor() : $section->getCollegeLong(); } unset($record); } diff --git a/application/modules/bulletin/views/scripts/edit/index.phtml b/application/modules/bulletin/views/scripts/edit/index.phtml index 080fbdfbee7b1c82587151a7645de3f9ecaaef26..c21d2553cbec10f9c470e7cea7a92432764b1114 100644 --- a/application/modules/bulletin/views/scripts/edit/index.phtml +++ b/application/modules/bulletin/views/scripts/edit/index.phtml @@ -20,7 +20,7 @@ $this->headScript()->appendFile($this->baseUrl() . '/ice/src/plugins/IceSmartQuo $this->headScript()->appendFile($this->baseUrl() . '/tinymce/jscripts/tiny_mce/tiny_mce.js'); $this->headScript()->appendFile($this->baseUrl() . '/javascript/bulletin/tinymce.js'); $this->headScript()->appendFile($this->baseUrl() . '/javascript/bulletin/edit.js'); -$this->layout()->pageTitle = 'Editing: ' . ($this->section->getMajor() ? $this->section->getMajor() : $this->section->getCollege()) . ' (' . $this->request->getTypeDescription() . ')'; +$this->layout()->pageTitle = 'Editing: ' . ($this->section->getMajor() ? $this->section->getMajor() : $this->section->getCollegeLong()) . ' (' . $this->request->getTypeDescription() . ')'; ?> <form action="<?php echo $this->baseUrl('/bulletin/edit/edit.post'); ?>" method="post" enctype="multipart/form-data"> @@ -83,7 +83,7 @@ $this->layout()->pageTitle = 'Editing: ' . ($this->section->getMajor() ? $this-> <p>Only used by some Education & Human Sciences and Fine & Performing Arts programs. Please leave blank if there is no information already here for your program. Please contact Brooke Glenn (<a href="mailto:bglenn2@unl.edu">bglenn2@unl.edu</a>, 402-472-6023) if you think you need to add information to this section.</p> <textarea name="other" class="mceEditor"><?php echo $this->other; ?></textarea> - <?php if ($this->section->getCollege() == 'Arts & Sciences') { ?> + <?php if ($this->section->getCollegeLong() == 'Arts & Sciences') { ?> <div> <h2><label for="justification">Justification</label></h2> <?php echo $this->formTextarea('justification', $this->request->getJustification()); ?> diff --git a/application/modules/bulletin/views/scripts/my-requests/saved.phtml b/application/modules/bulletin/views/scripts/my-requests/saved.phtml index e39ace2c1f162403713470f7cd314b8ffbe0d4b9..daaa408e2678c1be2b3b34df08f242e366e6b0d0 100644 --- a/application/modules/bulletin/views/scripts/my-requests/saved.phtml +++ b/application/modules/bulletin/views/scripts/my-requests/saved.phtml @@ -14,7 +14,7 @@ $section = $data['section']; ?> <tr> - <td><?php echo $this->escape($section->getMajor() ? $section->getMajor() : $section->getCollege()); ?></td> + <td><?php echo $this->escape($section->getMajor() ? $section->getMajor() : $section->getCollegeLong()); ?></td> <td><?php echo $this->escape($request->getTypeDescription()); ?></td> <td> <a href="<?php echo $this->baseUrl(); ?>/requests/edit/load/sessionId/<?php echo $savedId; ?>">Edit</a> diff --git a/application/modules/bulletin/views/scripts/view/index.phtml b/application/modules/bulletin/views/scripts/view/index.phtml index 6f522dac88a6366037289b699cff17b1a48124f0..8cf27e2855cb5af4adce7ee270d822522dbc586d 100644 --- a/application/modules/bulletin/views/scripts/view/index.phtml +++ b/application/modules/bulletin/views/scripts/view/index.phtml @@ -7,7 +7,7 @@ if ($this->preview) { } else { $breadcrumb = 'Viewing'; } -$this->layout()->pageTitle = $breadcrumb . ': ' . ($this->section->getMajor() ? $this->section->getMajor() : $this->section->getCollege()) . ' (' . $this->request->getTypeDescription() . ')'; +$this->layout()->pageTitle = $breadcrumb . ': ' . ($this->section->getMajor() ? $this->section->getMajor() : $this->section->getCollegeLong()) . ' (' . $this->request->getTypeDescription() . ')'; $originalSection = Bulletin_SectionModel::parseHtml($this->originalFileContents); $proposedSection = Bulletin_SectionModel::parseHtml($this->proposedFileContents); ?> @@ -50,7 +50,7 @@ $proposedSection = Bulletin_SectionModel::parseHtml($this->proposedFileContents) </div> -<?php if ($this->section->getCollege() == 'Arts & Sciences') { ?> +<?php if ($this->section->getCollegeLong() == 'Arts & Sciences') { ?> <div> <h2>Justification</h2> <?php echo $this->escape($this->request->getJustification()); ?> diff --git a/application/modules/fouryearplans/models/FourYearPlanModel.php b/application/modules/fouryearplans/models/FourYearPlanModel.php index cac3bd03f180fd32fbf31fe09dafeb3bf6bcb307..b734a92819d547f3261f365af3bd8b01c0506bb2 100644 --- a/application/modules/fouryearplans/models/FourYearPlanModel.php +++ b/application/modules/fouryearplans/models/FourYearPlanModel.php @@ -86,7 +86,6 @@ class FourYearPlans_FourYearPlanModel extends Unl_Model 'type' => 'proposed', 'removed' => 'no', 'majorId' => null, - 'major' => '', 'courses' => array(), 'notes' => array(), ); @@ -285,8 +284,9 @@ class FourYearPlans_FourYearPlanModel extends Unl_Model $select = new Zend_Db_Select($db); $select->from(array('g' => 'creqFourYearPlanGenerations'), array('fourYearPlanGenerationId')); + $select->join(array('m' => 'creqMajors'), 'g.majorId = m.majorId', array('major' => 'name')); $select->join(array('f' => 'creqFourYearPlans'), 'g.fourYearPlanGenerationId = f.currentGeneration', array()); - $select->where('g.major = ?', $major); + $select->where('m.name = ?', $major); $records = $select->query()->fetchAll(); if (count($records) == 0) { @@ -355,8 +355,9 @@ class FourYearPlans_FourYearPlanModel extends Unl_Model $db = Zend_Registry::get('db'); $select = new Zend_Db_Select($db); $select->from(array('f' => 'creqFourYearPlanGenerations'), array()); + $select->join(array('m' => 'creqMajors'), 'f.majorId = m.majorId', array('major' => 'name')); $select->join(array('r' => 'creqRequests'), 'f.request = r.requestId', array('requestId')); - $select->where('f.major = ?', $major); + $select->where('m.name = ?', $major); $select->where('r.complete = ?', 'no'); $records = $select->query()->fetchAll(); @@ -527,7 +528,7 @@ class FourYearPlans_FourYearPlanModel extends Unl_Model } } - $sql = 'INSERT INTO creqFourYearPlanGenerations (assetId, parent, fourYearPlan, request, type, removed, majorId, major) VALUES '; + $sql = 'INSERT INTO creqFourYearPlanGenerations (assetId, parent, fourYearPlan, request, type, removed, majorId) VALUES '; $sqlParts = array(); foreach ($models as $model) { $sqlParts[] = $db->quoteInto('(?, ', $model->_data['assetId']) @@ -536,8 +537,7 @@ class FourYearPlans_FourYearPlanModel extends Unl_Model . $db->quoteInto('?, ' , $model->_data['request']) . $db->quoteInto('?, ' , $model->_data['type']) . $db->quoteInto('?, ' , $model->_data['removed']) - . $db->quoteInto('?, ' , $model->_data['majorId']) - . $db->quoteInto('?)' , $model->_data['major']); + . $db->quoteInto('?)' , $model->_data['majorId']); } $sql .= implode(', ', $sqlParts); $db->query($sql); @@ -619,8 +619,7 @@ class FourYearPlans_FourYearPlanModel extends Unl_Model . $db->quoteInto('?, ' , $model->_data['request']) . $db->quoteInto('?, ' , $model->_data['type']) . $db->quoteInto('?, ' , $model->_data['removed']) - . $db->quoteInto('?, ' , $model->_data['majorId']) - . $db->quoteInto('?)' , $model->_data['major']); + . $db->quoteInto('?)' , $model->_data['majorId']); } $sql .= implode(', ', $sqlParts); $db->query($sql); @@ -633,8 +632,7 @@ class FourYearPlans_FourYearPlanModel extends Unl_Model . ' a.request = b.request, ' . ' a.type = b.type, ' . ' a.removed = b.removed, ' - . ' a.majorId = b.majorId, ' - . ' a.major = b.major ' + . ' a.majorId = b.majorId ' . 'WHERE a.fourYearPlanGenerationId = b.fourYearPlanGenerationId '; $db->query($sql); $db->query('DROP TABLE creqFourYearPlanGenerationsUpdate'); @@ -936,7 +934,6 @@ class FourYearPlans_FourYearPlanModel extends Unl_Model throw new Exception('Major not found.'); } $this->_data['majorId'] = $majorId; - $this->_data['major'] = $majors[$majorId]; } public function setMajor($major) @@ -949,7 +946,6 @@ class FourYearPlans_FourYearPlanModel extends Unl_Model } $this->_data['majorId'] = $majorId; - $this->_data['major'] = $majors[$majorId]; } public function getConcentrations()