} $oR3DCQuery->MangeGameTimeOuts(); } // This variable will hold data to display on the page. $__pd = array(); // Field settings. Used for validation purposes and setting-up/customising the form. $fields = array(); $fields['t_name'] = array('type' => 'string', 'label' => _T('IDS_Admin_Tournament_Add_NAME', $config), 'max_length' => '32', 'required' => TRUE, 'width' => 40); $fields['t_type'] = array('type' => 'string', 'label' => _T('IDS_Admin_Tournament_Add_TYPE', $config), 'max_length' => '15', 'required' => TRUE, 'items' => get_tournament_types($config), 'render_type' => 'select'); $fields['t_playernum'] = array('type' => 'int', 'label' => _T('IDS_Admin_Tournament_Add_COUNT', $config), 'required' => FALSE, 'width' => 10); $fields['t_cutoffdate'] = array('type' => 'date', 'label' => _T('IDS_Admin_Tournament_Add_CUTOFF', $config), 'required' => TRUE, 'render_type' => 'date', 'width' => 20, 'id' => '_date_cutoff'); $fields['t_startdate'] = array('type' => 'date', 'label' => _T('IDS_Admin_Tournament_Add_START', $config), 'required' => TRUE, 'render_type' => 'date', 'width' => 20, 'id' => '_date_start'); $fields['t_comment'] = array('type' => 'string', 'label' => _T('IDS_Admin_Tournament_Add_COMMENT', $config), 'required' => FALSE, 'render_type' => 'description', 'width' => 30); $fields['t_status'] = array('type' => 'string', 'label' => _T('IDS_Admin_Tournament_Add_STATUS', $config), 'max_length' => '1', 'required' => TRUE, 'items' => get_status_filters($config), 'render_type' => 'select'); $__pd['fields'] = $fields; $result = check_form_submit($id, $fields, $oR3DCQuery, $config); $t = array('t_name' => '', 't_type' => '', 't_playernum' => '', 't_cutoffdate' => date('Y-m-d'), 't_startdate' => date('Y-m-d'), 't_comment' => '', 't_status' => ''); if ($result['submit'] == FALSE) { $__pd['tournament'] = $t; } elseif ($result['submit'] && count($result['errors']) != 0) { $__pd['tournament'] = $result['new_values']; $__pd['errors'] = $result['errors']; } else { $__pd['tournament'] = $t; $__pd['success'] = _T('IDS_Admin_Tournament_Add_CREATED', $config); } // Checks if a form submit occurred. This would be an update request. // Must validate all values before saving. If there are errors, they are // returned, along with all the new values entered. // id - the id of the record. IN this case this is field t_id. // fields - array of field options.
} $cnt = mysql_num_rows($result); if ($cnt == 0) { $__pd['error'] = _T('IDS_Admin_Tournament_Games_Edit_GAMEIDINVALID', $config); } else { $game = mysql_fetch_array($result, MYSQL_ASSOC); } } if (!isset($__pd['error'])) { // Field settings. Used for validation purposes and setting-up/customising the form. $players = get_active_player_list($oR3DCQuery); $fields = array(); $fields['status'] = array('type' => 'string', 'label' => _T('IDS_Admin_Tournament_Games_Edit_STATUS', $config), 'items' => get_all_status_values($config), 'render_type' => 'select'); $fields['completion_status'] = array('type' => 'string', 'label' => _T('IDS_Admin_Tournament_Games_Edit_COMPLETION', $config), 'items' => get_all_completion_status_values($config), 'render_type' => 'select'); $__pd['fields'] = $fields; $result = check_form_submit($tid, $gid, $fields, $oR3DCQuery); if ($result['submit'] == FALSE) { $__pd['game'] = $game; $__pd['game']['fen'] = $oR3DCQuery->GetInitialGameFEN($config, $gid); } elseif ($result['submit'] && count($result['errors']) != 0) { $__pd['game'] = $result['new_values']; $__pd['errors'] = $result['errors']; } else { $__pd['game'] = $result['new_values']; $__pd['game']['fen'] = $oR3DCQuery->GetInitialGameFEN($config, $gid); $__pd['success'] = _T('IDS_Admin_Tournament_Games_Edit_UPDATED', $config); } } // Checks if a form submit occurred. This would be an update request. // Must validate all values before saving. If there are errors, they are // returned, along with all the new values entered.
} else { $t = mysql_fetch_array($result, MYSQL_ASSOC); $__pd['tournament'] = $t; } } if (!isset($__pd['error'])) { // Field settings. Used for validation purposes and setting-up/customising the form. $players = get_active_player_list($oR3DCQuery); $fields = array(); $fields['w_player_id'] = array('type' => 'int', 'label' => _T('IDS_Admin_Tournament_Games_Add_WHITE', $config), 'required' => TRUE, 'width' => 40, 'items' => $players, 'render_type' => 'select'); $fields['b_player_id'] = array('type' => 'int', 'label' => _T('IDS_Admin_Tournament_Games_Add_BLACK', $config), 'required' => TRUE, 'width' => 40, 'items' => $players, 'render_type' => 'select'); $fields['fen'] = array('type' => 'string', 'label' => _T('IDS_Admin_Tournament_Games_Add_FEN', $config), 'required' => TRUE, 'width' => 70, 'value' => 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1', 'id' => 'FEN'); $fields['timing_mode'] = array('type' => 'string', 'label' => _T('IDS_Admin_Tournament_Games_Add_TIMING', $config), 'required' => TRUE, 'value' => 'C-Normal', 'items' => array('C-Snail' => _T('IDS_CREATE_GAME_OPT_5', $config), 'C-Slow' => _T('IDS_CREATE_GAME_OPT_4', $config), 'C-Normal' => _T('IDS_CREATE_GAME_OPT_3', $config), 'C-Short' => _T('IDS_CREATE_GAME_OPT_2', $config), 'C-Blitz' => _T('IDS_CREATE_GAME_OPT_1', $config)), 'render_type' => 'select'); $fields['time_controls'] = array('type' => 'time controls', 'label' => __l('Time Controls'), 'id' => 'tc', 'render_type' => 'time controls', 'width' => 4, 'txt_moves' => __l('moves adds'), 'txt_min' => __l('minutes')); $__pd['fields'] = $fields; $result = check_form_submit($id, NULL, $fields, $oR3DCQuery); if ($result['submit'] == FALSE) { $__pd['game'] = array(); } elseif ($result['submit'] && count($result['errors']) != 0) { $__pd['game'] = $result['new_values']; $__pd['errors'] = $result['errors']; } else { $__pd['game'] = array(); $str = _T('IDS_Admin_Tournament_Games_Add_CREATED', $config); $__pd['success'] = preg_replace('/\\{id\\}/', $result['game_id'], $str); } } // Checks if a form submit occurred. This would be an update request. // Must validate all values before saving. If there are errors, they are // returned, along with all the new values entered. // tid - the id of the tournament record that the game will be associated with.