/**
  * @return string
  * regresa "Administrador", "Docente", "Alumno" o NULL según las credenciales por Basic Auth
  */
 public static function tipoUsuario()
 {
     if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
         $query = "SELECT tipoUsuarioID FROM usuarios WHERE username = '******'PHP_AUTH_USER']}' AND password = '******'PHP_AUTH_PW']}'";
         $res = APIDatabase::select($query);
         return $res[0]['tipoUsuarioID'];
     }
     return FALSE;
 }
 public static function getPersonaPorCredenciales($username, $password)
 {
     $query = "SELECT * FROM usuarios WHERE username = '******' AND password = '******' LIMIT 1";
     $res = APIDatabase::select($query);
     switch ($res[0]['tipoUsuarioID']) {
         case "3":
             return new ProveedorModelo($res[0]['usuarioID']);
             break;
         default:
             return new self($res[0]['usuarioID']);
             break;
     }
 }
 public static function agregar($uniforme, $usuarioID)
 {
     extract($uniforme);
     $uniforme = new UniformeModelo($uniformeID);
     if ($uniforme->stock >= $cantidad) {
         $query = "INSERT INTO ventas SET uniformeID = {$uniformeID}, cantidad = {$cantidad}, montoUnitario = {$montoUnitario}, cajeroID = {$usuarioID}";
         $ventaID = APIDatabase::insert($query);
         if ($ventaID != 0) {
             $uniforme->ajustarStock(-$cantidad);
             return $ventaID;
         } else {
             return 501;
         }
     } else {
         return "Out of Stock";
     }
 }
 public static function getLista()
 {
     $query = "SELECT * FROM usuarios WHERE tipoUsuarioID = 3";
     return APIDatabase::select($query);
 }
 public static function agregar($uniforme)
 {
     extract($uniforme);
     $query = "INSERT INTO uniformes SET descripcion = '{$descripcion}', talla = '{$talla}',\n          stock = {$stock}, costo = {$costo}, precio = {$precio}, referencia = '{$referencia}', codigoBarra = '{$codigoBarra}', proveedorID = {$proveedorID}";
     return APIDatabase::insert($query);
 }