| | <?php |
| |
|
| | namespace Kanboard\Model; |
| |
|
| | use Kanboard\Core\Base; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | class BoardModel extends Base |
| | { |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getDefaultColumns() |
| | { |
| | return array(t('Backlog'), t('Ready'), t('Work in progress'), t('Done')); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getUserColumns() |
| | { |
| | $column_names = array_unique(explode_csv_field($this->configModel->get('board_columns', implode(',', $this->getDefaultColumns())))); |
| | $columns = array(); |
| |
|
| | foreach ($column_names as $column_name) { |
| | $columns[] = array( |
| | 'title' => $column_name, |
| | 'task_limit' => 0, |
| | 'description' => '', |
| | 'hide_in_dashboard' => 0, |
| | ); |
| | } |
| |
|
| | return $columns; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function create($project_id, array $columns) |
| | { |
| | $position = 0; |
| |
|
| | foreach ($columns as $column) { |
| | $values = array( |
| | 'title' => $column['title'], |
| | 'position' => ++$position, |
| | 'project_id' => $project_id, |
| | 'task_limit' => $column['task_limit'], |
| | 'description' => $column['description'], |
| | 'hide_in_dashboard' => $column['hide_in_dashboard'] ?: 0, |
| | ); |
| |
|
| | if (! $this->db->table(ColumnModel::TABLE)->save($values)) { |
| | return false; |
| | } |
| | } |
| |
|
| | return true; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function duplicate($project_from, $project_to) |
| | { |
| | $columns = $this->db->table(ColumnModel::TABLE) |
| | ->columns('title', 'task_limit', 'description', 'hide_in_dashboard') |
| | ->eq('project_id', $project_from) |
| | ->asc('position') |
| | ->findAll(); |
| |
|
| | return $this->boardModel->create($project_to, $columns); |
| | } |
| | } |
| |
|