summaryrefslogtreecommitdiff
path: root/app/Model/Project.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-08-16 17:53:07 -0700
committerFrédéric Guillot <fred@kanboard.net>2014-08-16 17:53:07 -0700
commit658123a2328867a87da59ca660a7044d99eea22c (patch)
treee9d278eeba1699b13823dc7b115dce56635d0823 /app/Model/Project.php
parentdb3c006be80d6690892b11608619f9683824e21b (diff)
The fullname is displayed instead of the username if not empty
Diffstat (limited to 'app/Model/Project.php')
-rw-r--r--app/Model/Project.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/app/Model/Project.php b/app/Model/Project.php
index 9f53fdda..9ee54cbd 100644
--- a/app/Model/Project.php
+++ b/app/Model/Project.php
@@ -80,12 +80,23 @@ class Project extends Base
*/
public function getAllowedUsers($project_id)
{
- return $this->db
+ $users = $this->db
->table(self::TABLE_USERS)
->join(User::TABLE, 'id', 'user_id')
->eq('project_id', $project_id)
->asc('username')
- ->listing('user_id', 'username');
+ ->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name')
+ ->findAll();
+
+ $result = array();
+
+ foreach ($users as $user) {
+ $result[$user['id']] = $user['name'] ?: $user['username'];
+ }
+
+ asort($result);
+
+ return $result;
}
/**