private function getDao($db_hostname, $db_username, $db_pass, $db_name) { if (is_null(self::$instance)) { self::$instance = new DaoPedidos($db_hostname, $db_username, $db_pass, $db_name); } return self::$instance; }
public function get($user = "") { if ($user != "") { $res = DaoPedidos::getDb()->getResultsFromQuery("SELECT id,nombre,usuario,password, null email FROM [SAVX].[dbo].[Usuario] WHERE borrado = 'N' AND usuario = '{$user}'"); foreach ($res as $user) { $this->id = $user['id']; $this->name = $user['nombre']; $this->user_name = $user['usuario']; $this->password = $user['password']; $this->email = $user['email']; } if ($this->id != "") { $res = DaoPedidos::getDb()->getResultsFromQuery("select top 1 id,nombre from UsuarioXRol ur inner join Rol r on ur.rol_id = r.id where ur.usuario_id = {$this->id}"); foreach ($res as $rol) { $this->rol = $rol; } } } }