Do not show inactive projects info on the dashboard and update picodb (merge #546)
This commit is contained in:
parent
655d75a3cf
commit
e506648cbc
|
|
@ -31,7 +31,7 @@ class App extends Base
|
|||
{
|
||||
$status = array(SubTaskModel::STATUS_TODO, SubTaskModel::STATUS_INPROGRESS);
|
||||
$user_id = $this->userSession->getId();
|
||||
$projects = $this->projectPermission->getMemberProjects($user_id);
|
||||
$projects = $this->projectPermission->getActiveMemberProjects($user_id);
|
||||
$project_ids = array_keys($projects);
|
||||
|
||||
$task_paginator = $this->paginator
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ class Task extends Base
|
|||
$task = $this->getTask();
|
||||
$values = $task;
|
||||
$errors = array();
|
||||
$projects_list = $this->projectPermission->getMemberProjects($this->userSession->getId());
|
||||
$projects_list = $this->projectPermission->getActiveMemberProjects($this->userSession->getId());
|
||||
|
||||
unset($projects_list[$task['project_id']]);
|
||||
|
||||
|
|
@ -457,7 +457,7 @@ class Task extends Base
|
|||
$task = $this->getTask();
|
||||
$values = $task;
|
||||
$errors = array();
|
||||
$projects_list = $this->projectPermission->getMemberProjects($this->userSession->getId());
|
||||
$projects_list = $this->projectPermission->getActiveMemberProjects($this->userSession->getId());
|
||||
|
||||
unset($projects_list[$task['project_id']]);
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ class Board extends Base
|
|||
*/
|
||||
public function moveDown($project_id, $column_id)
|
||||
{
|
||||
$columns = $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('position')->listing('id', 'position');
|
||||
$columns = $this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->asc('position')->getAll('id', 'position');
|
||||
$positions = array_flip($columns);
|
||||
|
||||
if (isset($columns[$column_id]) && $columns[$column_id] < count($columns)) {
|
||||
|
|
@ -207,7 +207,7 @@ class Board extends Base
|
|||
*/
|
||||
public function moveUp($project_id, $column_id)
|
||||
{
|
||||
$columns = $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('position')->listing('id', 'position');
|
||||
$columns = $this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->asc('position')->getAll('id', 'position');
|
||||
$positions = array_flip($columns);
|
||||
|
||||
if (isset($columns[$column_id]) && $columns[$column_id] > 1) {
|
||||
|
|
@ -264,11 +264,11 @@ class Board extends Base
|
|||
public function getColumnStats($project_id, $prepend = false)
|
||||
{
|
||||
$listing = $this->db
|
||||
->table(Task::TABLE)
|
||||
->hashtable(Task::TABLE)
|
||||
->eq('project_id', $project_id)
|
||||
->eq('is_active', 1)
|
||||
->groupBy('column_id')
|
||||
->listing('column_id', 'COUNT(*) AS total');
|
||||
->getAll('column_id', 'COUNT(*) AS total');
|
||||
|
||||
return $prepend ? array(-1 => t('All columns')) + $listing : $listing;
|
||||
}
|
||||
|
|
@ -295,7 +295,7 @@ class Board extends Base
|
|||
*/
|
||||
public function getColumnsList($project_id, $prepend = false)
|
||||
{
|
||||
$listing = $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('position')->listing('id', 'title');
|
||||
$listing = $this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->asc('position')->getAll('id', 'title');
|
||||
return $prepend ? array(-1 => t('All columns')) + $listing : $listing;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,10 +84,10 @@ class Category extends Base
|
|||
*/
|
||||
public function getList($project_id, $prepend_none = true, $prepend_all = false)
|
||||
{
|
||||
$listing = $this->db->table(self::TABLE)
|
||||
$listing = $this->db->hashtable(self::TABLE)
|
||||
->eq('project_id', $project_id)
|
||||
->asc('name')
|
||||
->listing('id', 'name');
|
||||
->getAll('id', 'name');
|
||||
|
||||
$prepend = array();
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class Config extends Base
|
|||
*/
|
||||
public function getAll()
|
||||
{
|
||||
return $this->db->table(self::TABLE)->listing('option', 'value');
|
||||
return $this->db->hashtable(self::TABLE)->getAll('option', 'value');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -128,10 +128,10 @@ class Project extends Base
|
|||
public function getList($prepend = true)
|
||||
{
|
||||
if ($prepend) {
|
||||
return array(t('None')) + $this->db->table(self::TABLE)->asc('name')->listing('id', 'name');
|
||||
return array(t('None')) + $this->db->hashtable(self::TABLE)->asc('name')->getAll('id', 'name');
|
||||
}
|
||||
|
||||
return $this->db->table(self::TABLE)->asc('name')->listing('id', 'name');
|
||||
return $this->db->hashtable(self::TABLE)->asc('name')->getAll('id', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -160,10 +160,10 @@ class Project extends Base
|
|||
public function getListByStatus($status)
|
||||
{
|
||||
return $this->db
|
||||
->table(self::TABLE)
|
||||
->hashtable(self::TABLE)
|
||||
->asc('name')
|
||||
->eq('is_active', $status)
|
||||
->listing('id', 'name');
|
||||
->getAll('id', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -315,10 +315,27 @@ class ProjectPermission extends Base
|
|||
public function getMemberProjects($user_id)
|
||||
{
|
||||
return $this->db
|
||||
->table(Project::TABLE)
|
||||
->hashtable(Project::TABLE)
|
||||
->eq('user_id', $user_id)
|
||||
->join(self::TABLE, 'project_id', 'id')
|
||||
->listing('projects.id', 'name');
|
||||
->getAll('projects.id', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of active projects where the user is member
|
||||
*
|
||||
* @access public
|
||||
* @param integer $user_id User id
|
||||
* @return array
|
||||
*/
|
||||
public function getActiveMemberProjects($user_id)
|
||||
{
|
||||
return $this->db
|
||||
->hashtable(Project::TABLE)
|
||||
->eq('user_id', $user_id)
|
||||
->eq(Project::TABLE.'.is_active', Project::ACTIVE)
|
||||
->join(self::TABLE, 'project_id', 'id')
|
||||
->getAll('projects.id', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ class SubTask extends Base
|
|||
Project::TABLE.'.name AS project_name'
|
||||
)
|
||||
->eq('user_id', $user_id)
|
||||
->eq(Project::TABLE.'.is_active', Project::ACTIVE)
|
||||
->in(SubTask::TABLE.'.status', $status)
|
||||
->join(Task::TABLE, 'id', 'task_id')
|
||||
->join(Project::TABLE, 'id', 'project_id', Task::TABLE)
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ class Swimlane extends Base
|
|||
|
||||
$swimlanes = array_merge(
|
||||
$swimlanes,
|
||||
$this->db->table(self::TABLE)->eq('project_id', $project_id)->orderBy('name', 'asc')->listing('id', 'name')
|
||||
$this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->orderBy('name', 'asc')->getAll('id', 'name')
|
||||
);
|
||||
|
||||
return $prepend ? array(-1 => t('All swimlanes')) + $swimlanes : $swimlanes;
|
||||
|
|
@ -354,11 +354,11 @@ class Swimlane extends Base
|
|||
*/
|
||||
public function moveDown($project_id, $swimlane_id)
|
||||
{
|
||||
$swimlanes = $this->db->table(self::TABLE)
|
||||
$swimlanes = $this->db->hashtable(self::TABLE)
|
||||
->eq('project_id', $project_id)
|
||||
->eq('is_active', self::ACTIVE)
|
||||
->asc('position')
|
||||
->listing('id', 'position');
|
||||
->getAll('id', 'position');
|
||||
|
||||
$positions = array_flip($swimlanes);
|
||||
|
||||
|
|
@ -388,11 +388,11 @@ class Swimlane extends Base
|
|||
*/
|
||||
public function moveUp($project_id, $swimlane_id)
|
||||
{
|
||||
$swimlanes = $this->db->table(self::TABLE)
|
||||
$swimlanes = $this->db->hashtable(self::TABLE)
|
||||
->eq('project_id', $project_id)
|
||||
->eq('is_active', self::ACTIVE)
|
||||
->asc('position')
|
||||
->listing('id', 'position');
|
||||
->getAll('id', 'position');
|
||||
|
||||
$positions = array_flip($swimlanes);
|
||||
|
||||
|
|
|
|||
|
|
@ -62,8 +62,9 @@ class TaskFinder extends Base
|
|||
'projects.name AS project_name'
|
||||
)
|
||||
->join(Project::TABLE, 'id', 'project_id')
|
||||
->eq('tasks.owner_id', $user_id)
|
||||
->eq('tasks.is_active', Task::STATUS_OPEN);
|
||||
->eq(Task::TABLE.'.owner_id', $user_id)
|
||||
->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN)
|
||||
->eq(Project::TABLE.'.is_active', Project::ACTIVE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"fguillot/simple-validator": "0.0.1",
|
||||
"swiftmailer/swiftmailer": "@stable",
|
||||
"fguillot/json-rpc": "0.0.1",
|
||||
"fguillot/picodb": "0.0.1",
|
||||
"fguillot/picodb": "0.0.2",
|
||||
"erusev/parsedown": "1.1.1",
|
||||
"lusitanian/oauth": "0.3.5",
|
||||
"pimple/pimple": "~3.0",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "b20bc90f39f04bf9d6828329d56cdc75",
|
||||
"hash": "a5f10d6c565a2a7b5b63650d550cabf2",
|
||||
"packages": [
|
||||
{
|
||||
"name": "erusev/parsedown",
|
||||
|
|
@ -84,16 +84,16 @@
|
|||
},
|
||||
{
|
||||
"name": "fguillot/picodb",
|
||||
"version": "v0.0.1",
|
||||
"version": "v0.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fguillot/picoDb.git",
|
||||
"reference": "f36d8e0191e2fa6f033baf94bc35ec6a00798bc0"
|
||||
"reference": "b3ef5f79e7e5e33729fdbf9c02c8a252a3d76b6b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/fguillot/picoDb/zipball/f36d8e0191e2fa6f033baf94bc35ec6a00798bc0",
|
||||
"reference": "f36d8e0191e2fa6f033baf94bc35ec6a00798bc0",
|
||||
"url": "https://api.github.com/repos/fguillot/picoDb/zipball/b3ef5f79e7e5e33729fdbf9c02c8a252a3d76b6b",
|
||||
"reference": "b3ef5f79e7e5e33729fdbf9c02c8a252a3d76b6b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
],
|
||||
"description": "Minimalist database query builder",
|
||||
"homepage": "https://github.com/fguillot/picoDb",
|
||||
"time": "2015-01-18 22:35:36"
|
||||
"time": "2015-01-25 16:20:14"
|
||||
},
|
||||
{
|
||||
"name": "fguillot/simple-validator",
|
||||
|
|
|
|||
Loading…
Reference in New Issue