premier test
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Game extends CI_Controller {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->load->model('game_model');
|
||||
$this->load->helper('url');
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$search = $this->input->get('search');
|
||||
$sort_by = $this->input->get('sort') ? $this->input->get('sort') : 'name';
|
||||
$sort_order = $this->input->get('order') ? $this->input->get('order') : 'ASC';
|
||||
$genre_id = $this->input->get('genre');
|
||||
$category_id = $this->input->get('category');
|
||||
|
||||
if (!empty($genre_id)) {
|
||||
$data['games'] = $this->game_model->get_games_genre($genre_id);
|
||||
} elseif (!empty($category_id)) {
|
||||
$data['games'] = $this->game_model->get_games_category($category_id);
|
||||
} else {
|
||||
$data['games'] = $this->game_model->get_games_filtered($search, $sort_by, $sort_order);
|
||||
}
|
||||
|
||||
$data['genres'] = $this->game_model->get_genres();
|
||||
$data['categories'] = $this->game_model->get_categories();
|
||||
|
||||
$data['current_search'] = $search;
|
||||
$data['current_sort'] = $sort_by;
|
||||
$data['current_order'] = $sort_order;
|
||||
|
||||
$this->load->view('game/test', $data);
|
||||
}
|
||||
|
||||
public function detail($id) {
|
||||
$data['game'] = $this->game_model->get_game_id_dev($id);
|
||||
|
||||
if (empty($data['game'])) {
|
||||
show_404();
|
||||
}
|
||||
|
||||
$this->load->view('game/details', $data);
|
||||
}
|
||||
|
||||
public function delete($id = NULL) {
|
||||
if ($id === NULL) {
|
||||
show_404();
|
||||
}
|
||||
$this->game_model->delete_game($id);
|
||||
redirect('game/test');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Welcome extends CI_Controller {
|
||||
|
||||
/**
|
||||
* Index Page for this controller.
|
||||
*
|
||||
* Maps to the following URL
|
||||
* http://example.com/index.php/welcome
|
||||
* - or -
|
||||
* http://example.com/index.php/welcome/index
|
||||
* - or -
|
||||
* Since this controller is set as the default controller in
|
||||
* config/routes.php, it's displayed at http://example.com/
|
||||
*
|
||||
* So any other public methods not prefixed with an underscore will
|
||||
* map to /index.php/welcome/<method_name>
|
||||
* @see https://codeigniter.com/userguide3/general/urls.html
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('welcome_message');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user