瀏覽代碼

Started working on a time entry override system that will allow users to request current pay period validated entries to be unlocked. An administrator can also unlock previous pay period entries based on a span of time.

Adam Day 9 年之前
父節點
當前提交
46d5bf9819

+ 3 - 1
application/controllers/reportsController.php

@@ -58,8 +58,10 @@ class reportsController extends Staple_Controller
         {
             $this->view->form = $form;
         }
+    }
 
-
+    public function unlock()
+    {
 
     }
 }

+ 100 - 0
application/models/unlockModel.php

@@ -0,0 +1,100 @@
+<?php
+
+class unlockModel extends Staple_Model
+{
+    private $db;
+    private $username;
+
+    private $id;
+    private $startTime;
+    private $endTime;
+    private $userId;
+
+    /**
+     * @return mixed
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    /**
+     * @param mixed $id
+     */
+    public function setId($id)
+    {
+        $this->id = $id;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getStartTime()
+    {
+        return $this->startTime;
+    }
+
+    /**
+     * @param mixed $startTime
+     */
+    public function setStartTime($startTime)
+    {
+        $this->startTime = $startTime;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getEndTime()
+    {
+        return $this->endTime;
+    }
+
+    /**
+     * @param mixed $endTime
+     */
+    public function setEndTime($endTime)
+    {
+        $this->endTime = $endTime;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getUserId()
+    {
+        return $this->userId;
+    }
+
+    /**
+     * @param mixed $userId
+     */
+    public function setUserId($userId)
+    {
+        $this->userId = $userId;
+    }
+
+    function __construct()
+    {
+        $this->db = Staple_DB::get();
+        $auth = Staple_Auth::get();
+        $this->username = $auth->getAuthId();
+    }
+
+    function load($uid)
+    {
+        $sql = "SELECT * type FROM overrideDates WHERE username = '".$this->db->real_escape_string($uid)."'";
+
+        if($this->db->query($sql)->fetch_row() > 0)
+        {
+            $query = $this->db->query($sql);
+            $result = $query->fetch_assoc();
+
+            $this->setId($result['id']);
+            $this->setStartTime($result['startTime']);
+            $this->setEndTime($result['startTime']);
+        }
+    }
+}
+
+?>

+ 13 - 8
application/views/reports/weekly.phtml

@@ -15,6 +15,17 @@
                     echo "
                         <div class='row'>
                             <div class='small-6 columns'>
+
+                            </div>
+                            <div class='small-6 columns'>
+                                <a class='button secondary radius right' href='".$this->link(array('reports','weekly'))."'>Back</a>
+                            </div>
+                        </div>
+
+                    <table width=\"100%\">
+                        <thead>
+                        <tr>
+                            <th colspan='2' class='text-center'>
                                 <h3>".$this->account['firstName']." ".$this->account['lastName']." (";
 
                                     if($this->account['type'] == "part")
@@ -27,14 +38,8 @@
                                     }
 
                                 echo")</h3>
-                            </div>
-                            <div class='small-6 columns'>
-                                <a class='button secondary radius right' href='".$this->link(array('reports','weekly'))."'>Back</a>
-                            </div>
-                        </div>
-
-                    <table width=\"100%\">
-                        <thead>
+                            </th>
+                        </tr>
                         <tr>
                             <th width='50%'>Week</th>
                             <th width='50%'>Hours Worked</th>