Source for file usergroupclass.php

Documentation is available at usergroupclass.php


1 <?php
2 /**
3 * @author Jan H. Andersen <jha@ipwsystems.dk>
4 * @author Martin R. Larsen <mrl@ipwsystems.dk>
5 * @copyright {@link http://www.ipwsystems.dk/ IPW Systems a.s}
6 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
7 * @package METAjour
8 * @subpackage core
9 * $Id: usergroupclass.php,v 1.10 2005/01/28 02:47:46 jan Exp $
10 */
11
12 require_once('basicclass.php');
13
14 class usergroup extends basic {
15
16 function usergroup() {
17 $this->basic();
18 $this->addcolumn('name',0,UI_STRING);
19 $this->addcolumn('level',0,UI_HIDDEN);
20
21 $this->removeview('createvariant');
22 $this->removeview('createfuture');
23 $this->removeview('approvepublish');
24 $this->removeview('requestapproval');
25 $this->removeview('category');
26 }
27
28 function prv_createobject($arr) {
29 basic::prv_createobject($arr);
30 $tarr = $arr['__member__'];
31 if (is_array($tarr)) {
32 $objectid = $this->getObjectId();
33 foreach ($tarr as $curr) {
34 if (!empty($curr))
35 $this->_adodb->execute("insert into usergroupmember (groupid , userid) values ($objectid, '$curr')");
36 }
37 }
38 }
39
40 function prv_updateobject($objectid, $arr) {
41 basic::prv_updateobject($objectid, $arr);
42 $this->_adodb->execute("delete from usergroupmember where groupid=$objectid");
43 $tarr = $arr['__member__'];
44 if (is_array($tarr)) {
45 foreach ($tarr as $curr) {
46 if (!empty($curr))
47 $this->_adodb->execute("insert into usergroupmember (groupid , userid) values ($objectid, '$curr')");
48 }
49 }
50 }
51
52 function prv_deleteobject() {
53 $this->_adodb->execute("delete from usergroupmember where groupid=".$this->getObjectId());
54 }
55
56 function getsystemgroup($accesslevel) {
57 $tmp = $this->_adodb->getone("select usergroup.objectid as res from usergroup, object where usergroup.objectid = object.objectid and site = '$this->site' and level = '$accesslevel'");
58 return (is_null($tmp)) ? false : $tmp;
59 }
60
61 function getmembers() {
62 return $this->_adodb->getcol("select userid from usergroupmember where groupid='".$this->prv_options['objectid']."'");
63 }
64
65 function addmember($userid) {
66 $this->_adodb->execute("replace into usergroupmember (groupid , userid) values ('".$this->getObjectId()."', '$userid')");
67 }
68
69 }

Documentation generated on Thu, 9 Jun 2005 06:54:15 +0200 by phpDocumentor 1.2.3