1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| <?php
if (isset($_POST['player']) && check_admin_referer('phpleague'))
{
$positions = ( ! empty($_POST['positions'])) ? maybe_serialize($_POST['positions']) : NULL;
$db->edit_player_settings($id_league, $positions);
$message[] = __('Players settings updated successfully!', 'phpleague');
}
// If the player mode is enabled...
if ($setting->player_mod === 'yes')
{
$output =
'<table id="positions-table" class="widefat">
<thead>
<tr>
<th>'.__('ID', 'phpleague').'</th>
<th>'.__('Name', 'phpleague').'</th>
<th>'.__('Order', 'phpleague').'</th>
<th>'.__('Show', 'phpleague').'</th>
<th><a href="#position" onclick="jQuery.add_position();">'.__('New Position', 'phpleague').'</a></th>
</tr>
</thead>
<tbody>';
$positions = $db->get_positions($id_league);
foreach (maybe_unserialize($positions) as $position)
{
if ($position != 'NULL')
{
foreach (maybe_unserialize($position) as $key => $row)
{
$key++;
$output .= '<tr id="position-'.$key.'">';
$output .= '<td>'.$fct->input('positions['.$key.'][id]', $row['id'], array('size' => '4')).'</td>';
$output .= '<td>'.$fct->input('positions['.$key.'][name]', $row['name']).'</td>';
$output .= '<td>'.$fct->input('positions['.$key.'][order]', $row['order'], array('size' => '4')).'</td>';
$output .= '<td>'.$fct->select('positions['.$key.'][show]', $yes_no, $row['show']).'</td>';
$output .= '<td>'.$fct->input('remove_position', __('Remove', 'phpleague'), array('type' => 'button', 'class' => 'button', 'onclick' => 'jQuery.remove_position('.$key.');')).'</td>';
$output .= '</tr>';
}
}
else
{
$output .= '<tr id="position-1">';
$output .= '<td>'.$fct->input('positions[1][id]', 1, array('size' => '4')).'</td>';
$output .= '<td>'.$fct->input('positions[1][name]', '').'</td>';
$output .= '<td>'.$fct->input('positions[1][order]', 0, array('size' => '4')).'</td>';
$output .= '<td>'.$fct->select('positions[1][show]', $yes_no, 'yes').'</td>';
$output .= '<td>'.$fct->input('remove_position', __('Remove', 'phpleague'), array('type' => 'button', 'class' => 'button', 'onclick' => 'jQuery.remove_position(1);')).'</td>';
$output .= '</tr>';
}
}
$output .= '</tbody></table><div class="submit">'.$fct->input('player', __('Save', 'phpleague'), array('type' => 'submit')).'</div>';
$output .= $fct->form_close();
$data[] = array(
'menu' => __('Settings', 'phpleague'),
'title' => __('Player Positions', 'phpleague'),
'text' => $output,
'class' => 'full'
);
}
echo $ctl->admin_container($menu, $data, $message); |
Partager