mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-09 04:56:06 +00:00
add more callbacks
This commit is contained in:
parent
5c32c6edbe
commit
ae14f25d58
|
@ -1287,7 +1287,16 @@ class SeedDMS_Core_DMS {
|
|||
if (!$res)
|
||||
return false;
|
||||
|
||||
return $this->getUser($this->db->getInsertID());
|
||||
$user = $this->getUser($this->db->getInsertID());
|
||||
|
||||
/* Check if 'onPostAddUser' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddUser'])) {
|
||||
$callback = $this->_dms->callbacks['onPostUser'];
|
||||
if(!call_user_func($callback[0], $callback[1], $user)) {
|
||||
}
|
||||
}
|
||||
|
||||
return $user;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
@ -1378,7 +1387,16 @@ class SeedDMS_Core_DMS {
|
|||
if (!$this->db->getResult($queryStr))
|
||||
return false;
|
||||
|
||||
return $this->getGroup($this->db->getInsertID());
|
||||
$group = $this->getGroup($this->db->getInsertID());
|
||||
|
||||
/* Check if 'onPostAddGroup' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddGroup'])) {
|
||||
$callback = $this->_dms->callbacks['onPostAddGroup'];
|
||||
if(!call_user_func($callback[0], $callback[1], $group)) {
|
||||
}
|
||||
}
|
||||
|
||||
return $group;
|
||||
} /* }}} */
|
||||
|
||||
function getKeywordCategory($id) { /* {{{ */
|
||||
|
@ -1457,7 +1475,16 @@ class SeedDMS_Core_DMS {
|
|||
if (!$this->db->getResult($queryStr))
|
||||
return false;
|
||||
|
||||
return $this->getKeywordCategory($this->db->getInsertID());
|
||||
$category = $this->getKeywordCategory($this->db->getInsertID());
|
||||
|
||||
/* Check if 'onPostAddKeywordCategory' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddKeywordCategory'])) {
|
||||
$callback = $this->_dms->callbacks['onPostAddKeywordCategory'];
|
||||
if(!call_user_func($callback[0], $callback[1], $category)) {
|
||||
}
|
||||
}
|
||||
|
||||
return $category;
|
||||
} /* }}} */
|
||||
|
||||
function getDocumentCategory($id) { /* {{{ */
|
||||
|
@ -1523,7 +1550,16 @@ class SeedDMS_Core_DMS {
|
|||
if (!$this->db->getResult($queryStr))
|
||||
return false;
|
||||
|
||||
return $this->getDocumentCategory($this->db->getInsertID());
|
||||
$category = $this->getDocumentCategory($this->db->getInsertID());
|
||||
|
||||
/* Check if 'onPostAddDocumentCategory' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddDocumentCategory'])) {
|
||||
$callback = $this->_dms->callbacks['onPostAddDocumentCategory'];
|
||||
if(!call_user_func($callback[0], $callback[1], $category)) {
|
||||
}
|
||||
}
|
||||
|
||||
return $category;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
|
|
@ -1798,7 +1798,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
|
||||
$db->startTransaction();
|
||||
|
||||
// FIXME: call a new function removeContent instead
|
||||
// remove content of document
|
||||
foreach ($this->_content as $version) {
|
||||
if (!$this->removeContent($version)) {
|
||||
$db->rollbackTransaction();
|
||||
|
|
|
@ -482,6 +482,14 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
}
|
||||
|
||||
$db->commitTransaction();
|
||||
|
||||
/* Check if 'onPostAddSubFolder' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddSubFolder'])) {
|
||||
$callback = $this->_dms->callbacks['onPostAddSubFolder'];
|
||||
if(!call_user_func($callback[0], $callback[1], $newFolder)) {
|
||||
}
|
||||
}
|
||||
|
||||
return $newFolder;
|
||||
} /* }}} */
|
||||
|
||||
|
@ -791,12 +799,28 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
}
|
||||
|
||||
$db->commitTransaction();
|
||||
|
||||
/* Check if 'onPostAddDocument' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddDocument'])) {
|
||||
$callback = $this->_dms->callbacks['onPostAddDocument'];
|
||||
if(!call_user_func($callback[0], $callback[1], $document)) {
|
||||
}
|
||||
}
|
||||
|
||||
return array($document, $res);
|
||||
} /* }}} */
|
||||
|
||||
function remove() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
/* Check if 'onPreRemoveFolder' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPreRemoveFolder'])) {
|
||||
$callback = $this->_dms->callbacks['onPreRemoveFolder'];
|
||||
if(!call_user_func($callback[0], $callback[1], $this)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Do not delete the root folder.
|
||||
if ($this->_id == $this->_dms->rootFolderID || !isset($this->_parentID) || ($this->_parentID == null) || ($this->_parentID == "") || ($this->_parentID == 0)) {
|
||||
return false;
|
||||
|
@ -847,6 +871,13 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
}
|
||||
$db->commitTransaction();
|
||||
|
||||
/* Check if 'onPostRemoveFolder' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostRemoveFolder'])) {
|
||||
$callback = $this->_dms->callbacks['onPostRemoveFolder'];
|
||||
if(!call_user_func($callback[0], $callback[1], $this->_id)) {
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} /* }}} */
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user