mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
Merge commit '10896ca183a4fa0b30c02fca8831d2f5497e6a76' into seeddms-5.1.x
This commit is contained in:
commit
3e5d744d6d
|
@ -90,5 +90,3 @@ require_once('Core/inc.AccessUtils.php');
|
|||
* @uses SeedDMS_File
|
||||
*/
|
||||
require_once('Core/inc.FileUtils.php');
|
||||
|
||||
?>
|
||||
|
|
|
@ -85,6 +85,4 @@ define("N_DELETE_VERSION", 5);
|
|||
/**
|
||||
* Notify when version of document was deleted
|
||||
*/
|
||||
define("N_ADD_DOCUMENT", 6);
|
||||
|
||||
?>
|
||||
define("N_ADD_DOCUMENT", 6);
|
|
@ -24,22 +24,47 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_Core_UserAccess { /* {{{ */
|
||||
|
||||
/**
|
||||
* @var SeedDMS_Core_User
|
||||
*/
|
||||
var $_user;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
var $_mode;
|
||||
|
||||
/**
|
||||
* SeedDMS_Core_UserAccess constructor.
|
||||
* @param $user
|
||||
* @param $mode
|
||||
*/
|
||||
function __construct($user, $mode) {
|
||||
$this->_user = $user;
|
||||
$this->_mode = $mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getUserID() { return $this->_user->getID(); }
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
function getMode() { return $this->_mode; }
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function isAdmin() {
|
||||
return ($this->_mode == SeedDMS_Core_User::role_admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SeedDMS_Core_User
|
||||
*/
|
||||
function getUser() {
|
||||
return $this->_user;
|
||||
}
|
||||
|
@ -57,20 +82,41 @@ class SeedDMS_Core_UserAccess { /* {{{ */
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_Core_GroupAccess { /* {{{ */
|
||||
|
||||
/**
|
||||
* @var SeedDMS_Core_Group
|
||||
*/
|
||||
var $_group;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
var $_mode;
|
||||
|
||||
/**
|
||||
* SeedDMS_Core_GroupAccess constructor.
|
||||
* @param $group
|
||||
* @param $mode
|
||||
*/
|
||||
function __construct($group, $mode) {
|
||||
$this->_group = $group;
|
||||
$this->_mode = $mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getGroupID() { return $this->_group->getID(); }
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
function getMode() { return $this->_mode; }
|
||||
|
||||
/**
|
||||
* @return SeedDMS_Core_Group
|
||||
*/
|
||||
function getGroup() {
|
||||
return $this->_group;
|
||||
}
|
||||
} /* }}} */
|
||||
?>
|
||||
} /* }}} */
|
|
@ -36,7 +36,7 @@ class SeedDMS_Core_Attribute { /* {{{ */
|
|||
protected $_id;
|
||||
|
||||
/**
|
||||
* @var object SeedDMS_Core_Object folder, document or document content
|
||||
* @var SeedDMS_Core_Folder|SeedDMS_Core_Document|SeedDMS_Core_DocumentContent SeedDMS_Core_Object folder, document or document content
|
||||
* this attribute belongs to
|
||||
*
|
||||
* @access protected
|
||||
|
@ -44,7 +44,7 @@ class SeedDMS_Core_Attribute { /* {{{ */
|
|||
protected $_obj;
|
||||
|
||||
/**
|
||||
* @var object SeedDMS_Core_AttributeDefinition definition of this attribute
|
||||
* @var SeedDMS_Core_AttributeDefinition definition of this attribute
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
|
@ -65,20 +65,19 @@ class SeedDMS_Core_Attribute { /* {{{ */
|
|||
protected $_validation_error;
|
||||
|
||||
/**
|
||||
* @var object SeedDMS_Core_DMS reference to the dms instance this attribute belongs to
|
||||
* @var SeedDMS_Core_DMS reference to the dms instance this attribute belongs to
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected $_dms;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param integer $id internal id of attribute
|
||||
* @param SeedDMS_Core_Object $obj object this attribute is attached to
|
||||
* @param SeedDMS_Core_AttributeDefinition $attrdef reference to the attribute definition
|
||||
* @param string $value value of the attribute
|
||||
*/
|
||||
/**
|
||||
* SeedDMS_Core_Attribute constructor.
|
||||
* @param $id
|
||||
* @param $obj
|
||||
* @param $attrdef
|
||||
* @param $value
|
||||
*/
|
||||
function __construct($id, $obj, $attrdef, $value) { /* {{{ */
|
||||
$this->_id = $id;
|
||||
$this->_obj = $obj;
|
||||
|
@ -242,10 +241,11 @@ class SeedDMS_Core_Attribute { /* {{{ */
|
|||
* If the validation fails the validation error will be set which
|
||||
* can be requested by SeedDMS_Core_Attribute::getValidationError()
|
||||
*
|
||||
* @return boolean true if validation succeds, otherwise false
|
||||
* @return boolean true if validation succeeds, otherwise false
|
||||
*/
|
||||
function validate() { /* {{{ */
|
||||
$attrdef = $this->_attrdef();
|
||||
/** @var SeedDMS_Core_AttributeDefinition $attrdef */
|
||||
$attrdef = $this->_attrdef(); /** @todo check this out, this method is not existing */
|
||||
$result = $attrdef->validate($this->_value);
|
||||
$this->_validation_error = $attrdef->getValidationError();
|
||||
return $result;
|
||||
|
@ -373,12 +373,17 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
protected $_validation_error;
|
||||
|
||||
/**
|
||||
* @var object SeedDMS_Core_DMS reference to the dms instance this attribute definition belongs to
|
||||
* @var SeedDMS_Core_DMS reference to the dms instance this attribute definition belongs to
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected $_dms;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_separator;
|
||||
|
||||
/*
|
||||
* Possible skalar data types of an attribute
|
||||
*/
|
||||
|
@ -398,20 +403,21 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
const objtype_document = '2';
|
||||
const objtype_documentcontent = '3';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param integer $id internal id of attribute definition
|
||||
* @param string $name name of attribute
|
||||
* @param integer $objtype type of object for which this attribute definition
|
||||
* may be used.
|
||||
* @param integer $type skalar type of attribute
|
||||
* @param boolean $multiple set to true if multiple values are allowed
|
||||
* @param integer $minvalues minimum number of values
|
||||
* @param integer $maxvalues maximum number of values
|
||||
* @param string $valueset separated list of allowed values, the first char
|
||||
* is taken as the separator
|
||||
*/
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param integer $id internal id of attribute definition
|
||||
* @param string $name name of attribute
|
||||
* @param integer $objtype type of object for which this attribute definition
|
||||
* may be used.
|
||||
* @param integer $type skalar type of attribute
|
||||
* @param boolean $multiple set to true if multiple values are allowed
|
||||
* @param integer $minvalues minimum number of values
|
||||
* @param integer $maxvalues maximum number of values
|
||||
* @param string $valueset separated list of allowed values, the first char
|
||||
* is taken as the separator
|
||||
* @param $regex
|
||||
*/
|
||||
function __construct($id, $name, $objtype, $type, $multiple, $minvalues, $maxvalues, $valueset, $regex) { /* {{{ */
|
||||
$this->_id = $id;
|
||||
$this->_name = $name;
|
||||
|
@ -472,14 +478,15 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
*/
|
||||
function getObjType() { return $this->_objtype; }
|
||||
|
||||
/**
|
||||
* Set object type of attribute definition
|
||||
*
|
||||
* This can be one of objtype_all,
|
||||
* objtype_folder, objtype_document, or objtype_documentcontent.
|
||||
*
|
||||
* @param integer $objtype type
|
||||
*/
|
||||
/**
|
||||
* Set object type of attribute definition
|
||||
*
|
||||
* This can be one of objtype_all,
|
||||
* objtype_folder, objtype_document, or objtype_documentcontent.
|
||||
*
|
||||
* @param integer $objtype type
|
||||
* @return bool
|
||||
*/
|
||||
function setObjType($objtype) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -502,14 +509,15 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
*/
|
||||
function getType() { return $this->_type; }
|
||||
|
||||
/**
|
||||
* Set type of attribute definition
|
||||
*
|
||||
* This can be one of type_int, type_float, type_string, type_boolean,
|
||||
* type_url, type_email.
|
||||
*
|
||||
* @param integer $type type
|
||||
*/
|
||||
/**
|
||||
* Set type of attribute definition
|
||||
*
|
||||
* This can be one of type_int, type_float, type_string, type_boolean,
|
||||
* type_url, type_email.
|
||||
*
|
||||
* @param integer $type type
|
||||
* @return bool
|
||||
*/
|
||||
function setType($type) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -529,12 +537,13 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
*/
|
||||
function getMultipleValues() { return $this->_multiple; }
|
||||
|
||||
/**
|
||||
* Set if attribute definition allows multi values for attribute
|
||||
*
|
||||
* @param boolean $mv true if attribute may have multiple values, otherwise
|
||||
* false
|
||||
*/
|
||||
/**
|
||||
* Set if attribute definition allows multi values for attribute
|
||||
*
|
||||
* @param boolean $mv true if attribute may have multiple values, otherwise
|
||||
* false
|
||||
* @return bool
|
||||
*/
|
||||
function setMultipleValues($mv) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -633,13 +642,14 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
return array();
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Get the n'th value of a value set
|
||||
*
|
||||
* @param interger $index
|
||||
* @return string n'th value of value set or false if the index is
|
||||
* out of range or the value set has less than 2 chars
|
||||
*/
|
||||
/**
|
||||
* Get the n'th value of a value set
|
||||
*
|
||||
* @param $ind
|
||||
* @return string n'th value of value set or false if the index is
|
||||
* out of range or the value set has less than 2 chars
|
||||
* @internal param int $index
|
||||
*/
|
||||
function getValueSetValue($ind) { /* {{{ */
|
||||
if(strlen($this->_valueset) > 1) {
|
||||
$tmp = explode($this->_valueset[0], substr($this->_valueset, 1));
|
||||
|
@ -745,17 +755,16 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Parse a given value according to attribute definition
|
||||
*
|
||||
* The return value is always an array, even if the attribute is single
|
||||
* value attribute.
|
||||
*
|
||||
* @return array list of single values
|
||||
*/
|
||||
/**
|
||||
* Parse a given value according to attribute definition
|
||||
*
|
||||
* The return value is always an array, even if the attribute is single
|
||||
* value attribute.
|
||||
*
|
||||
* @param $value
|
||||
* @return array|bool
|
||||
*/
|
||||
function parseValue($value) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
if($this->getMultipleValues()) {
|
||||
/* If the value doesn't start with the separator used in the value set,
|
||||
* then assume that the value was not saved with a leading separator.
|
||||
|
@ -771,7 +780,6 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
} else {
|
||||
return array($value);
|
||||
}
|
||||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
@ -779,8 +787,8 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
* attribute definition is used
|
||||
*
|
||||
* @param integer $limit return not more the n objects of each type
|
||||
* @return boolean true if attribute definition is used, otherwise false
|
||||
*/
|
||||
* @return array|bool
|
||||
*/
|
||||
function getStatistics($limit=0) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -997,8 +1005,8 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
if(!$success)
|
||||
$this->_validation_error = 3;
|
||||
break;
|
||||
case self::type_boolean:
|
||||
foreach($values as $value) {
|
||||
case self::type_boolean: /** @todo: Same case in LINE 966 */
|
||||
foreach($values as $value) {
|
||||
$success &= preg_match('/^[01]$/', $value);
|
||||
}
|
||||
break;
|
||||
|
@ -1043,4 +1051,3 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
function getValidationError() { return $this->_validation_error; }
|
||||
|
||||
} /* }}} */
|
||||
?>
|
||||
|
|
|
@ -74,7 +74,7 @@ require_once("inc.ClassAttribute.php");
|
|||
*/
|
||||
class SeedDMS_Core_DMS {
|
||||
/**
|
||||
* @var object $db reference to database object. This must be an instance
|
||||
* @var SeedDMS_Core_DatabaseAccess $db reference to database object. This must be an instance
|
||||
* of {@link SeedDMS_Core_DatabaseAccess}.
|
||||
* @access protected
|
||||
*/
|
||||
|
@ -88,7 +88,7 @@ class SeedDMS_Core_DMS {
|
|||
protected $classnames;
|
||||
|
||||
/**
|
||||
* @var object $user reference to currently logged in user. This must be
|
||||
* @var SeedDMS_Core_User $user reference to currently logged in user. This must be
|
||||
* an instance of {@link SeedDMS_Core_User}. This variable is currently not
|
||||
* used. It is set by {@link setUser}.
|
||||
* @access private
|
||||
|
@ -181,6 +181,11 @@ class SeedDMS_Core_DMS {
|
|||
*/
|
||||
public $callbacks;
|
||||
|
||||
/**
|
||||
* @var SeedDMS_Core_DMS
|
||||
*/
|
||||
public $_dms;
|
||||
|
||||
|
||||
/**
|
||||
* Checks if two objects are equal by comparing their IDs
|
||||
|
@ -214,7 +219,7 @@ class SeedDMS_Core_DMS {
|
|||
* The result of the function can be 0 which happens if the first element
|
||||
* of an indexed array matches.
|
||||
*
|
||||
* @param object $object1 object to look for (needle)
|
||||
* @param object $object object to look for (needle)
|
||||
* @param array $list list of objects (haystack)
|
||||
* @return boolean/integer index in array if object was found, otherwise false
|
||||
*/
|
||||
|
@ -294,7 +299,7 @@ class SeedDMS_Core_DMS {
|
|||
* given user. A link is only accessible, if it is publically visible,
|
||||
* owned by the user, or the accessing user is an administrator.
|
||||
*
|
||||
* @param array $links list of objects of type SeedDMS_Core_DocumentLink
|
||||
* @param SeedDMS_Core_DocumentLink[] $links list of objects of type SeedDMS_Core_DocumentLink
|
||||
* @param object $user user for which access is being checked
|
||||
* @param string $access set if source or target of link shall be checked
|
||||
* for sufficient access rights. Set to 'source' if the source document
|
||||
|
@ -341,14 +346,14 @@ class SeedDMS_Core_DMS {
|
|||
return $tmp;
|
||||
} /* }}} */
|
||||
|
||||
/** @noinspection PhpUndefinedClassInspection */
|
||||
/**
|
||||
* Create a new instance of the dms
|
||||
*
|
||||
* @param object $db object of class {@link SeedDMS_Core_DatabaseAccess}
|
||||
* @param SeedDMS_Core_DatabaseAccess $db object of class {@link SeedDMS_Core_DatabaseAccess}
|
||||
* to access the underlying database
|
||||
* @param string $contentDir path in filesystem containing the data store
|
||||
* all document contents is stored
|
||||
* @return object instance of {@link SeedDMS_Core_DMS}
|
||||
*/
|
||||
function __construct($db, $contentDir) { /* {{{ */
|
||||
$this->db = $db;
|
||||
|
@ -377,11 +382,11 @@ class SeedDMS_Core_DMS {
|
|||
/**
|
||||
* Return class name of instantiated objects
|
||||
*
|
||||
* This method returns the class name of those objects being instatiated
|
||||
* This method returns the class name of those objects being instantiated
|
||||
* by the dms. Each class has an internal place holder, which must be
|
||||
* passed to function.
|
||||
*
|
||||
* @param string placeholder (can be one of 'folder', 'document',
|
||||
* @param string $objectname placeholder (can be one of 'folder', 'document',
|
||||
* 'documentcontent', 'user', 'group'
|
||||
*
|
||||
* @return string/boolean name of class or false if placeholder is invalid
|
||||
|
@ -401,9 +406,9 @@ class SeedDMS_Core_DMS {
|
|||
* inherited from one of the available classes) implementing new
|
||||
* features. The method should be called in the postInitDMS hook.
|
||||
*
|
||||
* @param string placeholder (can be one of 'folder', 'document',
|
||||
* @param string $objectname placeholder (can be one of 'folder', 'document',
|
||||
* 'documentcontent', 'user', 'group'
|
||||
* @param string name of class
|
||||
* @param string $classname name of class
|
||||
*
|
||||
* @return string/boolean name of old class or false if not set
|
||||
*/
|
||||
|
@ -422,7 +427,7 @@ class SeedDMS_Core_DMS {
|
|||
* This method returns the database object as it was set by the first
|
||||
* parameter of the constructor.
|
||||
*
|
||||
* @return object database
|
||||
* @return SeedDMS_Core_DatabaseAccess database
|
||||
*/
|
||||
function getDB() { /* {{{ */
|
||||
return $this->db;
|
||||
|
@ -431,7 +436,7 @@ class SeedDMS_Core_DMS {
|
|||
/**
|
||||
* Return the database version
|
||||
*
|
||||
* @return array array with elements major, minor, subminor, date
|
||||
* @return array|bool
|
||||
*/
|
||||
function getDBVersion() { /* {{{ */
|
||||
$tbllist = $this->db->TableList();
|
||||
|
@ -478,7 +483,7 @@ class SeedDMS_Core_DMS {
|
|||
* This function must be called right after creating an instance of
|
||||
* {@link SeedDMS_Core_DMS}
|
||||
*
|
||||
* @param interger $id id of root folder
|
||||
* @param integer $id id of root folder
|
||||
*/
|
||||
function setRootFolderID($id) { /* {{{ */
|
||||
$this->rootFolderID = $id;
|
||||
|
@ -504,7 +509,7 @@ class SeedDMS_Core_DMS {
|
|||
* This function must be called right after creating an instance of
|
||||
* {@link SeedDMS_Core_DMS}
|
||||
*
|
||||
* @param interger $id id of root folder
|
||||
* @param integer $id id of root folder
|
||||
*/
|
||||
function setMaxDirID($id) { /* {{{ */
|
||||
$this->maxDirID = $id;
|
||||
|
@ -513,7 +518,7 @@ class SeedDMS_Core_DMS {
|
|||
/**
|
||||
* Get root folder
|
||||
*
|
||||
* @return object/boolean return the object of the root folder or false if
|
||||
* @return SeedDMS_Core_Folder|boolean return the object of the root folder or false if
|
||||
* the root folder id was not set before with {@link setRootFolderID}.
|
||||
*/
|
||||
function getRootFolder() { /* {{{ */
|
||||
|
@ -556,7 +561,7 @@ class SeedDMS_Core_DMS {
|
|||
* If user authentication was done externally, this function can
|
||||
* be used to tell the dms who is currently logged in.
|
||||
*
|
||||
* @return object $user
|
||||
* @return SeedDMS_Core_User $user
|
||||
*
|
||||
*/
|
||||
function getLoggedInUser() { /* {{{ */
|
||||
|
@ -569,7 +574,7 @@ class SeedDMS_Core_DMS {
|
|||
* This function retrieves a document from the database by its id.
|
||||
*
|
||||
* @param integer $id internal id of document
|
||||
* @return object instance of {@link SeedDMS_Core_Document} or false
|
||||
* @return SeedDMS_Core_Document instance of {@link SeedDMS_Core_Document} or false
|
||||
*/
|
||||
function getDocument($id) { /* {{{ */
|
||||
$classname = $this->classnames['document'];
|
||||
|
@ -601,7 +606,8 @@ class SeedDMS_Core_DMS {
|
|||
*
|
||||
* @param string $date date in format YYYY-MM-DD or an integer with the number
|
||||
* of days. A negative value will cover the days in the past.
|
||||
* @return array list of documents
|
||||
* @param SeedDMS_Core_User $user
|
||||
* @return bool|SeedDMS_Core_Document[]
|
||||
*/
|
||||
function getDocumentsExpired($date, $user=null) { /* {{{ */
|
||||
$db = $this->getDB();
|
||||
|
@ -649,8 +655,8 @@ class SeedDMS_Core_DMS {
|
|||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
||||
/** @var SeedDMS_Core_Document[] $documents */
|
||||
$documents = array();
|
||||
$ts = mktime(0, 0, 0) + 86400;
|
||||
foreach ($resArr as $row) {
|
||||
$document = $this->getDocument($row["id"]);
|
||||
if($updatestatus)
|
||||
|
@ -668,7 +674,7 @@ class SeedDMS_Core_DMS {
|
|||
*
|
||||
* @param string $name
|
||||
* @param object $folder
|
||||
* @return object/boolean found document or false
|
||||
* @return SeedDMS_Core_Document|boolean found document or false
|
||||
*/
|
||||
function getDocumentByName($name, $folder=null) { /* {{{ */
|
||||
if (!$name) return false;
|
||||
|
@ -689,6 +695,7 @@ class SeedDMS_Core_DMS {
|
|||
return false;
|
||||
|
||||
$row = $resArr[0];
|
||||
/** @var SeedDMS_Core_Document $document */
|
||||
$document = new $this->classnames['document']($row["id"], $row["name"], $row["comment"], $row["date"], $row["expires"], $row["owner"], $row["folder"], $row["inheritAccess"], $row["defaultAccess"], $row["lockUser"], $row["keywords"], $row["sequence"]);
|
||||
$document->setDMS($this);
|
||||
return $document;
|
||||
|
@ -703,7 +710,7 @@ class SeedDMS_Core_DMS {
|
|||
*
|
||||
* @param string $name
|
||||
* @param object $folder
|
||||
* @return object/boolean found document or false
|
||||
* @return SeedDMS_Core_Document|boolean found document or false
|
||||
*/
|
||||
function getDocumentByOriginalFilename($name, $folder=null) { /* {{{ */
|
||||
if (!$name) return false;
|
||||
|
@ -726,6 +733,7 @@ class SeedDMS_Core_DMS {
|
|||
return false;
|
||||
|
||||
$row = $resArr[0];
|
||||
/** @var SeedDMS_Core_Document $document */
|
||||
$document = new $this->classnames['document']($row["id"], $row["name"], $row["comment"], $row["date"], $row["expires"], $row["owner"], $row["folder"], $row["inheritAccess"], $row["defaultAccess"], $row["lockUser"], $row["keywords"], $row["sequence"]);
|
||||
$document->setDMS($this);
|
||||
return $document;
|
||||
|
@ -737,7 +745,7 @@ class SeedDMS_Core_DMS {
|
|||
* This function retrieves a document content from the database by its id.
|
||||
*
|
||||
* @param integer $id internal id of document content
|
||||
* @return object instance of {@link SeedDMS_Core_DocumentContent} or false
|
||||
* @return bool|SeedDMS_Core_Document or false
|
||||
*/
|
||||
function getDocumentContent($id) { /* {{{ */
|
||||
if (!is_numeric($id)) return false;
|
||||
|
@ -793,14 +801,13 @@ class SeedDMS_Core_DMS {
|
|||
*
|
||||
* @param string $listtype type of document list, can be 'AppRevByMe',
|
||||
* 'AppRevOwner', 'ReceiptByMe', 'ReviseByMe', 'LockedByMe', 'MyDocs'
|
||||
* @param object $param1 user
|
||||
* @param string $param2 set to true
|
||||
* @param SeedDMS_Core_User $param1 user
|
||||
* @param bool $param2 set to true
|
||||
* if 'AppRevByMe', 'ReviseByMe', 'ReceiptByMe' shall return even documents
|
||||
* І have already taken care of.
|
||||
* if 'ExpiredOwner' contains the date in days or as 'yyyy-mm-dd'
|
||||
* @param string $param3 sort list by this field
|
||||
* @param string $param4 order direction
|
||||
* @return array list of documents records
|
||||
* @return array|bool
|
||||
*/
|
||||
function getDocumentList($listtype, $param1=null, $param2=false, $param3='', $param4='') { /* {{{ */
|
||||
/* The following query will get all documents and lots of additional
|
||||
|
@ -1091,8 +1098,9 @@ class SeedDMS_Core_DMS {
|
|||
$orderdir = 'DESC';
|
||||
else
|
||||
$orderdir = 'ASC';
|
||||
/** @noinspection PhpUndefinedConstantInspection */
|
||||
$queryStr .= "AND `tblDocuments`.`owner` = '".$user->getID()."' ".
|
||||
"AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.", ".S_IN_REVISION.") ";
|
||||
"AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.", ".S_IN_REVISION.") "; /** @todo S_IN_REVISION is not defined */
|
||||
if ($orderby=='e') $queryStr .= "ORDER BY `expires`";
|
||||
else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`";
|
||||
else if ($orderby=='s') $queryStr .= "ORDER BY `status`";
|
||||
|
@ -1263,7 +1271,7 @@ class SeedDMS_Core_DMS {
|
|||
return mktime($hour, $min, $sec, $month, $day, $year);
|
||||
} /* }}} */
|
||||
|
||||
/*
|
||||
/**
|
||||
* Search the database for documents
|
||||
*
|
||||
* Note: the creation date will be used to check againts the
|
||||
|
@ -1273,30 +1281,30 @@ class SeedDMS_Core_DMS {
|
|||
* meanѕ that updateѕ of a document will only result in a searchable
|
||||
* modification if a new version is uploaded.
|
||||
*
|
||||
* @param query string seach query with space separated words
|
||||
* @param limit integer number of items in result set
|
||||
* @param offset integer index of first item in result set
|
||||
* @param logicalmode string either AND or OR
|
||||
* @param searchin array() list of fields to search in
|
||||
* @param string $query seach query with space separated words
|
||||
* @param integer $limit number of items in result set
|
||||
* @param integer $offset index of first item in result set
|
||||
* @param string $logicalmode either AND or OR
|
||||
* @param array $searchin list of fields to search in
|
||||
* 1 = keywords, 2=name, 3=comment, 4=attributes
|
||||
* @param startFolder object search in the folder only (null for root folder)
|
||||
* @param owner object search for documents owned by this user
|
||||
* @param status array list of status
|
||||
* @param creationstartdate array search for documents created after this date
|
||||
* @param creationenddate array search for documents created before this date
|
||||
* @param modificationstartdate array search for documents modified after this date
|
||||
* @param modificationenddate array search for documents modified before this date
|
||||
* @param categories array list of categories the documents must have assigned
|
||||
* @param attributes array list of attributes. The key of this array is the
|
||||
* @param SeedDMS_Core_Folder|null $startFolder search in the folder only (null for root folder)
|
||||
* @param SeedDMS_Core_User $owner search for documents owned by this user
|
||||
* @param array $status list of status
|
||||
* @param array $creationstartdate search for documents created after this date
|
||||
* @param array $creationenddate search for documents created before this date
|
||||
* @param array $modificationstartdate search for documents modified after this date
|
||||
* @param array $modificationenddate search for documents modified before this date
|
||||
* @param array $categories list of categories the documents must have assigned
|
||||
* @param array $attributes list of attributes. The key of this array is the
|
||||
* attribute definition id. The value of the array is the value of the
|
||||
* attribute. If the attribute may have multiple values it must be an array.
|
||||
* @param mode int decide whether to search for documents/folders
|
||||
* @param integer $mode decide whether to search for documents/folders
|
||||
* 0x1 = documents only
|
||||
* 0x2 = folders only
|
||||
* 0x3 = both
|
||||
* @param expirationstartdate array search for documents expiring after this date
|
||||
* @param expirationenddate array search for documents expiring before this date
|
||||
* @return array containing the elements total and docs
|
||||
* @param array $expirationstartdate search for documents expiring after this date
|
||||
* @param array $expirationenddate search for documents expiring before this date
|
||||
* @return array|bool
|
||||
*/
|
||||
function search($query, $limit=0, $offset=0, $logicalmode='AND', $searchin=array(), $startFolder=null, $owner=null, $status = array(), $creationstartdate=array(), $creationenddate=array(), $modificationstartdate=array(), $modificationenddate=array(), $categories=array(), $attributes=array(), $mode=0x3, $expirationstartdate=array(), $expirationenddate=array()) { /* {{{ */
|
||||
// Split the search string into constituent keywords.
|
||||
|
@ -1379,6 +1387,7 @@ class SeedDMS_Core_DMS {
|
|||
if ($creationenddate) {
|
||||
$stopdate = SeedDMS_Core_DMS::makeTimeStamp($creationenddate['hour'], $creationstartdate['minute'], $creationstartdate['second'], $creationenddate["year"], $creationenddate["month"], $creationenddate["day"]);
|
||||
if ($stopdate) {
|
||||
/** @noinspection PhpUndefinedVariableInspection */
|
||||
if($startdate)
|
||||
$searchCreateDate .= " AND ";
|
||||
$searchCreateDate .= "`tblFolders`.`date` <= ".$stopdate;
|
||||
|
@ -1440,6 +1449,7 @@ class SeedDMS_Core_DMS {
|
|||
foreach ($resArr as $folderArr) {
|
||||
$folders[] = $this->getFolder($folderArr['id']);
|
||||
}
|
||||
/** @noinspection PhpUndefinedVariableInspection */
|
||||
$folderresult = array('totalFolders'=>$totalFolders, 'folders'=>$folders);
|
||||
}
|
||||
} else {
|
||||
|
@ -1517,6 +1527,7 @@ class SeedDMS_Core_DMS {
|
|||
} elseif($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent) {
|
||||
if($attrdef->getValueSet()) {
|
||||
if($attrdef->getMultipleValues()) {
|
||||
/** @noinspection PhpUndefinedVariableInspection */
|
||||
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentContentAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblDocumentContentAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblDocumentContentAttributes`.`document` = `tblDocumentContent`.`id`)";
|
||||
} else {
|
||||
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentContentAttributes`.`value`='".$attribute."' AND `tblDocumentContentAttributes`.content = `tblDocumentContent`.id)";
|
||||
|
@ -1675,6 +1686,7 @@ class SeedDMS_Core_DMS {
|
|||
foreach ($resArr as $docArr) {
|
||||
$docs[] = $this->getDocument($docArr['id']);
|
||||
}
|
||||
/** @noinspection PhpUndefinedVariableInspection */
|
||||
$docresult = array('totalDocs'=>$totalDocs, 'docs'=>$docs);
|
||||
}
|
||||
} else {
|
||||
|
@ -1702,7 +1714,7 @@ class SeedDMS_Core_DMS {
|
|||
* This function retrieves a folder from the database by its id.
|
||||
*
|
||||
* @param integer $id internal id of folder
|
||||
* @return object instance of SeedDMS_Core_Folder or false
|
||||
* @return SeedDMS_Core_Folder instance of SeedDMS_Core_Folder or false
|
||||
*/
|
||||
function getFolder($id) { /* {{{ */
|
||||
$classname = $this->classnames['folder'];
|
||||
|
@ -1718,8 +1730,8 @@ class SeedDMS_Core_DMS {
|
|||
* only within this parent folder. It will not be done recursively.
|
||||
*
|
||||
* @param string $name name of the folder
|
||||
* @param object $folder parent folder
|
||||
* @return object/boolean found folder or false
|
||||
* @param SeedDMS_Core_Folder $folder parent folder
|
||||
* @return SeedDMS_Core_Folder|boolean found folder or false
|
||||
*/
|
||||
function getFolderByName($name, $folder=null) { /* {{{ */
|
||||
if (!$name) return false;
|
||||
|
@ -1737,6 +1749,7 @@ class SeedDMS_Core_DMS {
|
|||
return false;
|
||||
|
||||
$resArr = $resArr[0];
|
||||
/** @var SeedDMS_Core_Folder $folder */
|
||||
$folder = new $this->classnames['folder']($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["date"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]);
|
||||
$folder->setDMS($this);
|
||||
return $folder;
|
||||
|
@ -1747,7 +1760,7 @@ class SeedDMS_Core_DMS {
|
|||
*
|
||||
* This function checks all folders in the database.
|
||||
*
|
||||
* @return array list of errors
|
||||
* @return array|bool
|
||||
*/
|
||||
function checkFolders() { /* {{{ */
|
||||
$queryStr = "SELECT * FROM `tblFolders`";
|
||||
|
@ -1781,7 +1794,7 @@ class SeedDMS_Core_DMS {
|
|||
*
|
||||
* This function checks all documents in the database.
|
||||
*
|
||||
* @return array list of errors
|
||||
* @return array|bool
|
||||
*/
|
||||
function checkDocuments() { /* {{{ */
|
||||
$queryStr = "SELECT * FROM `tblFolders`";
|
||||
|
@ -1827,7 +1840,7 @@ class SeedDMS_Core_DMS {
|
|||
* This function retrieves a user from the database by its id.
|
||||
*
|
||||
* @param integer $id internal id of user
|
||||
* @return object instance of {@link SeedDMS_Core_User} or false
|
||||
* @return SeedDMS_Core_User|boolean instance of {@link SeedDMS_Core_User} or false
|
||||
*/
|
||||
function getUser($id) { /* {{{ */
|
||||
$classname = $this->classnames['user'];
|
||||
|
@ -1867,7 +1880,9 @@ class SeedDMS_Core_DMS {
|
|||
/**
|
||||
* Return list of all users
|
||||
*
|
||||
* @return array of instances of {@link SeedDMS_Core_User} or false
|
||||
* @param string $orderby
|
||||
* @return array of instances of <a href='psi_element://SeedDMS_Core_User'>SeedDMS_Core_User</a> or false
|
||||
* or false
|
||||
*/
|
||||
function getAllUsers($orderby = '') { /* {{{ */
|
||||
$classname = $this->classnames['user'];
|
||||
|
@ -1879,14 +1894,19 @@ class SeedDMS_Core_DMS {
|
|||
*
|
||||
* @param string $login login name
|
||||
* @param string $pwd password of new user
|
||||
* @param $fullName
|
||||
* @param string $email Email of new user
|
||||
* @param string $language language of new user
|
||||
* @param $theme
|
||||
* @param string $comment comment of new user
|
||||
* @param integer $role role of new user (can be 0=normal, 1=admin, 2=guest)
|
||||
* @param int|string $role role of new user (can be 0=normal, 1=admin, 2=guest)
|
||||
* @param integer $isHidden hide user in all lists, if this is set login
|
||||
* is still allowed
|
||||
* @param integer $isDisabled disable user and prevent login
|
||||
* @return object of {@link SeedDMS_Core_User}
|
||||
* @param string $pwdexpiration
|
||||
* @param int $quota
|
||||
* @param null $homefolder
|
||||
* @return bool|SeedDMS_Core_User
|
||||
*/
|
||||
function addUser($login, $pwd, $fullName, $email, $language, $theme, $comment, $role='0', $isHidden=0, $isDisabled=0, $pwdexpiration='', $quota=0, $homefolder=null) { /* {{{ */
|
||||
$db = $this->db;
|
||||
|
@ -1912,6 +1932,7 @@ class SeedDMS_Core_DMS {
|
|||
/* Check if 'onPostAddUser' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddUser'])) {
|
||||
foreach($this->_dms->callbacks['onPostUser'] as $callback) {
|
||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||
if(!call_user_func($callback[0], $callback[1], $user)) {
|
||||
}
|
||||
}
|
||||
|
@ -1924,7 +1945,7 @@ class SeedDMS_Core_DMS {
|
|||
* Get a group by its id
|
||||
*
|
||||
* @param integer $id id of group
|
||||
* @return object/boolean group or false if no group was found
|
||||
* @return SeedDMS_Core_Group|boolean group or false if no group was found
|
||||
*/
|
||||
function getGroup($id) { /* {{{ */
|
||||
$classname = $this->classnames['group'];
|
||||
|
@ -1935,7 +1956,7 @@ class SeedDMS_Core_DMS {
|
|||
* Get a group by its name
|
||||
*
|
||||
* @param string $name name of group
|
||||
* @return object/boolean group or false if no group was found
|
||||
* @return SeedDMS_Core_Group|boolean group or false if no group was found
|
||||
*/
|
||||
function getGroupByName($name) { /* {{{ */
|
||||
$classname = $this->classnames['group'];
|
||||
|
@ -1945,7 +1966,7 @@ class SeedDMS_Core_DMS {
|
|||
/**
|
||||
* Get a list of all groups
|
||||
*
|
||||
* @return array array of instances of {@link SeedDMS_Core_Group}
|
||||
* @return SeedDMS_Core_Group[] array of instances of {@link SeedDMS_Core_Group}
|
||||
*/
|
||||
function getAllGroups() { /* {{{ */
|
||||
$classname = $this->classnames['group'];
|
||||
|
@ -1957,7 +1978,7 @@ class SeedDMS_Core_DMS {
|
|||
*
|
||||
* @param string $name name of group
|
||||
* @param string $comment comment of group
|
||||
* @return object/boolean instance of {@link SeedDMS_Core_Group} or false in
|
||||
* @return SeedDMS_Core_Group|boolean instance of {@link SeedDMS_Core_Group} or false in
|
||||
* case of an error.
|
||||
*/
|
||||
function addGroup($name, $comment) { /* {{{ */
|
||||
|
@ -1974,6 +1995,7 @@ class SeedDMS_Core_DMS {
|
|||
/* Check if 'onPostAddGroup' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddGroup'])) {
|
||||
foreach($this->_dms->callbacks['onPostAddGroup'] as $callback) {
|
||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||
if(!call_user_func($callback[0], $callback[1], $group)) {
|
||||
}
|
||||
}
|
||||
|
@ -2030,6 +2052,8 @@ class SeedDMS_Core_DMS {
|
|||
|
||||
/**
|
||||
* This function should be replaced by getAllKeywordCategories()
|
||||
* @param $userID
|
||||
* @return SeedDMS_Core_KeywordCategory[]|bool
|
||||
*/
|
||||
function getAllUserKeywordCategories($userID) { /* {{{ */
|
||||
$queryStr = "SELECT * FROM `tblKeywordCategories`";
|
||||
|
@ -2063,6 +2087,7 @@ class SeedDMS_Core_DMS {
|
|||
/* Check if 'onPostAddKeywordCategory' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddKeywordCategory'])) {
|
||||
foreach($this->_dms->callbacks['onPostAddKeywordCategory'] as $callback) {
|
||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||
if(!call_user_func($callback[0], $callback[1], $category)) {
|
||||
}
|
||||
}
|
||||
|
@ -2109,7 +2134,7 @@ class SeedDMS_Core_DMS {
|
|||
* The name of a category is by default unique.
|
||||
*
|
||||
* @param string $name human readable name of category
|
||||
* @return object instance of {@link SeedDMS_Core_DocumentCategory}
|
||||
* @return SeedDMS_Core_DocumentCategory|boolean instance of {@link SeedDMS_Core_DocumentCategory}
|
||||
*/
|
||||
function getDocumentCategoryByName($name) { /* {{{ */
|
||||
if (!$name) return false;
|
||||
|
@ -2139,6 +2164,7 @@ class SeedDMS_Core_DMS {
|
|||
/* Check if 'onPostAddDocumentCategory' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddDocumentCategory'])) {
|
||||
foreach($this->_dms->callbacks['onPostAddDocumentCategory'] as $callback) {
|
||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||
if(!call_user_func($callback[0], $callback[1], $category)) {
|
||||
}
|
||||
}
|
||||
|
@ -2178,7 +2204,8 @@ class SeedDMS_Core_DMS {
|
|||
* This function will not delete the password but just creates an entry
|
||||
* in tblUserRequestPassword indicating a password request.
|
||||
*
|
||||
* @return string hash value of false in case of an error
|
||||
* @param SeedDMS_Core_User $user
|
||||
* @return string|boolean hash value of false in case of an error
|
||||
*/
|
||||
function createPasswordRequest($user) { /* {{{ */
|
||||
$hash = md5(uniqid(time()));
|
||||
|
@ -2195,6 +2222,7 @@ class SeedDMS_Core_DMS {
|
|||
* returns the user.
|
||||
*
|
||||
* @param string $hash
|
||||
* @return bool|SeedDMS_Core_User
|
||||
*/
|
||||
function checkPasswordRequest($hash) { /* {{{ */
|
||||
/* Get the password request from the database */
|
||||
|
@ -2215,6 +2243,7 @@ class SeedDMS_Core_DMS {
|
|||
* Delete a password request
|
||||
*
|
||||
* @param string $hash
|
||||
* @return bool
|
||||
*/
|
||||
function deletePasswordRequest($hash) { /* {{{ */
|
||||
/* Delete the request, so nobody can use it a second time */
|
||||
|
@ -2231,7 +2260,7 @@ class SeedDMS_Core_DMS {
|
|||
* its id.
|
||||
*
|
||||
* @param integer $id internal id of attribute defintion
|
||||
* @return object instance of {@link SeedDMS_Core_AttributeDefinition} or false
|
||||
* @return bool|SeedDMS_Core_AttributeDefinition or false
|
||||
*/
|
||||
function getAttributeDefinition($id) { /* {{{ */
|
||||
if (!is_numeric($id))
|
||||
|
@ -2256,7 +2285,7 @@ class SeedDMS_Core_DMS {
|
|||
* This function retrieves an attribute def. from the database by its name.
|
||||
*
|
||||
* @param string $name internal name of attribute def.
|
||||
* @return object instance of {@link SeedDMS_Core_AttributeDefinition} or false
|
||||
* @return SeedDMS_Core_AttributeDefinition|boolean instance of {@link SeedDMS_Core_AttributeDefinition} or false
|
||||
*/
|
||||
function getAttributeDefinitionByName($name) { /* {{{ */
|
||||
if (!$name) return false;
|
||||
|
@ -2278,7 +2307,8 @@ class SeedDMS_Core_DMS {
|
|||
* Return list of all attributes definitions
|
||||
*
|
||||
* @param integer $objtype select those attributes defined for an object type
|
||||
* @return array of instances of {@link SeedDMS_Core_AttributeDefinition} or false
|
||||
* @return bool|SeedDMS_Core_AttributeDefinition[] of instances of <a href='psi_element://SeedDMS_Core_AttributeDefinition'>SeedDMS_Core_AttributeDefinition</a> or false
|
||||
* or false
|
||||
*/
|
||||
function getAllAttributeDefinitions($objtype=0) { /* {{{ */
|
||||
$queryStr = "SELECT * FROM `tblAttributeDefinitions`";
|
||||
|
@ -2294,6 +2324,7 @@ class SeedDMS_Core_DMS {
|
|||
if (is_bool($resArr) && $resArr == false)
|
||||
return false;
|
||||
|
||||
/** @var SeedDMS_Core_AttributeDefinition[] $attrdefs */
|
||||
$attrdefs = array();
|
||||
|
||||
for ($i = 0; $i < count($resArr); $i++) {
|
||||
|
@ -2309,12 +2340,14 @@ class SeedDMS_Core_DMS {
|
|||
* Add a new attribute definition
|
||||
*
|
||||
* @param string $name name of attribute
|
||||
* @param $objtype
|
||||
* @param string $type type of attribute
|
||||
* @param boolean $multiple set to 1 if attribute has multiple attributes
|
||||
* @param bool|int $multiple set to 1 if attribute has multiple attributes
|
||||
* @param integer $minvalues minimum number of values
|
||||
* @param integer $maxvalues maximum number of values if multiple is set
|
||||
* @param string $valueset list of allowed values (csv format)
|
||||
* @return object of {@link SeedDMS_Core_User}
|
||||
* @param string $regex
|
||||
* @return bool|SeedDMS_Core_User
|
||||
*/
|
||||
function addAttributeDefinition($name, $objtype, $type, $multiple=0, $minvalues=0, $maxvalues=1, $valueset='', $regex='') { /* {{{ */
|
||||
if (is_object($this->getAttributeDefinitionByName($name))) {
|
||||
|
@ -2339,7 +2372,7 @@ class SeedDMS_Core_DMS {
|
|||
/**
|
||||
* Return list of all workflows
|
||||
*
|
||||
* @return array of instances of {@link SeedDMS_Core_Workflow} or false
|
||||
* @return SeedDMS_Core_Workflow[]|bool of instances of {@link SeedDMS_Core_Workflow} or false
|
||||
*/
|
||||
function getAllWorkflows() { /* {{{ */
|
||||
$queryStr = "SELECT * FROM `tblWorkflows` ORDER BY `name`";
|
||||
|
@ -2358,8 +2391,10 @@ class SeedDMS_Core_DMS {
|
|||
$wkfstates[$ressArr[$i]["id"]] = new SeedDMS_Core_Workflow_State($ressArr[$i]["id"], $ressArr[$i]["name"], $ressArr[$i]["maxtime"], $ressArr[$i]["precondfunc"], $ressArr[$i]["documentstatus"]);
|
||||
}
|
||||
|
||||
/** @var SeedDMS_Core_Workflow[] $workflows */
|
||||
$workflows = array();
|
||||
for ($i = 0; $i < count($resArr); $i++) {
|
||||
/** @noinspection PhpUndefinedVariableInspection */
|
||||
$workflow = new SeedDMS_Core_Workflow($resArr[$i]["id"], $resArr[$i]["name"], $wkfstates[$resArr[$i]["initstate"]]);
|
||||
$workflow->setDMS($this);
|
||||
$workflows[$i] = $workflow;
|
||||
|
@ -2372,7 +2407,7 @@ class SeedDMS_Core_DMS {
|
|||
* Return workflow by its Id
|
||||
*
|
||||
* @param integer $id internal id of workflow
|
||||
* @return object of instances of {@link SeedDMS_Core_Workflow} or false
|
||||
* @return SeedDMS_Core_Workflow|bool of instances of {@link SeedDMS_Core_Workflow} or false
|
||||
*/
|
||||
function getWorkflow($id) { /* {{{ */
|
||||
$queryStr = "SELECT * FROM `tblWorkflows` WHERE `id`=".intval($id);
|
||||
|
@ -2396,7 +2431,7 @@ class SeedDMS_Core_DMS {
|
|||
* Return workflow by its name
|
||||
*
|
||||
* @param string $name name of workflow
|
||||
* @return object of instances of {@link SeedDMS_Core_Workflow} or false
|
||||
* @return SeedDMS_Core_Workflow|bool of instances of {@link SeedDMS_Core_Workflow} or false
|
||||
*/
|
||||
function getWorkflowByName($name) { /* {{{ */
|
||||
if (!$name) return false;
|
||||
|
@ -2422,7 +2457,8 @@ class SeedDMS_Core_DMS {
|
|||
* Add a new workflow
|
||||
*
|
||||
* @param string $name name of workflow
|
||||
* @param string $initstate initial state of workflow
|
||||
* @param SeedDMS_Core_Workflow_State $initstate initial state of workflow
|
||||
* @return bool|SeedDMS_Core_Workflow
|
||||
*/
|
||||
function addWorkflow($name, $initstate) { /* {{{ */
|
||||
$db = $this->db;
|
||||
|
@ -2443,7 +2479,7 @@ class SeedDMS_Core_DMS {
|
|||
* This function retrieves a workflow state from the database by its id.
|
||||
*
|
||||
* @param integer $id internal id of workflow state
|
||||
* @return object instance of {@link SeedDMS_Core_Workflow_State} or false
|
||||
* @return bool|SeedDMS_Core_Workflow_State or false
|
||||
*/
|
||||
function getWorkflowState($id) { /* {{{ */
|
||||
if (!is_numeric($id))
|
||||
|
@ -2466,7 +2502,7 @@ class SeedDMS_Core_DMS {
|
|||
* Return workflow state by its name
|
||||
*
|
||||
* @param string $name name of workflow state
|
||||
* @return object of instances of {@link SeedDMS_Core_Workflow_State} or false
|
||||
* @return bool|SeedDMS_Core_Workflow_State or false
|
||||
*/
|
||||
function getWorkflowStateByName($name) { /* {{{ */
|
||||
if (!$name) return false;
|
||||
|
@ -2491,7 +2527,7 @@ class SeedDMS_Core_DMS {
|
|||
/**
|
||||
* Return list of all workflow states
|
||||
*
|
||||
* @return array of instances of {@link SeedDMS_Core_Workflow_State} or false
|
||||
* @return SeedDMS_Core_Workflow_State[]|bool of instances of {@link SeedDMS_Core_Workflow_State} or false
|
||||
*/
|
||||
function getAllWorkflowStates() { /* {{{ */
|
||||
$queryStr = "SELECT * FROM `tblWorkflowStates` ORDER BY `name`";
|
||||
|
@ -2515,7 +2551,7 @@ class SeedDMS_Core_DMS {
|
|||
*
|
||||
* @param string $name name of workflow state
|
||||
* @param integer $docstatus document status when this state is reached
|
||||
* @return object instance of new workflow state
|
||||
* @return bool|SeedDMS_Core_Workflow_State
|
||||
*/
|
||||
function addWorkflowState($name, $docstatus) { /* {{{ */
|
||||
$db = $this->db;
|
||||
|
@ -2536,7 +2572,7 @@ class SeedDMS_Core_DMS {
|
|||
* This function retrieves a workflow action from the database by its id.
|
||||
*
|
||||
* @param integer $id internal id of workflow action
|
||||
* @return object instance of {@link SeedDMS_Core_Workflow_Action} or false
|
||||
* @return SeedDMS_Core_Workflow_Action|bool instance of {@link SeedDMS_Core_Workflow_Action} or false
|
||||
*/
|
||||
function getWorkflowAction($id) { /* {{{ */
|
||||
if (!is_numeric($id))
|
||||
|
@ -2561,7 +2597,7 @@ class SeedDMS_Core_DMS {
|
|||
* This function retrieves a workflow action from the database by its name.
|
||||
*
|
||||
* @param string $name name of workflow action
|
||||
* @return object instance of {@link SeedDMS_Core_Workflow_Action} or false
|
||||
* @return SeedDMS_Core_Workflow_Action|bool instance of {@link SeedDMS_Core_Workflow_Action} or false
|
||||
*/
|
||||
function getWorkflowActionByName($name) { /* {{{ */
|
||||
if (!$name) return false;
|
||||
|
@ -2582,7 +2618,7 @@ class SeedDMS_Core_DMS {
|
|||
/**
|
||||
* Return list of workflow action
|
||||
*
|
||||
* @return array list of instances of {@link SeedDMS_Core_Workflow_Action} or false
|
||||
* @return SeedDMS_Core_Workflow_Action[]|bool list of instances of {@link SeedDMS_Core_Workflow_Action} or false
|
||||
*/
|
||||
function getAllWorkflowActions() { /* {{{ */
|
||||
$queryStr = "SELECT * FROM `tblWorkflowActions`";
|
||||
|
@ -2591,6 +2627,7 @@ class SeedDMS_Core_DMS {
|
|||
if (is_bool($resArr) && $resArr == false)
|
||||
return false;
|
||||
|
||||
/** @var SeedDMS_Core_Workflow_Action[] $wkfactions */
|
||||
$wkfactions = array();
|
||||
for ($i = 0; $i < count($resArr); $i++) {
|
||||
$action = new SeedDMS_Core_Workflow_Action($resArr[$i]["id"], $resArr[$i]["name"]);
|
||||
|
@ -2605,7 +2642,7 @@ class SeedDMS_Core_DMS {
|
|||
* Add new workflow action
|
||||
*
|
||||
* @param string $name name of workflow action
|
||||
* @return object instance new workflow action
|
||||
* @return SeedDMS_Core_Workflow_Action|bool
|
||||
*/
|
||||
function addWorkflowAction($name) { /* {{{ */
|
||||
$db = $this->db;
|
||||
|
@ -2626,7 +2663,7 @@ class SeedDMS_Core_DMS {
|
|||
* This function retrieves a workflow transition from the database by its id.
|
||||
*
|
||||
* @param integer $id internal id of workflow transition
|
||||
* @return object instance of {@link SeedDMS_Core_Workflow_Transition} or false
|
||||
* @return SeedDMS_Core_Workflow_Transition|bool instance of {@link SeedDMS_Core_Workflow_Transition} or false
|
||||
*/
|
||||
function getWorkflowTransition($id) { /* {{{ */
|
||||
if (!is_numeric($id))
|
||||
|
@ -2653,6 +2690,8 @@ class SeedDMS_Core_DMS {
|
|||
* but little checks for database consistency and possible errors
|
||||
* in the application may have left over document content though
|
||||
* the document is gone already.
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
function getUnlinkedDocumentContent() { /* {{{ */
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` NOT IN (SELECT id FROM `tblDocuments`)";
|
||||
|
@ -2662,6 +2701,7 @@ class SeedDMS_Core_DMS {
|
|||
|
||||
$versions = array();
|
||||
foreach($resArr as $row) {
|
||||
/** @var SeedDMS_Core_Document $document */
|
||||
$document = new $this->classnames['document']($row['document'], '', '', '', '', '', '', '', '', '', '', '');
|
||||
$document->setDMS($this);
|
||||
$version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']);
|
||||
|
@ -2677,6 +2717,8 @@ class SeedDMS_Core_DMS {
|
|||
* This method is for finding document content without a file size
|
||||
* set in the database. The file size of a document content was introduced
|
||||
* in version 4.0.0 of SeedDMS for implementation of user quotas.
|
||||
*
|
||||
* @return SeedDMS_Core_Document[]|bool
|
||||
*/
|
||||
function getNoFileSizeDocumentContent() { /* {{{ */
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `fileSize` = 0 OR `fileSize` is null";
|
||||
|
@ -2684,8 +2726,10 @@ class SeedDMS_Core_DMS {
|
|||
if ($resArr === false)
|
||||
return false;
|
||||
|
||||
/** @var SeedDMS_Core_Document[] $versions */
|
||||
$versions = array();
|
||||
foreach($resArr as $row) {
|
||||
/** @var SeedDMS_Core_Document $document */
|
||||
$document = new $this->classnames['document']($row['document'], '', '', '', '', '', '', '', '', '', '', '');
|
||||
$document->setDMS($this);
|
||||
$version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum'], $row['fileSize'], $row['checksum']);
|
||||
|
@ -2701,6 +2745,7 @@ class SeedDMS_Core_DMS {
|
|||
* This method is for finding document content without a checksum
|
||||
* set in the database. The checksum of a document content was introduced
|
||||
* in version 4.0.0 of SeedDMS for finding duplicates.
|
||||
* @return bool|SeedDMS_Core_Document[]
|
||||
*/
|
||||
function getNoChecksumDocumentContent() { /* {{{ */
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `checksum` = '' OR `checksum` is null";
|
||||
|
@ -2708,8 +2753,10 @@ class SeedDMS_Core_DMS {
|
|||
if ($resArr === false)
|
||||
return false;
|
||||
|
||||
/** @var SeedDMS_Core_Document[] $versions */
|
||||
$versions = array();
|
||||
foreach($resArr as $row) {
|
||||
/** @var SeedDMS_Core_Document $document */
|
||||
$document = new $this->classnames['document']($row['document'], '', '', '', '', '', '', '', '', '', '', '');
|
||||
$document->setDMS($this);
|
||||
$version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']);
|
||||
|
@ -2725,6 +2772,7 @@ class SeedDMS_Core_DMS {
|
|||
* This method is for finding document content which is available twice
|
||||
* in the database. The checksum of a document content was introduced
|
||||
* in version 4.0.0 of SeedDMS for finding duplicates.
|
||||
* @return array|bool
|
||||
*/
|
||||
function getDuplicateDocumentContent() { /* {{{ */
|
||||
$queryStr = "SELECT a.*, b.`id` as dupid FROM `tblDocumentContent` a LEFT JOIN `tblDocumentContent` b ON a.`checksum`=b.`checksum` where a.`id`!=b.`id` ORDER by a.`id` LIMIT 1000";
|
||||
|
@ -2732,6 +2780,7 @@ class SeedDMS_Core_DMS {
|
|||
if (!$resArr)
|
||||
return false;
|
||||
|
||||
/** @var SeedDMS_Core_Document[] $versions */
|
||||
$versions = array();
|
||||
foreach($resArr as $row) {
|
||||
$document = $this->getDocument($row['document']);
|
||||
|
@ -2752,6 +2801,10 @@ class SeedDMS_Core_DMS {
|
|||
*
|
||||
* This method is for finding reviews or approvals whose user
|
||||
* or group was deleted and not just removed from the process.
|
||||
*
|
||||
* @param string $process
|
||||
* @param string $usergroup
|
||||
* @return array
|
||||
*/
|
||||
function getProcessWithoutUserGroup($process, $usergroup) { /* {{{ */
|
||||
switch($process) {
|
||||
|
@ -2762,6 +2815,7 @@ class SeedDMS_Core_DMS {
|
|||
$queryStr = "SELECT a.*, b.`name` FROM `tblDocumentApprovers`";
|
||||
break;
|
||||
}
|
||||
/** @noinspection PhpUndefinedVariableInspection */
|
||||
$queryStr .= " a LEFT JOIN `tblDocuments` b ON a.`documentID`=b.`id` where";
|
||||
switch($usergroup) {
|
||||
case 'user':
|
||||
|
@ -2781,6 +2835,10 @@ class SeedDMS_Core_DMS {
|
|||
* This method is for removing all reviews or approvals whose user
|
||||
* or group was deleted and not just removed from the process.
|
||||
* If the optional parameter $id is set, only this user/group id is removed.
|
||||
* @param string $process
|
||||
* @param string $usergroup
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
function removeProcessWithoutUserGroup($process, $usergroup, $id=0) { /* {{{ */
|
||||
/* Entries of tblDocumentReviewLog or tblDocumentApproveLog are deleted
|
||||
|
@ -2794,6 +2852,7 @@ class SeedDMS_Core_DMS {
|
|||
$queryStr = "DELETE FROM tblDocumentApprovers";
|
||||
break;
|
||||
}
|
||||
/** @noinspection PhpUndefinedVariableInspection */
|
||||
$queryStr .= " WHERE";
|
||||
switch($usergroup) {
|
||||
case 'user':
|
||||
|
@ -2819,7 +2878,7 @@ class SeedDMS_Core_DMS {
|
|||
* documents or used space per user, recent activity, etc.
|
||||
*
|
||||
* @param string $type type of statistic
|
||||
* @return array statistical data
|
||||
* @return array|bool
|
||||
*/
|
||||
function getStatisticalData($type='') { /* {{{ */
|
||||
switch($type) {
|
||||
|
@ -2845,6 +2904,7 @@ class SeedDMS_Core_DMS {
|
|||
|
||||
return $resArr;
|
||||
case 'docsperstatus':
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$queryStr = "select b.`status` as `key`, count(b.`status`) as total from (select a.id, max(b.version), max(c.`statusLogID`) as maxlog from `tblDocuments` a left join `tblDocumentStatus` b on a.id=b.`documentID` left join `tblDocumentStatusLog` c on b.`statusID`=c.`statusID` group by a.`id`, b.`version` order by a.`id`, b.`statusID`) a left join `tblDocumentStatusLog` b on a.`maxlog`=b.`statusLogID` group by b.`status`";
|
||||
$queryStr = "select b.`status` as `key`, count(b.`status`) as total from (select a.`id`, max(c.`statusLogID`) as maxlog from `tblDocuments` a left join `tblDocumentStatus` b on a.id=b.`documentID` left join `tblDocumentStatusLog` c on b.`statusID`=c.`statusID` group by a.`id` order by a.id) a left join `tblDocumentStatusLog` b on a.maxlog=b.`statusLogID` group by b.`status`";
|
||||
$resArr = $this->db->getResultArray($queryStr);
|
||||
|
@ -2895,15 +2955,19 @@ class SeedDMS_Core_DMS {
|
|||
* entries in the database tables tblDocumentContent, tblDocumentFiles,
|
||||
* and tblDocumentStatusLog
|
||||
*
|
||||
* @param string $start start date, defaults to start of current day
|
||||
* @param string $end end date, defaults to end of start day
|
||||
* @return array list of changes
|
||||
* @param string $startts
|
||||
* @param string $endts
|
||||
* @return array|bool
|
||||
* @internal param string $start start date, defaults to start of current day
|
||||
* @internal param string $end end date, defaults to end of start day
|
||||
*/
|
||||
function getTimeline($startts='', $endts='') { /* {{{ */
|
||||
if(!$startts)
|
||||
$startts = mktime(0, 0, 0);
|
||||
if(!$endts)
|
||||
$endts = $startts+86400;
|
||||
|
||||
/** @var SeedDMS_Core_Document[] $timeline */
|
||||
$timeline = array();
|
||||
|
||||
$queryStr = "SELECT DISTINCT document FROM `tblDocumentContent` WHERE `date` > ".$startts." AND `date` < ".$endts." UNION SELECT DISTINCT document FROM `tblDocumentFiles` WHERE `date` > ".$startts." AND `date` < ".$endts;
|
||||
|
@ -2948,6 +3012,7 @@ class SeedDMS_Core_DMS {
|
|||
* Create an sql dump of the complete database
|
||||
*
|
||||
* @param string $filename name of dump file
|
||||
* @return bool
|
||||
*/
|
||||
function createDump($filename) { /* {{{ */
|
||||
$h = fopen($filename, "w");
|
||||
|
@ -2979,4 +3044,3 @@ class SeedDMS_Core_DMS {
|
|||
} /* }}} */
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -176,7 +176,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
protected $_keywords;
|
||||
|
||||
/**
|
||||
* @var array list of categories
|
||||
* @var SeedDMS_Core_DocumentCategory[] list of categories
|
||||
*/
|
||||
protected $_categories;
|
||||
|
||||
|
@ -186,7 +186,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
protected $_sequence;
|
||||
|
||||
/**
|
||||
* @var object temp. storage for latestcontent
|
||||
* @var SeedDMS_Core_DocumentContent temp. storage for latestcontent
|
||||
*/
|
||||
protected $_latestContent;
|
||||
|
||||
|
@ -195,6 +195,14 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
*/
|
||||
protected $_content;
|
||||
|
||||
/**
|
||||
* @var SeedDMS_Core_Folder
|
||||
*/
|
||||
protected $_folder;
|
||||
|
||||
/** @var array of SeedDMS_Core_UserAccess and SeedDMS_Core_GroupAccess */
|
||||
protected $_accessList;
|
||||
|
||||
function __construct($id, $name, $comment, $date, $expires, $ownerID, $folderID, $inheritAccess, $defaultAccess, $locked, $keywords, $sequence) { /* {{{ */
|
||||
parent::__construct($id);
|
||||
$this->_name = $name;
|
||||
|
@ -218,6 +226,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* Return an array of database fields which used for searching
|
||||
* a term entered in the database search form
|
||||
*
|
||||
* @param SeedDMS_Core_DMS $dms
|
||||
* @param array $searchin integer list of search scopes (2=name, 3=comment,
|
||||
* 4=attributes)
|
||||
* @return array list of database fields
|
||||
|
@ -251,7 +260,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* Return an document by its id
|
||||
*
|
||||
* @param integer $id id of document
|
||||
* @return object/boolean instance of SeedDMS_Core_Document if document exists, null
|
||||
* @param SeedDMS_Core_DMS $dms
|
||||
* @return bool|SeedDMS_Core_Document instance of SeedDMS_Core_Document if document exists, null
|
||||
* if document does not exist, false in case of error
|
||||
*/
|
||||
public static function getInstance($id, $dms) { /* {{{ */
|
||||
|
@ -278,12 +288,13 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
}
|
||||
|
||||
$classname = $dms->getClassname('document');
|
||||
/** @var SeedDMS_Core_Document $document */
|
||||
$document = new $classname($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $lock, $resArr["keywords"], $resArr["sequence"]);
|
||||
$document->setDMS($dms);
|
||||
return $document;
|
||||
} /* }}} */
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the directory of the document in the file system relativ
|
||||
* to the contentDir
|
||||
*
|
||||
|
@ -298,17 +309,18 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the name of the document
|
||||
*
|
||||
* @return string name of document
|
||||
*/
|
||||
function getName() { return $this->_name; }
|
||||
|
||||
/*
|
||||
/**
|
||||
* Set the name of the document
|
||||
*
|
||||
* @param $newName string new name of document
|
||||
* @return bool
|
||||
*/
|
||||
function setName($newName) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -321,17 +333,18 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the comment of the document
|
||||
*
|
||||
* @return string comment of document
|
||||
*/
|
||||
function getComment() { return $this->_comment; }
|
||||
|
||||
/*
|
||||
/**
|
||||
* Set the comment of the document
|
||||
*
|
||||
* @param $newComment string new comment of document
|
||||
* @return bool
|
||||
*/
|
||||
function setComment($newComment) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -344,8 +357,15 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getKeywords() { return $this->_keywords; }
|
||||
|
||||
/**
|
||||
* @param string $newKeywords
|
||||
* @return bool
|
||||
*/
|
||||
function setKeywords($newKeywords) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -360,7 +380,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Retrieve a list of all categories this document belongs to
|
||||
*
|
||||
* @return array list of category objects
|
||||
* @return bool|SeedDMS_Core_DocumentCategory[]
|
||||
*/
|
||||
function getCategories() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -385,7 +405,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* This function will delete currently assigned categories and sets new
|
||||
* categories.
|
||||
*
|
||||
* @param array $newCategories list of category objects
|
||||
* @param SeedDMS_Core_DocumentCategory[] $newCategories list of category objects
|
||||
* @return bool
|
||||
*/
|
||||
function setCategories($newCategories) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -501,7 +522,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Return the parent folder of the document
|
||||
*
|
||||
* @return object parent folder
|
||||
* @return SeedDMS_Core_Folder parent folder
|
||||
*/
|
||||
function getParent() { /* {{{ */
|
||||
return self::getFolder();
|
||||
|
@ -519,7 +540,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* This function basically moves a document from a folder to another
|
||||
* folder.
|
||||
*
|
||||
* @param object $newFolder
|
||||
* @param SeedDMS_Core_Folder $newFolder
|
||||
* @return boolean false in case of an error, otherwise true
|
||||
*/
|
||||
function setFolder($newFolder) { /* {{{ */
|
||||
|
@ -529,11 +550,13 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
if (!$db->getResult($queryStr))
|
||||
return false;
|
||||
$this->_folderID = $newFolder->getID();
|
||||
/** @noinspection PhpUndefinedFieldInspection */
|
||||
$this->_folder = $newFolder;
|
||||
|
||||
// Make sure that the folder search path is also updated.
|
||||
$path = $newFolder->getPath();
|
||||
$flist = "";
|
||||
/** @var SeedDMS_Core_Folder[] $path */
|
||||
foreach ($path as $f) {
|
||||
$flist .= ":".$f->getID();
|
||||
}
|
||||
|
@ -550,7 +573,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Return owner of document
|
||||
*
|
||||
* @return object owner of document as an instance of {@link SeedDMS_Core_User}
|
||||
* @return SeedDMS_Core_User owner of document as an instance of {@link SeedDMS_Core_User}
|
||||
*/
|
||||
function getOwner() { /* {{{ */
|
||||
if (!isset($this->_owner))
|
||||
|
@ -561,7 +584,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Set owner of a document
|
||||
*
|
||||
* @param object $newOwner new owner
|
||||
* @param SeedDMS_Core_User $newOwner new owner
|
||||
* @return boolean true if successful otherwise false
|
||||
*/
|
||||
function setOwner($newOwner) { /* {{{ */
|
||||
|
@ -572,10 +595,14 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
return false;
|
||||
|
||||
$this->_ownerID = $newOwner->getID();
|
||||
/** @noinspection PhpUndefinedFieldInspection */
|
||||
$this->_owner = $newOwner;
|
||||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return bool|int
|
||||
*/
|
||||
function getDefaultAccess() { /* {{{ */
|
||||
if ($this->inheritsAccess()) {
|
||||
$res = $this->getFolder();
|
||||
|
@ -592,7 +619,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* will not have read access anymore.
|
||||
*
|
||||
* @param integer $mode access mode
|
||||
* @param boolean $noclean set to true if notifier list shall not be clean up
|
||||
* @param bool|string $noclean set to true if notifier list shall not be clean up
|
||||
* @return bool
|
||||
*/
|
||||
function setDefaultAccess($mode, $noclean="false") { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -609,6 +637,9 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function inheritsAccess() { return $this->_inheritAccess; }
|
||||
|
||||
/**
|
||||
|
@ -667,7 +698,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Set expiration date as unix timestamp
|
||||
*
|
||||
* @param integer unix timestamp of expiration date
|
||||
* @param integer $expires unix timestamp of expiration date
|
||||
* @return bool
|
||||
*/
|
||||
function setExpires($expires) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -736,7 +768,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Lock or unlock document
|
||||
*
|
||||
* @param $falseOrUser user object for locking or false for unlocking
|
||||
* @param SeedDMS_Core_User|bool $falseOrUser user object for locking or false for unlocking
|
||||
* @return boolean true if operation was successful otherwise false
|
||||
*/
|
||||
function setLocked($falseOrUser) { /* {{{ */
|
||||
|
@ -764,7 +796,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Get the user currently locking the document
|
||||
*
|
||||
* @return object user have a lock
|
||||
* @return SeedDMS_Core_User|bool user have a lock
|
||||
*/
|
||||
function getLockingUser() { /* {{{ */
|
||||
if (!$this->isLocked())
|
||||
|
@ -775,8 +807,15 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
return $this->_lockingUser;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getSequence() { return $this->_sequence; }
|
||||
|
||||
/**
|
||||
* @param $seq
|
||||
* @return bool
|
||||
*/
|
||||
function setSequence($seq) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -823,9 +862,9 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* 'users' and 'groups' which are than empty. The methode returns false
|
||||
* if the function fails.
|
||||
*
|
||||
* @param integer $mode access mode (defaults to M_ANY)
|
||||
* @param integer $op operation (defaults to O_EQ)
|
||||
* @return array multi dimensional array or false in case of an error
|
||||
* @param int $mode access mode (defaults to M_ANY)
|
||||
* @param int|string $op operation (defaults to O_EQ)
|
||||
* @return bool|array
|
||||
*/
|
||||
function getAccessList($mode = M_ANY, $op = O_EQ) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -871,6 +910,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* @param integer $userOrGroupID id of user or group
|
||||
* @param integer $isUser set to 1 if $userOrGroupID is the id of a
|
||||
* user
|
||||
* @return bool
|
||||
*/
|
||||
function addAccess($mode, $userOrGroupID, $isUser) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -901,6 +941,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* @param integer $userOrGroupID id of user or group
|
||||
* @param integer $isUser set to 1 if $userOrGroupID is the id of a
|
||||
* user
|
||||
* @return bool
|
||||
*/
|
||||
function changeAccess($newMode, $userOrGroupID, $isUser) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -991,6 +1032,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
$accessList = $this->getAccessList();
|
||||
if (!$accessList) return false;
|
||||
|
||||
/** @var SeedDMS_Core_UserAccess $userAccess */
|
||||
foreach ($accessList["users"] as $userAccess) {
|
||||
if ($userAccess->getUserID() == $user->getID()) {
|
||||
$mode = $userAccess->getMode();
|
||||
|
@ -1004,6 +1046,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/* Get the highest right defined by a group */
|
||||
if($accessList['groups']) {
|
||||
$mode = 0;
|
||||
/** @var SeedDMS_Core_GroupAccess $groupAccess */
|
||||
foreach ($accessList["groups"] as $groupAccess) {
|
||||
if ($user->isMemberOfGroup($groupAccess->getGroup())) {
|
||||
if ($groupAccess->getMode() > $mode)
|
||||
|
@ -1035,7 +1078,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* The function takes inherited access rights into account.
|
||||
* For a list of possible access rights see @file inc.AccessUtils.php
|
||||
*
|
||||
* @param $group object instance of class SeedDMS_Core_Group
|
||||
* @param SeedDMS_Core_Group $group object instance of class SeedDMS_Core_Group
|
||||
* @return integer access mode
|
||||
*/
|
||||
function getGroupAccessMode($group) { /* {{{ */
|
||||
|
@ -1047,6 +1090,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
if (!$accessList)
|
||||
return false;
|
||||
|
||||
/** @var SeedDMS_Core_GroupAccess $groupAccess */
|
||||
foreach ($accessList["groups"] as $groupAccess) {
|
||||
if ($groupAccess->getGroupID() == $group->getID()) {
|
||||
$foundInACL = true;
|
||||
|
@ -1072,7 +1116,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* SeedDMS_Core_Group.
|
||||
*
|
||||
* @param integer $type type of notification (not yet used)
|
||||
* @return array list of notifications
|
||||
* @return array|bool
|
||||
*/
|
||||
function getNotifyList($type=0) { /* {{{ */
|
||||
if (empty($this->_notifyList)) {
|
||||
|
@ -1113,7 +1157,9 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/* Make a copy of both notifier lists because removeNotify will empty
|
||||
* $this->_notifyList and the second foreach will not work anymore.
|
||||
*/
|
||||
/** @var SeedDMS_Core_User[] $nusers */
|
||||
$nusers = $this->_notifyList["users"];
|
||||
/** @var SeedDMS_Core_Group[] $ngroups */
|
||||
$ngroups = $this->_notifyList["groups"];
|
||||
foreach ($nusers as $u) {
|
||||
if ($this->getAccessMode($u) < M_READ) {
|
||||
|
@ -1193,6 +1239,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
// that the current group has not been explicitly excluded.
|
||||
$acl = $this->getAccessList(M_NONE, O_EQ);
|
||||
$found = false;
|
||||
/** @var SeedDMS_Core_GroupAccess $group */
|
||||
foreach ($acl["groups"] as $group) {
|
||||
if ($group->getGroupID() == $userOrGroupID) {
|
||||
$found = true;
|
||||
|
@ -1211,6 +1258,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
return -4;
|
||||
}
|
||||
$found = false;
|
||||
/** @var SeedDMS_Core_GroupAccess $group */
|
||||
foreach ($acl["groups"] as $group) {
|
||||
if ($group->getGroupID() == $userOrGroupID) {
|
||||
$found = true;
|
||||
|
@ -1248,10 +1296,10 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* is allowed to remove a notification. This must be checked by the calling
|
||||
* application.
|
||||
*
|
||||
* @param $userOrGroupID id of user or group
|
||||
* @param $isUser boolean true if a user is passed in $userOrGroupID, false
|
||||
* @param integer $userOrGroupID id of user or group
|
||||
* @param boolean $isUser boolean true if a user is passed in $userOrGroupID, false
|
||||
* if a group is passed in $userOrGroupID
|
||||
* @param $type type of notification (0 will delete all) Not used yet!
|
||||
* @param integer $type type of notification (0 will delete all) Not used yet!
|
||||
* @return integer 0 if operation was succesful
|
||||
* -1 if the userid/groupid is invalid
|
||||
* -3 if the user/group is already subscribed
|
||||
|
@ -1261,6 +1309,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
$db = $this->_dms->getDB();
|
||||
|
||||
/* Verify that user / group exists. */
|
||||
/** @var SeedDMS_Core_Group|SeedDMS_Core_User $obj */
|
||||
$obj = ($isUser ? $this->_dms->getUser($userOrGroupID) : $this->_dms->getGroup($userOrGroupID));
|
||||
if (!is_object($obj)) {
|
||||
return -1;
|
||||
|
@ -1336,7 +1385,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* @param array $attributes list of version attributes. The element key
|
||||
* must be the id of the attribute definition.
|
||||
* @param object $workflow
|
||||
* @return bool/array false in case of an error or a result set
|
||||
* @return bool|SeedDMS_Core_AddContentResultSet
|
||||
*/
|
||||
function addContent($comment, $user, $tmpFile, $orgFileName, $fileType, $mimeType, $reviewers=array(), $approvers=array(), $version=0, $attributes=array(), $workflow=null) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1386,7 +1435,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
|
||||
$this->_content = null;
|
||||
$this->_latestContent = null;
|
||||
$content = $this->getLatestContent($contentID);
|
||||
$content = $this->getLatestContent($contentID); /** @todo: Parameter not defined in Funktion */
|
||||
$docResultSet = new SeedDMS_Core_AddContentResultSet($content);
|
||||
$docResultSet->setDMS($this->_dms);
|
||||
|
||||
|
@ -1423,7 +1472,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
// and submit comments, if appropriate. Reviewers can also recommend that
|
||||
// a document be rejected.
|
||||
$pendingReview=false;
|
||||
$reviewRes = array();
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$reviewRes = array(); /** @todo unused variable */
|
||||
foreach (array("i", "g") as $i){
|
||||
if (isset($reviewers[$i])) {
|
||||
foreach ($reviewers[$i] as $reviewerID) {
|
||||
|
@ -1441,7 +1491,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
// Add approvers to the database. Approvers must also review the document
|
||||
// and make a recommendation on its release as an approved version.
|
||||
$pendingApproval=false;
|
||||
$approveRes = array();
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$approveRes = array(); /** @todo unused variable */
|
||||
foreach (array("i", "g") as $i){
|
||||
if (isset($approvers[$i])) {
|
||||
foreach ($approvers[$i] as $approverID) {
|
||||
|
@ -1479,7 +1530,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
return false;
|
||||
}
|
||||
|
||||
$docResultSet->setStatus($status,$comment,$user);
|
||||
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
||||
$docResultSet->setStatus($status,$comment,$user); /** @todo parameter count wrong */
|
||||
|
||||
$db->commitTransaction();
|
||||
return $docResultSet;
|
||||
|
@ -1517,7 +1569,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
if ((int) $version<1) {
|
||||
$queryStr = "SELECT MAX(`version`) as m from `tblDocumentContent` where `document` = ".$this->_id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$res)
|
||||
if (is_bool($resArr) && !$res) /** @todo undefined variable */
|
||||
return false;
|
||||
|
||||
$version = $resArr[0]['m'];
|
||||
|
@ -1572,7 +1624,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* out. Access rights based on the document status are calculated for the
|
||||
* currently logged in user.
|
||||
*
|
||||
* @return array list of objects of class SeedDMS_Core_DocumentContent
|
||||
* @return bool|SeedDMS_Core_DocumentContent[]
|
||||
*/
|
||||
function getContent() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1580,13 +1632,14 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
if (!isset($this->_content)) {
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." ORDER BY `version`";
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$res)
|
||||
if (is_bool($resArr) && !$res) /** @todo undefined variable */
|
||||
return false;
|
||||
|
||||
$this->_content = array();
|
||||
$classname = $this->_dms->getClassname('documentcontent');
|
||||
$user = $this->_dms->getLoggedInUser();
|
||||
foreach ($resArr as $row) {
|
||||
/** @var SeedDMS_Core_DocumentContent $content */
|
||||
$content = new $classname($row["id"], $this, $row["version"], $row["comment"], $row["date"], $row["createdBy"], $row["dir"], $row["orgFileName"], $row["fileType"], $row["mimeType"], $row['fileSize'], $row['checksum']);
|
||||
if($user) {
|
||||
if($content->getAccessMode($user) >= M_READ)
|
||||
|
@ -1608,7 +1661,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* currently logged in user.
|
||||
*
|
||||
* @param integer $version version number of content element
|
||||
* @return object/boolean object of class {@link SeedDMS_Core_DocumentContent}
|
||||
* @return SeedDMS_Core_DocumentContent|boolean object of class {@link SeedDMS_Core_DocumentContent}
|
||||
* or false
|
||||
*/
|
||||
function getContentByVersion($version) { /* {{{ */
|
||||
|
@ -1625,13 +1678,14 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
$db = $this->_dms->getDB();
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." AND `version` = " . (int) $version;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$res)
|
||||
if (is_bool($resArr) && !$res) /** @todo undefined variable */
|
||||
return false;
|
||||
if (count($resArr) != 1)
|
||||
return false;
|
||||
|
||||
$resArr = $resArr[0];
|
||||
$classname = $this->_dms->getClassname('documentcontent');
|
||||
/** @var SeedDMS_Core_DocumentContent $content */
|
||||
if($content = new $classname($resArr["id"], $this, $resArr["version"], $resArr["comment"], $resArr["date"], $resArr["createdBy"], $resArr["dir"], $resArr["orgFileName"], $resArr["fileType"], $resArr["mimeType"], $resArr['fileSize'], $resArr['checksum'])) {
|
||||
$user = $this->_dms->getLoggedInUser();
|
||||
/* A user with write access on the document may always see the version */
|
||||
|
@ -1644,6 +1698,9 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return bool|null|SeedDMS_Core_DocumentContent
|
||||
*/
|
||||
function __getLatestContent() { /* {{{ */
|
||||
if (!$this->_latestContent) {
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1672,20 +1729,21 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* Access rights based on the document status are calculated for the
|
||||
* currently logged in user.
|
||||
*
|
||||
* @return object object of class {@link SeedDMS_Core_DocumentContent}
|
||||
* @return bool|SeedDMS_Core_DocumentContent object of class {@link SeedDMS_Core_DocumentContent}
|
||||
*/
|
||||
function getLatestContent() { /* {{{ */
|
||||
if (!$this->_latestContent) {
|
||||
$db = $this->_dms->getDB();
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." ORDER BY `version` DESC";
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$res)
|
||||
if (is_bool($resArr) && !$res) /** @todo: $res not defined */
|
||||
return false;
|
||||
|
||||
$classname = $this->_dms->getClassname('documentcontent');
|
||||
$user = $this->_dms->getLoggedInUser();
|
||||
foreach ($resArr as $row) {
|
||||
if (!$this->_latestContent) {
|
||||
/** @var SeedDMS_Core_DocumentContent $content */
|
||||
$content = new $classname($row["id"], $this, $row["version"], $row["comment"], $row["date"], $row["createdBy"], $row["dir"], $row["orgFileName"], $row["fileType"], $row["mimeType"], $row['fileSize'], $row['checksum']);
|
||||
if($user) {
|
||||
/* If the user may even write the document, then also allow to see all content.
|
||||
|
@ -1707,7 +1765,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Remove version of document
|
||||
*
|
||||
* @param interger $version version number of content
|
||||
* @param SeedDMS_Core_DocumentContent $version version number of content
|
||||
* @return boolean true if successful, otherwise false
|
||||
*/
|
||||
private function _removeContent($version) { /* {{{ */
|
||||
|
@ -1837,7 +1895,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Call callback onPreRemoveDocument before deleting content
|
||||
*
|
||||
* @param integer $version version number of content
|
||||
* @param SeedDMS_Core_DocumentContent $version version number of content
|
||||
* @return bool|mixed
|
||||
*/
|
||||
function removeContent($version) { /* {{{ */
|
||||
/* Check if 'onPreRemoveDocument' callback is set */
|
||||
|
@ -1868,7 +1927,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* Return a certain document link
|
||||
*
|
||||
* @param integer $linkID id of link
|
||||
* @return object instance of SeedDMS_Core_DocumentLink or false in case of
|
||||
* @return SeedDMS_Core_DocumentLink|bool of SeedDMS_Core_DocumentLink or false in case of
|
||||
* an error.
|
||||
*/
|
||||
function getDocumentLink($linkID) { /* {{{ */
|
||||
|
@ -3505,7 +3564,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
return 0;
|
||||
|
||||
$queryStr = "INSERT INTO `tblDocumentReviewLog` (`reviewID`, `status`,
|
||||
`comment`, `date`, `userID`) ".
|
||||
`comment`, `date`, `userID`) ".
|
||||
"VALUES ('". $indstatus["reviewID"] ."', '".
|
||||
(int) $status ."', ".$db->qstr($comment).", ".$db->getCurrentDatetime().", '".
|
||||
$requestUser->getID() ."')";
|
||||
|
@ -3557,7 +3616,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
return 0;
|
||||
|
||||
$queryStr = "INSERT INTO `tblDocumentReviewLog` (`reviewID`, `status`,
|
||||
`comment`, `date`, `userID`) ".
|
||||
`comment`, `date`, `userID`) ".
|
||||
"VALUES ('". $reviewStatus[0]["reviewID"] ."', '".
|
||||
(int) $status ."', ".$db->qstr($comment).", ".$db->getCurrentDatetime().", '".
|
||||
$requestUser->getID() ."')";
|
||||
|
@ -3727,7 +3786,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
return 0;
|
||||
|
||||
$queryStr = "INSERT INTO `tblDocumentApproveLog` (`approveID`, `status`,
|
||||
`comment`, `date`, `userID`) ".
|
||||
`comment`, `date`, `userID`) ".
|
||||
"VALUES ('". $indstatus["approveID"] ."', '".
|
||||
(int) $status ."', ".$db->qstr($comment).", ".$db->getCurrentDatetime().", '".
|
||||
$requestUser->getID() ."')";
|
||||
|
@ -3771,7 +3830,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
return 0;
|
||||
|
||||
$queryStr = "INSERT INTO `tblDocumentApproveLog` (`approveID`, `status`,
|
||||
`comment`, `date`, `userID`) ".
|
||||
`comment`, `date`, `userID`) ".
|
||||
"VALUES ('". $approvalStatus[0]["approveID"] ."', '".
|
||||
(int) $status ."', ".$db->qstr($comment).", ".$db->getCurrentDatetime().", '".
|
||||
$requestUser->getID() ."')";
|
||||
|
@ -4664,7 +4723,7 @@ class SeedDMS_Core_DocumentLink { /* {{{ */
|
|||
protected $_id;
|
||||
|
||||
/**
|
||||
* @var object reference to document this link belongs to
|
||||
* @var SeedDMS_Core_Document reference to document this link belongs to
|
||||
*/
|
||||
protected $_document;
|
||||
|
||||
|
@ -4683,6 +4742,14 @@ class SeedDMS_Core_DocumentLink { /* {{{ */
|
|||
*/
|
||||
protected $_public;
|
||||
|
||||
/**
|
||||
* SeedDMS_Core_DocumentLink constructor.
|
||||
* @param $id
|
||||
* @param $document
|
||||
* @param $target
|
||||
* @param $userID
|
||||
* @param $public
|
||||
*/
|
||||
function __construct($id, $document, $target, $userID, $public) {
|
||||
$this->_id = $id;
|
||||
$this->_document = $document;
|
||||
|
@ -4691,22 +4758,37 @@ class SeedDMS_Core_DocumentLink { /* {{{ */
|
|||
$this->_public = $public;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getID() { return $this->_id; }
|
||||
|
||||
/**
|
||||
* @return SeedDMS_Core_Document
|
||||
*/
|
||||
function getDocument() {
|
||||
return $this->_document;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
function getTarget() {
|
||||
return $this->_target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|SeedDMS_Core_User
|
||||
*/
|
||||
function getUser() {
|
||||
if (!isset($this->_user))
|
||||
$this->_user = $this->_document->_dms->getUser($this->_userID);
|
||||
return $this->_user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function isPublic() { return $this->_public; }
|
||||
|
||||
/**
|
||||
|
@ -4717,8 +4799,10 @@ class SeedDMS_Core_DocumentLink { /* {{{ */
|
|||
* It is only called for public document links, not accessed by the owner
|
||||
* or the administrator.
|
||||
*
|
||||
* @param object $u user
|
||||
* @return integer either M_NONE or M_READ
|
||||
* @param SeedDMS_Core_User $u user
|
||||
* @param $source
|
||||
* @param $target
|
||||
* @return int either M_NONE or M_READ
|
||||
*/
|
||||
function getAccessMode($u, $source, $target) { /* {{{ */
|
||||
$dms = $this->_document->_dms;
|
||||
|
@ -4761,7 +4845,7 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
|
|||
protected $_id;
|
||||
|
||||
/**
|
||||
* @var object reference to document this file belongs to
|
||||
* @var SeedDMS_Core_Document reference to document this file belongs to
|
||||
*/
|
||||
protected $_document;
|
||||
|
||||
|
@ -4818,6 +4902,21 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
|
|||
*/
|
||||
protected $_name;
|
||||
|
||||
/**
|
||||
* SeedDMS_Core_DocumentFile constructor.
|
||||
* @param $id
|
||||
* @param $document
|
||||
* @param $userID
|
||||
* @param $comment
|
||||
* @param $date
|
||||
* @param $dir
|
||||
* @param $fileType
|
||||
* @param $mimeType
|
||||
* @param $orgFileName
|
||||
* @param $name
|
||||
* @param $version
|
||||
* @param $public
|
||||
*/
|
||||
function __construct($id, $document, $userID, $comment, $date, $dir, $fileType, $mimeType, $orgFileName,$name,$version,$public) {
|
||||
$this->_id = $id;
|
||||
$this->_document = $document;
|
||||
|
@ -4833,15 +4932,30 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
|
|||
$this->_public = $public;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getID() { return $this->_id; }
|
||||
|
||||
/**
|
||||
* @return SeedDMS_Core_Document
|
||||
*/
|
||||
function getDocument() { return $this->_document; }
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getUserID() { return $this->_userID; }
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getComment() { return $this->_comment; }
|
||||
|
||||
/*
|
||||
* Set the comment of the document file
|
||||
*
|
||||
* @param $newComment string new comment of document
|
||||
* @param string $newComment string new comment of document
|
||||
*/
|
||||
function setComment($newComment) { /* {{{ */
|
||||
$db = $this->_document->_dms->getDB();
|
||||
|
@ -4854,6 +4968,9 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getDate() { return $this->_date; }
|
||||
|
||||
/**
|
||||
|
@ -4880,10 +4997,29 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getDir() { return $this->_dir; }
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getFileType() { return $this->_fileType; }
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getMimeType() { return $this->_mimeType; }
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getOriginalFileName() { return $this->_orgFileName; }
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getName() { return $this->_name; }
|
||||
|
||||
/*
|
||||
|
@ -4902,16 +5038,25 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return bool|SeedDMS_Core_User
|
||||
*/
|
||||
function getUser() {
|
||||
if (!isset($this->_user))
|
||||
$this->_user = $this->_document->_dms->getUser($this->_userID);
|
||||
return $this->_user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getPath() {
|
||||
return $this->_document->getDir() . "f" .$this->_id . $this->_fileType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getVersion() { return $this->_version; }
|
||||
|
||||
/*
|
||||
|
@ -4933,6 +5078,9 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function isPublic() { return $this->_public; }
|
||||
|
||||
/*
|
||||
|
@ -4999,18 +5147,45 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
|
|||
*/
|
||||
class SeedDMS_Core_AddContentResultSet { /* {{{ */
|
||||
|
||||
/**
|
||||
* @var null
|
||||
*/
|
||||
protected $_indReviewers;
|
||||
|
||||
/**
|
||||
* @var null
|
||||
*/
|
||||
protected $_grpReviewers;
|
||||
|
||||
/**
|
||||
* @var null
|
||||
*/
|
||||
protected $_indApprovers;
|
||||
|
||||
/**
|
||||
* @var null
|
||||
*/
|
||||
protected $_grpApprovers;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $_content;
|
||||
|
||||
/**
|
||||
* @var null
|
||||
*/
|
||||
protected $_status;
|
||||
|
||||
/**
|
||||
* @var object back reference to document management system
|
||||
* @var SeedDMS_Core_DMS back reference to document management system
|
||||
*/
|
||||
protected $_dms;
|
||||
|
||||
/**
|
||||
* SeedDMS_Core_AddContentResultSet constructor.
|
||||
* @param $content
|
||||
*/
|
||||
function __construct($content) { /* {{{ */
|
||||
$this->_content = $content;
|
||||
$this->_indReviewers = null;
|
||||
|
@ -5021,7 +5196,7 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */
|
|||
$this->_dms = null;
|
||||
} /* }}} */
|
||||
|
||||
/*
|
||||
/**
|
||||
* Set dms this object belongs to.
|
||||
*
|
||||
* Each object needs a reference to the dms it belongs to. It will be
|
||||
|
@ -5029,12 +5204,18 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */
|
|||
* The dms has a references to the currently logged in user
|
||||
* and the database connection.
|
||||
*
|
||||
* @param object $dms reference to dms
|
||||
* @param SeedDMS_Core_DMS $dms reference to dms
|
||||
*/
|
||||
function setDMS($dms) { /* {{{ */
|
||||
$this->_dms = $dms;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param $reviewer
|
||||
* @param $type
|
||||
* @param $status
|
||||
* @return bool
|
||||
*/
|
||||
function addReviewer($reviewer, $type, $status) { /* {{{ */
|
||||
$dms = $this->_dms;
|
||||
|
||||
|
@ -5062,6 +5243,12 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param $approver
|
||||
* @param $type
|
||||
* @param $status
|
||||
* @return bool
|
||||
*/
|
||||
function addApprover($approver, $type, $status) { /* {{{ */
|
||||
$dms = $this->_dms;
|
||||
|
||||
|
@ -5089,6 +5276,10 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param $status
|
||||
* @return bool
|
||||
*/
|
||||
function setStatus($status) { /* {{{ */
|
||||
if (!is_integer($status)) {
|
||||
return false;
|
||||
|
@ -5100,14 +5291,24 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
function getStatus() { /* {{{ */
|
||||
return $this->_status;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
function getContent() { /* {{{ */
|
||||
return $this->_content;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
* @return array|bool|null
|
||||
*/
|
||||
function getReviewers($type) { /* {{{ */
|
||||
if (strcasecmp($type, "i") && strcasecmp($type, "g")) {
|
||||
return false;
|
||||
|
@ -5120,6 +5321,10 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
* @return array|bool|null
|
||||
*/
|
||||
function getApprovers($type) { /* {{{ */
|
||||
if (strcasecmp($type, "i") && strcasecmp($type, "g")) {
|
||||
return false;
|
||||
|
@ -5132,4 +5337,3 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */
|
|||
}
|
||||
} /* }}} */
|
||||
} /* }}} */
|
||||
?>
|
||||
|
|
|
@ -73,6 +73,48 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
*/
|
||||
protected $_sequence;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $_date;
|
||||
|
||||
/**
|
||||
* @var SeedDMS_Core_Folder
|
||||
*/
|
||||
protected $_parent;
|
||||
|
||||
/**
|
||||
* @var SeedDMS_Core_User
|
||||
*/
|
||||
protected $_owner;
|
||||
|
||||
/**
|
||||
* @var SeedDMS_Core_Folder[]
|
||||
*/
|
||||
protected $_subFolders;
|
||||
|
||||
/**
|
||||
* @var SeedDMS_Core_Document[]
|
||||
*/
|
||||
protected $_documents;
|
||||
|
||||
/**
|
||||
* @var SeedDMS_Core_UserAccess[]|SeedDMS_Core_GroupAccess[]
|
||||
*/
|
||||
protected $_accessList;
|
||||
|
||||
/**
|
||||
* SeedDMS_Core_Folder constructor.
|
||||
* @param $id
|
||||
* @param $name
|
||||
* @param $parentID
|
||||
* @param $comment
|
||||
* @param $date
|
||||
* @param $ownerID
|
||||
* @param $inheritAccess
|
||||
* @param $defaultAccess
|
||||
* @param $sequence
|
||||
*/
|
||||
function __construct($id, $name, $parentID, $comment, $date, $ownerID, $inheritAccess, $defaultAccess, $sequence) { /* {{{ */
|
||||
parent::__construct($id);
|
||||
$this->_id = $id;
|
||||
|
@ -91,6 +133,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* Return an array of database fields which used for searching
|
||||
* a term entered in the database search form
|
||||
*
|
||||
* @param SeedDMS_Core_DMS $dms
|
||||
* @param array $searchin integer list of search scopes (2=name, 3=comment,
|
||||
* 4=attributes)
|
||||
* @return array list of database fields
|
||||
|
@ -129,7 +172,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* Return a folder by its id
|
||||
*
|
||||
* @param integer $id id of folder
|
||||
* @return object/boolean instance of SeedDMS_Core_Folder if document exists, null
|
||||
* @param SeedDMS_Core_DMS $dms
|
||||
* @return SeedDMS_Core_Folder|bool instance of SeedDMS_Core_Folder if document exists, null
|
||||
* if document does not exist, false in case of error
|
||||
*/
|
||||
public static function getInstance($id, $dms) { /* {{{ */
|
||||
|
@ -144,22 +188,24 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
|
||||
$resArr = $resArr[0];
|
||||
$classname = $dms->getClassname('folder');
|
||||
/** @var SeedDMS_Core_Folder $folder */
|
||||
$folder = new $classname($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["date"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]);
|
||||
$folder->setDMS($dms);
|
||||
return $folder;
|
||||
} /* }}} */
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the name of the folder.
|
||||
*
|
||||
* @return string name of folder
|
||||
*/
|
||||
public function getName() { return $this->_name; }
|
||||
|
||||
/*
|
||||
/**
|
||||
* Set the name of the folder.
|
||||
*
|
||||
* @param string $newName set a new name of the folder
|
||||
* @return bool
|
||||
*/
|
||||
public function setName($newName) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -173,8 +219,15 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getComment() { return $this->_comment; }
|
||||
|
||||
/**
|
||||
* @param $newComment
|
||||
* @return bool
|
||||
*/
|
||||
public function setComment($newComment) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -222,7 +275,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
/**
|
||||
* Returns the parent
|
||||
*
|
||||
* @return object parent folder or false if there is no parent folder
|
||||
* @return bool|SeedDMS_Core_Folder
|
||||
*/
|
||||
public function getParent() { /* {{{ */
|
||||
if ($this->_id == $this->_dms->rootFolderID || empty($this->_parentID)) {
|
||||
|
@ -239,10 +292,10 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* Check if the folder is subfolder
|
||||
*
|
||||
* This function checks if the passed folder is a subfolder of the current
|
||||
* folder.
|
||||
* folder.
|
||||
*
|
||||
* @param object $subFolder potential sub folder
|
||||
* @return boolean true if passes folder is a subfolder
|
||||
* @param SeedDMS_Core_Folder $subfolder
|
||||
* @return bool true if passes folder is a subfolder
|
||||
*/
|
||||
function isSubFolder($subfolder) { /* {{{ */
|
||||
$target_path = $subfolder->getPath();
|
||||
|
@ -259,7 +312,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* This function moves a folder from one parent folder into another parent
|
||||
* folder. It will fail if the root folder is moved.
|
||||
*
|
||||
* @param object $newParent new parent folder
|
||||
* @param SeedDMS_Core_Folder $newParent new parent folder
|
||||
* @return boolean true if operation was successful otherwise false
|
||||
*/
|
||||
public function setParent($newParent) { /* {{{ */
|
||||
|
@ -313,6 +366,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
foreach ($resArr as $row) {
|
||||
$newPath = preg_replace("/^.*:".$this->_id.":(.*$)/", $pathPrefix."\\1", $row["folderList"]);
|
||||
$queryStr="UPDATE `tblDocuments` SET `folderList` = '".$newPath."' WHERE `tblDocuments`.`id` = '".$row["id"]."'";
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$res = $db->getResult($queryStr);
|
||||
}
|
||||
|
||||
|
@ -325,6 +379,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
foreach ($resArr as $row) {
|
||||
$newPath = preg_replace("/^.*:".$this->_id.":(.*$)/", $pathPrefix."\\1", $row["folderList"]);
|
||||
$queryStr="UPDATE `tblFolders` SET `folderList` = '".$newPath."' WHERE `tblFolders`.`id` = '".$row["id"]."'";
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$res = $db->getResult($queryStr);
|
||||
}
|
||||
|
||||
|
@ -345,7 +400,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
/**
|
||||
* Set the owner
|
||||
*
|
||||
* @param object new owner of the folder
|
||||
* @param SeedDMS_Core_User $newOwner of the folder
|
||||
* @return boolean true if successful otherwise false
|
||||
*/
|
||||
function setOwner($newOwner) { /* {{{ */
|
||||
|
@ -360,6 +415,9 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return bool|int
|
||||
*/
|
||||
function getDefaultAccess() { /* {{{ */
|
||||
if ($this->inheritsAccess()) {
|
||||
$res = $this->getParent();
|
||||
|
@ -378,6 +436,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
*
|
||||
* @param integer $mode access mode
|
||||
* @param boolean $noclean set to true if notifier list shall not be clean up
|
||||
* @return bool
|
||||
*/
|
||||
function setDefaultAccess($mode, $noclean=false) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -450,7 +509,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
function hasSubFolders() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
if (isset($this->_subFolders)) {
|
||||
return count($this->subFolders);
|
||||
/** @noinspection PhpUndefinedFieldInspection */
|
||||
return count($this->subFolders); /** @todo not $this->_subFolders? */
|
||||
}
|
||||
$queryStr = "SELECT count(*) as c FROM `tblFolders` WHERE `parent` = " . $this->_id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
|
@ -471,7 +531,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* @param string $dir direction of sorting (asc or desc)
|
||||
* @param integer $limit limit number of subfolders
|
||||
* @param integer $offset offset in retrieved list of subfolders
|
||||
* @return array list of folder objects or false in case of an error
|
||||
* @return SeedDMS_Core_Folder[]|bool list of folder objects or false in case of an error
|
||||
*/
|
||||
function getSubFolders($orderby="", $dir="asc", $limit=0, $offset=0) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -511,7 +571,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* @param integer $sequence position of folder in list of sub folders.
|
||||
* @param array $attributes list of document attributes. The element key
|
||||
* must be the id of the attribute definition.
|
||||
* @return object object of type SeedDMS_Core_Folder or false in case of
|
||||
* @return bool|SeedDMS_Core_Folder
|
||||
* an error.
|
||||
*/
|
||||
function addSubFolder($name, $comment, $owner, $sequence, $attributes=array()) { /* {{{ */
|
||||
|
@ -554,7 +614,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
/* Check if 'onPostAddSubFolder' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddSubFolder'])) {
|
||||
foreach($this->_dms->callbacks['onPostAddSubFolder'] as $callback) {
|
||||
if(!call_user_func($callback[0], $callback[1], $newFolder)) {
|
||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||
if(!call_user_func($callback[0], $callback[1], $newFolder)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -566,7 +627,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* Returns an array of all parents, grand parent, etc. up to root folder.
|
||||
* The folder itself is the last element of the array.
|
||||
*
|
||||
* @return array Array of parents
|
||||
* @return array|bool
|
||||
*/
|
||||
function getPath() { /* {{{ */
|
||||
if (!isset($this->_parentID) || ($this->_parentID == "") || ($this->_parentID == 0) || ($this->_id == $this->_dms->rootFolderID)) {
|
||||
|
@ -632,7 +693,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
function hasDocuments() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
if (isset($this->_documents)) {
|
||||
return count($this->documents);
|
||||
/** @noinspection PhpUndefinedFieldInspection */
|
||||
return count($this->documents); /** @todo not $this->_documents? */
|
||||
}
|
||||
$queryStr = "SELECT count(*) as c FROM `tblDocuments` WHERE `folder` = " . $this->_id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
|
@ -645,12 +707,14 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
/**
|
||||
* Check if folder has document with given name
|
||||
*
|
||||
* @return boolean true if document exists, false if not or in case
|
||||
* @param string $name
|
||||
* @return bool true if document exists, false if not or in case
|
||||
* of an error
|
||||
*/
|
||||
function hasDocumentByName($name) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
if (isset($this->_documents)) {
|
||||
/** @noinspection PhpUndefinedFieldInspection */ /** @todo not $this->_documents? */
|
||||
return count($this->documents);
|
||||
}
|
||||
$queryStr = "SELECT count(*) as c FROM `tblDocuments` WHERE `folder` = " . $this->_id . " AND `name` = ".$db->qstr($name);
|
||||
|
@ -672,7 +736,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* @param string $dir direction of sorting (asc or desc)
|
||||
* @param integer $limit limit number of documents
|
||||
* @param integer $offset offset in retrieved list of documents
|
||||
* @return array list of documents or false in case of an error
|
||||
* @return SeedDMS_Core_Document[]|bool list of documents or false in case of an error
|
||||
*/
|
||||
function getDocuments($orderby="", $dir="asc", $limit=0, $offset=0) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -718,13 +782,14 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* Setting the parameter $limit to 0 will turn off access right checking
|
||||
* which is reasonable if the $user is an administrator.
|
||||
*
|
||||
* @param string $orderby if set to 'n' the list is ordered by name, otherwise
|
||||
* it will be ordered by sequence
|
||||
* @param SeedDMS_Core_User $user
|
||||
* @param integer $limit maximum number of folders and documents that will
|
||||
* be precisly counted by taken the access rights into account
|
||||
* @return array array with four elements 'document_count', 'folder_count'
|
||||
* @return array|bool with four elements 'document_count', 'folder_count'
|
||||
* 'document_precise', 'folder_precise' holding
|
||||
* the counted number and a flag if the number is precise.
|
||||
* the counted number and a flag if the number is precise.
|
||||
* @internal param string $orderby if set to 'n' the list is ordered by name, otherwise
|
||||
* it will be ordered by sequence
|
||||
*/
|
||||
function countChildren($user, $limit=10000) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -794,7 +859,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
// $comment will be used for both document and version leaving empty the version_comment
|
||||
/**
|
||||
* Add a new document to the folder
|
||||
* This function will add a new document and its content from a given file.
|
||||
* This function will add a new document and its content from a given file.
|
||||
* It does not check for access rights on the folder. The new documents
|
||||
* default access right is read only and the access right is inherited.
|
||||
*
|
||||
|
@ -803,7 +868,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* @param integer $expires expiration date as a unix timestamp or 0 for no
|
||||
* expiration date
|
||||
* @param object $owner owner of the new document
|
||||
* @param string $keywords keywords of new document
|
||||
* @param SeedDMS_Core_User $keywords keywords of new document
|
||||
* @param array $categories list of category ids
|
||||
* @param string $tmpFile the path of the file containing the content
|
||||
* @param string $orgFileName the original file name
|
||||
|
@ -812,17 +877,17 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* @param float $sequence position of new document within the folder
|
||||
* @param array $reviewers list of users who must review this document
|
||||
* @param array $approvers list of users who must approve this document
|
||||
* @param string $reqversion version number of the content
|
||||
* @param int|string $reqversion version number of the content
|
||||
* @param string $version_comment comment of the content. If left empty
|
||||
* the $comment will be used.
|
||||
* @param array $attributes list of document attributes. The element key
|
||||
* must be the id of the attribute definition.
|
||||
* @param array $version_attributes list of document version attributes.
|
||||
* The element key must be the id of the attribute definition.
|
||||
* @param object $workflow
|
||||
* @return array/boolean false in case of error, otherwise an array
|
||||
* @param SeedDMS_Core_Workflow $workflow
|
||||
* @return array|bool false in case of error, otherwise an array
|
||||
* containing two elements. The first one is the new document, the
|
||||
* second one is the result set returned when inserting the content.
|
||||
* second one is the result set returned when inserting the content.
|
||||
*/
|
||||
function addDocument($name, $comment, $expires, $owner, $keywords, $categories, $tmpFile, $orgFileName, $fileType, $mimeType, $sequence, $reviewers=array(), $approvers=array(),$reqversion=0,$version_comment="", $attributes=array(), $version_attributes=array(), $workflow=null) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -880,7 +945,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
/* Check if 'onPostAddDocument' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddDocument'])) {
|
||||
foreach($this->_dms->callbacks['onPostAddDocument'] as $callback) {
|
||||
if(!call_user_func($callback[0], $callback[1], $document)) {
|
||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||
if(!call_user_func($callback[0], $callback[1], $document)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -944,7 +1010,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
/* Check if 'onPostRemoveFolder' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostRemoveFolder'])) {
|
||||
foreach($this->_dms->callbacks['onPostRemoveFolder'] as $callback) {
|
||||
if(!call_user_func($callback[0], $callback[1], $this->_id)) {
|
||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||
if(!call_user_func($callback[0], $callback[1], $this->_id)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -960,6 +1027,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* @return boolean true on success, false in case of an error
|
||||
*/
|
||||
function remove() { /* {{{ */
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
// Do not delete the root folder.
|
||||
|
@ -1003,10 +1071,10 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* has no access list the returned array contains the two elements
|
||||
* 'users' and 'groups' which are than empty. The methode returns false
|
||||
* if the function fails.
|
||||
*
|
||||
* @param integer $mode access mode (defaults to M_ANY)
|
||||
* @param integer $op operation (defaults to O_EQ)
|
||||
* @return array multi dimensional array
|
||||
*
|
||||
* @param int $mode access mode (defaults to M_ANY)
|
||||
* @param int|string $op operation (defaults to O_EQ)
|
||||
* @return bool|SeedDMS_Core_GroupAccess|SeedDMS_Core_UserAccess
|
||||
*/
|
||||
function getAccessList($mode = M_ANY, $op = O_EQ) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1073,6 +1141,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* @param integer $userOrGroupID id of user or group
|
||||
* @param integer $isUser set to 1 if $userOrGroupID is the id of a
|
||||
* user
|
||||
* @return bool
|
||||
*/
|
||||
function addAccess($mode, $userOrGroupID, $isUser) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1103,6 +1172,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* @param integer $userOrGroupID id of user or group
|
||||
* @param integer $isUser set to 1 if $userOrGroupID is the id of a
|
||||
* user
|
||||
* @return bool
|
||||
*/
|
||||
function changeAccess($newMode, $userOrGroupID, $isUser) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1123,6 +1193,11 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param $userOrGroupID
|
||||
* @param $isUser
|
||||
* @return bool
|
||||
*/
|
||||
function removeAccess($userOrGroupID, $isUser) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -1179,6 +1254,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
$accessList = $this->getAccessList();
|
||||
if (!$accessList) return false;
|
||||
|
||||
/** @var SeedDMS_Core_UserAccess $userAccess */
|
||||
foreach ($accessList["users"] as $userAccess) {
|
||||
if ($userAccess->getUserID() == $user->getID()) {
|
||||
$mode = $userAccess->getMode();
|
||||
|
@ -1192,6 +1268,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
/* Get the highest right defined by a group */
|
||||
if($accessList['groups']) {
|
||||
$mode = 0;
|
||||
/** @var SeedDMS_Core_GroupAccess $groupAccess */
|
||||
foreach ($accessList["groups"] as $groupAccess) {
|
||||
if ($user->isMemberOfGroup($groupAccess->getGroup())) {
|
||||
if ($groupAccess->getMode() > $mode)
|
||||
|
@ -1219,7 +1296,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* applied to get the access mode is the same as describe at
|
||||
* {@link getAccessMode}
|
||||
*
|
||||
* @param object $group group for which access shall be checked
|
||||
* @param SeedDMS_Core_Group $group group for which access shall be checked
|
||||
* @return integer access mode
|
||||
*/
|
||||
function getGroupAccessMode($group) { /* {{{ */
|
||||
|
@ -1229,6 +1306,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
if (!$accessList)
|
||||
return false;
|
||||
|
||||
/** @var SeedDMS_Core_GroupAccess $groupAccess */
|
||||
foreach ($accessList["groups"] as $groupAccess) {
|
||||
if ($groupAccess->getGroupID() == $group->getID()) {
|
||||
$foundInACL = true;
|
||||
|
@ -1245,13 +1323,14 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
return $this->getDefaultAccess();
|
||||
} /* }}} */
|
||||
|
||||
/** @noinspection PhpUnusedParameterInspection */
|
||||
/**
|
||||
* Get a list of all notification
|
||||
* This function returns all users and groups that have registerd a
|
||||
* notification for the folder
|
||||
*
|
||||
* @param integer $type type of notification (not yet used)
|
||||
* @return array array with a the elements 'users' and 'groups' which
|
||||
* @return SeedDMS_Core_User[]|SeedDMS_Core_Group[]|bool array with a the elements 'users' and 'groups' which
|
||||
* contain a list of users and groups.
|
||||
*/
|
||||
function getNotifyList($type=0) { /* {{{ */
|
||||
|
@ -1293,6 +1372,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
/* Make a copy of both notifier lists because removeNotify will empty
|
||||
* $this->_notifyList and the second foreach will not work anymore.
|
||||
*/
|
||||
/** @var SeedDMS_Core_User[] $nusers */
|
||||
$nusers = $this->_notifyList["users"];
|
||||
$ngroups = $this->_notifyList["groups"];
|
||||
foreach ($nusers as $u) {
|
||||
|
@ -1300,6 +1380,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
$this->removeNotify($u->getID(), true);
|
||||
}
|
||||
}
|
||||
|
||||
/** @var SeedDMS_Core_Group[] $ngroups */
|
||||
foreach ($ngroups as $g) {
|
||||
if ($this->getGroupAccessMode($g) < M_READ) {
|
||||
$this->removeNotify($g->getID(), false);
|
||||
|
@ -1307,7 +1389,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
/*
|
||||
/**
|
||||
* Add a user/group to the notification list
|
||||
* This function does not check if the currently logged in user
|
||||
* is allowed to add a notification. This must be checked by the calling
|
||||
|
@ -1328,6 +1410,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
$userOrGroup = ($isUser) ? "`userID`" : "`groupID`";
|
||||
|
||||
/* Verify that user / group exists */
|
||||
/** @var SeedDMS_Core_User|SeedDMS_Core_Group $obj */
|
||||
$obj = ($isUser ? $this->_dms->getUser($userOrGroupID) : $this->_dms->getGroup($userOrGroupID));
|
||||
if (!is_object($obj)) {
|
||||
return -1;
|
||||
|
@ -1377,6 +1460,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
// that the current group has not been explicitly excluded.
|
||||
$acl = $this->getAccessList(M_NONE, O_EQ);
|
||||
$found = false;
|
||||
/** @var SeedDMS_Core_GroupAccess $group */
|
||||
foreach ($acl["groups"] as $group) {
|
||||
if ($group->getGroupID() == $userOrGroupID) {
|
||||
$found = true;
|
||||
|
@ -1395,6 +1479,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
return -4;
|
||||
}
|
||||
$found = false;
|
||||
/** @var SeedDMS_Core_GroupAccess $group */
|
||||
foreach ($acl["groups"] as $group) {
|
||||
if ($group->getGroupID() == $userOrGroupID) {
|
||||
$found = true;
|
||||
|
@ -1428,7 +1513,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/*
|
||||
/**
|
||||
* Removes notify for a user or group to folder
|
||||
* This function does not check if the currently logged in user
|
||||
* is allowed to remove a notification. This must be checked by the calling
|
||||
|
@ -1436,12 +1521,12 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
*
|
||||
* @param integer $userOrGroupID
|
||||
* @param boolean $isUser true if $userOrGroupID is a user id otherwise false
|
||||
* @param $type type of notification (0 will delete all) Not used yet!
|
||||
* @return integer error code
|
||||
* @param int $type type of notification (0 will delete all) Not used yet!
|
||||
* @return int error code
|
||||
* -1: Invalid User/Group ID.
|
||||
* -3: User is not subscribed.
|
||||
* -4: Database / internal error.
|
||||
* 0: Update successful.
|
||||
* -3: User is not subscribed.
|
||||
* -4: Database / internal error.
|
||||
* 0: Update successful.
|
||||
*/
|
||||
function removeNotify($userOrGroupID, $isUser, $type=0) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1521,9 +1606,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* administrators and the owner of the folder unless $listadmin resp.
|
||||
* $listowner is set to true.
|
||||
*
|
||||
* @param boolean $listadmin if set to true any admin will be listed too
|
||||
* @param boolean $listowner if set to true the owner will be listed too
|
||||
*
|
||||
* @param bool|int $listadmin if set to true any admin will be listed too
|
||||
* @param bool|int $listowner if set to true the owner will be listed too
|
||||
* @return array list of users and groups
|
||||
*/
|
||||
function getReadAccessList($listadmin=0, $listowner=0) { /* {{{ */
|
||||
|
@ -1551,9 +1635,12 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
// to the folder.
|
||||
$tmpList = $this->getAccessList(M_NONE, O_LTEQ);
|
||||
}
|
||||
/** @var SeedDMS_Core_GroupAccess $groupAccess */
|
||||
foreach ($tmpList["groups"] as $groupAccess) {
|
||||
$groupIDs .= (strlen($groupIDs)==0 ? "" : ", ") . $groupAccess->getGroupID();
|
||||
}
|
||||
|
||||
/** @var SeedDMS_Core_UserAccess $userAccess */
|
||||
foreach ($tmpList["users"] as $userAccess) {
|
||||
$user = $userAccess->getUser();
|
||||
if (!$listadmin && $user->isAdmin()) continue;
|
||||
|
@ -1695,7 +1782,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
/**
|
||||
* Get the min and max sequence value for documents
|
||||
*
|
||||
* @return boolean/array array with keys 'min' and 'max', false in case of an error
|
||||
* @return bool|array array with keys 'min' and 'max', false in case of an error
|
||||
*/
|
||||
function getDocumentsMinMax() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
|
|
@ -36,6 +36,11 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
*/
|
||||
protected $_name;
|
||||
|
||||
/**
|
||||
* @var SeedDMS_Core_User[]
|
||||
*/
|
||||
protected $_users;
|
||||
|
||||
/**
|
||||
* The comment of the user group
|
||||
*
|
||||
|
@ -46,7 +51,7 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
/**
|
||||
* Back reference to DMS this user group belongs to
|
||||
*
|
||||
* @var object
|
||||
* @var SeedDMS_Core_DMS
|
||||
*/
|
||||
protected $_dms;
|
||||
|
||||
|
@ -62,11 +67,11 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
*
|
||||
* @param string|integer $id Id, name of group, depending
|
||||
* on the 3rd parameter.
|
||||
* @param object $dms instance of dms
|
||||
* @param SeedDMS_Core_DMS $dms instance of dms
|
||||
* @param string $by search by group name if set to 'name'.
|
||||
* Search by Id of group if left empty.
|
||||
* @return object instance of class SeedDMS_Core_Group if group was found, null
|
||||
* if group was not found, false in case of error
|
||||
* @return SeedDMS_Core_Group|bool instance of class SeedDMS_Core_Group if group was
|
||||
* found, null if group was not found, false in case of error
|
||||
*/
|
||||
public static function getInstance($id, $dms, $by='') { /* {{{ */
|
||||
$db = $dms->getDB();
|
||||
|
@ -92,6 +97,11 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
return $group;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param $orderby
|
||||
* @param SeedDMS_Core_DMS $dms
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function getAllInstances($orderby, $dms) { /* {{{ */
|
||||
$db = $dms->getDB();
|
||||
|
||||
|
@ -114,14 +124,27 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
return $groups;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param SeedDMS_Core_DMS $dms
|
||||
*/
|
||||
function setDMS($dms) { /* {{{ */
|
||||
$this->_dms = $dms;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getID() { return $this->_id; }
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getName() { return $this->_name; }
|
||||
|
||||
/**
|
||||
* @param $newName
|
||||
* @return bool
|
||||
*/
|
||||
function setName($newName) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -133,8 +156,15 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getComment() { return $this->_comment; }
|
||||
|
||||
/**
|
||||
* @param $newComment
|
||||
* @return bool
|
||||
*/
|
||||
function setComment($newComment) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -146,6 +176,9 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return SeedDMS_Core_User[]|bool
|
||||
*/
|
||||
function getUsers() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -161,6 +194,7 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
|
||||
$classname = $this->_dms->getClassname('user');
|
||||
foreach ($resArr as $row) {
|
||||
/** @var SeedDMS_Core_User $user */
|
||||
$user = new $classname($row["id"], $row["login"], $row["pwd"], $row["fullName"], $row["email"], $row["language"], $row["theme"], $row["comment"], $row["role"], $row['hidden']);
|
||||
array_push($this->_users, $user);
|
||||
}
|
||||
|
@ -168,6 +202,9 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
return $this->_users;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return SeedDMS_Core_User[]|bool
|
||||
*/
|
||||
function getManagers() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -182,12 +219,18 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
|
||||
$classname = $this->_dms->getClassname('user');
|
||||
foreach ($resArr as $row) {
|
||||
/** @var SeedDMS_Core_User $user */
|
||||
$user = new $classname($row["id"], $row["login"], $row["pwd"], $row["fullName"], $row["email"], $row["language"], $row["theme"], $row["comment"], $row["role"], $row['hidden']);
|
||||
array_push($managers, $user);
|
||||
}
|
||||
return $managers;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param SeedDMS_Core_User $user
|
||||
* @param bool $asManager
|
||||
* @return bool
|
||||
*/
|
||||
function addUser($user,$asManager=false) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -200,6 +243,10 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param SeedDMS_Core_User $user
|
||||
* @return bool
|
||||
*/
|
||||
function removeUser($user) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -214,7 +261,7 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
/**
|
||||
* Check if user is member of group
|
||||
*
|
||||
* @param object $user user to be checked
|
||||
* @param SeedDMS_Core_User $user user to be checked
|
||||
* @param boolean $asManager also check whether user is manager of group if
|
||||
* set to true, otherwise does not care about manager status
|
||||
* @return boolean true if user is member, otherwise false
|
||||
|
@ -242,7 +289,7 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
/**
|
||||
* Toggle manager status of user
|
||||
*
|
||||
* @param object $user
|
||||
* @param SeedDMS_Core_User $user
|
||||
* @return boolean true if operation was successful, otherwise false
|
||||
*/
|
||||
function toggleManager($user) { /* {{{ */
|
||||
|
@ -262,7 +309,7 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
* This function deletes the user group and all it references, like access
|
||||
* control lists, notifications, as a child of other groups, etc.
|
||||
*
|
||||
* @param object $user the user doing the removal (needed for entry in
|
||||
* @param SeedDMS_Core_User $user the user doing the removal (needed for entry in
|
||||
* review log.
|
||||
* @return boolean true on success or false in case of an error
|
||||
*/
|
||||
|
@ -406,7 +453,7 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
* @param int $documentID optional document id for which to retrieve the
|
||||
* reviews
|
||||
* @param int $version optional version of the document
|
||||
* @return array list of all workflows
|
||||
* @return bool|array list of all workflows
|
||||
*/
|
||||
function getWorkflowStatus($documentID=null, $version=null) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -433,7 +480,7 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
* Get all notifications of group
|
||||
*
|
||||
* @param integer $type type of item (T_DOCUMENT or T_FOLDER)
|
||||
* @return array array of notifications
|
||||
* @return SeedDMS_Core_Notification[]|bool array of notifications
|
||||
*/
|
||||
function getNotifications($type=0) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -458,4 +505,3 @@ class SeedDMS_Core_Group { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
} /* }}} */
|
||||
?>
|
||||
|
|
|
@ -42,11 +42,17 @@ class SeedDMS_Core_KeywordCategory {
|
|||
protected $_name;
|
||||
|
||||
/**
|
||||
* @var object $_dms reference to dms this category belongs to
|
||||
* @var SeedDMS_Core_DMS $_dms reference to dms this category belongs to
|
||||
* @access protected
|
||||
*/
|
||||
protected $_dms;
|
||||
|
||||
/**
|
||||
* SeedDMS_Core_KeywordCategory constructor.
|
||||
* @param $id
|
||||
* @param $ownerID
|
||||
* @param $name
|
||||
*/
|
||||
function __construct($id, $ownerID, $name) {
|
||||
$this->_id = $id;
|
||||
$this->_name = $name;
|
||||
|
@ -54,20 +60,36 @@ class SeedDMS_Core_KeywordCategory {
|
|||
$this->_dms = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SeedDMS_Core_DMS $dms
|
||||
*/
|
||||
function setDMS($dms) {
|
||||
$this->_dms = $dms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getID() { return $this->_id; }
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getName() { return $this->_name; }
|
||||
|
||||
/**
|
||||
* @return bool|SeedDMS_Core_User
|
||||
*/
|
||||
function getOwner() {
|
||||
if (!isset($this->_owner))
|
||||
$this->_owner = $this->_dms->getUser($this->_ownerID);
|
||||
return $this->_owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $newName
|
||||
* @return bool
|
||||
*/
|
||||
function setName($newName) {
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -79,6 +101,10 @@ class SeedDMS_Core_KeywordCategory {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SeedDMS_Core_User $user
|
||||
* @return bool
|
||||
*/
|
||||
function setOwner($user) {
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -91,6 +117,9 @@ class SeedDMS_Core_KeywordCategory {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
function getKeywordLists() {
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -98,6 +127,11 @@ class SeedDMS_Core_KeywordCategory {
|
|||
return $db->getResultArray($queryStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $listID
|
||||
* @param $keywords
|
||||
* @return bool
|
||||
*/
|
||||
function editKeywordList($listID, $keywords) {
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -105,6 +139,10 @@ class SeedDMS_Core_KeywordCategory {
|
|||
return $db->getResult($queryStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $keywords
|
||||
* @return bool
|
||||
*/
|
||||
function addKeywordList($keywords) {
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -112,6 +150,10 @@ class SeedDMS_Core_KeywordCategory {
|
|||
return $db->getResult($queryStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $listID
|
||||
* @return bool
|
||||
*/
|
||||
function removeKeywordList($listID) {
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -119,6 +161,9 @@ class SeedDMS_Core_KeywordCategory {
|
|||
return $db->getResult($queryStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function remove() {
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -139,5 +184,3 @@ class SeedDMS_Core_KeywordCategory {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -34,16 +34,20 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
protected $_attributes;
|
||||
|
||||
/**
|
||||
* @var object back reference to document management system
|
||||
* @var SeedDMS_Core_DMS back reference to document management system
|
||||
*/
|
||||
public $_dms;
|
||||
|
||||
/**
|
||||
* SeedDMS_Core_Object constructor.
|
||||
* @param $id
|
||||
*/
|
||||
function __construct($id) { /* {{{ */
|
||||
$this->_id = $id;
|
||||
$this->_dms = null;
|
||||
} /* }}} */
|
||||
|
||||
/*
|
||||
/**
|
||||
* Set dms this object belongs to.
|
||||
*
|
||||
* Each object needs a reference to the dms it belongs to. It will be
|
||||
|
@ -51,13 +55,13 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
* The dms has a references to the currently logged in user
|
||||
* and the database connection.
|
||||
*
|
||||
* @param object $dms reference to dms
|
||||
* @param SeedDMS_Core_DMS $dms reference to dms
|
||||
*/
|
||||
function setDMS($dms) { /* {{{ */
|
||||
$this->_dms = $dms;
|
||||
} /* }}} */
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the internal id of the document
|
||||
*
|
||||
* @return integer id of document
|
||||
|
@ -67,8 +71,8 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Returns all attributes set for the object
|
||||
*
|
||||
* @return array list of objects of class SeedDMS_Core_Attribute
|
||||
*/
|
||||
* @return array|bool
|
||||
*/
|
||||
function getAttributes() { /* {{{ */
|
||||
if (!$this->_attributes) {
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -102,12 +106,13 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Returns an attribute of the object for the given attribute definition
|
||||
*
|
||||
* @return array|string value of attritbute or false. The value is an array
|
||||
* if the attribute is defined as multi value
|
||||
*/
|
||||
/**
|
||||
* Returns an attribute of the object for the given attribute definition
|
||||
*
|
||||
* @param SeedDMS_Core_AttributeDefinition $attrdef
|
||||
* @return array|string value of attritbute or false. The value is an array
|
||||
* if the attribute is defined as multi value
|
||||
*/
|
||||
function getAttribute($attrdef) { /* {{{ */
|
||||
if (!$this->_attributes) {
|
||||
$this->getAttributes();
|
||||
|
@ -124,6 +129,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Returns an attribute value of the object for the given attribute definition
|
||||
*
|
||||
* @param SeedDMS_Core_AttributeDefinition $attrdef
|
||||
* @return array|string value of attritbute or false. The value is an array
|
||||
* if the attribute is defined as multi value
|
||||
*/
|
||||
|
@ -154,16 +160,17 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Returns an attribute value of the object for the given attribute definition
|
||||
*
|
||||
* This is a short cut for getAttribute($attrdef)->getValueAsArray() but
|
||||
* first checks if the object has an attribute for the given attribute
|
||||
* definition.
|
||||
*
|
||||
* @return array value of attritbute or false. The value is always an array
|
||||
* even if the attribute is not defined as multi value
|
||||
*/
|
||||
/**
|
||||
* Returns an attribute value of the object for the given attribute definition
|
||||
*
|
||||
* This is a short cut for getAttribute($attrdef)->getValueAsArray() but
|
||||
* first checks if the object has an attribute for the given attribute
|
||||
* definition.
|
||||
*
|
||||
* @param SeedDMS_Core_AttributeDefinition $attrdef
|
||||
* @return array|bool
|
||||
* even if the attribute is not defined as multi value
|
||||
*/
|
||||
function getAttributeValueAsArray($attrdef) { /* {{{ */
|
||||
if (!$this->_attributes) {
|
||||
$this->getAttributes();
|
||||
|
@ -183,6 +190,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
* first checks if the object has an attribute for the given attribute
|
||||
* definition.
|
||||
*
|
||||
* @param SeedDMS_Core_AttributeDefinition $attrdef
|
||||
* @return string value of attritbute or false. The value is always a string
|
||||
* even if the attribute is defined as multi value
|
||||
*/
|
||||
|
@ -201,8 +209,8 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Set an attribute of the object for the given attribute definition
|
||||
*
|
||||
* @param object $attrdef definition of attribute
|
||||
* @param array|sting $value value of attribute, for multiple values this
|
||||
* @param SeedDMS_Core_AttributeDefinition $attrdef definition of attribute
|
||||
* @param array|string $value value of attribute, for multiple values this
|
||||
* must be an array
|
||||
* @return boolean true if operation was successful, otherwise false
|
||||
*/
|
||||
|
@ -254,7 +262,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
|
||||
/**
|
||||
* Remove an attribute of the object for the given attribute definition
|
||||
*
|
||||
* @param SeedDMS_Core_AttributeDefinition $attrdef
|
||||
* @return boolean true if operation was successful, otherwise false
|
||||
*/
|
||||
function removeAttribute($attrdef) { /* {{{ */
|
||||
|
@ -285,4 +293,3 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
} /* }}} */
|
||||
?>
|
||||
|
|
|
@ -117,23 +117,51 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
var $_loginFailures;
|
||||
|
||||
/**
|
||||
* @var object home folder
|
||||
* @var SeedDMS_Core_Folder home folder
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_homeFolder;
|
||||
|
||||
/**
|
||||
* @var object reference to the dms instance this user belongs to
|
||||
* @var SeedDMS_Core_DMS reference to the dms instance this user belongs to
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_dms;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $_quota;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $_hasImage;
|
||||
|
||||
const role_user = '0';
|
||||
const role_admin = '1';
|
||||
const role_guest = '2';
|
||||
|
||||
/**
|
||||
* SeedDMS_Core_User constructor.
|
||||
* @param $id
|
||||
* @param $login
|
||||
* @param $pwd
|
||||
* @param $fullName
|
||||
* @param $email
|
||||
* @param $language
|
||||
* @param $theme
|
||||
* @param $comment
|
||||
* @param $role
|
||||
* @param int $isHidden
|
||||
* @param int $isDisabled
|
||||
* @param string $pwdExpiration
|
||||
* @param int $loginFailures
|
||||
* @param int $quota
|
||||
* @param null $homeFolder
|
||||
*/
|
||||
function __construct($id, $login, $pwd, $fullName, $email, $language, $theme, $comment, $role, $isHidden=0, $isDisabled=0, $pwdExpiration='', $loginFailures=0, $quota=0, $homeFolder=null) {
|
||||
$this->_id = $id;
|
||||
$this->_login = $login;
|
||||
|
@ -158,13 +186,13 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
*
|
||||
* @param string|integer $id Id, login name, or email of user, depending
|
||||
* on the 3rd parameter.
|
||||
* @param object $dms instance of dms
|
||||
* @param SeedDMS_Core_DMS $dms instance of dms
|
||||
* @param string $by search by [name|email]. If 'name' is passed, the method
|
||||
* will check for the 4th paramater and also filter by email. If this
|
||||
* parameter is left empty, the user will be search by its Id.
|
||||
* @param string $email optional email address if searching for name
|
||||
* @return object instance of class SeedDMS_Core_User if user was found, null
|
||||
* if user was not found, false in case of error
|
||||
* @return SeedDMS_Core_User|bool instance of class SeedDMS_Core_User if user was
|
||||
* found, null if user was not found, false in case of error
|
||||
*/
|
||||
public static function getInstance($id, $dms, $by='', $email='') { /* {{{ */
|
||||
$db = $dms->getDB();
|
||||
|
@ -193,6 +221,11 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return $user;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param $orderby
|
||||
* @param SeedDMS_Core_DMS $dms
|
||||
* @return SeedDMS_Core_User[]|bool
|
||||
*/
|
||||
public static function getAllInstances($orderby, $dms) { /* {{{ */
|
||||
$db = $dms->getDB();
|
||||
|
||||
|
@ -208,6 +241,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
$users = array();
|
||||
|
||||
for ($i = 0; $i < count($resArr); $i++) {
|
||||
/** @var SeedDMS_Core_User $user */
|
||||
$user = new self($resArr[$i]["id"], $resArr[$i]["login"], $resArr[$i]["pwd"], $resArr[$i]["fullName"], $resArr[$i]["email"], (isset($resArr[$i]["language"])?$resArr[$i]["language"]:NULL), (isset($resArr[$i]["theme"])?$resArr[$i]["theme"]:NULL), $resArr[$i]["comment"], $resArr[$i]["role"], $resArr[$i]["hidden"], $resArr[$i]["disabled"], $resArr[$i]["pwdExpiration"], $resArr[$i]["loginfailures"], $resArr[$i]["quota"], $resArr[$i]["homefolder"]);
|
||||
$user->setDMS($dms);
|
||||
$users[$i] = $user;
|
||||
|
@ -216,14 +250,27 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return $users;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param SeedDMS_Core_DMS $dms
|
||||
*/
|
||||
function setDMS($dms) {
|
||||
$this->_dms = $dms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getID() { return $this->_id; }
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getLogin() { return $this->_login; }
|
||||
|
||||
/**
|
||||
* @param $newLogin
|
||||
* @return bool
|
||||
*/
|
||||
function setLogin($newLogin) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -236,8 +283,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getFullName() { return $this->_fullName; }
|
||||
|
||||
/**
|
||||
* @param $newFullName
|
||||
* @return bool
|
||||
*/
|
||||
function setFullName($newFullName) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -250,8 +304,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getPwd() { return $this->_pwd; }
|
||||
|
||||
/**
|
||||
* @param $newPwd
|
||||
* @return bool
|
||||
*/
|
||||
function setPwd($newPwd) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -264,8 +325,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getPwdExpiration() { return $this->_pwdExpiration; }
|
||||
|
||||
/**
|
||||
* @param $newPwdExpiration
|
||||
* @return bool
|
||||
*/
|
||||
function setPwdExpiration($newPwdExpiration) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -284,8 +352,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getEmail() { return $this->_email; }
|
||||
|
||||
/**
|
||||
* @param $newEmail
|
||||
* @return bool
|
||||
*/
|
||||
function setEmail($newEmail) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -298,8 +373,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getLanguage() { return $this->_language; }
|
||||
|
||||
/**
|
||||
* @param $newLanguage
|
||||
* @return bool
|
||||
*/
|
||||
function setLanguage($newLanguage) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -312,8 +394,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getTheme() { return $this->_theme; }
|
||||
|
||||
/**
|
||||
* @param string $newTheme
|
||||
* @return bool
|
||||
*/
|
||||
function setTheme($newTheme) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -326,8 +415,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getComment() { return $this->_comment; }
|
||||
|
||||
/**
|
||||
* @param $newComment
|
||||
* @return bool
|
||||
*/
|
||||
function setComment($newComment) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -340,8 +436,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getRole() { return $this->_role; }
|
||||
|
||||
/**
|
||||
* @param $newrole
|
||||
* @return bool
|
||||
*/
|
||||
function setRole($newrole) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -353,9 +456,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function isAdmin() { return ($this->_role == SeedDMS_Core_User::role_admin); }
|
||||
|
||||
function setAdmin($isAdmin) { /* {{{ */
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function setAdmin() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblUsers` SET `role` = " . SeedDMS_Core_User::role_admin . " WHERE `id` = " . $this->_id;
|
||||
|
@ -366,9 +475,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function isGuest() { return ($this->_role == SeedDMS_Core_User::role_guest); }
|
||||
|
||||
function setGuest($isGuest) { /* {{{ */
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function setGuest() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblUsers` SET `role` = " . SeedDMS_Core_User::role_guest . " WHERE `id` = " . $this->_id;
|
||||
|
@ -379,8 +494,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return bool|int
|
||||
*/
|
||||
function isHidden() { return $this->_isHidden; }
|
||||
|
||||
/**
|
||||
* @param $isHidden
|
||||
* @return bool
|
||||
*/
|
||||
function setHidden($isHidden) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -393,8 +515,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return bool|int
|
||||
*/
|
||||
function isDisabled() { return $this->_isDisabled; }
|
||||
|
||||
/**
|
||||
* @param $isDisabled
|
||||
* @return bool
|
||||
*/
|
||||
function setDisabled($isDisabled) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -407,6 +536,9 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return bool|int
|
||||
*/
|
||||
function addLoginFailure() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -418,6 +550,9 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return $this->_loginFailures;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function clearLoginFailures() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -448,8 +583,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return $resArr[0]['sum'];
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getQuota() { return $this->_quota; }
|
||||
|
||||
/**
|
||||
* @param $quota
|
||||
* @return bool
|
||||
*/
|
||||
function setQuota($quota) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -462,8 +604,15 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @return null|SeedDMS_Core_Folder
|
||||
*/
|
||||
function getHomeFolder() { return $this->_homeFolder; }
|
||||
|
||||
/**
|
||||
* @param $homefolder
|
||||
* @return bool
|
||||
*/
|
||||
function setHomeFolder($homefolder) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -656,9 +805,9 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* Do not remove folders and documents of the user, but assign them
|
||||
* to a different user.
|
||||
*
|
||||
* @param object $user the user doing the removal (needed for entry in
|
||||
* @param SeedDMS_Core_User $user the user doing the removal (needed for entry in
|
||||
* review and approve log).
|
||||
* @param object $assignToUser the user who is new owner of folders and
|
||||
* @param SeedDMS_Core_User $assignToUser the user who is new owner of folders and
|
||||
* documents which previously were owned by the delete user.
|
||||
* @return boolean true on success or false in case of an error
|
||||
*/
|
||||
|
@ -671,8 +820,9 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* anymore.
|
||||
*/
|
||||
if(!$assignToUser)
|
||||
return;
|
||||
$assignTo = $assignToUser->getID();
|
||||
return false;
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$assignTo = $assignToUser->getID();
|
||||
|
||||
$db->startTransaction();
|
||||
|
||||
|
@ -828,7 +978,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* This function uses {@link SeedDMS_Group::addUser} but checks before if
|
||||
* the user is already a member of the group.
|
||||
*
|
||||
* @param object $group group to be the member of
|
||||
* @param SeedDMS_Core_Group $group group to be the member of
|
||||
* @return boolean true on success or false in case of an error or the user
|
||||
* is already a member of the group
|
||||
*/
|
||||
|
@ -848,7 +998,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* This function uses {@link SeedDMS_Group::removeUser} but checks before if
|
||||
* the user is a member of the group at all.
|
||||
*
|
||||
* @param object $group group to leave
|
||||
* @param SeedDMS_Core_Group $group group to leave
|
||||
* @return boolean true on success or false in case of an error or the user
|
||||
* is not a member of the group
|
||||
*/
|
||||
|
@ -866,7 +1016,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
/**
|
||||
* Get all groups the user is a member of
|
||||
*
|
||||
* @return array list of groups
|
||||
* @return SeedDMS_Core_Group[]|bool list of groups
|
||||
*/
|
||||
function getGroups() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -883,6 +1033,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
$this->_groups = array();
|
||||
$classname = $this->_dms->getClassname('group');
|
||||
foreach ($resArr as $row) {
|
||||
/** @var SeedDMS_Core_Group $group */
|
||||
$group = new $classname($row["id"], $row["name"], $row["comment"]);
|
||||
$group->setDMS($this->_dms);
|
||||
array_push($this->_groups, $group);
|
||||
|
@ -894,7 +1045,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
/**
|
||||
* Checks if user is member of a given group
|
||||
*
|
||||
* @param object $group
|
||||
* @param SeedDMS_Core_Group $group
|
||||
* @return boolean true if user is member of the given group otherwise false
|
||||
*/
|
||||
function isMemberOfGroup($group) { /* {{{ */
|
||||
|
@ -925,7 +1076,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
/**
|
||||
* Get the image from the users profile
|
||||
*
|
||||
* @return array image data
|
||||
* @return array|bool image data
|
||||
*/
|
||||
function getImage() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -940,6 +1091,11 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
return $resArr;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* @param $tmpfile
|
||||
* @param $mimeType
|
||||
* @return bool
|
||||
*/
|
||||
function setImage($tmpfile, $mimeType) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -961,9 +1117,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
|
||||
/**
|
||||
* Returns all documents of a given user
|
||||
*
|
||||
* @param object $user
|
||||
* @return array list of documents
|
||||
* @return SeedDMS_Core_Document[]|bool list of documents
|
||||
*/
|
||||
function getDocuments() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -980,6 +1134,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
$documents = array();
|
||||
$classname = $this->_dms->getClassname('document');
|
||||
foreach ($resArr as $row) {
|
||||
/** @var SeedDMS_Core_Document $document */
|
||||
$document = new $classname($row["id"], $row["name"], $row["comment"], $row["date"], $row["expires"], $row["owner"], $row["folder"], $row["inheritAccess"], $row["defaultAccess"], $row["lockUser"], $row["keywords"], $row["sequence"]);
|
||||
$document->setDMS($this->_dms);
|
||||
$documents[] = $document;
|
||||
|
@ -990,8 +1145,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
/**
|
||||
* Returns all documents locked by a given user
|
||||
*
|
||||
* @param object $user
|
||||
* @return array list of documents
|
||||
* @return bool|SeedDMS_Core_Document[] list of documents
|
||||
*/
|
||||
function getDocumentsLocked() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1008,6 +1162,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
$documents = array();
|
||||
$classname = $this->_dms->getClassname('document');
|
||||
foreach ($resArr as $row) {
|
||||
/** @var SeedDMS_Core_Document $document */
|
||||
$document = new $classname($row["id"], $row["name"], $row["comment"], $row["date"], $row["expires"], $row["owner"], $row["folder"], $row["inheritAccess"], $row["defaultAccess"], $row["lockUser"], $row["keywords"], $row["sequence"]);
|
||||
$document->setDMS($this->_dms);
|
||||
$documents[] = $document;
|
||||
|
@ -1033,7 +1188,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* @param int $documentID optional document id for which to retrieve the
|
||||
* reviews
|
||||
* @param int $version optional version of the document
|
||||
* @return array list of all reviews
|
||||
* @return array|bool list of all reviews
|
||||
*/
|
||||
function getReviewStatus($documentID=null, $version=null) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1126,14 +1281,14 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* @param int $documentID optional document id for which to retrieve the
|
||||
* approvals
|
||||
* @param int $version optional version of the document
|
||||
* @return array list of all approvals
|
||||
* @return array|bool list of all approvals
|
||||
*/
|
||||
function getApprovalStatus($documentID=null, $version=null) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$status = array("indstatus"=>array(), "grpstatus"=>array());
|
||||
$queryStr =
|
||||
"SELECT `tblDocumentApprovers`.*, `tblDocumentApproveLog`.`status`, ".
|
||||
"SELECT `tblDocumentApprovers`.*, `tblDocumentApproveLog`.`status`, ".
|
||||
"`tblDocumentApproveLog`.`comment`, `tblDocumentApproveLog`.`date`, ".
|
||||
"`tblDocumentApproveLog`.`userID` ".
|
||||
"FROM `tblDocumentApprovers` ".
|
||||
|
@ -1196,7 +1351,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* @param int $documentID optional document id for which to retrieve the
|
||||
* reviews
|
||||
* @param int $version optional version of the document
|
||||
* @return array list of all workflows
|
||||
* @return array|bool list of all workflows
|
||||
*/
|
||||
function getWorkflowStatus($documentID=null, $version=null) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1238,7 +1393,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
/**
|
||||
* Get a list of workflows this user is involved as in individual
|
||||
*
|
||||
* @return array list of all workflows
|
||||
* @return array|bool list of all workflows
|
||||
*/
|
||||
function getWorkflowsInvolved() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1298,7 +1453,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* This method is the reverse function of getMandatoryReviewers(). It returns
|
||||
* those user where the current user is a mandatory reviewer.
|
||||
*
|
||||
* @return array list of users where this user is a mandatory reviewer.
|
||||
* @return SeedDMS_Core_User[]|bool list of users where this user is a mandatory reviewer.
|
||||
*/
|
||||
function isMandatoryReviewerOf() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1321,7 +1476,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* This method is the reverse function of getMandatoryApprovers(). It returns
|
||||
* those user where the current user is a mandatory approver.
|
||||
*
|
||||
* @return array list of users where this user is a mandatory approver.
|
||||
* @return SeedDMS_Core_User[]|bool list of users where this user is a mandatory approver.
|
||||
*/
|
||||
function isMandatoryApproverOf() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1345,7 +1500,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* Whenever the user inserts a new document the mandatory workflow is
|
||||
* filled in as the workflow.
|
||||
*
|
||||
* @return object workflow
|
||||
* @return SeedDMS_Core_Workflow|bool workflow
|
||||
*/
|
||||
function getMandatoryWorkflow() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1368,7 +1523,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* Whenever the user inserts a new document the mandatory workflow is
|
||||
* filled in as the workflow.
|
||||
*
|
||||
* @return object workflow
|
||||
* @return SeedDMS_Core_Workflow[]|bool workflow
|
||||
*/
|
||||
function getMandatoryWorkflows() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1419,6 +1574,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
if (is_bool($resArr) && !$resArr) return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
@ -1436,7 +1592,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
|
||||
$queryStr = "SELECT * FROM `tblMandatoryApprovers` WHERE `userID` = " . $this->_id . " AND `approverGroupID` = " . (int) $id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (count($resArr)!=0) return;
|
||||
if (count($resArr)!=0) return true;
|
||||
|
||||
$queryStr = "INSERT INTO `tblMandatoryApprovers` (`userID`, `approverGroupID`) VALUES (" . $this->_id . ", " . $id .")";
|
||||
$resArr = $db->getResult($queryStr);
|
||||
|
@ -1446,12 +1602,14 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
|
||||
$queryStr = "SELECT * FROM `tblMandatoryApprovers` WHERE `userID` = " . $this->_id . " AND `approverUserID` = " . (int) $id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (count($resArr)!=0) return;
|
||||
if (count($resArr)!=0) return true;
|
||||
|
||||
$queryStr = "INSERT INTO `tblMandatoryApprovers` (`userID`, `approverUserID`) VALUES (" . $this->_id . ", " . $id .")";
|
||||
$resArr = $db->getResult($queryStr);
|
||||
if (is_bool($resArr) && !$resArr) return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
@ -1466,18 +1624,20 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
|
||||
$queryStr = "SELECT * FROM `tblWorkflowMandatoryWorkflow` WHERE `userid` = " . $this->_id . " AND `workflow` = " . (int) $workflow->getID();
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (count($resArr)!=0) return;
|
||||
if (count($resArr)!=0) return true;
|
||||
|
||||
$queryStr = "INSERT INTO `tblWorkflowMandatoryWorkflow` (`userid`, `workflow`) VALUES (" . $this->_id . ", " . $workflow->getID() .")";
|
||||
$resArr = $db->getResult($queryStr);
|
||||
if (is_bool($resArr) && !$resArr) return false;
|
||||
|
||||
return false;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Set a mandatory workflows
|
||||
* This function sets a list of mandatory workflows.
|
||||
*
|
||||
* @param array $workflows list of workflow objects
|
||||
* @param SeedDMS_Core_Workflow[] $workflows list of workflow objects
|
||||
* @return boolean true on success, otherwise false
|
||||
*/
|
||||
function setMandatoryWorkflows($workflows) { /* {{{ */
|
||||
|
@ -1544,7 +1704,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* Get all notifications of user
|
||||
*
|
||||
* @param integer $type type of item (T_DOCUMENT or T_FOLDER)
|
||||
* @return array array of notifications
|
||||
* @return SeedDMS_Core_Notification[]|bool array of notifications
|
||||
*/
|
||||
function getNotifications($type=0) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1571,7 +1731,7 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
/**
|
||||
* Return list of personal keyword categories
|
||||
*
|
||||
* @return array/boolean list of categories or false in case of an error
|
||||
* @return SeedDMS_Core_KeywordCategory[]|bool list of categories or false in case of an error
|
||||
*/
|
||||
function getKeywordCategories() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -1593,4 +1753,3 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
} /* }}} */
|
||||
?>
|
||||
|
|
|
@ -29,33 +29,39 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
var $_id;
|
||||
|
||||
/**
|
||||
* @var name of the workflow
|
||||
* @var string name of the workflow
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_name;
|
||||
|
||||
/**
|
||||
* @var initial state of the workflow
|
||||
* @var SeedDMS_Core_Workflow_State initial state of the workflow
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_initstate;
|
||||
|
||||
/**
|
||||
* @var name of the workflow state
|
||||
* @var SeedDMS_Core_Workflow_Transition[] name of the workflow state
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_transitions;
|
||||
|
||||
/**
|
||||
* @var object reference to the dms instance this attribute belongs to
|
||||
* @var SeedDMS_Core_DMS reference to the dms instance this attribute belongs to
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_dms;
|
||||
|
||||
/**
|
||||
* SeedDMS_Core_Workflow constructor.
|
||||
* @param int $id
|
||||
* @param string $name
|
||||
* @param SeedDMS_Core_Workflow_State $initstate
|
||||
*/
|
||||
function __construct($id, $name, $initstate) { /* {{{ */
|
||||
$this->_id = $id;
|
||||
$this->_name = $name;
|
||||
|
@ -64,15 +70,28 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
$this->_dms = null;
|
||||
} /* }}} */
|
||||
|
||||
function setDMS($dms) { /* {{{ */
|
||||
/**
|
||||
* @param SeedDMS_Core_DMS $dms
|
||||
*/
|
||||
function setDMS($dms) { /* {{{ */
|
||||
$this->_dms = $dms;
|
||||
} /* }}} */
|
||||
|
||||
function getID() { return $this->_id; }
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getID() { return $this->_id; }
|
||||
|
||||
function getName() { return $this->_name; }
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getName() { return $this->_name; }
|
||||
|
||||
function setName($newName) { /* {{{ */
|
||||
/**
|
||||
* @param $newName
|
||||
* @return bool
|
||||
*/
|
||||
function setName($newName) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblWorkflows` SET `name` = ".$db->qstr($newName)." WHERE `id` = " . $this->_id;
|
||||
|
@ -84,9 +103,16 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
function getInitState() { return $this->_initstate; }
|
||||
/**
|
||||
* @return SeedDMS_Core_Workflow_State
|
||||
*/
|
||||
function getInitState() { return $this->_initstate; }
|
||||
|
||||
function setInitState($state) { /* {{{ */
|
||||
/**
|
||||
* @param SeedDMS_Core_Workflow_State $state
|
||||
* @return bool
|
||||
*/
|
||||
function setInitState($state) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblWorkflows` SET `initstate` = ".$state->getID()." WHERE `id` = " . $this->_id;
|
||||
|
@ -98,7 +124,10 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
function getTransitions() { /* {{{ */
|
||||
/**
|
||||
* @return SeedDMS_Core_Workflow_Transition[]|bool
|
||||
*/
|
||||
function getTransitions() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
if($this->_transitions)
|
||||
|
@ -121,8 +150,12 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
return $this->_transitions;
|
||||
} /* }}} */
|
||||
|
||||
function getStates() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
function getStates() { /* {{{ */
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
if(!$this->_transitions)
|
||||
$this->getTransitions();
|
||||
|
@ -138,14 +171,15 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
return $states;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Get the transition by its id
|
||||
*
|
||||
* @param integer $id id of transition
|
||||
* @param object transition
|
||||
*/
|
||||
/**
|
||||
* Get the transition by its id
|
||||
*
|
||||
* @param integer $id id of transition
|
||||
* @return bool|SeedDMS_Core_Workflow_Transition
|
||||
*/
|
||||
function getTransition($id) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
if(!$this->_transitions)
|
||||
$this->getTransitions();
|
||||
|
@ -156,12 +190,12 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
return false;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Get the transitions that can be triggered while being in the given state
|
||||
*
|
||||
* @param object $state current workflow state
|
||||
* @param array list of transitions
|
||||
*/
|
||||
/**
|
||||
* Get the transitions that can be triggered while being in the given state
|
||||
*
|
||||
* @param SeedDMS_Core_Workflow_State $state current workflow state
|
||||
* @return SeedDMS_Core_Workflow_Transition[]|bool
|
||||
*/
|
||||
function getNextTransitions($state) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -180,12 +214,12 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
return $wkftransitions;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Get the transitions that lead to the given state
|
||||
*
|
||||
* @param object $state current workflow state
|
||||
* @param array list of transitions
|
||||
*/
|
||||
/**
|
||||
* Get the transitions that lead to the given state
|
||||
*
|
||||
* @param SeedDMS_Core_Workflow_State $state current workflow state
|
||||
* @return SeedDMS_Core_Workflow_Transition[]|bool
|
||||
*/
|
||||
function getPreviousTransitions($state) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -204,13 +238,13 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
return $wkftransitions;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Get all transitions from one state into another state
|
||||
*
|
||||
* @param object $state state to start from
|
||||
* @param object $nextstate state after transition
|
||||
* @param array list of transitions
|
||||
*/
|
||||
/**
|
||||
* Get all transitions from one state into another state
|
||||
*
|
||||
* @param SeedDMS_Core_Workflow_State $state state to start from
|
||||
* @param SeedDMS_Core_Workflow_State $nextstate state after transition
|
||||
* @return SeedDMS_Core_Workflow_Transition[]|bool
|
||||
*/
|
||||
function getTransitionsByStates($state, $nextstate) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
|
@ -233,7 +267,7 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
* Remove a transition from a workflow
|
||||
* Deprecated! User SeedDMS_Core_Workflow_Transition::remove() instead.
|
||||
*
|
||||
* @param object $transition
|
||||
* @param SeedDMS_Core_Workflow_Transition $transition
|
||||
* @return boolean true if no error occured, otherwise false
|
||||
*/
|
||||
function removeTransition($transition) { /* {{{ */
|
||||
|
@ -243,12 +277,12 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
/**
|
||||
* Add new transition to workflow
|
||||
*
|
||||
* @param object $state
|
||||
* @param object $action
|
||||
* @param object $nextstate
|
||||
* @param array $users
|
||||
* @param array $groups
|
||||
* @return object instance of new transition
|
||||
* @param SeedDMS_Core_Workflow_State $state
|
||||
* @param SeedDMS_Core_Workflow_Action $action
|
||||
* @param SeedDMS_Core_Workflow_State $nextstate
|
||||
* @param SeedDMS_Core_User[] $users
|
||||
* @param SeedDMS_Core_Group[] $groups
|
||||
* @return SeedDMS_Core_Workflow_Transition|bool instance of new transition
|
||||
*/
|
||||
function addTransition($state, $action, $nextstate, $users, $groups) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -301,7 +335,11 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
private function penetrate($laststates) {
|
||||
/**
|
||||
* @param SeedDMS_Core_Workflow_State[] $laststates
|
||||
* @return SeedDMS_Core_Workflow_State[]|bool
|
||||
*/
|
||||
private function penetrate($laststates) {
|
||||
$state = end($laststates);
|
||||
$transitions = $this->getNextTransitions($state);
|
||||
foreach($transitions as $transition) {
|
||||
|
@ -323,7 +361,8 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
* @return boolean list of states if workflow contains cycles, otherwise false
|
||||
*/
|
||||
function checkForCycles() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$initstate = $this->getInitState();
|
||||
|
||||
|
@ -389,41 +428,49 @@ class SeedDMS_Core_Workflow_State { /* {{{ */
|
|||
var $_id;
|
||||
|
||||
/**
|
||||
* @var name of the workflow state
|
||||
* @var string name of the workflow state
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_name;
|
||||
|
||||
/**
|
||||
* @var maximum of seconds allowed in this state
|
||||
* @var int maximum of seconds allowed in this state
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_maxtime;
|
||||
|
||||
/**
|
||||
* @var maximum of seconds allowed in this state
|
||||
* @var int maximum of seconds allowed in this state
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_precondfunc;
|
||||
|
||||
/**
|
||||
* @var matching documentstatus when this state is reached
|
||||
* @var int matching documentstatus when this state is reached
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_documentstatus;
|
||||
|
||||
/**
|
||||
* @var object reference to the dms instance this attribute belongs to
|
||||
* @var SeedDMS_Core_DMS reference to the dms instance this attribute belongs to
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_dms;
|
||||
|
||||
function __construct($id, $name, $maxtime, $precondfunc, $documentstatus) {
|
||||
/**
|
||||
* SeedDMS_Core_Workflow_State constructor.
|
||||
* @param $id
|
||||
* @param $name
|
||||
* @param $maxtime
|
||||
* @param $precondfunc
|
||||
* @param $documentstatus
|
||||
*/
|
||||
function __construct($id, $name, $maxtime, $precondfunc, $documentstatus) {
|
||||
$this->_id = $id;
|
||||
$this->_name = $name;
|
||||
$this->_maxtime = $maxtime;
|
||||
|
@ -432,15 +479,28 @@ class SeedDMS_Core_Workflow_State { /* {{{ */
|
|||
$this->_dms = null;
|
||||
}
|
||||
|
||||
function setDMS($dms) {
|
||||
/**
|
||||
* @param $dms
|
||||
*/
|
||||
function setDMS($dms) {
|
||||
$this->_dms = $dms;
|
||||
}
|
||||
|
||||
function getID() { return $this->_id; }
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getID() { return $this->_id; }
|
||||
|
||||
function getName() { return $this->_name; }
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getName() { return $this->_name; }
|
||||
|
||||
function setName($newName) { /* {{{ */
|
||||
/**
|
||||
* @param string $newName
|
||||
* @return bool
|
||||
*/
|
||||
function setName($newName) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblWorkflowStates` SET `name` = ".$db->qstr($newName)." WHERE `id` = " . $this->_id;
|
||||
|
@ -452,9 +512,16 @@ class SeedDMS_Core_Workflow_State { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
function getMaxTime() { return $this->_maxtime; }
|
||||
/**
|
||||
* @return int maximum
|
||||
*/
|
||||
function getMaxTime() { return $this->_maxtime; }
|
||||
|
||||
function setMaxTime($maxtime) { /* {{{ */
|
||||
/**
|
||||
* @param $maxtime
|
||||
* @return bool
|
||||
*/
|
||||
function setMaxTime($maxtime) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblWorkflowStates` SET `maxtime` = ".intval($maxtime)." WHERE `id` = " . $this->_id;
|
||||
|
@ -466,9 +533,16 @@ class SeedDMS_Core_Workflow_State { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
function getPreCondFunc() { return $this->_precondfunc; }
|
||||
/**
|
||||
* @return int maximum
|
||||
*/
|
||||
function getPreCondFunc() { return $this->_precondfunc; }
|
||||
|
||||
function setPreCondFunc($precondfunc) { /* {{{ */
|
||||
/**
|
||||
* @param $precondfunc
|
||||
* @return bool
|
||||
*/
|
||||
function setPreCondFunc($precondfunc) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblWorkflowStates` SET `precondfunc` = ".$db->qstr($precondfunc)." WHERE id = " . $this->_id;
|
||||
|
@ -476,7 +550,8 @@ class SeedDMS_Core_Workflow_State { /* {{{ */
|
|||
if (!$res)
|
||||
return false;
|
||||
|
||||
$this->_maxtime = $maxtime;
|
||||
/** @noinspection PhpUndefinedVariableInspection */
|
||||
$this->_maxtime = $maxtime; /* @todo fix me */
|
||||
return true;
|
||||
} /* }}} */
|
||||
|
||||
|
@ -490,7 +565,11 @@ class SeedDMS_Core_Workflow_State { /* {{{ */
|
|||
*/
|
||||
function getDocumentStatus() { return $this->_documentstatus; }
|
||||
|
||||
function setDocumentStatus($docstatus) { /* {{{ */
|
||||
/**
|
||||
* @param $docstatus
|
||||
* @return bool
|
||||
*/
|
||||
function setDocumentStatus($docstatus) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblWorkflowStates` SET `documentstatus` = ".intval($docstatus)." WHERE id = " . $this->_id;
|
||||
|
@ -520,7 +599,7 @@ class SeedDMS_Core_Workflow_State { /* {{{ */
|
|||
/**
|
||||
* Return workflow transitions the status is being used in
|
||||
*
|
||||
* @return array/boolean array of workflow transitions or false in case of an error
|
||||
* @return SeedDMS_Core_Workflow_Transition[]|boolean array of workflow transitions or false in case of an error
|
||||
*/
|
||||
function getTransitions() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -586,34 +665,52 @@ class SeedDMS_Core_Workflow_Action { /* {{{ */
|
|||
var $_id;
|
||||
|
||||
/**
|
||||
* @var name of the workflow action
|
||||
* @var string name of the workflow action
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_name;
|
||||
|
||||
/**
|
||||
* @var object reference to the dms instance this attribute belongs to
|
||||
* @var SeedDMS_Core_DMS reference to the dms instance this attribute belongs to
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_dms;
|
||||
|
||||
function __construct($id, $name) {
|
||||
/**
|
||||
* SeedDMS_Core_Workflow_Action constructor.
|
||||
* @param $id
|
||||
* @param $name
|
||||
*/
|
||||
function __construct($id, $name) {
|
||||
$this->_id = $id;
|
||||
$this->_name = $name;
|
||||
$this->_dms = null;
|
||||
}
|
||||
|
||||
function setDMS($dms) {
|
||||
/**
|
||||
* @param $dms
|
||||
*/
|
||||
function setDMS($dms) {
|
||||
$this->_dms = $dms;
|
||||
}
|
||||
|
||||
function getID() { return $this->_id; }
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getID() { return $this->_id; }
|
||||
|
||||
function getName() { return $this->_name; }
|
||||
/**
|
||||
* @return string name
|
||||
*/
|
||||
function getName() { return $this->_name; }
|
||||
|
||||
function setName($newName) { /* {{{ */
|
||||
/**
|
||||
* @param $newName
|
||||
* @return bool
|
||||
*/
|
||||
function setName($newName) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblWorkflowActions` SET `name` = ".$db->qstr($newName)." WHERE `id` = " . $this->_id;
|
||||
|
@ -643,7 +740,7 @@ class SeedDMS_Core_Workflow_Action { /* {{{ */
|
|||
/**
|
||||
* Return workflow transitions the action is being used in
|
||||
*
|
||||
* @return array/boolean array of workflow transitions or false in case of an error
|
||||
* @return SeedDMS_Core_Workflow_Transition[]|boolean array of workflow transitions or false in case of an error
|
||||
*/
|
||||
function getTransitions() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -709,62 +806,71 @@ class SeedDMS_Core_Workflow_Transition { /* {{{ */
|
|||
var $_id;
|
||||
|
||||
/**
|
||||
* @var workflow this transition belongs to
|
||||
* @var SeedDMS_Core_Workflow workflow this transition belongs to
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_workflow;
|
||||
|
||||
/**
|
||||
* @var state of the workflow transition
|
||||
* @var SeedDMS_Core_Workflow_State of the workflow transition
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_state;
|
||||
|
||||
/**
|
||||
* @var next state of the workflow transition
|
||||
* @var SeedDMS_Core_Workflow_State next state of the workflow transition
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_nextstate;
|
||||
|
||||
/**
|
||||
* @var action of the workflow transition
|
||||
* @var SeedDMS_Core_Workflow_Action of the workflow transition
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_action;
|
||||
|
||||
/**
|
||||
* @var maximum of seconds allowed until this transition must be triggered
|
||||
* @var integer maximum of seconds allowed until this transition must be triggered
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_maxtime;
|
||||
|
||||
/**
|
||||
* @var list of users allowed to trigger this transaction
|
||||
* @var SeedDMS_Core_User[] of users allowed to trigger this transaction
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_users;
|
||||
|
||||
/**
|
||||
* @var list of groups allowed to trigger this transaction
|
||||
* @var SeedDMS_Core_Group[] of groups allowed to trigger this transaction
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_groups;
|
||||
|
||||
/**
|
||||
* @var object reference to the dms instance this attribute belongs to
|
||||
* @var SeedDMS_Core_DMS reference to the dms instance this attribute belongs to
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
var $_dms;
|
||||
|
||||
function __construct($id, $workflow, $state, $action, $nextstate, $maxtime) {
|
||||
/**
|
||||
* SeedDMS_Core_Workflow_Transition constructor.
|
||||
* @param $id
|
||||
* @param $workflow
|
||||
* @param $state
|
||||
* @param $action
|
||||
* @param $nextstate
|
||||
* @param $maxtime
|
||||
*/
|
||||
function __construct($id, $workflow, $state, $action, $nextstate, $maxtime) {
|
||||
$this->_id = $id;
|
||||
$this->_workflow = $workflow;
|
||||
$this->_state = $state;
|
||||
|
@ -774,15 +880,28 @@ class SeedDMS_Core_Workflow_Transition { /* {{{ */
|
|||
$this->_dms = null;
|
||||
}
|
||||
|
||||
function setDMS($dms) {
|
||||
/**
|
||||
* @param $dms
|
||||
*/
|
||||
function setDMS($dms) {
|
||||
$this->_dms = $dms;
|
||||
}
|
||||
|
||||
function getID() { return $this->_id; }
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getID() { return $this->_id; }
|
||||
|
||||
function getWorkflow() { return $this->_workflow; }
|
||||
/**
|
||||
* @return SeedDMS_Core_Workflow
|
||||
*/
|
||||
function getWorkflow() { return $this->_workflow; }
|
||||
|
||||
function setWorkflow($newWorkflow) { /* {{{ */
|
||||
/**
|
||||
* @param SeedDMS_Core_Workflow $newWorkflow
|
||||
* @return bool
|
||||
*/
|
||||
function setWorkflow($newWorkflow) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblWorkflowTransitions` SET `workflow` = ".$newWorkflow->getID()." WHERE `id` = " . $this->_id;
|
||||
|
@ -794,9 +913,17 @@ class SeedDMS_Core_Workflow_Transition { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
function getState() { return $this->_state; }
|
||||
|
||||
function setState($newState) { /* {{{ */
|
||||
/**
|
||||
* @return SeedDMS_Core_Workflow_State
|
||||
*/
|
||||
function getState() { return $this->_state; }
|
||||
|
||||
/**
|
||||
* @param SeedDMS_Core_Workflow_State $newState
|
||||
* @return bool
|
||||
*/
|
||||
function setState($newState) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblWorkflowTransitions` SET `state` = ".$newState->getID()." WHERE `id` = " . $this->_id;
|
||||
|
@ -808,9 +935,16 @@ class SeedDMS_Core_Workflow_Transition { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
function getNextState() { return $this->_nextstate; }
|
||||
/**
|
||||
* @return SeedDMS_Core_Workflow_State
|
||||
*/
|
||||
function getNextState() { return $this->_nextstate; }
|
||||
|
||||
function setNextState($newNextState) { /* {{{ */
|
||||
/**
|
||||
* @param SeedDMS_Core_Workflow_State $newNextState
|
||||
* @return bool
|
||||
*/
|
||||
function setNextState($newNextState) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblWorkflowTransitions` SET `nextstate` = ".$newNextState->getID()." WHERE `id` = " . $this->_id;
|
||||
|
@ -822,9 +956,16 @@ class SeedDMS_Core_Workflow_Transition { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
function getAction() { return $this->_action; }
|
||||
/**
|
||||
* @return SeedDMS_Core_Workflow_Action
|
||||
*/
|
||||
function getAction() { return $this->_action; }
|
||||
|
||||
function setAction($newAction) { /* {{{ */
|
||||
/**
|
||||
* @param SeedDMS_Core_Workflow_Action $newAction
|
||||
* @return bool
|
||||
*/
|
||||
function setAction($newAction) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblWorkflowTransitions` SET `action` = ".$newAction->getID()." WHERE `id` = " . $this->_id;
|
||||
|
@ -836,9 +977,16 @@ class SeedDMS_Core_Workflow_Transition { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
function getMaxTime() { return $this->_maxtime; }
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function getMaxTime() { return $this->_maxtime; }
|
||||
|
||||
function setMaxTime($maxtime) { /* {{{ */
|
||||
/**
|
||||
* @param $maxtime
|
||||
* @return bool
|
||||
*/
|
||||
function setMaxTime($maxtime) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "UPDATE `tblWorkflowTransitions` SET `maxtime` = ".intval($maxtime)." WHERE `id` = " . $this->_id;
|
||||
|
@ -853,7 +1001,7 @@ class SeedDMS_Core_Workflow_Transition { /* {{{ */
|
|||
/**
|
||||
* Get all users allowed to trigger this transition
|
||||
*
|
||||
* @return array list of users
|
||||
* @return SeedDMS_Core_User[]|bool list of users
|
||||
*/
|
||||
function getUsers() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -881,7 +1029,7 @@ class SeedDMS_Core_Workflow_Transition { /* {{{ */
|
|||
/**
|
||||
* Get all users allowed to trigger this transition
|
||||
*
|
||||
* @return array list of users
|
||||
* @return SeedDMS_Core_Group[]|bool list of users
|
||||
*/
|
||||
function getGroups() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
@ -969,13 +1117,22 @@ class SeedDMS_Core_Workflow_Transition_User { /* {{{ */
|
|||
*/
|
||||
var $_dms;
|
||||
|
||||
function __construct($id, $transition, $user) {
|
||||
/**
|
||||
* SeedDMS_Core_Workflow_Transition_User constructor.
|
||||
* @param $id
|
||||
* @param $transition
|
||||
* @param $user
|
||||
*/
|
||||
function __construct($id, $transition, $user) {
|
||||
$this->_id = $id;
|
||||
$this->_transition = $transition;
|
||||
$this->_user = $user;
|
||||
}
|
||||
|
||||
function setDMS($dms) { /* {{{ */
|
||||
/**
|
||||
* @param $dms
|
||||
*/
|
||||
function setDMS($dms) { /* {{{ */
|
||||
$this->_dms = $dms;
|
||||
} /* }}} */
|
||||
|
||||
|
@ -1043,14 +1200,24 @@ class SeedDMS_Core_Workflow_Transition_Group { /* {{{ */
|
|||
*/
|
||||
var $_dms;
|
||||
|
||||
function __construct($id, $transition, $group, $numOfUsers) { /* {{{ */
|
||||
/**
|
||||
* SeedDMS_Core_Workflow_Transition_Group constructor.
|
||||
* @param $id
|
||||
* @param $transition
|
||||
* @param $group
|
||||
* @param $numOfUsers
|
||||
*/
|
||||
function __construct($id, $transition, $group, $numOfUsers) { /* {{{ */
|
||||
$this->_id = $id;
|
||||
$this->_transition = $transition;
|
||||
$this->_group = $group;
|
||||
$this->_numOfUsers = $numOfUsers;
|
||||
} /* }}} */
|
||||
|
||||
function setDMS($dms) { /* {{{ */
|
||||
/**
|
||||
* @param $dms
|
||||
*/
|
||||
function setDMS($dms) { /* {{{ */
|
||||
$this->_dms = $dms;
|
||||
} /* }}} */
|
||||
|
||||
|
@ -1156,7 +1323,18 @@ class SeedDMS_Core_Workflow_Log { /* {{{ */
|
|||
*/
|
||||
var $_dms;
|
||||
|
||||
function __construct($id, $document, $version, $workflow, $user, $transition, $date, $comment) {
|
||||
/**
|
||||
* SeedDMS_Core_Workflow_Log constructor.
|
||||
* @param $id
|
||||
* @param $document
|
||||
* @param $version
|
||||
* @param $workflow
|
||||
* @param $user
|
||||
* @param $transition
|
||||
* @param $date
|
||||
* @param $comment
|
||||
*/
|
||||
function __construct($id, $document, $version, $workflow, $user, $transition, $date, $comment) {
|
||||
$this->_id = $id;
|
||||
$this->_document = $document;
|
||||
$this->_version = $version;
|
||||
|
@ -1168,27 +1346,45 @@ class SeedDMS_Core_Workflow_Log { /* {{{ */
|
|||
$this->_dms = null;
|
||||
}
|
||||
|
||||
function setDMS($dms) { /* {{{ */
|
||||
/**
|
||||
* @param $dms
|
||||
*/
|
||||
function setDMS($dms) { /* {{{ */
|
||||
$this->_dms = $dms;
|
||||
} /* }}} */
|
||||
|
||||
function getTransition() { /* {{{ */
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
function getTransition() { /* {{{ */
|
||||
return $this->_transition;
|
||||
} /* }}} */
|
||||
|
||||
function getWorkflow() { /* {{{ */
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
function getWorkflow() { /* {{{ */
|
||||
return $this->_workflow;
|
||||
} /* }}} */
|
||||
|
||||
function getUser() { /* {{{ */
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
function getUser() { /* {{{ */
|
||||
return $this->_user;
|
||||
} /* }}} */
|
||||
|
||||
function getComment() { /* {{{ */
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getComment() { /* {{{ */
|
||||
return $this->_comment;
|
||||
} /* }}} */
|
||||
|
||||
function getDate() { /* {{{ */
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function getDate() { /* {{{ */
|
||||
return $this->_date;
|
||||
} /* }}} */
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* Include the adodb database abstraction
|
||||
*/
|
||||
require_once "adodb/adodb.inc.php";
|
||||
/** @noinspection PhpUndefinedClassInspection */
|
||||
|
||||
/**
|
||||
* Class to represent the database access for the document management
|
||||
|
@ -54,19 +55,19 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
*/
|
||||
function TableList() {
|
||||
return $this->_conn->MetaTables("TABLES");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor of SeedDMS_Core_DatabaseAccess
|
||||
*
|
||||
* Sets all database parameters but does not connect.
|
||||
*
|
||||
* @param string $driver the database type e.g. mysql, sqlite
|
||||
* @param string $hostname host of database server
|
||||
* @param string $user name of user having access to database
|
||||
* @param string $passw password of user
|
||||
* @param string $database name of database
|
||||
*/
|
||||
/**
|
||||
* Constructor of SeedDMS_Core_DatabaseAccess
|
||||
*
|
||||
* Sets all database parameters but does not connect.
|
||||
*
|
||||
* @param string $driver the database type e.g. mysql, sqlite
|
||||
* @param string $hostname host of database server
|
||||
* @param string $user name of user having access to database
|
||||
* @param string $passw password of user
|
||||
* @param bool|string $database name of database
|
||||
*/
|
||||
function __construct($driver, $hostname, $user, $passw, $database = false) {
|
||||
$this->_driver = $driver;
|
||||
$this->_hostname = $hostname;
|
||||
|
@ -127,7 +128,7 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
/**
|
||||
* Sanitize String used in database operations
|
||||
*
|
||||
* @param string text
|
||||
* @param string $text
|
||||
* @return string sanitized string
|
||||
*/
|
||||
function qstr($text) { /* {{{ */
|
||||
|
@ -141,10 +142,11 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
* Call this function only with sql query which return data records.
|
||||
*
|
||||
* @param string $queryStr sql query
|
||||
* @return array/boolean data if query could be executed otherwise false
|
||||
* @return array|boolean data if query could be executed otherwise false
|
||||
*/
|
||||
function getResultArray($queryStr) { /* {{{ */
|
||||
$resArr = array();
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$resArr = array();
|
||||
|
||||
$res = $this->_conn->Execute($queryStr);
|
||||
if (!$res) {
|
||||
|
@ -157,17 +159,17 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
return $resArr;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Execute SQL query
|
||||
*
|
||||
* Call this function only with sql query which do not return data records.
|
||||
*
|
||||
* @param string $queryStr sql query
|
||||
* @param boolean $silent not used anymore. This was used when this method
|
||||
* still issued an error message
|
||||
* @return boolean true if query could be executed otherwise false
|
||||
*/
|
||||
function getResult($queryStr, $silent=false) { /* {{{ */
|
||||
/**
|
||||
* Execute SQL query
|
||||
*
|
||||
* Call this function only with sql query which do not return data records.
|
||||
*
|
||||
* @param string $queryStr sql query
|
||||
* @return bool true if query could be executed otherwise false
|
||||
* @internal param bool $silent not used anymore. This was used when this method
|
||||
* still issued an error message
|
||||
*/
|
||||
function getResult($queryStr) { /* {{{ */
|
||||
$res = $this->_conn->Execute($queryStr);
|
||||
if(!$res) {
|
||||
if($this->_debug)
|
||||
|
@ -215,9 +217,12 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
return $this->_conn->ErrorNo();
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Create various temporary tables to speed up and simplify sql queries
|
||||
*/
|
||||
/**
|
||||
* Create various temporary tables to speed up and simplify sql queries
|
||||
* @param $tableName
|
||||
* @param bool $override
|
||||
* @return bool
|
||||
*/
|
||||
function createTemporaryTable($tableName, $override=false) { /* {{{ */
|
||||
if (!strcasecmp($tableName, "ttreviewid")) {
|
||||
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreviewid` (PRIMARY KEY (`reviewID`), INDEX (`maxLogID`)) ".
|
||||
|
@ -309,6 +314,4 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
}
|
||||
return false;
|
||||
} /* }}} */
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
|
@ -10,6 +10,7 @@
|
|||
* @copyright Copyright (C) 2012 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
/** @noinspection PhpUndefinedClassInspection */
|
||||
|
||||
/**
|
||||
* Class to represent the database access for the document management
|
||||
|
@ -112,7 +113,7 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
*
|
||||
* This function is used to retrieve a list of database tables for backup
|
||||
*
|
||||
* @return array list of table names
|
||||
* @return string[]|bool list of table names
|
||||
*/
|
||||
function TableList() { /* {{{ */
|
||||
switch($this->_driver) {
|
||||
|
@ -172,7 +173,7 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
* @param string $hostname host of database server
|
||||
* @param string $user name of user having access to database
|
||||
* @param string $passw password of user
|
||||
* @param string $database name of database
|
||||
* @param bool|string $database name of database
|
||||
*/
|
||||
function __construct($driver, $hostname, $user, $passw, $database = false) { /* {{{ */
|
||||
$this->_driver = $driver;
|
||||
|
@ -246,6 +247,7 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
$dsn = $this->_driver.":".$this->_database;
|
||||
break;
|
||||
}
|
||||
/** @noinspection PhpUndefinedVariableInspection */
|
||||
$this->_conn = new PDO($dsn, $this->_user, $this->_passw);
|
||||
if (!$this->_conn)
|
||||
return false;
|
||||
|
@ -291,7 +293,7 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
/**
|
||||
* Sanitize String used in database operations
|
||||
*
|
||||
* @param string text
|
||||
* @param string $text
|
||||
* @return string sanitized string
|
||||
*/
|
||||
function qstr($text) { /* {{{ */
|
||||
|
@ -301,7 +303,7 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
/**
|
||||
* Replace back ticks by '"'
|
||||
*
|
||||
* @param string text
|
||||
* @param string $text
|
||||
* @return string sanitized string
|
||||
*/
|
||||
function rbt($text) { /* {{{ */
|
||||
|
@ -314,7 +316,8 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
* Call this function only with sql query which return data records.
|
||||
*
|
||||
* @param string $queryStr sql query
|
||||
* @return array/boolean data if query could be executed otherwise false
|
||||
* @param bool $retick
|
||||
* @return array|bool data if query could be executed otherwise false
|
||||
*/
|
||||
function getResultArray($queryStr, $retick=true) { /* {{{ */
|
||||
$resArr = array();
|
||||
|
@ -389,7 +392,9 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
/**
|
||||
* Return the id of the last instert record
|
||||
*
|
||||
* @return integer id used in last autoincrement
|
||||
* @param string $tablename
|
||||
* @param string $fieldname
|
||||
* @return int id used in last autoincrement
|
||||
*/
|
||||
function getInsertID($tablename='', $fieldname='id') { /* {{{ */
|
||||
if($this->_driver == 'pgsql')
|
||||
|
@ -409,6 +414,10 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
|
||||
/**
|
||||
* Create various temporary tables to speed up and simplify sql queries
|
||||
*
|
||||
* @param string $tableName
|
||||
* @param bool $override
|
||||
* @return bool
|
||||
*/
|
||||
private function __createTemporaryTable($tableName, $override=false) { /* {{{ */
|
||||
if (!strcasecmp($tableName, "ttreviewid")) {
|
||||
|
@ -579,7 +588,11 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Create various temporary tables to speed up and simplify sql queries
|
||||
* Create various views to speed up and simplify sql queries
|
||||
*
|
||||
* @param string $tableName
|
||||
* @param bool $override
|
||||
* @return bool
|
||||
*/
|
||||
private function __createView($tableName, $override=false) { /* {{{ */
|
||||
if (!strcasecmp($tableName, "ttreviewid")) {
|
||||
|
@ -741,7 +754,11 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Create various temporary tables to speed up and simplify sql queries
|
||||
* Create various temporary tables or view to speed up and simplify sql queries
|
||||
*
|
||||
* @param string $tableName
|
||||
* @param bool $override
|
||||
* @return bool
|
||||
*/
|
||||
public function createTemporaryTable($tableName, $override=false) { /* {{{ */
|
||||
if($this->_useviews)
|
||||
|
@ -755,6 +772,7 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
* containing a unix timestamp
|
||||
*
|
||||
* @param string $fieldname name of field containing the timestamp
|
||||
* @param string $format
|
||||
* @return string sql code
|
||||
*/
|
||||
function getDateExtract($fieldname, $format='%Y-%m-%d') { /* {{{ */
|
||||
|
@ -823,6 +841,7 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
/**
|
||||
* Return sql statement for returning the current timestamp
|
||||
*
|
||||
* @param $field
|
||||
* @return string sql code
|
||||
*/
|
||||
function castToText($field) { /* {{{ */
|
||||
|
@ -834,5 +853,3 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
return $field;
|
||||
} /* }}} */
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -25,25 +25,50 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_Core_File {
|
||||
static function renameFile($old, $new) { /* {{{ */
|
||||
/**
|
||||
* @param $old
|
||||
* @param $new
|
||||
* @return bool
|
||||
*/
|
||||
static function renameFile($old, $new) { /* {{{ */
|
||||
return @rename($old, $new);
|
||||
} /* }}} */
|
||||
|
||||
static function removeFile($file) { /* {{{ */
|
||||
/**
|
||||
* @param $file
|
||||
* @return bool
|
||||
*/
|
||||
static function removeFile($file) { /* {{{ */
|
||||
return @unlink($file);
|
||||
} /* }}} */
|
||||
|
||||
static function copyFile($source, $target) { /* {{{ */
|
||||
/**
|
||||
* @param $source
|
||||
* @param $target
|
||||
* @return bool
|
||||
*/
|
||||
static function copyFile($source, $target) { /* {{{ */
|
||||
return @copy($source, $target);
|
||||
} /* }}} */
|
||||
|
||||
static function moveFile($source, $target) { /* {{{ */
|
||||
if (!@copyFile($source, $target))
|
||||
/**
|
||||
* @param $source
|
||||
* @param $target
|
||||
* @return bool
|
||||
*/
|
||||
static function moveFile($source, $target) { /* {{{ */
|
||||
/** @noinspection PhpUndefinedFunctionInspection */
|
||||
if (!@copyFile($source, $target))
|
||||
return false;
|
||||
return @removeFile($source);
|
||||
/** @noinspection PhpUndefinedFunctionInspection */
|
||||
return @removeFile($source);
|
||||
} /* }}} */
|
||||
|
||||
static function fileSize($file) { /* {{{ */
|
||||
/**
|
||||
* @param $file
|
||||
* @return bool|int
|
||||
*/
|
||||
static function fileSize($file) { /* {{{ */
|
||||
if(!$a = fopen($file, 'r'))
|
||||
return false;
|
||||
fseek($a, 0, SEEK_END);
|
||||
|
@ -52,12 +77,22 @@ class SeedDMS_Core_File {
|
|||
return $filesize;
|
||||
} /* }}} */
|
||||
|
||||
static function format_filesize($size, $sizes = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')) { /* {{{ */
|
||||
/**
|
||||
* @param $size
|
||||
* @param array $sizes
|
||||
* @return string
|
||||
*/
|
||||
static function format_filesize($size, $sizes = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')) { /* {{{ */
|
||||
if ($size == 0) return('0 Bytes');
|
||||
return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]);
|
||||
/** @noinspection PhpIllegalArrayKeyTypeInspection */
|
||||
return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]);
|
||||
} /* }}} */
|
||||
|
||||
static function parse_filesize($str) { /* {{{ */
|
||||
/**
|
||||
* @param $str
|
||||
* @return bool|int
|
||||
*/
|
||||
static function parse_filesize($str) { /* {{{ */
|
||||
preg_replace('/\s\s+/', ' ', $str);
|
||||
if(strtoupper(substr($str, -1)) == 'B') {
|
||||
$value = (int) substr($str, 0, -2);
|
||||
|
@ -80,18 +115,32 @@ class SeedDMS_Core_File {
|
|||
return $value;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
/** @noinspection PhpUnreachableStatementInspection */
|
||||
return false;
|
||||
} /* }}} */
|
||||
|
||||
static function checksum($file) { /* {{{ */
|
||||
/**
|
||||
* @param $file
|
||||
* @return string
|
||||
*/
|
||||
static function checksum($file) { /* {{{ */
|
||||
return md5_file($file);
|
||||
} /* }}} */
|
||||
|
||||
static function renameDir($old, $new) { /* {{{ */
|
||||
/**
|
||||
* @param $old
|
||||
* @param $new
|
||||
* @return bool
|
||||
*/
|
||||
static function renameDir($old, $new) { /* {{{ */
|
||||
return @rename($old, $new);
|
||||
} /* }}} */
|
||||
|
||||
static function makeDir($path) { /* {{{ */
|
||||
/**
|
||||
* @param $path
|
||||
* @return bool
|
||||
*/
|
||||
static function makeDir($path) { /* {{{ */
|
||||
|
||||
if( !is_dir( $path ) ){
|
||||
$res=@mkdir( $path , 0777, true);
|
||||
|
@ -146,7 +195,11 @@ class SeedDMS_Core_File {
|
|||
*/
|
||||
} /* }}} */
|
||||
|
||||
static function removeDir($path) { /* {{{ */
|
||||
/**
|
||||
* @param $path
|
||||
* @return bool
|
||||
*/
|
||||
static function removeDir($path) { /* {{{ */
|
||||
$handle = @opendir($path);
|
||||
while ($entry = @readdir($handle) )
|
||||
{
|
||||
|
@ -167,7 +220,12 @@ class SeedDMS_Core_File {
|
|||
return @rmdir($path);
|
||||
} /* }}} */
|
||||
|
||||
static function copyDir($sourcePath, $targetPath) { /* {{{ */
|
||||
/**
|
||||
* @param $sourcePath
|
||||
* @param $targetPath
|
||||
* @return bool
|
||||
*/
|
||||
static function copyDir($sourcePath, $targetPath) { /* {{{ */
|
||||
if (mkdir($targetPath, 0777)) {
|
||||
$handle = @opendir($sourcePath);
|
||||
while ($entry = @readdir($handle) ) {
|
||||
|
@ -189,14 +247,26 @@ class SeedDMS_Core_File {
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
static function moveDir($sourcePath, $targetPath) { /* {{{ */
|
||||
if (!copyDir($sourcePath, $targetPath))
|
||||
/**
|
||||
* @param $sourcePath
|
||||
* @param $targetPath
|
||||
* @return bool
|
||||
*/
|
||||
static function moveDir($sourcePath, $targetPath) { /* {{{ */
|
||||
/** @noinspection PhpUndefinedFunctionInspection */
|
||||
if (!copyDir($sourcePath, $targetPath))
|
||||
return false;
|
||||
return removeDir($sourcePath);
|
||||
/** @noinspection PhpUndefinedFunctionInspection */
|
||||
return removeDir($sourcePath);
|
||||
} /* }}} */
|
||||
|
||||
// code by Kioob (php.net manual)
|
||||
static function gzcompressfile($source,$level=false) { /* {{{ */
|
||||
/**
|
||||
* @param $source
|
||||
* @param bool $level
|
||||
* @return bool|string
|
||||
*/
|
||||
static function gzcompressfile($source, $level=false) { /* {{{ */
|
||||
$dest=$source.'.gz';
|
||||
$mode='wb'.$level;
|
||||
$error=false;
|
||||
|
@ -214,5 +284,4 @@ class SeedDMS_Core_File {
|
|||
if($error) return false;
|
||||
else return $dest;
|
||||
} /* }}} */
|
||||
}
|
||||
?>
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||
<notes>
|
||||
add SeedDMS_Core_Folder::getDocumentsMinMax()
|
||||
add lots of DocBlocks from merge request #8
|
||||
</notes>
|
||||
<contents>
|
||||
<dir baseinstalldir="SeedDMS" name="/">
|
||||
|
|
|
@ -24,8 +24,17 @@
|
|||
*/
|
||||
class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $errormsg;
|
||||
|
||||
/**
|
||||
* @param $cmd
|
||||
* @param int $timeout
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
static function execWithTimeout($cmd, $timeout=2) { /* {{{ */
|
||||
$descriptorspec = array(
|
||||
0 => array("pipe", "r"),
|
||||
|
@ -71,6 +80,11 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
|
|||
/**
|
||||
* Constructor. Creates our indexable document and adds all
|
||||
* necessary fields to it using the passed in document
|
||||
* @param SeedDMS_Core_DMS $dms
|
||||
* @param SeedDMS_Core_Document $document
|
||||
* @param null $convcmd
|
||||
* @param bool $nocontent
|
||||
* @param int $timeout
|
||||
*/
|
||||
public function __construct($dms, $document, $convcmd=null, $nocontent=false, $timeout=5) { /* {{{ */
|
||||
$this->errormsg = '';
|
||||
|
|
Loading…
Reference in New Issue
Block a user