Example #1
0
 public function index()
 {
     $data = array();
     $data['title'] = $this->lang->line('home');
     $this->load->model('message_model');
     if (!is_connected()) {
         $language = $this->config->item('language');
     } else {
         $language = $this->session->userdata['user']->language;
     }
     $data['home_message'] = $this->message_model->get_message('home-message');
     if ($data['home_message'] !== '') {
         $data['home_message'] = $data['home_message'][0]->{$language . '_content'};
     }
     $data['home_message'] = html_entity_decode($data['home_message']);
     $data['yesterday_matches'] = matches_of_day(date('d/m/Y', time() - 60 * 60 * 24));
     $data['today_matches'] = matches_of_day();
     $data['tomorrow_matches'] = matches_of_day(date('d/m/Y', time() + 60 * 60 * 24));
     if (!$data['yesterday_matches'] && !$data['today_matches'] && !$data['tomorrow_matches']) {
         $data['last_matches'] = last_matches();
         $data['next_matches'] = next_matches();
     }
     $this->load->view('templates/header', $data);
     $this->load->view('templates/nav', $data);
     $this->load->view('index', $data);
     $this->load->view('templates/footer', $data);
 }
Example #2
0
/**
 * Cette fonction renvoie les prochains matchs à jouer.
 *
 * @return les prochains matchs à jouer
 */
function next_matches()
{
    $CI =& get_instance();
    // Récupération de la date des derniers matchs
    $select = 'date';
    $where = 'date >= NOW()';
    $order = 'date ASC';
    $limit = 1;
    $date_next_matches = $CI->db->select($select)->from($CI->config->item('match', 'table'))->where($where)->order_by($order)->limit($limit)->get()->result();
    $date_next_matches = $date_next_matches[0]->date;
    $year_searched = substr($date_next_matches, 0, 4);
    $month_searched = substr($date_next_matches, 5, 2);
    $day_searched = substr($date_next_matches, 8, 2);
    return matches_of_day($day_searched . '/' . $month_searched . '/' . $year_searched);
}