function edit_view() { global $wpdb; $table1 = $wpdb->prefix . 'iggamelist'; if (!empty($_REQUEST['edit_id'])) { $hidden_edit_id = $_REQUEST['edit_id']; $edit_rec = $wpdb->get_results("SELECT * FROM {$table1} where id='" . $_REQUEST['edit_id'] . "'"); } $exp_urlkey = $edit_rec[0]->urlkey; ?> <?php if (isset($_POST['comp-update'])) { ?> <div class="updated"><p><?php echo "Comp Updated"; ?> </p></div> <?php } ?> <form name="teamfrm" action="options-general.php?page=igamezone.php&link=viewcomp" method="post" enctype="multipart/form-data"> <p><label>Game</label> <select name="gamedrop"> <?php select_game(); ?> </select> </p> <p><label>Tournament</label> <select name="tourdrop"> <?php select_tour(); ?> </select> </p> <p><label>Teams</label> <select name="tourdrop1"> <?php select_team('team1'); ?> </select> <select name="tourdrop2"> <?php select_team('team2'); ?> </select> </p> <p><label>Match Time</label> <div class="combine_div"> <span class="date_drop"><small>Date</small><?php date_list(); ?> </span> <span class="time_drop"><small>Time</small><?php time_list(); ?> </span> <span class="time_zone_drop"><small>Timezone</small><?php timezone_drop(); ?> </span> </div> </p> <p><label>Match Duration</label> <span class="match_duration"><?php game_duration(); ?> </div> </p> <p><label>URL Link</label> <input type="text" name="url_key" id="url" value="<?php echo $exp_urlkey; ?> "> </p> <p><input type="hidden" name="hd_edit_id" value="<?php echo $hidden_edit_id; ?> " id="sub"></p> <p><input type="submit" name="comp-update" value="Update" id="sub"></p> </form> <?php }
function my_player() { return select_game(game, array("my_player"))["my_player"]; }
function pretty_game($game) { return link_to(path("show", "game", $game["id"]), pretty_date(select_game($game["id"], array("date"))["date"])); }
function add_player_in_game($bdd2, $id_game, $id_player) { $id_game = protect_sql($id_game, "intval"); $id_player = protect_sql($id_player, "intval"); if ($type = select_game($bdd2, $id_game)) { $sql = "SELECT COUNT(*) AS `nbr` FROM `play_in` WHERE id_game = '" . $id_game . "'"; if ($data = $bdd2->query_select($sql)) { if ($data[0]['nbr'] < $type['nbr_player']) { $data[0]['nbr']++; $sql2 = "INSERT INTO `play_in` VALUES ('" . $id_player . "', '" . $id_game . "', '" . $type['nbr_points'] . "', '" . $data[0]['nbr'] . "')"; if ($bdd2->query($sql2)) { return 1; } else { return 0; } } } else { return 0; } } else { return 0; } }
function add_extra_profile($user) { function select_game($id) { global $wpdb; $sel = ""; $table1 = $wpdb->prefix . 'iggame'; $tableedit = $wpdb->prefix . 'iggamelist'; global $wpdb; $team_rec = $wpdb->get_results("SELECT * FROM {$table1}"); $temp_data = explode(",", get_the_author_meta('gamebox', $id)); function objectToArray($object) { if (!is_object($object) && !is_array($object)) { return $object; } return array_map('objectToArray', (array) $object); } foreach ($team_rec as $key => $obj) { $flag = ''; $objtoarr = json_decode(json_encode($obj), TRUE); for ($k = 0; $k < count($temp_data); $k++) { if (in_array($temp_data[$k], $objtoarr)) { $flag = 'checked'; } } echo '<input type="checkbox" ' . $flag . ' value="' . $team_rec[$key]->id . '" name="gamebox[]"/>' . $team_rec[$key]->name . '</br>'; } } ?> <h3>Game Option fields</h3> <table class="form-table"> <tr> <th><label for="estimezone">Timezone</label></th> <td><input type="text" name="estimezone" value="<?php echo esc_attr(get_the_author_meta('estimezone', $user->ID)); ?> " readonly class="regular-text" /></td> </tr> <tr> <th><label for="gamebox">Favourite Games</label></th> <td> <?php select_game($user->ID); ?> </td> </tr> </table> <?php }
echo "Comp Inserted"; ?> </p></div> <?php } ?> <form name="teamfrm" action="<?php echo $_SERVER['REQUEST_URI']; ?> " method="post" enctype="multipart/form-data"> <p><label>Game</label> <select name="gamedrop"> <?php select_game(); ?> </select> </p> <p><label>Tournament</label> <select name="tourdrop"> <?php select_tour(); ?> </select> </p> <p><label>Teams</label> <select name="tourdrop1"> <?php