summaryrefslogtreecommitdiff
path: root/app/Model/Category.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/Category.php')
-rw-r--r--app/Model/Category.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/app/Model/Category.php b/app/Model/Category.php
index 54a0f552..cd60e7f7 100644
--- a/app/Model/Category.php
+++ b/app/Model/Category.php
@@ -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