123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <?php
- class userModel extends Staple_Model
- {
- private $db;
- private $id;
- private $username;
- private $firstName;
- private $lastName;
- private $accountType;
- private $batchId;
- /**
- * @return mixed
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * @param mixed $id
- */
- public function setId($id)
- {
- $this->id = $id;
- }
- /**
- * @return mixed
- */
- public function getUsername()
- {
- return $this->username;
- }
- /**
- * @param mixed $username
- */
- public function setUsername($username)
- {
- $this->username = $username;
- }
- /**
- * @return mixed
- */
- public function getFirstName()
- {
- return $this->firstName;
- }
- /**
- * @param mixed $firstName
- */
- public function setFirstName($firstName)
- {
- $this->firstName = $firstName;
- }
- /**
- * @return mixed
- */
- public function getLastName()
- {
- return $this->lastName;
- }
- /**
- * @param mixed $lastName
- */
- public function setLastName($lastName)
- {
- $this->lastName = $lastName;
- }
- /**
- * @return mixed
- */
- public function getAccountType()
- {
- return $this->accountType;
- }
- /**
- * @param mixed $accountType
- */
- public function setAccountType($accountType)
- {
- $this->accountType = $accountType;
- }
- /**
- * @return mixed
- */
- public function getBatchId()
- {
- return $this->batchId;
- }
- /**
- * @param mixed $batchId
- */
- public function setBatchId($batchId)
- {
- $this->batchId = $batchId;
- }
- function __construct()
- {
- $this->db = Staple_DB::get();
- $auth = Staple_Auth::get();
- $username = $auth->getAuthId();
- $sql = "SELECT id, username, firstName, lastName, accountType, batchId FROM accounts WHERE username = '".$this->db->real_escape_string($username)."'";
- if($this->db->query($sql)->fetch_row() > 0)
- {
- $query = $this->db->query($sql);
- $result = $query->fetch_assoc();
- $this->setid($result['id']);
- $this->setUsername($result['username']);
- $this->setFirstName($result['firstName']);
- $this->setLastName($result['lastName']);
- $this->setAccountType($result['accountType']);
- $this->setBatchId($result['batchId']);
- }
- else
- {
- return false;
- }
- }
- }
- ?>
|