コード例 #1
0
 /**
  * Authenticates a user.
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     if ($this->user_type == 1 || $this->user_type == 2) {
         $criteria = new CDbCriteria();
         $criteria->condition = 'LOWER(mid)=' . strtolower($this->username) . ' AND management_user_level_id=' . $this->user_type;
         $user = Management::model()->find($criteria);
     } else {
         if ($this->user_type == 4) {
             $user = Doctor::model()->find('LOWER(did)=?', array(strtolower($this->username)));
         } else {
             if ($this->user_type == 3) {
                 $user = Patient::model()->find('LOWER(pid)=?', array(strtolower($this->username)));
             } else {
                 $user = Nurses::model()->find('LOWER(nid)=?', array(strtolower($this->username)));
             }
         }
     }
     if ($user === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         if (!($user->pass == $this->password)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             if ($this->user_type == 1 || $this->user_type == 2) {
                 $this->_id = $user->mid;
                 $this->username = $user->mid;
             } else {
                 if ($this->user_type == 4) {
                     $this->_id = $user->did;
                     $this->username = $user->did;
                 } else {
                     if ($this->user_type == 3) {
                         $this->_id = $user->pid;
                         $this->username = $user->pid;
                     } else {
                         $this->_id = $user->nid;
                         $this->username = $user->nid;
                     }
                 }
             }
             $this->_type = $this->user_type;
             $this->errorCode = self::ERROR_NONE;
             $this->setState("type", $this->_type);
         }
     }
     return $this->errorCode == self::ERROR_NONE;
 }
コード例 #2
0
    echo "<tr><td>{$row['employee_id']}</td><td>{$row['first_name']}</td><td>{$row['last_name']}</td>";
    echo "<td>{$row['contact']}</td></tr>";
    $row = $objnurse->fetch();
}
echo "</table></center>";
?>

<!-- A form to take in the id of nurse that will be deleted-->
<center><form action="nurseFunction.php" method="GET">
<p><i><b>Delete a nurse</b></i></p>
	<div>Employee id:<input type="Text" name="id" size="30"></div>
	<div><input type="Submit" value="Delete"></div>
</form></center>

				<?php 
/**
 *implementation of the delete nurse function
 **/
if (isset($_REQUEST['id'])) {
    include_once "nurses.php";
    $obj_nurse = new Nurses();
    $theId = $_REQUEST['id'];
    if (!$obj_nurse->deleteNurse($theId)) {
        echo "The nurse was not deleted";
    } else {
        echo "A nurse was deleted successfully";
    }
}
?>
	</body>
</html>
コード例 #3
0
					</li>
				</ul>
			    </section>
					</ul>
				
			</header>
	    </div>
	    <div id="table_overlay"></div>
		<div id="table_overlay_div">
		<div class="close-button">X</div>
	    <?php 
/**
 *function to add and view administrator
 */
include_once "nurses.php";
$objnurse = new Nurses();
$objnurse->viewAllNurses();
if (!($row = $objnurse->fetch())) {
    echo "There are no nurses currently";
}
/**
 *Setting a table to contain the contents of tasks objects
 */
echo "<center><table border='1'>";
echo "<tr><td>Employee_id</td><td>First Name</td><td>Last Name</td><td>Department</td>\n\t          <td>Contact</td></tr>";
while ($row) {
    echo "<tr><td>{$row['employee_id']}</td><td>{$row['first_name']}</td><td>{$row['last_name']}</td>";
    echo "<td>{$row['contact']}</td></tr>";
    $row = $objnurse->fetch();
}
echo "</table></center>";
コード例 #4
0
 public function actionViewNurse()
 {
     $this->authenUser();
     $nurseId;
     $nurseData;
     if (isset($_REQUEST['nurseId'])) {
         $nurseId = $_REQUEST['nurseId'];
         if (!is_numeric($nurseId)) {
             $this->redirect($statusCode = 404);
         } else {
             $nurseData = Nurses::model()->find('nid=?', array($nurseId));
             if ($nurseData == null) {
                 $this->redirect($statusCode = 404);
             }
             // invalid request redirected to 404 not found page
         }
     }
     $this->render('viewNurse', array('nurseProfile' => $nurseData));
 }
コード例 #5
0
 public function actionViewProfile()
 {
     $this->authenUser();
     $nurseProfile = Nurses::model()->find('nid=?', array($this->userId));
     $this->render('viewProfile', array('nurseProfile' => $nurseProfile));
 }