Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.ControlObject.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: Class.ControlObject.php,v 1.7 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 CORE
15  */
16 /**
17  */
18 // $Id: Class.ControlObject.php,v 1.7 2003/08/18 15:46:41 eric Exp $
19 // $Source: /home/cvsroot/anakeen/freedom/core/Class/Appmng/Class.ControlObject.php,v $
20 // ---------------------------------------------------------------
21 //
22 $CLASS_CONTROLOBJECT_PHP = '$Id: Class.ControlObject.php,v 1.7 2003/08/18 15:46:41 eric Exp $';
23 include_once ('Class.DbObjCtrl.php');
24 include_once ('Class.QueryDb.php');
25 include_once ('Class.Application.php');
26 include_once ('Class.Action.php');
27 include_once ('Class.Acl.php');
28 include_once ('Class.User.php');
29 include_once ('Class.Group.php');
30 
31 class ControlObject extends DbObj
32 {
33  var $fields = array(
34  "id_obj",
35  "id_class",
36  "description"
37  );
38 
39  var $id_fields = array(
40  "id_obj",
41  "id_class"
42  );
43 
44  var $dbtable = "octrl";
45 
46  var $sqlcreate = '
47 create table octrl (id_obj int not null,
48  id_class int not null,
49  description varchar(256));
50 create unique index i_octrl on octrl (id_obj, id_class);';
51  // --------------------------------------------------------------------
52  //---------------------- OBJECT CONTROL PERMISSION --------------------
53 
54  // --------------------------------------------------------------------
55  function ControlObject($dbaccess = '', $id = '', $res = '', $dbid = 0)
56  // --------------------------------------------------------------------
57 
58  {
59  // change DB for permission : see 'dboperm' session var
60  global $action;
61  $dbaccess = $action->Read("dboperm", $dbaccess);
62 
63  DbObj::DbObj($dbaccess, $id, $res, $dbid);
64  }
65  // --------------------------------------------------------------------
66  function PostDelete()
67  // --------------------------------------------------------------------
68 
69  {
70  // ------------------------------
71  // delete object permision object
72  $dq = new QueryDb($this->dbaccess, "ObjectPermission");
73  $dq->Query(0, 0, "TABLE", "delete from operm where id_obj not in (select id_obj from octrl)");
74  }
75  // --------------------------------------------------------------------
76 
77  // get controlled object for a specific class
78  function GetOids($idclass)
79  {
80 
81  $oids = array();
82  $query = new QueryDb($this->dbaccess, "ControlObject");
83  $query->AddQuery("id_class=$idclass");
84  $table1 = $query->Query();
85  if ($query->nb > 0) {
86  while (list($k, $v) = each($table1)) {
87  $oids[] = $v;
88  }
89  }
90  return $oids;
91  }
92 }
93 ?>
← centre documentaire © anakeen - published under CC License - Dynacase