- renamed class Group to LetoDMS_Group

- moved all static functions into class but kept old functions for
  backward compatibility
This commit is contained in:
steinm 2010-11-03 10:18:26 +00:00
parent 12ca95bb40
commit a26a34162e
4 changed files with 95 additions and 79 deletions

View File

@ -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"]);
} }
} }
} }

View File

@ -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"]);
} }
} }
} }

View File

@ -22,6 +22,39 @@
\**********************************************************************/ \**********************************************************************/
function getGroup($id) {
return LetoDMS_Group::getGroup($id);
}
function getGroupByName($name) {
return LetoDMS_Group::getGroupByName($name);
}
function getAllGroups() {
return LetoDMS_Group::getAllGroups();
}
function addGroup($name, $comment) {
return LetoDMS_Group::addGroup($name, $comment);
}
/**********************************************************************\
| Group-Klasse |
\**********************************************************************/
class LetoDMS_Group
{
var $_id;
var $_name;
function LetoDMS_Group($id, $name, $comment)
{
$this->_id = $id;
$this->_name = $name;
$this->_comment = $comment;
}
function getGroup($id) function getGroup($id)
{ {
global $db; global $db;
@ -39,7 +72,7 @@ function getGroup($id)
$resArr = $resArr[0]; $resArr = $resArr[0];
return new Group($resArr["id"], $resArr["name"], $resArr["comment"]); return new LetoDMS_Group($resArr["id"], $resArr["name"], $resArr["comment"]);
} }
function getGroupByName($name) { function getGroupByName($name) {
@ -55,7 +88,7 @@ function getGroupByName($name) {
$resArr = $resArr[0]; $resArr = $resArr[0];
return new Group($resArr["id"], $resArr["name"], $resArr["comment"]); return new LetoDMS_Group($resArr["id"], $resArr["name"], $resArr["comment"]);
} }
function getAllGroups() function getAllGroups()
@ -71,7 +104,7 @@ function getAllGroups()
$groups = array(); $groups = array();
for ($i = 0; $i < count($resArr); $i++) for ($i = 0; $i < count($resArr); $i++)
$groups[$i] = new Group($resArr[$i]["id"], $resArr[$i]["name"], $resArr[$i]["comment"]); $groups[$i] = new LetoDMS_Group($resArr[$i]["id"], $resArr[$i]["name"], $resArr[$i]["comment"]);
return $groups; return $groups;
} }
@ -89,24 +122,7 @@ function addGroup($name, $comment)
if (!$db->getResult($queryStr)) if (!$db->getResult($queryStr))
return false; return false;
return getGroup($db->getInsertID()); return self::getGroup($db->getInsertID());
}
/**********************************************************************\
| Group-Klasse |
\**********************************************************************/
class Group
{
var $_id;
var $_name;
function Group($id, $name, $comment)
{
$this->_id = $id;
$this->_name = $name;
$this->_comment = $comment;
} }
function getID() { return $this->_id; } function getID() { return $this->_id; }

View File

@ -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);
} }
} }