From 536a336c146e6dea632f64af94a128e0c136ebd4 Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Fri, 5 Jan 2007 18:14:48 +0000
Subject: [PATCH] Updates for ZF 0.6.0 compatibility, also some minor updates

---
 .../ApprovalbodyadminController.php           | 12 +++---
 application/controllers/AuthController.php    |  6 +--
 .../controllers/ConflictController.php        |  9 +++--
 .../controllers/CourseadminController.php     | 17 ++++----
 application/controllers/HomeController.php    |  5 ++-
 application/controllers/IndexController.php   |  2 +-
 .../controllers/NewrequestController.php      | 40 ++++++++++---------
 application/controllers/TestController.php    |  3 +-
 .../controllers/TestformController.php        | 14 +++----
 .../controllers/UseradminController.php       | 10 ++---
 application/models/rows/ApprovalChain.php     | 16 ++++++++
 application/models/rows/Person.php            |  2 +-
 application/models/tables/ApprovalChains.php  | 24 ++++++++++-
 .../models/tables/CourseCrosslistings.php     |  2 +-
 14 files changed, 103 insertions(+), 59 deletions(-)
 create mode 100644 application/models/rows/ApprovalChain.php

diff --git a/application/controllers/ApprovalbodyadminController.php b/application/controllers/ApprovalbodyadminController.php
index 655098e7..fe566791 100644
--- a/application/controllers/ApprovalbodyadminController.php
+++ b/application/controllers/ApprovalbodyadminController.php
@@ -9,7 +9,7 @@ class ApprovalBodyAdminController extends Nmc_Controller_Action
 
         $out->approvalBodies = ApprovalBodies::getInstance()->fetchAll();
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function editBodyAction()
@@ -23,7 +23,7 @@ class ApprovalBodyAdminController extends Nmc_Controller_Action
         $out->approvalBody = ApprovalBodies::getInstance()->find($approvalBodyId);
         $out->approvalBodies = ApprovalBodies::getInstance()->fetchAll();
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function editRoleAction()
@@ -38,7 +38,7 @@ class ApprovalBodyAdminController extends Nmc_Controller_Action
         $out->approvalBodyRole = ApprovalBodyRoles::getInstance()->find($roleId);
         $out->approvalBodies = ApprovalBodies::getInstance()->fetchAll();
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function addRoleAction()
@@ -55,7 +55,7 @@ class ApprovalBodyAdminController extends Nmc_Controller_Action
         $out->approvalBodyRole->approvalBody = $parentApprovalBody->getPrimaryKey();
         $out->approvalBodies = ApprovalBodies::getInstance()->fetchAll();
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function editBodyPostAction()
@@ -74,7 +74,7 @@ class ApprovalBodyAdminController extends Nmc_Controller_Action
 
         $out = new Nmc_View();
         $out->refresh = '/ApprovalBodyAdmin/EditBody/' . $body->getPrimaryKey();
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function editRolePostAction()
@@ -94,7 +94,7 @@ class ApprovalBodyAdminController extends Nmc_Controller_Action
 
         $out = new Nmc_View();
         $out->refresh = '/ApprovalBodyAdmin/EditRole/' . $role->getPrimaryKey();
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 }
 
diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php
index ec852e95..61d125c2 100644
--- a/application/controllers/AuthController.php
+++ b/application/controllers/AuthController.php
@@ -7,14 +7,14 @@ class AuthController extends Nmc_Controller_Action
     {
         $out = new Nmc_View_Unl();
         $out->location = '/';
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function loginAction()
     {
         Nmc_Registry_Session::getInstance()->erase('loginError');
 
-        $in = new Zend_Filter_Input($this->_action->getParams());
+        $in = new Zend_Filter_Input($this->_getAllParams());
 
         $out = new Nmc_View();
         $out->title = 'Processing...';
@@ -78,7 +78,7 @@ class AuthController extends Nmc_Controller_Action
         Nmc_User::getInstance()->logout();
         $out = new Nmc_View();
         $out->assign('location', '/');
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
 }
diff --git a/application/controllers/ConflictController.php b/application/controllers/ConflictController.php
index e0a7175d..53135fd9 100644
--- a/application/controllers/ConflictController.php
+++ b/application/controllers/ConflictController.php
@@ -2,8 +2,9 @@
 
 class ConflictController extends Nmc_Controller_Action
 {
-    public function __construct()
+    public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
     {
+        parent::__construct($request, $response, $invokeArgs);
         $this->_registerPlugin(new Nmc_Controller_Action_Plugin_Authorize());
         //$this->_registerPlugin(new Nmc_Controller_Action_Plugin_Test());
     }
@@ -56,7 +57,7 @@ EOF;
         $out->allIds = $allIds;
         $out->conflictedCourseCode = $conflictedCourseCode;
         $out->page = 'conflict';
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function removeAction()
@@ -74,7 +75,7 @@ EOF;
 
         $out = new Nmc_View();
         $out->location = '/conflict';
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function skipAction()
@@ -82,7 +83,7 @@ EOF;
         Nmc_Registry_Session::getInstance('conflict')->skippedRecords++;
         $out = new Nmc_View();
         $out->location = '/conflict';
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 }
 
diff --git a/application/controllers/CourseadminController.php b/application/controllers/CourseadminController.php
index 2db404af..59b802e5 100644
--- a/application/controllers/CourseadminController.php
+++ b/application/controllers/CourseadminController.php
@@ -2,8 +2,9 @@
 
 class CourseAdminController extends Nmc_Controller_Action
 {
-    public function __construct()
+    public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
     {
+        parent::__construct($request, $response, $invokeArgs);
         $this->_registerPlugin(new Nmc_Controller_Action_Plugin_Authorize());
     }
 
@@ -17,8 +18,8 @@ class CourseAdminController extends Nmc_Controller_Action
 
     public function indexAction()
     {
-        $in = new Zend_Filter_Input($this->_action->getParams());
-        $uriParams = $this->_action->getParams();
+        $in = new Zend_Filter_Input($this->_getAllParams());
+        $uriParams = $this->_getAllParams();
         $uriParams = $uriParams['URI_PARAMS'];
 
         $out = new Nmc_View_Unl();
@@ -85,11 +86,11 @@ class CourseAdminController extends Nmc_Controller_Action
         $out->assign('parentGeneration', $course->getParentGeneration());
         $out->assign('childGenerations', $course->getChildGenerations());
         $out->assign('uriParams', $uriParams);
-        echo $out->render();
+        echo $out->render('unl_index.xhtml');
     }
 
     public function updateCourseAction() {
-        $uriParams = $this->_action->getParams();
+        $uriParams = $this->_getAllParams();
         $uriParams = $uriParams['URI_PARAMS'];
 
         $course = CourseGenerations::getInstance()->find($_POST['courseId']);
@@ -173,12 +174,12 @@ class CourseAdminController extends Nmc_Controller_Action
 
         $out = new Nmc_View();
         $out->refresh = '/courseadmin/index/' . $course->getPrimaryKey();
-        echo $out->render();
+        echo $out->render('unl_index.xhtml');
     }
 
     public function deleteCourseAction()
     {
-        $in = $this->_action->getParams();
+        $in = $this->_getAllParams();
         $courseId = Zend_Filter::getInt($in['URI_PARAMS'][0]);
 
         if($courseId > 0) {
@@ -188,7 +189,7 @@ class CourseAdminController extends Nmc_Controller_Action
 
         $out = new Nmc_View();
         $out->refresh = '/courseadmin/index/' . $courseId;
-        echo $out->render();
+        echo $out->render('unl_index.xhtml');
     }
 
     public function otherAction()
diff --git a/application/controllers/HomeController.php b/application/controllers/HomeController.php
index 1eb13d38..688a68ed 100644
--- a/application/controllers/HomeController.php
+++ b/application/controllers/HomeController.php
@@ -3,8 +3,9 @@
 class HomeController extends Nmc_Controller_Action
 {
 
-    public function __construct()
+    public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
     {
+        parent::__construct($request, $response, $invokeArgs);
         $this->_registerPlugin(new Nmc_Controller_Action_Plugin_Authorize());
     }
 
@@ -21,7 +22,7 @@ class HomeController extends Nmc_Controller_Action
         $out->myRequests = $requests;
         $out->page = 'my_home';
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
 }
\ No newline at end of file
diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php
index 6a9984d2..1eafd1f1 100644
--- a/application/controllers/IndexController.php
+++ b/application/controllers/IndexController.php
@@ -5,7 +5,7 @@ class IndexController extends Nmc_Controller_Action
 
     public function indexAction()
     {
-        $in = new Zend_Filter_Input($this->_action->getParams());
+        $in = new Zend_Filter_Input($this->_getAllParams());
         $out = new Nmc_View();
         $out->addScriptPath(APPLICATION_PATH . DIRECTORY_SEPARATOR . 'views');
         $out->page = 'login';
diff --git a/application/controllers/NewrequestController.php b/application/controllers/NewrequestController.php
index 0f8caf9a..b019a82b 100644
--- a/application/controllers/NewrequestController.php
+++ b/application/controllers/NewrequestController.php
@@ -3,9 +3,9 @@
 class NewRequestController extends Nmc_Controller_Action
 {
 
-    public function __construct()
+    public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
     {
-        parent::__construct();
+        parent::__construct($request, $response, $invokeArgs);
         $this->_registerPlugin(new Nmc_Controller_Action_Plugin_Authorize());
     }
 
@@ -21,7 +21,7 @@ class NewRequestController extends Nmc_Controller_Action
 
     public function searchAction()
     {
-        $in = $this->_action->getParams();
+        $in = $this->_getAllParams();
         if($in[0] != '' && $in[1] != '') {
             return $this->searchResultsAction();
         }
@@ -29,12 +29,12 @@ class NewRequestController extends Nmc_Controller_Action
         $out = new Nmc_View();
         $out->page = 'request/search';
         $out->css_files[] = '/css/request/edit_wrapper.css';
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function searchResultsAction()
     {
-        $in = $this->_action->getParams();
+        $in = $this->_getAllParams();
 
         $subject = Zend_Filter::getAlpha($in[0]);
         $courseNumber = Zend_Filter::getDigits($in[1]);
@@ -63,12 +63,12 @@ class NewRequestController extends Nmc_Controller_Action
 
             Nmc_Registry_Session::getInstance()->course = $course;
         }
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function createAction()
     {
-        $in = $this->_action->getParams();
+        $in = $this->_getAllParams();
 
         $type = Zend_Filter::getAlnum($in[0]);
         $subject = Zend_Filter::getAlpha($in[1]);
@@ -97,12 +97,12 @@ class NewRequestController extends Nmc_Controller_Action
 
         $out = new Nmc_View();
         $out->location = '/newrequest/CourseID';
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function loadAction()
     {
-        $in = $this->_action->getParams();
+        $in = $this->_getAllParams();
 
         $requestId = Zend_Filter::getInt($in[0]);
         $request = Requests::getInstance()->find($requestId);
@@ -113,7 +113,7 @@ class NewRequestController extends Nmc_Controller_Action
 
         $out = new Nmc_View();
         $out->location = '/NewRequest/CourseID';
-        $out->render();
+        $out->render('index.xhtml');
     }
 
     public function updateAction() {
@@ -375,7 +375,7 @@ class NewRequestController extends Nmc_Controller_Action
 
         $out->assign('refresh', '/NewRequest/' . $targetForm . '/');
         if(true || $_SERVER['REMOTE_ADDR'] != '129.93.39.17') {
-            echo $out->render();
+            echo $out->render('index.xhtml');
         } else {
             //print_r($course);
         }
@@ -404,7 +404,7 @@ class NewRequestController extends Nmc_Controller_Action
 
         $out->course = $course;
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function creditHoursAction()
@@ -434,7 +434,7 @@ class NewRequestController extends Nmc_Controller_Action
         }
         $out->creditsSingleValues = implode(' ', $creditsSingleValues);
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function timeLocationAction()
@@ -448,7 +448,7 @@ class NewRequestController extends Nmc_Controller_Action
         $course = Nmc_Registry_Session::getInstance()->course;
         $out->course = $course;
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function graduateTieInAction()
@@ -473,7 +473,7 @@ class NewRequestController extends Nmc_Controller_Action
         $out->hasGradTieIn = $hasGradTieIn;
         $out->course = $course;
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function supportiveMaterialAction()
@@ -491,7 +491,7 @@ class NewRequestController extends Nmc_Controller_Action
         $request = Nmc_Registry_Session::getInstance()->request;
         $out->request = $request;
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function additionalInformationAction()
@@ -505,7 +505,7 @@ class NewRequestController extends Nmc_Controller_Action
         $course = Nmc_Registry_Session::getInstance()->course;
         $out->course = $course;
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function submitRequestAction()
@@ -520,22 +520,24 @@ class NewRequestController extends Nmc_Controller_Action
         $out->requestPage = 'submit';
         $out->css_files[] = '/css/request/submit.css';
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     protected function _submitRequestAction()
     {
         try {
             $course = Nmc_Registry_Session::getInstance()->course;
+            $request = Nmc_Registry_Session::getInstance()->request;
 
             $course->save();
+            $request->save();
 
             Nmc_Registry_Session::getInstance()->erase('course');
             Nmc_Registry_Session::getInstance()->erase('request');
 
             $out = new Nmc_View();
             $out->refresh = '/home';
-            echo $out->render();
+            echo $out->render('index.xhtml');
         } catch(Exception $e) {
             throw $e;
         }
diff --git a/application/controllers/TestController.php b/application/controllers/TestController.php
index e3c6ae9b..cf35d852 100644
--- a/application/controllers/TestController.php
+++ b/application/controllers/TestController.php
@@ -2,8 +2,9 @@
 
 class TestController extends Nmc_Controller_Action
 {
-    public function __construct()
+    public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
     {
+        parent::__construct($request, $response, $invokeArgs);
         //$this->_registerPlugin(new Nmc_Controller_Action_Plugin_Authorize());
         //$this->_registerPlugin(new Nmc_Controller_Action_Plugin_Test());
     }
diff --git a/application/controllers/TestformController.php b/application/controllers/TestformController.php
index bbc91222..eb79bf1c 100644
--- a/application/controllers/TestformController.php
+++ b/application/controllers/TestformController.php
@@ -2,9 +2,9 @@
 
 class TestFormController extends Nmc_Controller_Action
 {
-    public function __construct()
+    public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
     {
-        //
+        parent::__construct($request, $response, $invokeArgs);
     }
 
     public function indexAction()
@@ -34,7 +34,7 @@ class TestFormController extends Nmc_Controller_Action
         $out = new Nmc_View_Unl();
         $out->assign('page', 'listAddress');
         $out->assign('records', $recrods);
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function viewAction()
@@ -47,14 +47,14 @@ class TestFormController extends Nmc_Controller_Action
         $out = new Nmc_View_Unl();
         $out->assign('page', 'viewAddress');
         $out->assign('record', $record);
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function addAction()
     {
         $out = new Nmc_View_Unl();
         $out->page = 'addAddress';
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function editAction()
@@ -67,7 +67,7 @@ class TestFormController extends Nmc_Controller_Action
         $out = new Nmc_View_Unl();
         $out->assign('page', 'editAddress');
         $out->assign('record', $record);
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function saveAction()
@@ -95,7 +95,7 @@ class TestFormController extends Nmc_Controller_Action
 
         $out = new Nmc_View_Unl();
         $out->refresh = '/testform/view/' . $id;
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 }
 
diff --git a/application/controllers/UseradminController.php b/application/controllers/UseradminController.php
index d52ff86f..9fd40e70 100644
--- a/application/controllers/UseradminController.php
+++ b/application/controllers/UseradminController.php
@@ -11,7 +11,7 @@ class UserAdminController extends Nmc_Controller_Action
         $out->title = 'Group Administration';
         $out->page = 'user_admin';
         $out->groups = $groups;
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function editUserAction()
@@ -35,7 +35,7 @@ class UserAdminController extends Nmc_Controller_Action
         }
         $out->groups = Groups::getInstance()->fetchAllWithoutPrimaries();
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     protected function editUserActionPost()
@@ -74,7 +74,7 @@ class UserAdminController extends Nmc_Controller_Action
 
         $out = new Nmc_View();
         $out->refresh = '/UserAdmin/EditUser/' . $userId;
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     public function editGroupAction()
@@ -100,7 +100,7 @@ class UserAdminController extends Nmc_Controller_Action
         $out->users = People::getInstance()->fetchAll();
         $out->groups = Groups::getInstance()->fetchAllWithoutPrimaries();
 
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 
     protected function editGroupActionPost()
@@ -153,7 +153,7 @@ class UserAdminController extends Nmc_Controller_Action
 
         $out = new Nmc_View();
         $out->refresh = '/UserAdmin/EditGroup/' . $groupId;
-        echo $out->render();
+        echo $out->render('index.xhtml');
     }
 }
 
diff --git a/application/models/rows/ApprovalChain.php b/application/models/rows/ApprovalChain.php
new file mode 100644
index 00000000..88b3b9c3
--- /dev/null
+++ b/application/models/rows/ApprovalChain.php
@@ -0,0 +1,16 @@
+<?php
+
+class ApprovalChain extends Nmc_Db_Table_Row
+{
+
+    /**
+     * This function is called by ApprovalActions when a decision has been reached.
+     * When called, the next ApprovalAction in the chain will be called
+     *
+     * @param Request $request
+     */
+    public function advance(Request $request)
+    {
+        //
+    }
+}
diff --git a/application/models/rows/Person.php b/application/models/rows/Person.php
index de13ad86..6c3501b1 100644
--- a/application/models/rows/Person.php
+++ b/application/models/rows/Person.php
@@ -1,6 +1,6 @@
 <?php
 
-Zend::loadInterface('Nmc_Model_UserInterface');
+require_once 'Nmc/Model/UserInterface.php';
 
 /**
  *
diff --git a/application/models/tables/ApprovalChains.php b/application/models/tables/ApprovalChains.php
index 92dfee50..cd617630 100644
--- a/application/models/tables/ApprovalChains.php
+++ b/application/models/tables/ApprovalChains.php
@@ -3,8 +3,30 @@
 /**
  *
  * @primary approval_chain_id
+ * @rowClass ApprovalChain
  *
  */
-class ApprovalChains extends Nmc_Db_Table {}
+class ApprovalChains extends Nmc_Db_Table
+{
+    /**
+     * The one true instance
+     *
+     * @var ApprovalChains
+     */
+    static protected $_instance;
+
+    /**
+     * Return the one true instance
+     *
+     * @return ApprovalChains
+     */
+    static public function getInstance($config = array())
+    {
+        if (!self::$_instance) {
+            self::$_instance = new ApprovalChains($config);
+        }
+        return self::$_instance;
+    }
+}
 
 ?>
\ No newline at end of file
diff --git a/application/models/tables/CourseCrosslistings.php b/application/models/tables/CourseCrosslistings.php
index f36debd2..f80091f4 100644
--- a/application/models/tables/CourseCrosslistings.php
+++ b/application/models/tables/CourseCrosslistings.php
@@ -55,7 +55,7 @@ class CourseCrosslistings extends Local_Db_CourseTableMany
         $select->where($db->quoteInto('subject = ?', $subject));
         $select->where($db->quoteInto('course_number = ?', $number));
         $select->where($db->quoteInto('course_letter = ?', $letter));
-        $select->order('creation_time DESC');
+        $select->order('creation_time ASC');
 
         $row = $db->fetchRow($select);
         $result = $me->find($row[$courseCrosslistingsPrimaryKeyName]);
-- 
GitLab