Browse code

Externalisation du systeme de menu

schardon authored on 27/04/2020 23:19:23
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,32 +0,0 @@
1
-<?php
2
-
3
-class Database {
4
-  private $_dbfile;
5
-  private $_dbcnx;
6
-
7
-  public function __construct($dbfile) {
8
-    $this->_dbfile = $dbfile;
9
-    $this->_dbcnx = false;
10
-    while(!$this->_dbcnx) {
11
-      $this->_dbcnx = new SQLite3($this->_dbfile);
12
-      $this->_dbcnx->busyTimeout(5000);
13
-    }
14
-  }
15
-
16
-  public function req($req) {
17
-    return $this->_dbcnx->query($req);
18
-  }
19
-
20
-  public function next($dbreq) {
21
-    return $dbreq->fetchArray();
22
-  }
23
-
24
-  public function reqFirst($req) {
25
-    return $this->next( $this->req( $req ) );
26
-  }
27
-}
28
-
29
-if(!isset($racine)) $racine='.';
30
-$db = new Database($racine.'/karuba.sqlite');
31
-
32
-?>
Browse code

Version complete a tester

schardon authored on 26/04/2020 11:25:16
Showing 1 changed files
... ...
@@ -6,7 +6,11 @@ class Database {
6 6
 
7 7
   public function __construct($dbfile) {
8 8
     $this->_dbfile = $dbfile;
9
-    $this->_dbcnx = new SQLite3($this->_dbfile);
9
+    $this->_dbcnx = false;
10
+    while(!$this->_dbcnx) {
11
+      $this->_dbcnx = new SQLite3($this->_dbfile);
12
+      $this->_dbcnx->busyTimeout(5000);
13
+    }
10 14
   }
11 15
 
12 16
   public function req($req) {
Browse code

Gestion du choix de la partie et du joueur

schardon authored on 22/04/2020 21:35:22
Showing 1 changed files
... ...
@@ -2,13 +2,15 @@
2 2
 
3 3
 class Database {
4 4
   private $_dbfile;
5
+  private $_dbcnx;
5 6
 
6 7
   public function __construct($dbfile) {
7
-    $this->$dbfile = $_dbfile;
8
+    $this->_dbfile = $dbfile;
9
+    $this->_dbcnx = new SQLite3($this->_dbfile);
8 10
   }
9 11
 
10 12
   public function req($req) {
11
-    return $this->$_dbfile->query($req);
13
+    return $this->_dbcnx->query($req);
12 14
   }
13 15
 
14 16
   public function next($dbreq) {
... ...
@@ -16,10 +18,11 @@ class Database {
16 18
   }
17 19
 
18 20
   public function reqFirst($req) {
19
-    $this->next( $this->req( $req ) );
21
+    return $this->next( $this->req( $req ) );
20 22
   }
21 23
 }
22 24
 
23
-$db = new Database('karuba.sqlite');
25
+if(!isset($racine)) $racine='.';
26
+$db = new Database($racine.'/karuba.sqlite');
24 27
 
25 28
 ?>
Browse code

Initialisation du projet

schardon authored on 21/04/2020 17:15:53
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,25 @@
1
+<?php
2
+
3
+class Database {
4
+  private $_dbfile;
5
+
6
+  public function __construct($dbfile) {
7
+    $this->$dbfile = $_dbfile;
8
+  }
9
+
10
+  public function req($req) {
11
+    return $this->$_dbfile->query($req);
12
+  }
13
+
14
+  public function next($dbreq) {
15
+    return $dbreq->fetchArray();
16
+  }
17
+
18
+  public function reqFirst($req) {
19
+    $this->next( $this->req( $req ) );
20
+  }
21
+}
22
+
23
+$db = new Database('karuba.sqlite');
24
+
25
+?>