user.php (1154B)
1 <?php 2 /* 3 * location: catalog/model/extension/d_opencart_patch/user.php 4 * 5 */ 6 7 class ModelExtensionDOpencartPatchUser extends Model { 8 9 public function __construct($registry) { 10 parent::__construct($registry); 11 if(!isset($this->user)){ 12 $this->registry->set('user', new Cart\User($registry)); 13 } 14 15 } 16 17 public function isLogged(){ 18 return $this->user->isLogged(); 19 } 20 21 public function getId(){ 22 return $this->user->getId(); 23 } 24 25 public function getUserName(){ 26 return $this->user->getUserName(); 27 } 28 29 public function logout(){ 30 return $this->user->logout(); 31 } 32 33 public function hasPermission($key, $value) { 34 return $this->user->hasPermission($key, $value); 35 } 36 37 public function getGroupId(){ 38 if(VERSION == '2.0.0.0'){ 39 $user_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '" . $this->user->getId() . "'"); 40 $user_group_id = (int)$user_query->row['user_group_id']; 41 }else{ 42 $user_group_id = $this->user->getGroupId(); 43 } 44 45 return $user_group_id; 46 } 47 }