Add default project categories in settings
This commit is contained in:
@@ -118,7 +118,30 @@ class Category extends Base
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a category
|
||||
* Create default cetegories during project creation (transaction already started in Project::create())
|
||||
*
|
||||
* @access public
|
||||
* @param integer $project_id
|
||||
*/
|
||||
public function createDefaultCategories($project_id)
|
||||
{
|
||||
$categories = explode(',', $this->config->get('project_categories'));
|
||||
|
||||
foreach ($categories as $category) {
|
||||
|
||||
$category = trim($category);
|
||||
|
||||
if (! empty($category)) {
|
||||
$this->db->table(self::TABLE)->insert(array(
|
||||
'project_id' => $project_id,
|
||||
'name' => $category,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a category (run inside a transaction)
|
||||
*
|
||||
* @access public
|
||||
* @param array $values Form values
|
||||
|
||||
Reference in New Issue
Block a user