diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 5fc0098c7..c2238033d 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -3180,7 +3180,7 @@ class SeedDMS_Core_DMS { return false; $resArr = $resArr[0]; - $cat = new SeedDMS_Core_DocumentCategory($resArr["id"], $resArr["name"]); + $cat = new SeedDMS_Core_DocumentCategory($resArr["id"], $resArr["name"], $resArr['color']); $cat->setDMS($this); return $cat; } /* }}} */ @@ -3194,7 +3194,7 @@ class SeedDMS_Core_DMS { $categories = array(); foreach ($resArr as $row) { - $cat = new SeedDMS_Core_DocumentCategory($row["id"], $row["name"]); + $cat = new SeedDMS_Core_DocumentCategory($row["id"], $row["name"], $row['color']); $cat->setDMS($this); array_push($categories, $cat); } @@ -3219,17 +3219,17 @@ class SeedDMS_Core_DMS { return false; $row = $resArr[0]; - $cat = new SeedDMS_Core_DocumentCategory($row["id"], $row["name"]); + $cat = new SeedDMS_Core_DocumentCategory($row["id"], $row["name"], $row['color']); $cat->setDMS($this); return $cat; } /* }}} */ - function addDocumentCategory($name) { /* {{{ */ + function addDocumentCategory($name, $color) { /* {{{ */ if (is_object($this->getDocumentCategoryByName($name))) { return false; } - $queryStr = "INSERT INTO `tblCategory` (`name`) VALUES (".$this->db->qstr($name).")"; + $queryStr = "INSERT INTO `tblCategory` (`name`, `color`) VALUES (".$this->db->qstr($name).", ".$this->db->qstr($color).")"; if (!$this->db->getResult($queryStr)) return false; diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index 72a9bb9a7..5cdb63b2e 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -471,7 +471,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ return false; foreach ($resArr as $row) { - $cat = new SeedDMS_Core_DocumentCategory($row['id'], $row['name']); + $cat = new SeedDMS_Core_DocumentCategory($row['id'], $row['name'], $row['color']); $cat->setDMS($this->_dms); $this->_categories[] = $cat; } diff --git a/SeedDMS_Core/Core/inc.ClassDocumentCategory.php b/SeedDMS_Core/Core/inc.ClassDocumentCategory.php index 6d5451664..e0d384fd1 100644 --- a/SeedDMS_Core/Core/inc.ClassDocumentCategory.php +++ b/SeedDMS_Core/Core/inc.ClassDocumentCategory.php @@ -33,15 +33,22 @@ class SeedDMS_Core_DocumentCategory { */ protected $_name; + /** + * @var string $_color color of category in html notation + * @access protected + */ + protected $_color; + /** * @var object $_dms reference to dms this category belongs to * @access protected */ protected $_dms; - function __construct($id, $name) { /* {{{ */ + function __construct($id, $name, $color) { /* {{{ */ $this->_id = $id; $this->_name = $name; + $this->_color = $color; $this->_dms = null; } /* }}} */ @@ -64,6 +71,19 @@ class SeedDMS_Core_DocumentCategory { return true; } /* }}} */ + function getColor() { return $this->_color; } + + function setColor($newColor) { /* {{{ */ + $db = $this->_dms->getDB(); + + $queryStr = "UPDATE `tblCategory` SET `color` = ".$db->qstr($newColor)." WHERE `id` = ". $this->_id; + if (!$db->getResult($queryStr)) + return false; + + $this->_color = $newColor; + return true; + } /* }}} */ + function isUsed() { /* {{{ */ $db = $this->_dms->getDB(); diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index 37e85f73a..624220772 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -25,6 +25,7 @@ GPL License add class SeedDMS_Core_ApiKey +add property color to SeedDMS_Document_Category