Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
janzarsky committed Nov 29, 2014
1 parent 1175e3f commit eda505c
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 13 deletions.
12 changes: 9 additions & 3 deletions application/models/admin_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,19 @@ public function get_setup_lock() {

public function get_players()
{
return $this->db
->select("`players`.`name` as label, CONCAT('/media/images/avatars/', `avatars`.`id` ) as image_url,
CONCAT('/viewer/', `players`.`id` ) as url, `players`.`id` as id", false)
$data = $this->db
->select('avatars.id as avatar_id, players.name as label, players.id as id')
->from('players')
->join('avatars', 'players.avatar_id = avatars.id', 'left')
->order_by('name')
->get()->result_array();

foreach ($data as $key => $d) {
$data[$key]['image_url'] = '/media/images/avatars/' . $d['avatar_id'];
$data[$key]['url'] = '/viewer/' . $d['id'];
}

return $data;
}

public function get_free_avatars()
Expand Down
12 changes: 10 additions & 2 deletions application/models/control_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@ public function get_players()

public function get_games()
{
return $this->db
->select("CONCAT(`games`.`name`, ' (', `skills`.`name`, ')') as label, CONCAT('/control/', `games`.`id`) as url", false)
$data = $this->db
->select('games.name as name, skills.name as skill_name, games.id as id')
->from('games')
->join('skills', 'games.skill_id = skills.id')
->order_by('games.id')
->get()->result_array();


foreach ($data as $key => $d) {
$data[$key]['label'] = $d['name'] . '(' . $d['skill_name'] . ')';
$data[$key]['url'] = '/control/' . $d['id'];
}

return $data;
}

public function get_game_name($game_id) {
Expand Down
20 changes: 16 additions & 4 deletions application/models/setup_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,17 @@ public function delete_skill($id = false) {
}

public function get_games() {
return $this->db
->select("CONCAT(`games`.`name`, ' (', `skills`.`name`, ')') as label, `games`.`id` as id", false)
$data = $this->db
->select("skills.name as skill_name, games.name as game_name, games.id as id")
->join("skills", "skills.id = games.skill_id")
->from('games')
->get()->result_array();

foreach ($data as $key => $d) {
$data[$key]['label'] = $d['game_name'] . '(' . $d['skill_name'] . ')';
}

return $data;
}

public function get_skills() {
Expand Down Expand Up @@ -125,10 +131,16 @@ public function delete_game($id = false) {
}

public function get_avatars() {
return $this->db
->select("CONCAT('media/images/avatars/', `id`) as image_url, id as label, id as id", false)
$data = $this->db
->select("id as label, id as id")
->from('avatars')
->get()->result_array();

foreach ($data as $key => $d) {
$data[$key]['image_url'] = 'media/images/avatars/' . $d['id'];
}

return $data;
}

public function add_avatar($file = false) {
Expand Down
13 changes: 10 additions & 3 deletions application/models/viewer_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ public function get_player($id = FALSE) {
}

public function get_players() {
return $this->db
->select("`players`.`name` as label, CONCAT('/media/images/avatars/', `avatars`.`id` ) as image_url,
CONCAT('/viewer/', `players`.`id` ) as url", false)
$data = $this->db
->select('avatars.id as avatar_id, players.id as id, players.name as label')
->from('players')
->join('avatars', 'players.avatar_id = avatars.id', 'left')
->order_by('name')
->get()->result_array();


foreach ($data as $key => $d) {
$data[$key]['image_url'] = '/media/images/avatars/' . $d['avatar_id'];
$data[$key]['url'] = '/viewer/' . $d['id'];
}

return $data;
}

public function get_player_id($nick = FALSE) {
Expand Down
4 changes: 3 additions & 1 deletion system/core/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ function &get_config($replace = array())
}
}

return $_config[0] =& $config;
//return $_config[0] =& $config;
$_config[0] =& $config;
return $_config[0];
}
}

Expand Down

0 comments on commit eda505c

Please sign in to comment.