mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 00:45:34 +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);
|
||||
if (!is_bool($resArr)) {
|
||||
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);
|
||||
if (!is_bool($resArr)) {
|
||||
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"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,99 +16,115 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
/**********************************************************************\
|
||||
| statische, Group-bezogene Funktionen |
|
||||
\**********************************************************************/
|
||||
|
||||
|
||||
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 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 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 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 getGroup($db->getInsertID());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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 Group
|
||||
class LetoDMS_Group
|
||||
{
|
||||
var $_id;
|
||||
var $_name;
|
||||
|
||||
function Group($id, $name, $comment)
|
||||
function LetoDMS_Group($id, $name, $comment)
|
||||
{
|
||||
$this->_id = $id;
|
||||
$this->_name = $name;
|
||||
$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 getName() { return $this->_name; }
|
||||
|
|
|
@ -428,7 +428,7 @@ class LetoDMS_User
|
|||
|
||||
$this->_groups = array();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user