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

Initial checkin of the app

parent cbd0de28
Branches
No related tags found
No related merge requests found
Showing
with 626 additions and 0 deletions
<?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
<?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
<?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();
}
}
<?php
class IndexController extends App_Controller_Action
{
public function indexAction()
{
}
}
\ No newline at end of file
<?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
<?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;
<?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
<?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
<?php
class Evaluate_FinishedController extends App_Controller_Action
{
public function indexAction()
{
}
}
<?php
class Evaluate_IndexController extends App_Controller_Action
{
public function indexAction()
{
$this->_redirect('/evaluate/find-supervisor');
}
}
\ No newline at end of file
<?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
<?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
<?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
<?php $this->layout()->tagline = 'Finished'; ?>
Thank you for completing the evaluation!
\ No newline at end of file
@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
@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
<?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);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment