mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 13:11:31 +00:00
- renamed class Group to LetoDMS_Group
- moved all static functions into class but kept old functions for backward compatibility
This commit is contained in:
parent
12ca95bb40
commit
a26a34162e
|
@ -1455,7 +1455,7 @@ class LetoDMS_Document
|
||||||
$resArr = $db->getResultArray($queryStr);
|
$resArr = $db->getResultArray($queryStr);
|
||||||
if (!is_bool($resArr)) {
|
if (!is_bool($resArr)) {
|
||||||
foreach ($resArr as $row) {
|
foreach ($resArr as $row) {
|
||||||
$this->_approversList["groups"][] = new Group($row["id"], $row["name"], $row["comment"]);
|
$this->_approversList["groups"][] = new LetoDMS_Group($row["id"], $row["name"], $row["comment"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1165,7 +1165,7 @@ class LetoDMS_Folder
|
||||||
$resArr = $db->getResultArray($queryStr);
|
$resArr = $db->getResultArray($queryStr);
|
||||||
if (!is_bool($resArr)) {
|
if (!is_bool($resArr)) {
|
||||||
foreach ($resArr as $row) {
|
foreach ($resArr as $row) {
|
||||||
$this->_approversList["groups"][] = new Group($row["id"], $row["name"], $row["comment"]);
|
$this->_approversList["groups"][] = new LetoDMS_Group($row["id"], $row["name"], $row["comment"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,74 +22,20 @@
|
||||||
\**********************************************************************/
|
\**********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
function getGroup($id)
|
function getGroup($id) {
|
||||||
{
|
return LetoDMS_Group::getGroup($id);
|
||||||
global $db;
|
|
||||||
|
|
||||||
if (!is_numeric($id))
|
|
||||||
die ("invalid groupid");
|
|
||||||
|
|
||||||
$queryStr = "SELECT * FROM tblGroups WHERE id = " . $id;
|
|
||||||
$resArr = $db->getResultArray($queryStr);
|
|
||||||
|
|
||||||
if (is_bool($resArr) && $resArr == false)
|
|
||||||
return false;
|
|
||||||
else if (count($resArr) != 1) //wenn, dann wohl eher 0 als > 1 ;-)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
$resArr = $resArr[0];
|
|
||||||
|
|
||||||
return new Group($resArr["id"], $resArr["name"], $resArr["comment"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGroupByName($name) {
|
function getGroupByName($name) {
|
||||||
global $db;
|
return LetoDMS_Group::getGroupByName($name);
|
||||||
|
|
||||||
$queryStr = "SELECT `tblGroups`.* FROM `tblGroups` WHERE `tblGroups`.`name` = '".$name."'";
|
|
||||||
$resArr = $db->getResultArray($queryStr);
|
|
||||||
|
|
||||||
if (is_bool($resArr) && $resArr == false)
|
|
||||||
return false;
|
|
||||||
else if (count($resArr) != 1) //wenn, dann wohl eher 0 als > 1 ;-)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
$resArr = $resArr[0];
|
|
||||||
|
|
||||||
return new Group($resArr["id"], $resArr["name"], $resArr["comment"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAllGroups()
|
function getAllGroups() {
|
||||||
{
|
return LetoDMS_Group::getAllGroups();
|
||||||
global $db;
|
|
||||||
|
|
||||||
$queryStr = "SELECT * FROM tblGroups ORDER BY name";
|
|
||||||
$resArr = $db->getResultArray($queryStr);
|
|
||||||
|
|
||||||
if (is_bool($resArr) && $resArr == false)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
$groups = array();
|
|
||||||
|
|
||||||
for ($i = 0; $i < count($resArr); $i++)
|
|
||||||
$groups[$i] = new Group($resArr[$i]["id"], $resArr[$i]["name"], $resArr[$i]["comment"]);
|
|
||||||
|
|
||||||
return $groups;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addGroup($name, $comment) {
|
||||||
function addGroup($name, $comment)
|
return LetoDMS_Group::addGroup($name, $comment);
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
|
|
||||||
if (is_object(getGroupByName($name))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$queryStr = "INSERT INTO tblGroups (name, comment) VALUES ('".$name."', '" . $comment . "')";
|
|
||||||
if (!$db->getResult($queryStr))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return getGroup($db->getInsertID());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,18 +43,88 @@ function addGroup($name, $comment)
|
||||||
| Group-Klasse |
|
| Group-Klasse |
|
||||||
\**********************************************************************/
|
\**********************************************************************/
|
||||||
|
|
||||||
class Group
|
class LetoDMS_Group
|
||||||
{
|
{
|
||||||
var $_id;
|
var $_id;
|
||||||
var $_name;
|
var $_name;
|
||||||
|
|
||||||
function Group($id, $name, $comment)
|
function LetoDMS_Group($id, $name, $comment)
|
||||||
{
|
{
|
||||||
$this->_id = $id;
|
$this->_id = $id;
|
||||||
$this->_name = $name;
|
$this->_name = $name;
|
||||||
$this->_comment = $comment;
|
$this->_comment = $comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getGroup($id)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
if (!is_numeric($id))
|
||||||
|
die ("invalid groupid");
|
||||||
|
|
||||||
|
$queryStr = "SELECT * FROM tblGroups WHERE id = " . $id;
|
||||||
|
$resArr = $db->getResultArray($queryStr);
|
||||||
|
|
||||||
|
if (is_bool($resArr) && $resArr == false)
|
||||||
|
return false;
|
||||||
|
else if (count($resArr) != 1) //wenn, dann wohl eher 0 als > 1 ;-)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$resArr = $resArr[0];
|
||||||
|
|
||||||
|
return new LetoDMS_Group($resArr["id"], $resArr["name"], $resArr["comment"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGroupByName($name) {
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$queryStr = "SELECT `tblGroups`.* FROM `tblGroups` WHERE `tblGroups`.`name` = '".$name."'";
|
||||||
|
$resArr = $db->getResultArray($queryStr);
|
||||||
|
|
||||||
|
if (is_bool($resArr) && $resArr == false)
|
||||||
|
return false;
|
||||||
|
else if (count($resArr) != 1) //wenn, dann wohl eher 0 als > 1 ;-)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$resArr = $resArr[0];
|
||||||
|
|
||||||
|
return new LetoDMS_Group($resArr["id"], $resArr["name"], $resArr["comment"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAllGroups()
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$queryStr = "SELECT * FROM tblGroups ORDER BY name";
|
||||||
|
$resArr = $db->getResultArray($queryStr);
|
||||||
|
|
||||||
|
if (is_bool($resArr) && $resArr == false)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$groups = array();
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($resArr); $i++)
|
||||||
|
$groups[$i] = new LetoDMS_Group($resArr[$i]["id"], $resArr[$i]["name"], $resArr[$i]["comment"]);
|
||||||
|
|
||||||
|
return $groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function addGroup($name, $comment)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
if (is_object(getGroupByName($name))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$queryStr = "INSERT INTO tblGroups (name, comment) VALUES ('".$name."', '" . $comment . "')";
|
||||||
|
if (!$db->getResult($queryStr))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return self::getGroup($db->getInsertID());
|
||||||
|
}
|
||||||
|
|
||||||
function getID() { return $this->_id; }
|
function getID() { return $this->_id; }
|
||||||
|
|
||||||
function getName() { return $this->_name; }
|
function getName() { return $this->_name; }
|
||||||
|
|
|
@ -428,7 +428,7 @@ class LetoDMS_User
|
||||||
|
|
||||||
$this->_groups = array();
|
$this->_groups = array();
|
||||||
foreach ($resArr as $row) {
|
foreach ($resArr as $row) {
|
||||||
$group = new Group($row["id"], $row["name"], $row["comment"]);
|
$group = new LetoDMS_Group($row["id"], $row["name"], $row["comment"]);
|
||||||
array_push($this->_groups, $group);
|
array_push($this->_groups, $group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user