فهرست منبع

Added administrative actions and a system audit trail.

Adam Day 9 سال پیش
والد
کامیت
079e585bc8

+ 2 - 6
application/controllers/indexController.php

@@ -29,12 +29,8 @@ class indexController extends Staple_Controller
 
 
 		$this->view->week = $report->getWeekWorked($this->userId, $week, $year);
 		$this->view->week = $report->getWeekWorked($this->userId, $week, $year);
 
 
-		$overRide = new unlockModel();
-		$test = $overRide->rangeDates($this->userId);
-
-		echo "<pre>";
-		print_r($test);
-		echo "</pre>";
+		$unlock = new unlockModel();
+		$this->view->unlockedTimes = count($unlock->load($this->userId));
 	}
 	}
 }
 }
 ?>
 ?>

+ 41 - 32
application/controllers/reportsController.php

@@ -3,11 +3,14 @@
 class reportsController extends Staple_Controller
 class reportsController extends Staple_Controller
 {
 {
     private $authLevel;
     private $authLevel;
+    private $uid;
 
 
     public function _start()
     public function _start()
     {
     {
         $auth = Staple_Auth::get();
         $auth = Staple_Auth::get();
         $this->authLevel = $auth->getAuthLevel();
         $this->authLevel = $auth->getAuthLevel();
+        $user = new userModel();
+        $this->uid = $user->getId();
         if ($this->authLevel < 500) {
         if ($this->authLevel < 500) {
             header("location:" . $this->_link(array('index', 'index')) . "");
             header("location:" . $this->_link(array('index', 'index')) . "");
         }
         }
@@ -25,6 +28,38 @@ class reportsController extends Staple_Controller
 
 
         $report = new reportModel($year, $month);
         $report = new reportModel($year, $month);
         $this->view->report = $report->getTimesheets();
         $this->view->report = $report->getTimesheets();
+
+        $timesheet = new timesheetModel($year, $month);
+        $this->view->nextMonth = $timesheet->getNextMonth();
+        $this->view->previousMonth = $timesheet->getPreviousMonth();
+        $this->view->year = $timesheet->getCurrentYear();
+        $yearForm = new changeYearForm();
+        $yearForm->setAction($this->_link(array('reports','changeyear')));
+        $this->view->yearForm = $yearForm;
+
+        $this->view->accountLevel = $this->authLevel;
+    }
+
+    public function changeyear()
+    {
+        $form = new changeYearForm();
+        if($form->wasSubmitted())
+        {
+            $form->addData($_POST);
+            if($form->validate())
+            {
+                $data = $form->exportFormData();
+                header("location: ".$this->_link(array('reports',$data['year']))."");
+            }
+            else
+            {
+                header("location: ".$this->_link(array('reports'))."");
+            }
+        }
+        else
+        {
+            header("location: ".$this->_link(array('reports'))."");
+        }
     }
     }
 
 
     public function weekly()
     public function weekly()
@@ -61,36 +96,6 @@ class reportsController extends Staple_Controller
         }
         }
         else
         else
         {
         {
-            $rangeForm = new rangeUnlockForm();
-
-            if ($rangeForm->wasSubmitted()) {
-                $rangeForm->addData($_POST);
-                if ($rangeForm->validate()) {
-                    $data = $rangeForm->exportFormData();
-                    $unlock = new unlockModel();
-                    $unlock->setStartTime($data['startDate']);
-                    $unlock->setEndTime($data['endDate']);
-                    $unlock->setUserId($data['account']);
-                    $unlock->save();
-                    $this->view->rangeForm = new rangeUnlockForm();
-                } else {
-                    $this->view->rangeForm = $rangeForm;
-                }
-            } else {
-                $this->view->rangeForm = $rangeForm;
-            }
-
-            $singleForm = new singleUnlockForm();
-            if ($singleForm->wasSubmitted()) {
-                $singleForm->addData($_POST);
-                if ($singleForm->validate()) {
-                    $data = $singleForm->exportFormData();
-                } else {
-                    $this->view->singleForm = $singleForm;
-                }
-            } else {
-                $this->view->singleForm = $singleForm;
-            }
 
 
             $year = date('Y');
             $year = date('Y');
             $month = date('m');
             $month = date('m');
@@ -105,6 +110,7 @@ class reportsController extends Staple_Controller
     {
     {
         $auth = Staple_Auth::get();
         $auth = Staple_Auth::get();
         $this->authLevel = $auth->getAuthLevel();
         $this->authLevel = $auth->getAuthLevel();
+
         if ($this->authLevel < 900)
         if ($this->authLevel < 900)
         {
         {
             header("location:" . $this->_link(array('index', 'index')) . "");
             header("location:" . $this->_link(array('index', 'index')) . "");
@@ -113,9 +119,12 @@ class reportsController extends Staple_Controller
         {
         {
             $unlock = new unlockModel();
             $unlock = new unlockModel();
 
 
-            if ($unlock->unlock($id)) {
+            if ($unlock->unlock($id))
+            {
                 $this->view->message = "<i class='fa fa-check'></i> Time entry unlocked.";
                 $this->view->message = "<i class='fa fa-check'></i> Time entry unlocked.";
-            } else {
+            }
+            else
+            {
                 $this->view->message = "<i class='fa fa-close'></i> ERROR: Unable to unlock your own time entries.";
                 $this->view->message = "<i class='fa fa-close'></i> ERROR: Unable to unlock your own time entries.";
             }
             }
         }
         }

+ 124 - 39
application/controllers/timesheetController.php

@@ -1,9 +1,16 @@
 <?php
 <?php
 class timesheetController extends Staple_Controller
 class timesheetController extends Staple_Controller
 {
 {
+    private $userId;
+    private $accountLevel;
+
     public function _start()
     public function _start()
     {
     {
-
+        $auth = Staple_Auth::get();
+        $user = new userModel();
+        $user->userInfo($auth->getAuthId());
+        $this->userId = $user->getId();
+        $this->accountLevel = $user->getAuthLevel();
     }
     }
 
 
     public function index($year = null, $month = null)
     public function index($year = null, $month = null)
@@ -215,39 +222,29 @@ class timesheetController extends Staple_Controller
                     //Date is within pay period
                     //Date is within pay period
                     if($userDate >= $startDate && $userDate <= $endDate)
                     if($userDate >= $startDate && $userDate <= $endDate)
                     {
                     {
-                        //Compare in Times and out Times.
-                        //if(strtotime($data['inTime']) < strtotime($data['outTime']))
-                        //{
-                            //Create a new entry object and set properties
-                            $entry = new timeEntryModel();
-                            $entry->setId($id);
-                            $entry->setDate($data['date']);
-                            $entry->setInTime($data['inTime']);
-                            $entry->setOutTime($data['outTime']);
-                            $entry->setLessTime($data['lessTime']);
-                            $entry->setCodeId($data['code']);
-
-                            //Save entry data to table.
-                            if($entry->save())
-                            {
-                                //Return a new time form with success message
-                                $form->successMessage = array("<i class=\"fa fa-check\"></i> Entry saved for ".$data['date']."");
-                                $this->view->form = $form;
-                            }
-                            else
-                            {
-                                //Return the same form with a warning message
-                                $message = "<i class=\"fa fa-warning\"></i> Cannot insert overlapping time entries. If you are updating an already existing entry, remove that entry and submit a new one.";
-                                $form->errorMessage = array($message);
-                                $this->view->form = $form;
-                            }
-                        //}
-                        //else
-                        //{
-                            //Return the same form with error message.
-                        //    $form->errorMessage = array("<i class='fa fa-warning'></i> <b>'Time In'</b> entry cannot be before <b>'Time Out'</b> entry.");
-                        //    $this->view->form = $form;
-                        //}
+                        //Create a new entry object and set properties
+                        $entry = new timeEntryModel();
+                        $entry->setId($id);
+                        $entry->setDate($data['date']);
+                        $entry->setInTime($data['inTime']);
+                        $entry->setOutTime($data['outTime']);
+                        $entry->setLessTime($data['lessTime']);
+                        $entry->setCodeId($data['code']);
+
+                        //Save entry data to table.
+                        if($entry->save())
+                        {
+                            //Return a new time form with success message
+                            $form->successMessage = array("<i class=\"fa fa-check\"></i> Entry saved for ".$data['date']."");
+                            $this->view->form = $form;
+                        }
+                        else
+                        {
+                            //Return the same form with a warning message
+                            $message = "<i class=\"fa fa-warning\"></i> Cannot insert overlapping time entries. If you are updating an already existing entry, remove that entry and submit a new one.";
+                            $form->errorMessage = array($message);
+                            $this->view->form = $form;
+                        }
                     }
                     }
                     else
                     else
                     {
                     {
@@ -305,13 +302,16 @@ class timesheetController extends Staple_Controller
         $user = new userModel($auth->getAuthId());
         $user = new userModel($auth->getAuthId());
         $batchId = $user->getBatchId();
         $batchId = $user->getBatchId();
 
 
-        //Check for unvalidated entries
+        //Check for unvalidated entries within the current pay period.
         $i = 0;
         $i = 0;
         foreach($timesheet->getEntries() as $entry)
         foreach($timesheet->getEntries() as $entry)
         {
         {
-            if($entry->batchId == $timesheet->getBatch())
+            if($entry->inTimeRaw >= $timesheet->getStartDateTimeString() && $entry->inTimeRaw <= $timesheet->getEndDateTimeString())
             {
             {
-                $i++;
+                if($entry->batchId == $timesheet->getBatch())
+                {
+                    $i++;
+                }
             }
             }
         }
         }
 
 
@@ -324,8 +324,11 @@ class timesheetController extends Staple_Controller
 
 
             if($form->wasSubmitted())
             if($form->wasSubmitted())
             {
             {
-                $timesheet->validate($batchId);
-                header("location:".$this->_link(array('timesheet'))."");
+                if($entry->inTimeRaw >= $timesheet->getStartDateTimeString() && $entry->inTimeRaw <= $timesheet->getEndDateTimeString())
+                {
+                    $timesheet->validate($batchId);
+                    header("location:" . $this->_link(array('timesheet')) . "");
+                }
             }
             }
             else
             else
             {
             {
@@ -340,5 +343,87 @@ class timesheetController extends Staple_Controller
         }
         }
 
 
     }
     }
+
+    public function unlocked()
+    {
+        $form = new unlockDatesForm();
+
+        if($form->wasSubmitted())
+        {
+            $form->addData($_POST);
+            if($form->validate())
+            {
+                $data = $form->exportFormData();
+                echo "<pre>";
+                print_r($data);
+                echo "</pre>";
+            }
+            else
+            {
+                $this->view->form = $form;
+            }
+        }
+        else
+        {
+            $this->view->form = $form;
+        }
+
+    }
+
+    public function admininsert()
+    {
+        if($this->accountLevel >= 900)
+        {
+            $form = new insertTimeForm();
+            $form->admin(1);
+
+            if($form->wasSubmitted())
+            {
+                $form->addData($_POST);
+                if($form->validate())
+                {
+                    $data = $form->exportFormData();
+
+                    //Create a new entry object and set properties
+                    $entry = new timeEntryModel();
+                    $entry->setDate($data['date']);
+                    $entry->setInTime($data['inTime']);
+                    $entry->setOutTime($data['outTime']);
+                    $entry->setLessTime($data['lessTime']);
+                    $entry->setCodeId($data['code']);
+                    $entry->setUserId($data['account']);
+
+                    //Save entry data to table.
+                    if($entry->adminSave())
+                    {
+                        //Return a new time form with success message
+                        $form = new insertTimeForm();
+                        $form->admin(1);
+                        $form->successMessage = array("<i class=\"fa fa-check\"></i> Entry saved for ".$data['date']."");
+                        $this->view->form = $form;
+                    }
+                    else
+                    {
+                        //Return the same form with a warning message
+                        $message = "<i class=\"fa fa-warning\"></i> Administrative action not allowed on your own timesheet.";
+                        $form->errorMessage = array($message);
+                        $this->view->form = $form;
+                    }
+                }
+                else
+                {
+                    $this->view->form = $form;
+                }
+            }
+            else
+            {
+                $this->view->form = $form;
+            }
+        }
+        else
+        {
+            header("location: ".$this->_link(array('index'))."");
+        }
+    }
 }
 }
 ?>
 ?>

+ 2 - 1
application/forms/changeYearForm.php

@@ -33,7 +33,8 @@ class changeYearForm extends Staple_Form
         $user = new userModel();
         $user = new userModel();
         $userId = $user->getId();
         $userId = $user->getId();
 
 
-        $sql = "SELECT YEAR(FROM_UNIXTIME(inTime)) AS 'year' FROM timeEntries WHERE userId = $userId GROUP BY year ORDER by year ASC";
+        //$sql = "SELECT YEAR(FROM_UNIXTIME(inTime)) AS 'year' FROM timeEntries WHERE userId = $userId GROUP BY year ORDER by year ASC";
+        $sql = "SELECT YEAR(FROM_UNIXTIME(inTime)) AS 'year' FROM timeEntries GROUP BY year ORDER by year ASC";
 
 
         if($db->query($sql)->num_rows > 0)
         if($db->query($sql)->num_rows > 0)
         {
         {

+ 102 - 0
application/forms/insertTimeForm.php

@@ -2,8 +2,48 @@
 
 
 class insertTimeForm extends Staple_Form
 class insertTimeForm extends Staple_Form
 {
 {
+    private $accountLevel;
+    private $adminAction;
+
+    /**
+     * @return mixed
+     */
+    public function getAdminAction()
+    {
+        return $this->adminAction;
+    }
+
+    /**
+     * @param mixed $adminAction
+     */
+    public function setAdminAction($adminAction)
+    {
+        $this->adminAction = $adminAction;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getAccountLevel()
+    {
+        return $this->accountLevel;
+    }
+
+    /**
+     * @param mixed $accountLevel
+     */
+    public function setAccountLevel($accountLevel)
+    {
+        $this->accountLevel = $accountLevel;
+    }
+
     public function _start()
     public function _start()
     {
     {
+        $auth = Staple_Auth::get();
+        $user = new userModel();
+        $user->userInfo($auth->getAuthId());
+        $this->accountLevel = $user->getAuthLevel();
+
         $this->setLayout('insertFormLayout');
         $this->setLayout('insertFormLayout');
 
 
         $this->setName('insertTimeForm')
         $this->setName('insertTimeForm')
@@ -42,6 +82,68 @@ class insertTimeForm extends Staple_Form
 
 
         $this->addField($date, $inTime, $outTime, $lessTime, $code, $submit);
         $this->addField($date, $inTime, $outTime, $lessTime, $code, $submit);
     }
     }
+
+    public function admin($key)
+    {
+        if($key == 1)
+        {
+            $this->setAdminAction(1);
+            if($this->accountLevel >= 900)
+            {
+                if($this->adminAction == 1)
+                {
+                    $this->setAction($this->link(array('timesheet','admininsert')));
+                    $this->setLayout('adminInsertFormLayout');
+                    $account = new Staple_Form_FoundationSelectElement('account','Account');
+
+                    $account->setRequired()
+                        ->addOption('','Select an account')
+                        ->addOptionsArray($this->accounts())
+                        ->addValidator(new Staple_Form_Validate_InArray($this->accounts(1)));
+                    $this->addField($account);
+                }
+            }
+        }
+        else
+        {
+            $this->setAdminAction(0);
+        }
+
+    }
+
+    public function accounts($ids = null)
+    {
+        $user = new userModel();
+        $id = $user->getId();
+        $authLevel = $user->getAuthLevel();
+
+        $accounts = new userModel();
+        $users = $accounts->listAll();
+        $data = array();
+        if($ids == null)
+        {
+            foreach($users as $user)
+            {
+                if($user['supervisorId'] == $id)
+                {
+                    $data[$user['id']] = $user['lastName'].", ".$user['firstName']." (". $user['type'] .")";
+                }
+                elseif($authLevel >= 900)
+                {
+                    $data[$user['id']] = $user['lastName'].", ".$user['firstName']." (". $user['type'] .")";
+                }
+            }
+        }
+        else
+        {
+            foreach($users as $user)
+            {
+                $data[] = $user['id'];
+            }
+        }
+
+        return $data;
+    }
 }
 }
 
 
 ?>
 ?>

+ 119 - 0
application/forms/layouts/adminInsertFormLayout.phtml

@@ -0,0 +1,119 @@
+<div class="section">
+    <div class="row">
+        <div class="small-12 columns text-center">
+            <h2>Admin Time Insert</h2>
+        </div>
+    </div>
+    <div id="entryForm">
+        <div class="row">
+            <?php
+            if(count($this->errorMessage) > 0)
+            {
+
+                echo "<div data-alert class=\"alert-box warning\">";
+                foreach($this->errorMessage as $message)
+                {
+                    echo $message;
+                }
+                echo "<a href=\"#\" class=\"close\">&times;</a></div>";
+
+            }
+
+            if(count($this->successMessage) > 0)
+            {
+
+                echo "<div data-alert class=\"alert-box success\">";
+                foreach($this->successMessage as $message)
+                {
+                    echo $message;
+                }
+                echo "<a href=\"#\" class=\"close\">&times;</a></div>";
+
+            }
+            ?>
+        </div>
+        <div class="row">
+            <div class="small-12 columns">
+                <div class="row">
+                   <?php
+                    echo $this->formstart();
+                   ?>
+                </div>
+                <div class="row">
+                    <div class="small-12 medium-12 columns">
+                        <?php echo $this->fields['account'] ?>
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="small-6 medium-4 columns">
+                        <?php echo $this->fields['date'] ?>
+                    </div>
+                    <div class="small-6 medium-4 columns">
+                        <?php echo $this->fields['inTime'] ?>
+                    </div>
+                    <div class="small-6 medium-4 columns">
+                        <?php echo $this->fields['outTime'] ?>
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="small-6 medium-4 columns">
+                        <?php echo $this->fields['lessTime'] ?>
+                    </div>
+                    <div class="small-6 medium-4 columns">
+                        <?php echo $this->fields['code'] ?>
+                    </div>
+                    <div class="small-6 medium-4 columns">
+                        <br>
+                        <?php echo $this->fields['submit'] ?>
+                    </div>
+                    <?php echo $this->formend(); ?>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+<script>
+    <?php
+    $date = new DateTime();
+
+    if($date->format('d') > 25)
+    {
+        $date->modify('+1 month');
+    }
+    $maxDate = $date->setDate($date->format('Y'),$date->format('m'),25)->format('m/d/Y');
+    $minDate = $date->modify('-1 month +1 day');
+    $minDate = $date->format('m/d/Y');
+    ?>
+
+    $(document).ready(function() {
+
+        $(function() {
+            $( "#date" ).datepicker({
+                numberOfMonths:2,
+                maxDate: "<?php echo $maxDate ?>",
+                showWeek: true,
+                showButtonPanel: true
+            });
+        });
+
+        $('#entryToggle').click(function()
+        {
+            if($('#entryForm').is(":visible"))
+            {
+                $('#entryToggleIcon').addClass('fa-chevron-circle-down');
+                $('#entryToggleIcon').removeClass('fa-chevron-circle-up');
+                $('#entryToggleText').html('Show');
+            }
+            else
+            {
+                $('#entryToggleIcon').addClass('fa-chevron-circle-up');
+                $('#entryToggleIcon').removeClass('fa-chevron-circle-down');
+                $('#entryToggleText').html('Hide')
+            }
+            $('#entryForm').slideToggle(400);
+        });
+
+
+    });
+</script>

+ 0 - 1
application/forms/layouts/insertFormLayout.phtml

@@ -82,7 +82,6 @@
     ?>
     ?>
 
 
     $(document).ready(function() {
     $(document).ready(function() {
-
         $(function() {
         $(function() {
             $( "#date" ).datepicker({
             $( "#date" ).datepicker({
                 numberOfMonths:2,
                 numberOfMonths:2,

+ 0 - 69
application/forms/rangeUnlockForm.php

@@ -1,69 +0,0 @@
-<?php
-
-class rangeUnlockForm extends Staple_Form
-{
-    public function _start()
-    {
-        //$this->setLayout('insertFormLayout');
-
-        $this->setName('rangeUnlockForm')
-            ->setAction($this->link(array('reports','unlock')));
-
-        $startDate = new Staple_Form_FoundationTextElement('startDate','Start Date');
-        $startDate->setRequired()
-            ->addValidator(new Staple_Form_Validate_Date())
-            ->addAttrib('placeholder','mm/dd/yyyy');
-
-        $endDate = new Staple_Form_FoundationTextElement('endDate','End Date');
-        $endDate->setRequired()
-            ->addValidator(new Staple_Form_Validate_Date())
-            ->addAttrib('placeholder','mm/dd/yyyy');
-
-        $account = new Staple_Form_FoundationSelectElement('account','Account');
-        $account->setRequired()
-            ->addOption('','Select an account')
-            ->addOptionsArray($this->accounts())
-            ->addValidator(new Staple_Form_Validate_InArray($this->accounts(1)));
-
-        $submit = new Staple_Form_FoundationSubmitElement('submit','Submit');
-        $submit->addClass('button expand radius');
-
-        $this->addField($account, $startDate, $endDate, $submit);
-    }
-
-    public function accounts($ids = null)
-    {
-        $user = new userModel();
-        $id = $user->getId();
-        $authLevel = $user->getAuthLevel();
-
-        $accounts = new userModel();
-        $users = $accounts->listAll();
-        $data = array();
-        if($ids == null)
-        {
-            foreach($users as $user)
-            {
-                if($user['supervisorId'] == $id)
-                {
-                    $data[$user['id']] = $user['lastName'].", ".$user['firstName']." (". $user['type'] .")";
-                }
-                elseif($authLevel >= 900)
-                {
-                    $data[$user['id']] = $user['lastName'].", ".$user['firstName']." (". $user['type'] .")";
-                }
-            }
-        }
-        else
-        {
-            foreach($users as $user)
-            {
-                $data[] = $user['id'];
-            }
-        }
-
-        return $data;
-    }
-}
-
-?>

+ 0 - 69
application/forms/singleUnlockForm.php

@@ -1,69 +0,0 @@
-<?php
-
-class singleUnlockForm extends Staple_Form
-{
-    public function _start()
-    {
-        //$this->setLayout('insertFormLayout');
-
-        $this->setName('singleUnlockForm')
-            ->setAction($this->link(array('reports','unlock')));
-
-        $startDate = new Staple_Form_FoundationTextElement('startDate','Start Date');
-        $startDate->setRequired()
-            ->addValidator(new Staple_Form_Validate_Date())
-            ->addAttrib('placeholder','mm/dd/yyyy');
-
-        $endDate = new Staple_Form_FoundationTextElement('endDate','End Date');
-        $endDate->setRequired()
-            ->addValidator(new Staple_Form_Validate_Date())
-            ->addAttrib('placeholder','mm/dd/yyyy');
-
-        $account = new Staple_Form_FoundationSelectElement('account','Account');
-        $account->setRequired()
-            ->addOption('','Select an account')
-            ->addOptionsArray($this->accounts())
-            ->addValidator(new Staple_Form_Validate_InArray($this->accounts(1)));
-
-        $submit = new Staple_Form_FoundationSubmitElement('submit','Submit');
-        $submit->addClass('button expand radius');
-
-        $this->addField($account, $startDate, $endDate, $submit);
-    }
-
-    public function accounts($ids = null)
-    {
-        $user = new userModel();
-        $id = $user->getId();
-        $authLevel = $user->getAuthLevel();
-
-        $accounts = new userModel();
-        $users = $accounts->listAll();
-        $data = array();
-        if($ids == null)
-        {
-            foreach($users as $user)
-            {
-                if($user['supervisorId'] == $id)
-                {
-                    $data[$user['id']] = $user['lastName'].", ".$user['firstName']." (". $user['type'] .")";
-                }
-                elseif($authLevel >= 900)
-                {
-                    $data[$user['id']] = $user['lastName'].", ".$user['firstName']." (". $user['type'] .")";
-                }
-            }
-        }
-        else
-        {
-            foreach($users as $user)
-            {
-                $data[] = $user['id'];
-            }
-        }
-
-        return $data;
-    }
-}
-
-?>

+ 2 - 1
application/layouts/main.phtml

@@ -64,8 +64,9 @@
                         {
                         {
                             echo "
                             echo "
                             <li><a href=\"".$this->link(array('accounts')) ."\"><i class=\"fa fa-users\"></i> Accounts</a></li>
                             <li><a href=\"".$this->link(array('accounts')) ."\"><i class=\"fa fa-users\"></i> Accounts</a></li>
-                            <li><a href=\"".$this->link(array('audit')) ."\" ><i class=\"fa fa-list-alt\" ></i > Audit Log</a ></li >
+                            <li><a href=\"".$this->link(array('audit')) ."\" ><i class=\"fa fa-list-alt\" ></i > Audit Log</a ></li>
                             <li><a href=\"".$this->link(array('reports','unlock'))."\"><i class=\"fa fa-unlock\"></i> Time Unlock</a></li>
                             <li><a href=\"".$this->link(array('reports','unlock'))."\"><i class=\"fa fa-unlock\"></i> Time Unlock</a></li>
+                            <li><a href=\"".$this->link(array('timesheet','admininsert'))."\" ><i class=\"fa fa-plus\" ></i > Admin Time Insert</a ></li>
                             ";
                             ";
                         }
                         }
                     ?>
                     ?>

+ 2 - 2
application/models/auditModel.php

@@ -142,13 +142,13 @@ class auditModel extends Staple_Model
         if($uid == null)
         if($uid == null)
         {
         {
             $sql = "
             $sql = "
-              SELECT * FROM audit ORDER BY timestamp ASC LIMIT ".$pager->getStartingItem().", ".$pager->getItemsPerPage()."
+              SELECT * FROM audit ORDER BY timestamp DESC LIMIT ".$pager->getStartingItem().", ".$pager->getItemsPerPage()."
             ";
             ";
         }
         }
         else
         else
         {
         {
             $sql = "
             $sql = "
-                SELECT * FROM audit WHERE userId = '".$this->db->real_escape_string($uid)."' ORDER BY timestamp ASC LIMIT ".$pager->getStartingItem().", ".$pager->getItemsPerPage()."
+                SELECT * FROM audit WHERE userId = '".$this->db->real_escape_string($uid)."' ORDER BY timestamp DESC LIMIT ".$pager->getStartingItem().", ".$pager->getItemsPerPage()."
             ";
             ";
         }
         }
 
 

+ 92 - 3
application/models/timeEntryModel.php

@@ -20,6 +20,7 @@
         private $codeName;
         private $codeName;
         private $timeWorked;
         private $timeWorked;
         private $batchId;
         private $batchId;
+        private $userId;
 
 
         /**
         /**
          * @return mixed
          * @return mixed
@@ -277,6 +278,22 @@
             $this->batchId = $batchId;
             $this->batchId = $batchId;
         }
         }
 
 
+        /**
+         * @return mixed
+         */
+        public function getUserId()
+        {
+            return $this->userId;
+        }
+
+        /**
+         * @param mixed $userId
+         */
+        public function setUserId($userId)
+        {
+            $this->userId = $userId;
+        }
+
 		function __construct($id = null)
 		function __construct($id = null)
 		{
 		{
             $this->db = Staple_DB::get();
             $this->db = Staple_DB::get();
@@ -353,6 +370,8 @@
                     $code->load($result['codeId']);
                     $code->load($result['codeId']);
                     $this->setCodeName($code->getName());
                     $this->setCodeName($code->getName());
 
 
+                    $this->setUserId($result['userId']);
+
                     return true;
                     return true;
                 }
                 }
             }
             }
@@ -366,16 +385,46 @@
                 $auth = Staple_Auth::get();
                 $auth = Staple_Auth::get();
                 $user = new userModel($auth->getAuthId());
                 $user = new userModel($auth->getAuthId());
                 $userId = $user->getId();
                 $userId = $user->getId();
+                $accountLevel = $user->getAuthLevel();
+
+                $entry = new timeEntryModel($id);
+                $fullDate = $entry->getFullDate();
+                $inTime = $entry->getInTime();
+                $outTime = $entry->getOutTime();
+                $effectedUserId = $entry->getUserId();
+
+                $effectedUser = new userModel();
+                $account = $effectedUser->userInfo($effectedUserId);
 
 
-                //Check if validated
-                if($this->validated($id))
+                //Check for admin account delete
+                if($accountLevel >= 900)
                 {
                 {
-                    $sql = "DELETE FROM timeEntries WHERE id = '".$this->db->real_escape_string($id)."' AND userId = '".$this->db->real_escape_string($userId)."'";
+                    $sql = "DELETE FROM timeEntries WHERE id = '".$this->db->real_escape_string($id)."' AND userId <> '".$this->db->real_escape_string($userId)."'";
+
                     if($this->db->query($sql))
                     if($this->db->query($sql))
                     {
                     {
+                        $audit = new auditModel();
+                        $audit->setUserId($account['id']);
+                        $audit->setAction('Admin Entry Remove');
+                        $audit->setItem($user->getUsername()." removed entry for ".$fullDate." In Time: ".$inTime." Out Time: ".$outTime."");
+                        $audit->save();
+
                         return true;
                         return true;
                     }
                     }
                 }
                 }
+                else
+                {
+                    //Check if validated
+                    if($this->validated($id))
+                    {
+                        $sql = "DELETE FROM timeEntries WHERE id = '".$this->db->real_escape_string($id)."' AND userId = '".$this->db->real_escape_string($userId)."'";
+
+                        if($this->db->query($sql))
+                        {
+                              return true;
+                        }
+                    }
+                }
             }
             }
         }
         }
 
 
@@ -589,5 +638,45 @@
             }
             }
 
 
         }
         }
+
+        function adminSave()
+        {
+            if(isset($this->userId))
+            {
+                //Check for current account.
+                $currentUser = new userModel();
+                if($this->userId != $currentUser->getId())
+                {
+                    $inTime = strtotime($this->getDate()." ".$this->getInTime());
+                    $outTime = strtotime($this->getDate()." ".$this->getOutTime());
+
+                    $sql = "
+                  INSERT INTO timeEntries
+                  (userId,inTime,outTime,lessTime,codeId,batchId)
+                  VALUES (
+                  '".$this->db->real_escape_string($this->userId)."',
+                  '".$this->db->real_escape_string($inTime)."',
+                  '".$this->db->real_escape_string($outTime)."',
+                  '".$this->db->real_escape_string($this->lessTime)."',
+                  '".$this->db->real_escape_string($this->codeId)."',
+                  '".$this->db->real_escape_string("ADMIN ADD")."'
+                  )
+                ";
+
+                    if($this->db->query($sql))
+                    {
+                        $user = new userModel();
+
+                        $audit = new auditModel();
+                        $audit->setUserId($this->userId);
+                        $audit->setAction('Admin Entry Add');
+                        $audit->setItem($user->getUsername()." added entry for ".$this->getDate().". In Time: ".$this->inTime."/Out Time: ".$this->outTime."");
+                        $audit->save();
+
+                        return true;
+                    }
+                }
+            }
+        }
 	}
 	}
 ?>
 ?>

+ 89 - 106
application/models/unlockModel.php

@@ -4,12 +4,11 @@ class unlockModel extends Staple_Model
 {
 {
     private $db;
     private $db;
     private $username;
     private $username;
+    private $errors;
 
 
     private $id;
     private $id;
-    private $startTime;
-    private $endTime;
+    private $date;
     private $userId;
     private $userId;
-    private $rangeDates;
 
 
     /**
     /**
      * @return mixed
      * @return mixed
@@ -30,39 +29,22 @@ class unlockModel extends Staple_Model
     /**
     /**
      * @return mixed
      * @return mixed
      */
      */
-    public function getStartTime()
+    public function getDate()
     {
     {
-        $date = new DateTime();
-        $date->setTimestamp($this->startTime);
-        $startTime = $date->format('m/d/Y');
-        return $startTime;
+        $d = new DateTime();
+        $d->setTimestamp($this->date);
+        return $d->format('Y-m-d');
     }
     }
 
 
     /**
     /**
-     * @param mixed $startTime
+     * @param mixed $date
      */
      */
-    public function setStartTime($startTime)
+    public function setDate($date)
     {
     {
-        $this->startTime = strtotime($startTime);
-    }
-
-    /**
-     * @return mixed
-     */
-    public function getEndTime()
-    {
-        $date = new DateTime();
-        $date->setTimestamp($this->endTime);
-        $endTime = $date->format('m/d/Y');
-        return $endTime;
-    }
-
-    /**
-     * @param mixed $endTime
-     */
-    public function setEndTime($endTime)
-    {
-        $this->endTime = strtotime($endTime);
+        $date = strtotime($date);
+        $d = new DateTime();
+        $d->setTimestamp($date);
+        $this->date = $d->format('U');
     }
     }
 
 
     /**
     /**
@@ -82,22 +64,23 @@ class unlockModel extends Staple_Model
     }
     }
 
 
     /**
     /**
-    * @return mixed
-    */
-    public function getRangeDates()
+     * @return mixed
+     */
+    public function getErrors()
     {
     {
-        return $this->rangeDates;
+        return $this->errors;
     }
     }
 
 
     /**
     /**
-     * @param mixed $rangeDates
+     * @param mixed $errors
      */
      */
-
-    public function setRangeDates($rangeDates)
+    public function setErrors($errors)
     {
     {
-        $this->rangeDates = $rangeDates;
+        $this->errors = $errors;
     }
     }
 
 
+
+
     function __construct()
     function __construct()
     {
     {
         $this->db = Staple_DB::get();
         $this->db = Staple_DB::get();
@@ -107,43 +90,92 @@ class unlockModel extends Staple_Model
 
 
     function load($uid)
     function load($uid)
     {
     {
-        $sql = "SELECT * type FROM overrideDates WHERE username = '".$this->db->real_escape_string($uid)."'";
+        $sql = "SELECT * FROM overrideDates WHERE userId = '".$this->db->real_escape_string($uid)."' ORDER BY date ASC";
 
 
         if($this->db->query($sql)->fetch_row() > 0)
         if($this->db->query($sql)->fetch_row() > 0)
         {
         {
             $query = $this->db->query($sql);
             $query = $this->db->query($sql);
-            $result = $query->fetch_assoc();
 
 
-            $this->setId($result['id']);
-            $this->setStartTime($result['startTime']);
-            $this->setEndTime($result['startTime']);
+            while($result = $query->fetch_assoc())
+            {
+                $data[] = $result;
+            }
+            return $data;
         }
         }
     }
     }
 
 
     function save()
     function save()
     {
     {
-        if(isset($this->startTime) && !isset($this->id))
+        if(isset($this->date) && !isset($this->id))
         {
         {
-            $sql = "
-                INSERT INTO overrideDates (startTime, endTime, userId) VALUES ('".$this->db->real_escape_string($this->startTime)."','".$this->db->real_escape_string($this->endTime)."','".$this->db->real_escape_string($this->userId)."')
-            ";
-
-            if($this->db->query($sql))
+            $user = new userModel();
+            if($this->getUserId() != $user->getId())
             {
             {
-                $audit = new auditModel();
-                $audit->setUserId($this->userId);
-                $audit->setAction('Range unlock');
-                $audit->setItem($this->username." unlocked dates from ".$this->getStartTime()." to ".$this->getEndTime());
-                $audit->save();
-
-                return True;
+                //Check if date is in the currect pay period.
+                $timesheet = new timesheetModel(date('Y'),date('m'));
+                if($this->date < $timesheet->getStartDateTimeString())
+                {
+                    //Check for existing date
+                    $sql = "SELECT id FROM overrideDates WHERE date = '".$this->db->real_escape_string($this->date)."' AND userId = '".$this->db->real_escape_string($this->userId)."'";
+                    if($this->db->query($sql)->num_rows == 0)
+                    {
+                        //Check for already existing time entry
+                        $sql = "SELECT FROM_UNIXTIME(inTime,'%Y-%m-%d') AS date FROM timeEntries WHERE userId = '".$this->db->real_escape_string($this->userId)."'";
+
+                        $query = $this->db->query($sql);
+                        $matchDates = 0;
+                        while($result = $query->fetch_assoc())
+                        {
+                            $date = new DateTime();
+                            $date->setTimestamp($this->date);
+                            $submitDate = $date->format('Y-m-d');
+                            if($result['date'] == $submitDate)
+                            {
+                                $matchDates++;
+                            }
+                        }
+
+                        if($matchDates == 0)
+                        {
+                            $sql = "
+                              INSERT INTO overrideDates (date, userId) VALUES ('".$this->db->real_escape_string($this->date)."','".$this->db->real_escape_string($this->userId)."')
+                            ";
+
+                            if($this->db->query($sql))
+                            {
+                                $audit = new auditModel();
+                                $audit->setUserId($this->userId);
+                                $audit->setAction('Date unlock');
+                                $audit->setItem($this->username." unlocked date ".$this->getDate());
+                                $audit->save();
+
+                                return True;
+                            }
+                        }
+                        else
+                        {
+                            $this->errors[] = 'Time entry already exists for this date.';
+                        }
+                    }
+                    else
+                    {
+                        $this->errors[] = 'Unlock already submitted for this date.';
+                    }
+                }
+                else
+                {
+                    $this->errors[]  = "Date cannot be part of the current pay period.";
+                }
+            }
+            else
+            {
+                $this->errors[] = "Cannot unlock time entires for your own timesheet.";
             }
             }
         }
         }
     }
     }
 
 
     function unlock($id)
     function unlock($id)
     {
     {
-       //get userid
         $sql = "
         $sql = "
             SELECT userId FROM timeEntries WHERE id = '".$this->db->real_escape_string($id)."';
             SELECT userId FROM timeEntries WHERE id = '".$this->db->real_escape_string($id)."';
         ";
         ";
@@ -181,55 +213,6 @@ class unlockModel extends Staple_Model
 
 
         }
         }
     }
     }
-
-    function rangeDates($uid)
-    {
-        $sql = "
-            SELECT * FROM overrideDates WHERE userId = '".$this->db->real_escape_string($uid)."'
-        ";
-
-        if($this->db->query($sql)->num_rows > 0)
-        {
-            $query = $this->db->query($sql);
-
-            $rangeDays = array();
-            $groups = array();
-            $i=0;
-            while($result = $query->fetch_assoc())
-            {
-                $date = new DateTime();
-                $date->setTimestamp($result['startTime']);
-
-                $date2 = new DateTime();
-                $date2->setTimestamp($result['endTime']);
-
-                $interval = $date->diff($date2);
-                $days = $interval->days;
-                $groups[$i]['days'] = $days;
-                $groups[$i]['startTime'] = $result['startTime'];
-                $groups[$i]['endTime'] = $result['endTime'];
-                $i++;
-            }
-
-            $total=0;
-            foreach($groups as $group)
-            {
-                $total += $group['days'];
-            }
-
-            foreach($groups as $group)
-            {
-                for($i=1;$i<=$total;$i++)
-                {
-                    $rangeDays[$i]['startTime'] = $group['startTime'] + (86400 * $i);
-                    $rangeDays[$i]['endTime'] = $group['startTime'] + (86400 * $i) + 86400;
-                    $rangeDays[$i]['formattedStart'] = date('Y-m-d D', $group['startTime'] + (86400 * $i));
-                    $rangeDays[$i]['formattedEnd'] = date('Y-m-d D', $group['startTime'] + (86400 * $i) + 86400);
-                }
-            }
-            return $rangeDays;
-        }
-    }
 }
 }
 
 
 ?>
 ?>

+ 1 - 0
application/models/userModel.php

@@ -195,6 +195,7 @@
 
 
 		function listAll()
 		function listAll()
 		{
 		{
+			$userId = $this->id;
 			$sql = "SELECT id, username, firstName, lastName, authLevel, batchId, supervisorId, type FROM accounts ORDER BY type DESC, lastName ASC, firstName ASC";
 			$sql = "SELECT id, username, firstName, lastName, authLevel, batchId, supervisorId, type FROM accounts ORDER BY type DESC, lastName ASC, firstName ASC";
 			if($this->db->query($sql)->num_rows > 0)
 			if($this->db->query($sql)->num_rows > 0)
 			{
 			{

+ 13 - 3
application/views/index/index.phtml

@@ -27,10 +27,20 @@
                 <div class='small-12 columns text-center'>
                 <div class='small-12 columns text-center'>
                     <h2>".$this->week['total']."</h2>
                     <h2>".$this->week['total']."</h2>
                 </div>
                 </div>
-            </div>
-        ";
+                ";
+
+                if($this->unlockedTimes > 0)
+                {
+                    echo "
+                        <div class='row'>
+                            <div class='small-12 column text-center'>
+                                <a class='button radius success' href=\"".$this->link(array('timesheet','unlocked'))."\"><i class='fa fa-calendar'></i> Submit time for previous pay period</a>
+                            </div>
+                        </div>
+                    ";
+                }
+        echo "</div></div>";
 
 
-        echo "</div>";
         echo "<div class='section'>";
         echo "<div class='section'>";
 
 
         if($this->timesheet->totals['Total Time'] > 0)
         if($this->timesheet->totals['Total Time'] > 0)

+ 18 - 4
application/views/reports/index.phtml

@@ -5,16 +5,20 @@
         </div>
         </div>
     </div>
     </div>
     <div class="row">
     <div class="row">
-        <div class="small-6 columns">
+        <div class="small-4 columns">
             <ul class="button-group radius left">
             <ul class="button-group radius left">
                 <li><a class="button small" href="<?php echo $this->link(array('reports','weekly')) ?>"><i class="fa fa-file"></i> Week Report</a></li>
                 <li><a class="button small" href="<?php echo $this->link(array('reports','weekly')) ?>"><i class="fa fa-file"></i> Week Report</a></li>
             </ul>
             </ul>
         </div>
         </div>
-        <div class="small-6 columns">
-            <ul class="button-group radius right">
+        <div class="small-8 columns">
+            <ul class="button-group round right">
+                <li><a class="button small secondary" href="<?php echo $this->link(array('reports',$this->year, $this->previousMonth))?> "><i class="fa fa-caret-left"></i> Previous</a></li>
+                <li><a class="button small secondary" href="<?php echo $this->link(array('reports',$this->year, $this->nextMonth))?> ">Next <i class="fa fa-caret-right"></i></a></li>
+                <li><a class="button small secondary" data-reveal-id="yearForm" href="#"><i class="fa fa-calendar"></i> Change Year</a></li>
                 <li><a id="showAll" class="button small secondary" href="#"><i class="fa fa-eye"></i> Show All</a></li>
                 <li><a id="showAll" class="button small secondary" href="#"><i class="fa fa-eye"></i> Show All</a></li>
                 <li><a id="hideAll" class="button small secondary" href="#"><i class="fa fa-eye-slash"></i> Hide All</a></li>
                 <li><a id="hideAll" class="button small secondary" href="#"><i class="fa fa-eye-slash"></i> Hide All</a></li>
             </ul>
             </ul>
+
         </div>
         </div>
     </div>
     </div>
     <div class="row">
     <div class="row">
@@ -51,7 +55,7 @@
                 $totalVacation = 0;
                 $totalVacation = 0;
                 $totalSick = 0;
                 $totalSick = 0;
 
 
-                foreach($timesheet as $entry)
+                foreach($timesheet as $key=>$entry)
                 {
                 {
                     echo "
                     echo "
                         <tr>
                         <tr>
@@ -71,6 +75,11 @@
                         echo "<i class=\"fa fa-close red\"></i>";
                         echo "<i class=\"fa fa-close red\"></i>";
                     }
                     }
 
 
+                    if($this->accountLevel >= 900)
+                    {
+                        echo " | <a href=\"".$this->link(array('timesheet','remove',$key))."\"><i class=\"fa fa-trash\"></i></a>";
+                    }
+
                     echo "</td>
                     echo "</td>
                         </tr>
                         </tr>
                     ";
                     ";
@@ -140,6 +149,11 @@
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>
+<div id="yearForm" class="reveal-modal small" data-reveal aria-labelledby="Change Year" aria-hidden="true" role="dialog">
+    <h2 id="modalTitle">Select a Year</h2>
+    <?php echo $this->yearForm ?>
+    <a class="close-reveal-modal" aria-label="Close">&#215;</a>
+</div>
 
 
 <script>
 <script>
     $(function() {
     $(function() {

+ 54 - 90
application/views/reports/unlock.phtml

@@ -1,115 +1,79 @@
 <div class="section">
 <div class="section">
     <div class="row">
     <div class="row">
         <div class="small-12 columns">
         <div class="small-12 columns">
-            <h1><i class="fa fa-unlock"></i> Time Unlock</h1>
+            <h2><i class="fa fa-unlock"></i> Time Unlock</h2>
         </div>
         </div>
     </div>
     </div>
     <div class="row">
     <div class="row">
         <div class="small-12 columns">
         <div class="small-12 columns">
-            <ul class="tabs" data-tab>
-                <li class="tab-title active"><a href="#panel1"><i class="fa fa-square"></i> Single Unlock</a></li>
-                <li class="tab-title"><a href="#panel2"><i class="fa fa-th"></i> Range Unlock</a></li>
-            </ul>
-            <div class="tabs-content">
-                <div class="content active" id="panel1">
-                    <div class="small-12 columns">
-                        <p>Unlocks a single validated time entry.</p>
-                        <p>This is useful in a situation when an employee has accidentally validated a time entry and it is inaccurate.</p>
-                        <hr>
-                    </div>
-                    <div class="small-12 columns">
-                        <?php
-                            if(count($this->accounts->timesheets) > 0)
+            <hr>
+            <h3>Current Pay Period Entry Unlock</h3>
+            <?php
+                if(count($this->accounts->timesheets) > 0)
+                {
+                    foreach($this->accounts->timesheets as $account=>$timesheet)
+                    {
+                        if(count($timesheet) > 0)
+                        {
+                            $validatedTotal = 0;
+                            foreach($timesheet as $entry)
                             {
                             {
-                                foreach($this->accounts->timesheets as $account=>$timesheet)
+                                if($entry['validated'] == 1)
                                 {
                                 {
-                                    if(count($timesheet) > 0)
-                                    {
-                                        $validatedTotal = 0;
-                                        foreach($timesheet as $entry)
-                                        {
-                                            if($entry['validated'] == 1)
-                                            {
-                                                $validatedTotal++;
-                                            }
-                                        }
+                                    $validatedTotal++;
+                                }
+                            }
 
 
-                                        echo "<h3 class='timeTitle'>$account <i class='fa fa-chevron-down right'></i></h3>";
-                                        echo "<div class='wrapper hide'>";
-                                        if($validatedTotal > 0)
-                                        {
-                                            echo "
-                                                <table width='100%'>
-                                                    <tr>
-                                                           <th>Date</th>
-                                                           <th>Start Time</th>
-                                                           <th>End Time</th>
-                                                           <th>Code</th>
-                                                           <th>Action</th>
-                                                    </tr>
-                                            ";
+                            echo "<h4 class='timeTitle'>$account <i class='fa fa-chevron-down right'></i></h4>";
+                            echo "<div class='wrapper hide'>";
+                            if($validatedTotal > 0)
+                            {
+                                echo "
+                                    <table width='100%'>
+                                        <tr>
+                                               <th>Date</th>
+                                               <th>Start Time</th>
+                                               <th>End Time</th>
+                                               <th>Code</th>
+                                               <th>Action</th>
+                                        </tr>
+                                ";
 
 
-                                            foreach($timesheet as $id=>$entry)
-                                            {
-                                                if($entry['validated'] == 1)
-                                                {
-                                                    echo "
-                                                    <tr>
-                                                        <td>".$entry['date']."</td>
-                                                        <td>".date("g:i A",$entry['inTime'])."</td>
-                                                        <td>".date("g:i A",$entry['outTime'])."</td>
-                                                        <td>".$entry['code']."</td>
-                                                        <td><a href=\"".$this->link(array('reports','unlockid',$id))."\"><i class='fa fa-unlock-alt'></i> Unlock</td>
-                                                    </tr>
-                                                    ";
-                                                }
-                                            }
-                                        }
-                                        else
-                                        {
-                                            echo "<div class='text-center'>No validated time submitted for this pay period.</div>";
-                                        }
-                                        echo "</table></div> <!-- end wrapper -->";
+                                foreach($timesheet as $id=>$entry)
+                                {
+                                    if($entry['validated'] == 1)
+                                    {
+                                        echo "
+                                        <tr>
+                                            <td>".$entry['date']."</td>
+                                            <td>".date("g:i A",$entry['inTime'])."</td>
+                                            <td>".date("g:i A",$entry['outTime'])."</td>
+                                            <td>".$entry['code']."</td>
+                                            <td><a href=\"".$this->link(array('reports','unlockid',$id))."\"><i class='fa fa-unlock-alt'></i> Unlock</td>
+                                        </tr>
+                                        ";
                                     }
                                     }
                                 }
                                 }
                             }
                             }
-                        ?>
-                    </div>
-                </div>
-                <div class="content" id="panel2">
-                    <div class="small-12 medium-6 columns">
-                        <p>Unlocks a range of dates for a user to submit new time entries.</p>
-                        <p>This is useful in a situation when an employee needs to have previous pay period dates unlocked for submission.</p>
-                        <p>
-                            <b>Note:</b> This <b>will not</b> unlock validated time entries.
-                        </p>
-                    </div>
-                    <div class="small-12 medium-6 columns">
-                        <?php echo $this->rangeForm ?>
-                    </div>
-                </div>
-            </div>
+                            else
+                            {
+                                echo "<div class='text-center'>No validated time submitted for this pay period.</div>";
+                            }
+                            echo "</table></div> <!-- end wrapper -->";
+                        }
+                    }
+                }
+            ?>
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>
 
 
 <script>
 <script>
     $(function() {
     $(function() {
-        $( "#startDate" ).datepicker({
-            numberOfMonths: 2,
-            showWeek: true,
-            showButtonPanel: true,
-            onClose: function( selectedDate ) {
-                $( "#endDate" ).datepicker( "option", "minDate", selectedDate );
-            }
-        });
-        $( "#endDate" ).datepicker({
+        $( "#date" ).datepicker({
             numberOfMonths: 2,
             numberOfMonths: 2,
             showWeek: true,
             showWeek: true,
-            showButtonPanel: true,
-            onClose: function( selectedDate ) {
-                $( "#startDate" ).datepicker( "option", "maxDate", selectedDate );
-            }
+            showButtonPanel: true
         });
         });
 
 
         $(".timeTitle").click(function() {
         $(".timeTitle").click(function() {

+ 1 - 0
application/views/timesheet/admininsert.phtml

@@ -0,0 +1 @@
+<?php echo $this->form ?>

+ 12 - 0
application/views/timesheet/unlocked.phtml

@@ -0,0 +1,12 @@
+<div class="section">
+    <div class="row">
+        <div class="small-12">
+            <h2>Previous Timesheet Entries</h2>
+        </div>
+    </div>
+    <div class="row">
+        <div class="small-12">
+            <?php echo $this->form ?>
+        </div>
+    </div>
+</div>