23 lines
732 B
PHP
23 lines
732 B
PHP
<?php
|
|
class Tournament extends CI_Controller {
|
|
public function register() {
|
|
// Get the total number of participants from the registration form
|
|
$totalParticipants = $this->input->post('total_participants');
|
|
|
|
// Calculate the number of rounds
|
|
$numberOfRounds = $this->calculateRounds($totalParticipants);
|
|
|
|
// Pass the number of rounds to the view or store it in the database
|
|
$data['numberOfRounds'] = $numberOfRounds;
|
|
|
|
// Load your view with the tournament information
|
|
$this->load->view('tournament_view', $data);
|
|
}
|
|
}
|
|
|
|
// Function to calculate the number of rounds
|
|
function calculateRounds($totalParticipants) {
|
|
return ceil(log($totalParticipants, 2));
|
|
}
|
|
|
|
?>
|