/usr/share/php/LetoDMS/Core/inc.ClassDocumentCategory.php is in php-letodms-core 3.3.11-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | <?php
/**
* Implementation of document categories in the document management system
*
* @category DMS
* @package LetoDMS_Core
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010 Uwe Steinmann
* @version Release: 3.3.11
*/
/**
* Class to represent a document category in the document management system
*
* @category DMS
* @package LetoDMS_Core
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C)2011 Uwe Steinmann
* @version Release: 3.3.11
*/
class LetoDMS_Core_DocumentCategory {
/**
* @var integer $_id id of document category
* @access protected
*/
var $_id;
/**
* @var string $_name name of category
* @access protected
*/
var $_name;
/**
* @var object $_dms reference to dms this category belongs to
* @access protected
*/
var $_dms;
function LetoDMS_Core_DocumentCategory($id, $name) {
$this->_id = $id;
$this->_name = $name;
$this->_dms = null;
}
function setDMS($dms) {
$this->_dms = $dms;
}
function getID() { return $this->_id; }
function getName() { return $this->_name; }
function setName($newName) {
$db = $this->_dms->getDB();
$queryStr = "UPDATE tblCategory SET name = ".$db->qstr($newName)." WHERE id = ". $this->_id;
if (!$db->getResult($queryStr))
return false;
$this->_name = $newName;
return true;
}
function isUsed() {
$db = $this->_dms->getDB();
$queryStr = "SELECT * FROM tblDocumentCategory WHERE categoryID=".$this->_id;
$resArr = $db->getResultArray($queryStr);
if (is_array($resArr) && count($resArr) == 0)
return false;
return true;
}
function getCategories() {
$db = $this->_dms->getDB();
$queryStr = "SELECT * FROM tblCategory";
return $db->getResultArray($queryStr);
}
function addCategory($keywords) {
$db = $this->_dms->getDB();
$queryStr = "INSERT INTO tblCategory (category) VALUES (".$db->qstr($keywords).")";
return $db->getResult($queryStr);
}
function remove() {
$db = $this->_dms->getDB();
$queryStr = "DELETE FROM tblCategory WHERE id = " . $this->_id;
if (!$db->getResult($queryStr))
return false;
return true;
}
function getDocumentsByCategory() {
$db = $this->_dms->getDB();
$queryStr = "SELECT * FROM tblDocumentCategory where categoryID=".$this->_id;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$resArr)
return false;
$documents = array();
foreach ($resArr as $row) {
array_push($documents, $this->_dms->getDocument($row["id"]));
}
return $documents;
}
}
?>
|