User.class.php 1.39 KB
<?php

class User extends Model
{

   // ===========
    // = Statics =
    // ===========
    protected static $table_name = 'MJ_USER';

    // load all users from Db
    public static function getList()
    {
        $stm = parent::exec('USER_LIST');
        return $stm->fetchAll();
    }
    public static function getRow($id)
    {
        $stm = parent::exec('USER_GET_WITH_ID', ['id' => $id]);
        return $stm->fetchAll();
    }

    public static function updateUser($array)
    {
        $stm = parent::exec('USER_UPDATE', $array);
    }

    public static function tryLogin($login)
    {
        $stm = parent::exec('USER_GET_WITH_LOGIN', ['login' => $login]);
        return $stm->fetch();
    }
    public function id()
    {
        return trim($this->ID_USER);
    }
    public function role()
    {
        return trim($this->ID_ROLE);
    }
    public function password()
    {
        return trim($this->PASWORD);
    }
    public function avatar()
    {
        return trim($this->AVATAR);
    }
    public function lastname()
    {
        return trim($this->LASTNAME);
    }
    public function firstname()
    {
        return trim($this->FIRSTNAME);
    }
    public function email()
    {
        return trim($this->MAIL);
    }
    public function isBanned()
    {
        return trim($this->BAN_ACCOUNT);
    }
    public function lastIP()
    {
        return trim($this->LAST_IP);
    }
}