Source for file userclass.php

Documentation is available at userclass.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: userclass.php,v 1.10 2005/01/28 02:47:46 jan Exp $
10 */
11
12 require_once('basicclass.php');
13
14 class user extends basic {
15
16 function user() {
17 $this->basic();
18 $this->allowduplicate = false;
19 $this->addcolumn('name',0,UI_STRING);
20 $this->addcolumn('password',0,UI_PASSWORD);
21 $this->addcolumn('realname',0,UI_STRING);
22 $this->addcolumn('email',0,UI_STRING);
23 $this->addcolumn('country',0,UI_COUNTRY);
24 $this->addcolumn('rootdir',0,UI_HIDDEN);
25 $this->addcolumn('profileid',0,UI_RELATION,'profile');
26 $this->addcolumn('objectlanguage',0,UI_LANGUAGE);
27 $this->addcolumn('guilanguage',0,UI_LANGUAGE);
28 $this->addcolumn('restrictlanguage',0,UI_CHECKBOX);
29 $this->addcolumn('app',0,UI_APP);
30 $this->addcolumn('appavail',0,UI_APP_MULTIPLE);
31 $this->addcolumn('exstr1',0,UI_HIDDEN);
32 $this->addcolumn('exstr2',0,UI_HIDDEN);
33 $this->addcolumn('exstr3',0,UI_HIDDEN);
34 $this->addcolumn('exstr4',0,UI_HIDDEN);
35 $this->addcolumn('exstr5',0,UI_HIDDEN);
36 $this->addcolumn('exstr6',0,UI_HIDDEN);
37 $this->addcolumn('exstr7',0,UI_HIDDEN);
38 $this->addcolumn('exstr8',0,UI_HIDDEN);
39
40 $this->removeview('createvariant');
41 }
42
43 function stdListCol() {
44 $arr[] = 'name';
45 $arr[] = 'realname';
46 $arr[] = 'email';
47 $arr[] = 'profileid';
48 $arr[] = 'createdbyname';
49 $arr[] = 'changed';
50 $arr[] = 'objectid';
51 return $arr;
52 }
53
54 function prv_createobject($arr) {
55 $arr['password'] = $this->_adodb->getone("select password('" . $arr['password'] . "') from user");
56 basic::prv_createobject($arr);
57 $tarr = $arr['__membership__'];
58 if (is_array($tarr)) {
59 $objectid = $this->getObjectId();
60 foreach ($tarr as $curr) {
61 if (!empty($curr))
62 $this->_adodb->execute("insert into usergroupmember (groupid , userid) values ('$curr', '$objectid')");
63 }
64 }
65 }
66
67 function prv_updateobject($objectid, $arr) {
68 $tmp = $this->_adodb->getone("select password from user where objectid = '$objectid'");
69 if ($tmp != $arr['password']) {
70 $arr['password'] = $this->_adodb->getone("select password('" . $arr['password'] . "') from user");
71 }
72 basic::prv_updateobject($objectid, $arr);
73 $this->_adodb->execute("delete from usergroupmember where userid=$objectid");
74 $tarr = $arr['__membership__'];
75 if (is_array($tarr)) {
76 foreach ($tarr as $curr) {
77 if (!empty($curr))
78 $this->_adodb->execute("insert into usergroupmember (groupid , userid) values ('$curr', '$objectid')");
79 }
80 }
81 }
82
83 function prv_deleteobject() {
84 $this->_adodb->execute("delete from usergroupmember where userid=".$this->getObjectId());
85 basic::prv_deleteobject();
86 }
87
88 function getusername($objectid) {
89 $tmp = $this->_adodb->getone("select name from user where objectid = $objectid");
90 return $tmp;
91 }
92
93 function getgroupmemberships($userid) {
94 return $this->_adodb->getcol("select groupid from usergroupmember where userid='$userid'");
95 }
96
97 }

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