From b36ecdb583eb3b100b3d9fa8a88f774a105471e5 Mon Sep 17 00:00:00 2001
From: Nick Barry <nbarry@unl.edu>
Date: Wed, 29 Oct 2014 17:28:11 -0500
Subject: [PATCH] Fixed ACE recertification historic search, tweaked course
 model loading and edit controller

---
 application/modules/courses/models/CourseModel.php       | 7 +++++--
 .../modules/courses/views/scripts/edit/index.phtml       | 9 +++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/application/modules/courses/models/CourseModel.php b/application/modules/courses/models/CourseModel.php
index f991f7ee..d9384d2a 100644
--- a/application/modules/courses/models/CourseModel.php
+++ b/application/modules/courses/models/CourseModel.php
@@ -148,7 +148,10 @@ class Courses_CourseModel extends Unl_Model
             $select->order('q.questionSort');
             $recordsRecertQA = $select->query()->fetchAll();
             //print_r($recordsRecertQA);
-            if (!$recordsRecertQA || ($courses[$courseId]['type'] == "official" && !empty($recordsRecertQA[0]["dateRetired"]))) {
+
+            // Commented out so historic viewing of recertification isn't overwritten with new quesiton set
+            // Using updateAceRecertification() now for edit controller
+            /* if (!$recordsRecertQA || ($courses[$courseId]['type'] == "official" && !empty($recordsRecertQA[0]["dateRetired"]))) {
                 // load current empty question set
                 //SELECT q.* FROM creq.creqCourseAceRecertifyQuestionSets as s
                 //INNER JOIN creq.creqCourseAceRecertifyQuestions AS q ON s.courseAceRecertifyQuestionSetId = q.questionSetId
@@ -160,7 +163,7 @@ class Courses_CourseModel extends Unl_Model
                 $select->order('q.questionSort');
                 $recordsRecertQA = $select->query()->fetchAll();
                 //print_r($recordsRecertQA);
-            }
+            } */
 
             //$record['semestersTaught'] = explode(',', $record['semestersTaught']); // original code to explode semesters text to an array
             $courses[$courseId]['blackboardUpload'] = $record['blackboardUpload']; // need to carry this over from the recertification record
diff --git a/application/modules/courses/views/scripts/edit/index.phtml b/application/modules/courses/views/scripts/edit/index.phtml
index 3b7a3d58..5f21665d 100644
--- a/application/modules/courses/views/scripts/edit/index.phtml
+++ b/application/modules/courses/views/scripts/edit/index.phtml
@@ -1097,7 +1097,12 @@ if (in_array($this->request->getType(), array('NewCourseWithACE', 'AddACEToCours
 <?php } ?>
 
 <?php if (in_array($this->request->getType(), array('RecertifyACE', 'RecertifyACEAndChangeCourse'))) { ?>
-<?php $recertifyAceData = $this->course->getAceRecertification(); ?>
+<?php
+    //Update the ace recertification questions and answers. If there is a new version of the question set, it will be pulled in.
+    $this->course->updateAceRecertification();
+
+    $recertifyAceData = $this->course->getAceRecertification();
+?>
 
 <div class="main_section" id="recertifyAceSection">
 <h2>ACE Recertification</h2>
@@ -1176,7 +1181,7 @@ if (in_array($this->request->getType(), array('NewCourseWithACE', 'AddACEToCours
 <div><a href="/misc/ACE_Recertification_Protocols.pdf">Download and view the ACE Recertification Protocols</a></div>
 
 </div>
-	
+
 <div class="main_section" id="recertifyAceNotes">
 <h2>ACE Recertification Criteria</h2>
 	<div>
-- 
GitLab