Add settings field to control project columns (pull-request #244)
This commit is contained in:
@@ -20,6 +20,17 @@ class Board extends Base
|
||||
*/
|
||||
const TABLE = 'columns';
|
||||
|
||||
/**
|
||||
* Get Kanboard default columns
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDefaultColumns()
|
||||
{
|
||||
return array(t('Backlog'), t('Ready'), t('Work in progress'), t('Done'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a board with default columns, must be executed inside a transaction
|
||||
*
|
||||
|
||||
@@ -72,7 +72,7 @@ class Config extends Base
|
||||
$_SESSION['config'] = $this->getAll();
|
||||
}
|
||||
|
||||
if (isset($_SESSION['config'][$name])) {
|
||||
if (! empty($_SESSION['config'][$name])) {
|
||||
return $_SESSION['config'][$name];
|
||||
}
|
||||
|
||||
|
||||
@@ -496,14 +496,19 @@ class Project extends Base
|
||||
}
|
||||
|
||||
$project_id = $this->db->getConnection()->getLastId();
|
||||
$column_names = explode(',', $this->config->get('default_columns', implode(',', $this->board->getDefaultColumns())));
|
||||
$columns = array();
|
||||
|
||||
$this->board->create($project_id, array(
|
||||
array('title' => t('Backlog'), 'task_limit' => 0),
|
||||
array('title' => t('Ready'), 'task_limit' => 0),
|
||||
array('title' => t('Work in progress'), 'task_limit' => 0),
|
||||
array('title' => t('Done'), 'task_limit' => 0),
|
||||
));
|
||||
foreach ($column_names as $column_name) {
|
||||
|
||||
$column_name = trim($column_name);
|
||||
|
||||
if (! empty($column_name)) {
|
||||
$columns[] = array('title' => $column_name, 'task_limit' => 0);
|
||||
}
|
||||
}
|
||||
|
||||
$this->board->create($project_id, $columns);
|
||||
$this->db->closeTransaction();
|
||||
|
||||
return (int) $project_id;
|
||||
|
||||
Reference in New Issue
Block a user