Add project calendars (merge/refactoring of #490)

This commit is contained in:
Frederic Guillot
2015-01-17 17:11:51 -05:00
parent 4b45b2aa35
commit 84b0f0df90
50 changed files with 1438 additions and 173 deletions

View File

@@ -258,16 +258,19 @@ class Board extends Base
*
* @access public
* @param integer $project_id
* @param boolean $prepend Prepend default value
* @return array
*/
public function getColumnStats($project_id)
public function getColumnStats($project_id, $prepend = false)
{
return $this->db
->table(Task::TABLE)
->eq('project_id', $project_id)
->eq('is_active', 1)
->groupBy('column_id')
->listing('column_id', 'COUNT(*) AS total');
$listing = $this->db
->table(Task::TABLE)
->eq('project_id', $project_id)
->eq('is_active', 1)
->groupBy('column_id')
->listing('column_id', 'COUNT(*) AS total');
return $prepend ? array(-1 => t('All columns')) + $listing : $listing;
}
/**
@@ -287,11 +290,13 @@ class Board extends Base
*
* @access public
* @param integer $project_id Project id
* @param boolean $prepend Prepend a default value
* @return array
*/
public function getColumnsList($project_id)
public function getColumnsList($project_id, $prepend = false)
{
return $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('position')->listing('id', 'title');
$listing = $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('position')->listing('id', 'title');
return $prepend ? array(-1 => t('All columns')) + $listing : $listing;
}
/**