mirror of
https://git.code.sf.net/p/seeddms/code
synced 2026-02-01 14:11:55 +00:00
add property color to document categories
This commit is contained in:
parent
012054c731
commit
83dc876ac4
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||
<notes>
|
||||
add class SeedDMS_Core_ApiKey
|
||||
add property color to SeedDMS_Document_Category
|
||||
</notes>
|
||||
<contents>
|
||||
<dir baseinstalldir="SeedDMS" name="/">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user