Add table/pagination to the project list
This commit is contained in:
@@ -98,24 +98,22 @@ class Project extends Base
|
||||
* Get all projects
|
||||
*
|
||||
* @access public
|
||||
* @param bool $filter_permissions If true, remove projects not allowed for the current user
|
||||
* @return array
|
||||
*/
|
||||
public function getAll($filter_permissions = false)
|
||||
public function getAll()
|
||||
{
|
||||
$projects = $this->db->table(self::TABLE)->asc('name')->findAll();
|
||||
return $this->db->table(self::TABLE)->asc('name')->findAll();
|
||||
}
|
||||
|
||||
if ($filter_permissions) {
|
||||
|
||||
foreach ($projects as $key => $project) {
|
||||
|
||||
if (! $this->projectPermission->isUserAllowed($project['id'], $this->userSession->getId())) {
|
||||
unset($projects[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $projects;
|
||||
/**
|
||||
* Get all project ids
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getAllIds()
|
||||
{
|
||||
return $this->db->table(self::TABLE)->asc('name')->findAllByColumn('id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -321,6 +321,22 @@ class ProjectPermission extends Base
|
||||
->getAll('projects.id', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of project ids where the user is member
|
||||
*
|
||||
* @access public
|
||||
* @param integer $user_id User id
|
||||
* @return []integer
|
||||
*/
|
||||
public function getMemberProjectIds($user_id)
|
||||
{
|
||||
return $this->db
|
||||
->table(Project::TABLE)
|
||||
->eq('user_id', $user_id)
|
||||
->join(self::TABLE, 'project_id', 'id')
|
||||
->findAllByColumn('projects.id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of active projects where the user is member
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user