Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
edit_object.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Generated Header (not documented yet)
9  *
10  * @author Anakeen 2000
11  * @version $Id: edit_object.php,v 1.5 2003/08/18 15:46:41 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage ACCESS
15  */
16 /**
17  */
18 // ---------------------------------------------------------------
19 // $Id: edit_object.php,v 1.5 2003/08/18 15:46:41 eric Exp $
20 // $Source: /home/cvsroot/anakeen/freedom/core/Action/Access/edit_object.php,v $
21 // ---------------------------------------------------------------
22 // ---------------------------------------------------------------
23 include_once ("Class.User.php");
24 include_once ("Class.ControlObject.php");
25 include_once ("Class.ObjectPermission.php");
26 // -----------------------------------
27 function edit_object(&$action)
28 {
29  // -----------------------------------
30 
31  $coid = GetHttpVars("oid", 0);
32  $appid = GetHttpVars("appid", 0);
33  $viewuser = (GetHttpVars("viewuser", "no") == "yes");
34  // contruct user id list
35  // write title : oid description
36  $oid = new ControlObject($action->dbaccess, array(
37  $coid,
38  $appid
39  ));
40  $action->lay->Set("title", $oid->description);
41  $action->lay->Set("appid", $appid);
42  $action->lay->Set("oid", $coid);
43  // compute the head of table : acl definition
44  $acl = new Acl($action->dbaccess);
45  $appacls = $acl->getAclApplication($oid->id_class);
46  $tacldef = array();
47  while (list($k, $v) = each($appacls)) {
48  $tacldef[$k]["description"] = _($v->description);
49  $tacldef[$k]["name"] = $v->name;
50  }
51  $action->lay->SetBlockData("DEFACL", $tacldef);
52  // define ACL for each user
53  $ouser = new User();
54  if ($viewuser) $tiduser = $ouser->GetUserList();
55  else $tiduser = $ouser->GetGroupList();
56  $userids = array();
57  while (list($k, $v) = each($tiduser)) {
58  if ($v->id == 1) continue; // except admin : don't need privilege
59  $userids[$k]["userid"] = $v->id;
60  $userids[$k]["descuser"] = $v->firstname . " " . $v->lastname;
61  $userids[$k]["SELECTACL"] = "selectacl_$k";
62  // compute acl for userId
63  $uperm = new ObjectPermission($action->dbaccess, array(
64  $v->id,
65  $coid,
66  $appid
67  ));
68 
69  $tacl = array();
70  reset($appacls);
71  while (list($ka, $acl) = each($appacls)) {
72  $tacl[$ka]["aclid"] = $acl->id;
73  if (in_array($acl->id, $uperm->privileges)) {
74  $tacl[$ka]["selected"] = "checked";
75  } else $tacl[$ka]["selected"] = "";
76  }
77  $action->lay->SetBlockData($userids[$k]["SELECTACL"], $tacl);
78  }
79 
80  $action->lay->SetBlockData("USERS", $userids);
81 }
82 ?>
← centre documentaire © anakeen - published under CC License - Dynacase