|
@@ -6,19 +6,50 @@ try {
|
|
|
} catch (PDOException $e) {
|
|
} catch (PDOException $e) {
|
|
|
// handle the exception here
|
|
// handle the exception here
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+require "functions.php";
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* BUSINESS LOGIC
|
|
* BUSINESS LOGIC
|
|
|
*
|
|
*
|
|
|
|
|
+ * $screen = 0; // start
|
|
|
* 1) First we validate or create a maintainer.
|
|
* 1) First we validate or create a maintainer.
|
|
|
|
|
+ * Adding a maintainer is a detour but results
|
|
|
|
|
+ * in the same situation as selecting one.
|
|
|
|
|
+ * 1b) Cannot validate maintainer
|
|
|
|
|
+ * $screen = 1;
|
|
|
|
|
+ * 1a) Can validate maintainer
|
|
|
|
|
+ * $screen = 2; $_REQUEST['m']; // maintainer exists
|
|
|
* 2) The maintainer will be presented a page with
|
|
* 2) The maintainer will be presented a page with
|
|
|
* players. He can edit or remove a player.
|
|
* players. He can edit or remove a player.
|
|
|
|
|
+ * $screen = 3; $_REQUEST['e']; // edit player
|
|
|
|
|
+ * $screen = 4; $_REQUEST['x']; // remove player
|
|
|
* 3) The edit page allows the maintainer to add
|
|
* 3) The edit page allows the maintainer to add
|
|
|
* or remove features from the player.
|
|
* or remove features from the player.
|
|
|
*/
|
|
*/
|
|
|
-if ( isset( $_REQUEST['m'] ) ) {
|
|
|
|
|
- // There is a maintainer
|
|
|
|
|
- echo "Empty statement";
|
|
|
|
|
|
|
+// global
|
|
|
|
|
+$screen = 0;
|
|
|
|
|
+$maintainer = array(0, '?');
|
|
|
|
|
+if ( isset( $_REQUEST['i'] ) && $_REQUEST['i'] != '' ) {
|
|
|
|
|
+ // Try adding new maintainer ...
|
|
|
|
|
+ $maintainer = add_maintainer( $_REQUEST['i'] );
|
|
|
|
|
+ // ... then return to start screen
|
|
|
|
|
+ $screen = 0;
|
|
|
|
|
+}
|
|
|
|
|
+if ( isset( $_REQUEST['m'] ) && $_REQUEST['m'] != '' ) {
|
|
|
|
|
+ // There is a maintainer
|
|
|
|
|
+ $maintainer = get_maintainer( $_REQUEST['m'] );
|
|
|
|
|
+ $screen = 2;
|
|
|
|
|
+ if (isset($_REQUEST['e'])) {
|
|
|
|
|
+ // Request for edit screen
|
|
|
|
|
+ $screen = 3;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isset($_REQUEST['x'])) {
|
|
|
|
|
+ // Request to remove player
|
|
|
|
|
+ $screen = 4;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+assert( '$screen >= 0', "By now \$screen should be set to a value >= 0." );
|
|
|
?>
|
|
?>
|
|
|
|
|
|
|
|
<!doctype html>
|
|
<!doctype html>
|
|
@@ -40,10 +71,26 @@ if ( isset( $_REQUEST['m'] ) ) {
|
|
|
One of three columns
|
|
One of three columns
|
|
|
</div>
|
|
</div>
|
|
|
<div class="col-md">
|
|
<div class="col-md">
|
|
|
- One of three columns
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <?php
|
|
|
|
|
+ require "snippets.php";
|
|
|
|
|
+ if ( $maintainer[0] > 0 && $maintainer[0] < 100 ) {
|
|
|
|
|
+ // Error in creating maintainer
|
|
|
|
|
+ print( "<pre>" );
|
|
|
|
|
+ print( "ERROR $maintainer[0]: $maintainer[1]" );
|
|
|
|
|
+ print( "</pre>" );
|
|
|
|
|
+ // Try again
|
|
|
|
|
+ $screen = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ // Choose or add a maintainer; default screen
|
|
|
|
|
+ print( $snippets[$screen] );
|
|
|
|
|
+ ?>
|
|
|
|
|
+ </div>
|
|
|
<div class="col-md">
|
|
<div class="col-md">
|
|
|
- One of three columns
|
|
|
|
|
|
|
+ <pre>
|
|
|
|
|
+ <?php
|
|
|
|
|
+ print_r( $_REQUEST );
|
|
|
|
|
+ ?>
|
|
|
|
|
+ </pre>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|