diff --git a/application/modules/auth/controllers/LoginController.php b/application/modules/auth/controllers/LoginController.php new file mode 100644 index 0000000000000000000000000000000000000000..65c62497cfa16e92d35b9744d036493ebe2df2d8 --- /dev/null +++ b/application/modules/auth/controllers/LoginController.php @@ -0,0 +1,51 @@ +<?php + +class Auth_LoginController extends App_Controller_Action +{ + /** + * Enter description here... + * + * @var Zend_Controller_Action_Helper_FlashMessenger + */ + protected $_flashMessenger; + + public function init() + { + parent::init(); + + $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger'); + $this->_flashMessenger->setNamespace(__CLASS__); + $this->initView(); + } + + public function indexAction() + { + $this->view->messages = $this->_flashMessenger->getMessages(); + } + + public function postAction() + { + $username = $this->_getParam('username'); + $password = $this->_getParam('password'); + + $auth = Unl_Auth::getInstance(); + $ldap = new Unl_Ldap('ldap://localhost:10389'); + $auth->pushAdapter(new Unl_Auth_Adapter_Ldap($ldap, $username, $password)); + $result = $auth->authenticate(); + + if (!$result->isValid()) { + $this->_flashMessenger->addMessage('Login Failed'); + $this->_redirect('/auth/login'); + return; + } + + $evaluator = Evaluate_EvaluatorsModel::getInstance()->fetchWithUsername(Zend_Auth::getInstance()->getIdentity()); + if ($evaluator) { + $this->_flashMessenger->addMessage('You may only submit one evaluation.'); + $this->_redirect('/auth/login'); + return; + } + + $this->_redirect('/evaluate'); + } +} \ No newline at end of file diff --git a/application/modules/auth/views/scripts/login/index.phtml b/application/modules/auth/views/scripts/login/index.phtml new file mode 100644 index 0000000000000000000000000000000000000000..0a17ce1b865ad3c186bb962eb0501fe14bab136c --- /dev/null +++ b/application/modules/auth/views/scripts/login/index.phtml @@ -0,0 +1,25 @@ +<?php $this->layout()->tagline = 'Login'; ?> + +<?php foreach ($this->messages as $message) { ?> +<div><?php echo $message; ?></div> +<?php }?> + +<form method="post" action="<?php echo $this->baseUrl(); ?>/auth/login/post"> + <div> + <label> + Username:<br /> + <?php echo $this->formText('username'); ?> + </label> + </div> + + <div> + <label> + Password:<br /> + <?php echo $this->formPassword('password'); ?> + </label> + </div> + + <div> + <?php echo $this->formSubmit('submit', 'Login'); ?> + </div> +</form> \ No newline at end of file diff --git a/application/modules/default/controllers/ErrorController.php b/application/modules/default/controllers/ErrorController.php new file mode 100644 index 0000000000000000000000000000000000000000..6ced0269677a3fac3180a853c8d7ba46ef05105c --- /dev/null +++ b/application/modules/default/controllers/ErrorController.php @@ -0,0 +1,71 @@ +<?php + +/** + * ErrorController + * + * @author + * @version + */ + +require_once 'Zend/Controller/Action.php'; + +class ErrorController extends Unl_Controller_Action { + + protected $_exceptions; + + public function errorAction() { + $this->_exceptions = $this->getResponse()->getException(); + + if ($_SERVER['REMOTE_ADDR'] == '129.93.39.17') { + header('Content-type: text/plain'); + print_r($this->_exceptions); + exit; + } + + $this->_sendEmail('tsteiner2@unl.edu'); + $this->view->exceptions = $this->_exceptions; + } + + protected function _sendEmail($address, $moreAddresses = '...') + { + $mail = new Zend_Mail('utf-8'); + $mail->setFrom('php@' . $_SERVER['SERVER_NAME'], $_SERVER['SERVER_NAME']); + $mail->setSubject('Exception Report'); + + foreach(func_get_args() as $address) + { + if(is_array($address)) { + $mail->addTo($address[0], $address[1]); + } else { + $mail->addTo($address); + } + } + + $date = date('Y-m-d'); + $time = date('H:i'); + $body = "The following exception occured on $date at $time.\n\n" + . print_r($this->_exceptions, true) + . "\nRequest URI: " . $_SERVER['REQUEST_URI'] . "\n" + . "User Agent: " . $_SERVER['HTTP_USER_AGENT'] . "\n" + . "User IP Address :" . $_SERVER['REMOTE_ADDR'] ."\n"; + + if(count($_GET) > 0) { + $body .= "\nGET variables: \n" + . print_r($_GET, true); + } + if(count($_POST) > 0) { + $body .= "\nPOST variables: \n" + . print_r($_POST, true); + } + /* + if(session_id() && ($_SESSION) > 0) { + $body .= "\nSESSION variables: \n" + . print_r($_SESSION, true); + } + */ + + $mail->setBodyText('See HTML Version'); + $mail->setBodyHtml('<pre>' . $body . '</pre>'); + $mail->send(); + } +} diff --git a/application/modules/default/controllers/IndexController.php b/application/modules/default/controllers/IndexController.php new file mode 100644 index 0000000000000000000000000000000000000000..dd4a6bd28b368cd2e0137920439003213b150040 --- /dev/null +++ b/application/modules/default/controllers/IndexController.php @@ -0,0 +1,9 @@ +<?php + +class IndexController extends App_Controller_Action +{ + public function indexAction() + { + + } +} \ No newline at end of file diff --git a/application/modules/default/views/scripts/index/index.phtml b/application/modules/default/views/scripts/index/index.phtml new file mode 100644 index 0000000000000000000000000000000000000000..0e81f26c27846642575ca82a93211fbaa56c8d8e --- /dev/null +++ b/application/modules/default/views/scripts/index/index.phtml @@ -0,0 +1,5 @@ +<?php $this->layout()->tagline = 'Welcome'; ?> + +<div> +Please click <a href="<?php echo $this->baseUrl(); ?>/auth/login">here</a> to log in. +</div> \ No newline at end of file diff --git a/application/modules/default/views/scripts/layout.phtml b/application/modules/default/views/scripts/layout.phtml new file mode 100644 index 0000000000000000000000000000000000000000..ad475806876d7dea4e3c8897edaaebc56cb6dabc --- /dev/null +++ b/application/modules/default/views/scripts/layout.phtml @@ -0,0 +1,57 @@ +<?php + +header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 +header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past + +$this->headLink()->appendStylesheet($this->baseUrl() . '/css/index.css', 'all'); +$this->headLink()->appendStylesheet($this->baseUrl() . '/css/print.css', 'print'); +$this->headScript()->prependFile($this->baseUrl() . '/javascript/index.js'); + +if (!$this->layout()->template) { + $this->layout()->template = 'Fixed'; +} +if (!$this->layout()->title) { + $this->layout()->title = 'IS Supervisor Evaluation'; +} +if (!$this->layout()->tagline) { + $this->layout()->tagline = ''; +} + +$template = UNL_Templates::factory($this->layout()->template, array('sharedcodepath' => 'sharedcode')); +$template->titlegraphic = '<h1>' . $this->layout()->title . '</h1>' + . '<h2>' . $this->layout()->tagline . '</h2>'; + +if (is_array($this->layout()->breadcrumbs)) { + $template->breadcrumbs = '<ul>'; + foreach ($this->layout()->breadcrumbs as $text => $url) { + if ($url != '#') { + $template->breadcrumbs .= '<li><a href="' . $url . '">' . $text . '</a></li> '; + } else { + $template->breadcrumbs .= '<li>' . $text . '</li> '; + } + } + $template->breadcrumbs .= '</ul>'; +} + +$template->maincontentarea = ''; +$template->maincontentarea .= '<div id="creqSidebar">' . "\n"; +$template->maincontentarea .= '</div>' . "\n" + . '<div id="creqMain">' . "\n" + . $this->layout()->content . "\n" + . '</div>' . "\n" + . '<div class="clear">' . "\n" + . '</div>' . "\n"; + +$template->doctitle = '<title>' . $this->layout()->title . ': ' . $this->layout()->tagline . '</title>'; +$template->head .= "\n" . $this->headLink()->__toString() + . "\n" . $this->headMeta()->__toString() + . "\n" . $this->headScript()->__toString() + . "\n" . $this->headStyle()->__toString(); + +$template->loadSharedCodeFiles(); + + +echo "<?xml version='1.0' encoding='UTF-8'?>\n"; +$html = $template->toHtml(); +$html = strtr($html, array('<body' => '<body class="tundra" onload="handleOnLoad(\'' . $this->baseUrl() . '\');"')); +echo $html; diff --git a/application/modules/evaluate/controllers/FeedbackController.php b/application/modules/evaluate/controllers/FeedbackController.php new file mode 100644 index 0000000000000000000000000000000000000000..8a71098d99ff52749b96c8517496b8fcaf6e733a --- /dev/null +++ b/application/modules/evaluate/controllers/FeedbackController.php @@ -0,0 +1,159 @@ +<?php + +class Evaluate_FeedbackController extends App_Controller_Action +{ + /** + * Enter description here... + * + * @var Zend_Controller_Action_Helper_FlashMessenger + */ + protected $_flashMessenger; + + public function init() + { + parent::init(); + + if (!Zend_Auth::getInstance()->hasIdentity()) { + $this->_redirect('/auth/login'); + } + + $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger'); + $this->_flashMessenger->setNamespace(__CLASS__); + } + + public function indexAction() + { + $session = new Zend_Session_Namespace(__CLASS__); + $moduleSession = new Zend_Session_Namespace($this->_getParam('module')); + if (!$moduleSession->supervisor) { + $this->_redirect('/evaluate/find-supervisor'); + return; + } + $this->view->supervisor = $moduleSession->supervisor; + $this->view->formData = $session->formData; + $this->view->messages = $this->_flashMessenger->getMessages(); + } + + public function postAction() + { + $filters = array(); + $validators = array( + 'q1' => array( + 'presence' => 'required', + 'digits', + array('Between', 1, 5) + ), + + 'q2' => array( + 'presence' => 'required', + 'digits', + array('Between', 1, 5) + ), + + 'q3' => array( + 'presence' => 'required', + 'digits', + array('Between', 1, 5) + ), + + 'q4' => array( + 'presence' => 'required', + 'digits', + array('Between', 1, 5) + ), + + 'q5' => array( + 'presence' => 'required', + 'digits', + array('Between', 1, 5) + ), + + 'q6' => array( + 'presence' => 'required', + 'digits', + array('Between', 1, 5) + ), + + 'q7' => array( + 'presence' => 'required', + 'digits', + array('Between', 1, 5) + ), + + 'q8' => array( + 'presence' => 'required', + 'digits', + array('Between', 1, 5) + ), + + 'q9' => array( + 'presence' => 'required', + 'digits', + array('Between', 1, 5) + ), + + 'q10' => array( + 'presence' => 'required', + 'digits', + array('Between', 1, 5) + ), + + 'q11' => array( + 'presence' => 'required' + ), + + 'q12' => array( + 'presence' => 'required' + ) + ); + + $in = new Zend_Filter_Input(array(), $validators, $this->_getAllParams()); + + $session = new Zend_Session_Namespace(__CLASS__); + $session->formData = $this->_getAllParams(); + if(!$in->isValid()) { + $this->_flashMessenger->addMessage('Looks like you forgot something. Try again.'); + $this->_redirect('/evaluate/feedback'); + return; + } + + $evaluator = Evaluate_EvaluatorsModel::getInstance()->fetchWithUsername(Zend_Auth::getInstance()->getIdentity()); + if ($evaluator) { + throw new Exception('Cheater! You can\'t evaluate more than once!'); + } + + + $moduleSession = new Zend_Session_Namespace($this->_getParam('module')); + $supervisor = $moduleSession->supervisor; + + $this->initView(); + $this->view->supervisor = $moduleSession->supervisor; + $this->view->formData = $session->formData; + $this->view->messages = $this->_flashMessenger->getMessages(); + $this->view->lockFields = true; + + //$layout = $this->view->layout(); + //$layout->content = $this->view->render('feedback/index.phtml'); + //$bodyHtml = $layout->render(); + $bodyHtml = $this->view->render('feedback/index.phtml'); + + $mail = new Zend_Mail('UTF-8'); + $mail->setSubject('An evaluation for ' . $supervisor['cn'][0] . ' has been completed.'); + $mail->addTo('tsteiner2@unl.edu', 'Tim Steiner'); + $mail->setFrom('noreply@unl.edu'); + $mail->setBodyText('Sorry, this email requires an HTML capable client.'); + $mail->setBodyHtml($bodyHtml); + $result = $mail->send(); + + + $evaluator = Evaluate_EvaluatorsModel::getInstance()->fetchNew(); + $evaluator->username = Zend_Auth::getInstance()->getIdentity(); + $evaluator->supervisor = $moduleSession->supervisor['uid'][0]; + $evaluator->time = time(); + + //$evaluator->save(); + + //Zend_Auth::getInstance()->clearIdentity(); + $this->_redirect('/evaluate/finished'); + } +} \ No newline at end of file diff --git a/application/modules/evaluate/controllers/FindSupervisorController.php b/application/modules/evaluate/controllers/FindSupervisorController.php new file mode 100644 index 0000000000000000000000000000000000000000..6974f6642a9682232fefb90f3791f7a739bf7e5b --- /dev/null +++ b/application/modules/evaluate/controllers/FindSupervisorController.php @@ -0,0 +1,47 @@ +<?php + +class Evaluate_FindSupervisorController extends App_Controller_Action +{ + /** + * Enter description here... + * + * @var Zend_Controller_Action_Helper_FlashMessenger + */ + protected $_flashMessenger; + + public function init() + { + parent::init(); + + if (!Zend_Auth::getInstance()->hasIdentity()) { + $this->_redirect('/auth/login'); + } + + $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger'); + $this->_flashMessenger->setNamespace(__CLASS__); + } + + public function indexAction() + { + $this->view->messages = $this->_flashMessenger->getMessages(); + } + + public function postAction() + { + $bbUsername = $this->_getParam('bbUsername'); + + $ldap = new Unl_Ldap('ldap://localhost:10389'); + $ldap->bind('uid=fpatrack,ou=service,dc=unl,dc=edu', 'eziehuoz'); + $result = $ldap->search('dc=unl,dc=edu', 'uid=' . $bbUsername); + + if (count($result) == 0) { + $this->_flashMessenger->addMessage('Username "' . $bbUsername . '" not found.'); + $this->_redirect('/evaluate/find-supervisor'); + return; + } + + $session = new Zend_Session_Namespace($this->_getParam('module')); + $session->supervisor = $result[0]; + $this->_redirect('/evaluate/feedback'); + } +} \ No newline at end of file diff --git a/application/modules/evaluate/controllers/FinishedController.php b/application/modules/evaluate/controllers/FinishedController.php new file mode 100644 index 0000000000000000000000000000000000000000..8dac52f3198172ce13d548e0494c624d8218f664 --- /dev/null +++ b/application/modules/evaluate/controllers/FinishedController.php @@ -0,0 +1,10 @@ +<?php + +class Evaluate_FinishedController extends App_Controller_Action +{ + public function indexAction() + { + + } + +} diff --git a/application/modules/evaluate/controllers/IndexController.php b/application/modules/evaluate/controllers/IndexController.php new file mode 100644 index 0000000000000000000000000000000000000000..7f0633af6e3b9a1948996a56d5c3e3135bc478e8 --- /dev/null +++ b/application/modules/evaluate/controllers/IndexController.php @@ -0,0 +1,9 @@ +<?php + +class Evaluate_IndexController extends App_Controller_Action +{ + public function indexAction() + { + $this->_redirect('/evaluate/find-supervisor'); + } +} \ No newline at end of file diff --git a/application/modules/evaluate/models/EvaluatorsModel.php b/application/modules/evaluate/models/EvaluatorsModel.php new file mode 100644 index 0000000000000000000000000000000000000000..1e5771e6bdc961e1324d0825a20a4dc6c425d265 --- /dev/null +++ b/application/modules/evaluate/models/EvaluatorsModel.php @@ -0,0 +1,29 @@ +<?php + +class Evaluate_EvaluatorsModel extends Zend_Db_Table +{ + protected $_name = 'evaluators'; + protected $_primary = 'evaluatorId'; + + static protected $_instance; + + /** + * Returns the one true instance + * + * @return Evaluate_EvaluatorsModel + */ + static public function getInstance() + { + if (!self::$_instance) { + self::$_instance = new self(); + } + return self::$_instance; + } + + public function fetchWithUsername($username) + { + $db = $this->getAdapter(); + $where = $db->quoteInto('username = ?', $username); + return self::fetchRow($where); + } +} \ No newline at end of file diff --git a/application/modules/evaluate/views/scripts/feedback/index.phtml b/application/modules/evaluate/views/scripts/feedback/index.phtml new file mode 100644 index 0000000000000000000000000000000000000000..670e974698b20ac9199b27f94f57136780436e98 --- /dev/null +++ b/application/modules/evaluate/views/scripts/feedback/index.phtml @@ -0,0 +1,76 @@ +<?php $this->layout()->tagline = 'Feedback for ' . $this->supervisor['cn'][0]; ?> +<?php $this->headLink()->appendStylesheet($this->baseUrl() . '/css/evaluate/feedback.css', 'all'); ?> + +<div> + Definitions of evaluation terms: +</div> +<ol> + <li>Fails to meet expectations</li> + <li>Does not fully meet certain expectations</li> + <li>Fully meets and occasionally exceeds expectations</li> + <li>Consistently meets and frequently exceeds expectations</li> + <li>Clearly exceeds expectations on a consistent basis</li> +</ol> + +<?php foreach ($this->messages as $message) { ?> +<div><?php echo $message; ?></div> +<?php }?> + +<div> +Please complete all of the following questions +</div> + +<?php +$questions = array( + 1 => + 'Helps develop an atmosphere of mutual respect and confidence and works to create an inclusive environment.', + 'Assists the staff in personal/professional development.', + 'Demonstrates leadership in determining priorities.', + 'Demonstrates an open attitude toward new ideas and methods.', + 'Actively solicits and values staff’s input in areas relating to their duties.', + 'Sets clear expectations for work to be done.', + 'Fosters and implements effective communication including providing a schedule of availability and information on how to be contacted when absent.', + 'Delegates responsibility and authority appropriately.', + 'Exhibits a positive and professional image of the department and the University.', + 'Rate the overall 2008/2009 evaluation year performance of your supervisor.' +); + +$options = array(); +if ($this->lockFields) { + $options['disabled'] = 'disabled'; +} + +?> + +<form method="post" action="<?php echo $this->baseUrl(); ?>/evaluate/feedback/post"> + <table id="questionsTable"> + <?php foreach ($questions as $qid => $question) { ?> + <tr> + <td class="questionText"> + <?php echo $question; ?> + </td> + <td> + <?php echo $this->formRadio('q' . $qid, $this->formData['q' . $qid], $options, array(1 => '1', '2', '3', '4', '5'), '</td><td>'); ?> + </td> + </tr> + <?php } ?> + </table> + + <div> + What have you observed to be the strengths of your supervisor in his/her performance in 2008/2009?<br /> + Please give specific examples.<br /> + <?php echo $this->formTextarea('q11', $this->formData['q11'], $options + array('rows' => '5')); ?> + </div> + + <div> + What suggestions might you have as to how your supervisor could improve his/her performance in specific areas?<br /> + <?php echo $this->formTextarea('q12', $this->formData['q12'], $options + array('rows' => '5')); ?> + </div> + + <?php if (!$this->lockFields) { ?> + <div> + <?php echo $this->formSubmit('submit', 'Submit Feedback'); ?> + </div> + <?php } ?> + +</form> \ No newline at end of file diff --git a/application/modules/evaluate/views/scripts/find-supervisor/index.phtml b/application/modules/evaluate/views/scripts/find-supervisor/index.phtml new file mode 100644 index 0000000000000000000000000000000000000000..c281ddd3e25e6f96ef32b6b6fca962d66da3026c --- /dev/null +++ b/application/modules/evaluate/views/scripts/find-supervisor/index.phtml @@ -0,0 +1,18 @@ +<?php $this->layout()->tagline = 'Find Supervisor'; ?> + +<?php foreach ($this->messages as $message) { ?> +<div><?php echo $message; ?></div> +<?php }?> + +<form method="post" action="<?php echo $this->baseUrl(); ?>/evaluate/find-supervisor/post"> + <div> + <label> + Supervisor's Blackboard Username:<br /> + <?php echo $this->formText('bbUsername'); ?> + </label> + </div> + + <div> + <?php echo $this->formSubmit('submit', 'Find'); ?> + </div> +</form> \ No newline at end of file diff --git a/application/modules/evaluate/views/scripts/finished/index.phtml b/application/modules/evaluate/views/scripts/finished/index.phtml new file mode 100644 index 0000000000000000000000000000000000000000..ecd02c5fa602863b0ef6e36172b4d61e14df3640 --- /dev/null +++ b/application/modules/evaluate/views/scripts/finished/index.phtml @@ -0,0 +1,3 @@ +<?php $this->layout()->tagline = 'Finished'; ?> + +Thank you for completing the evaluation! \ No newline at end of file diff --git a/document_root/css/evaluate/feedback.css b/document_root/css/evaluate/feedback.css new file mode 100644 index 0000000000000000000000000000000000000000..cad22e98234b76dfe46fbf3c9ccbe6a362f18da3 --- /dev/null +++ b/document_root/css/evaluate/feedback.css @@ -0,0 +1,17 @@ +@CHARSET "UTF-8"; + +#questionsTable { + border-spacing: 0px; + /* border-collapse: collapse; */ + border-left: 1px solid #000; +} + +#questionsTable td { + border: 1px solid #000; + border-left: 0px solid #000; + padding: 0.2em; +} + +#questionsTable .questionText { + width: 75%; +} \ No newline at end of file diff --git a/document_root/css/index.css b/document_root/css/index.css new file mode 100644 index 0000000000000000000000000000000000000000..d0a7f1fc12b650fc66ecfcd7fdd308d9e3436720 --- /dev/null +++ b/document_root/css/index.css @@ -0,0 +1,29 @@ +@CHARSET "UTF-8"; + +#navigation {display: none;} +#container div.clear #main_right {float: none; width: auto;} +#creqSidebar {float: left;} +#creqMain {overflow: hidden; float:left;} + + +#maincontent table.questionGrid {margin: 1px; border-collapse: collapse;} + +#maincontent table.questionGrid td {border-right: 1px solid #000; border-left: 1px solid #000; padding: 0.5em; text-align: center;} +#maincontent table.questionGrid th {border-right: 1px solid #000; border-left: 1px solid #000; padding: 0.5em; text-align: left; font-weight: normal} +#maincontent table.questionGrid td.empty {border-right: 0px solid #000; border-left: 0px solid #000;} + +#maincontent table.questionGrid tr.top td {border-top: 1px solid #000;} +#maincontent table.questionGrid tr.top th {border-top: 1px solid #000;} +#maincontent table.questionGrid tr.top td.empty {border-top: 0px solid #000;} +#maincontent table.questionGrid tr.bottom td {border-bottom: 1px solid #000;} +#maincontent table.questionGrid tr.bottom th {border-bottom: 1px solid #000;} +#maincontent table.questionGrid tr.bottom td.empty {border-bottom: 0px solid #000;} +#main_right {overflow: visible;} + + +.hidden {display: none;} + +#maincontent b {text-decoration: underline;} + +.error {color: #c00; font-weight: bold; text-size: 110%;} +#scenarioDescription {display: none; position: absolute; top: -100px; left: 98px; width: 768px; height: 500px; background-color: #fff; border: 2px solid #000; padding: 0.5em; overflow: auto} \ No newline at end of file diff --git a/library/App/Controller/Action.php b/library/App/Controller/Action.php new file mode 100644 index 0000000000000000000000000000000000000000..47820d72cb0d53e55bfa3fbddb3cb5fb0f56ced8 --- /dev/null +++ b/library/App/Controller/Action.php @@ -0,0 +1,11 @@ +<?php + +class App_Controller_Action extends Unl_Controller_Action +{ + public function init() + { + parent::init(); + $this->view->addHelperPath(dirname(__FILE__) . '/../View/Helper', 'App_View_Helper'); + $this->view->doctype()->setDoctype(Zend_View_Helper_Doctype::XHTML1_TRANSITIONAL); + } +}