ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilOrgUnitObjectPositionSetting.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
12 {
13 
17  protected $db;
21  private $obj_id;
25  private $active;
26 
27 
33  public function __construct($a_obj_id)
34  {
35  $this->db = $GLOBALS['DIC']->database();
36  $this->obj_id = $a_obj_id;
37  $this->readSettings();
38  }
39 
40 
48  public function lookupActive($a_obj_id)
49  {
50  $db = $GLOBALS['DIC']->database();
51 
52  $query = 'select * from orgu_obj_pos_settings ' . 'where obj_id = '
53  . $db->quote($a_obj_id, 'integer');
54  $res = $this->db->query($query);
55  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
56  return (bool) $row->active;
57  }
58  }
59 
60 
66  public function isActive()
67  {
68  return $this->active;
69  }
70 
71 
77  public function setActive($a_status)
78  {
79  $this->active = $a_status;
80  }
81 
82 
86  public function update()
87  {
88  $this->db->replace('orgu_obj_pos_settings', [
89  'obj_id' => [ 'integer', $this->obj_id ],
90  ], [
91  'active' => [ 'integer', (int) $this->isActive() ],
92  ]);
93  }
94 
95 
99  public function delete()
100  {
101  $query = 'DELETE from orgu_obj_pos_settings ' . 'WHERE obj_id = '
102  . $this->db->quote($this->obj_id, 'integer');
103  $this->db->manipulate($query);
104  }
105 
106 
111  public function hasObjectSpecificActivation()
112  {
113  return $this->active !== null;
114  }
115 
116 
120  protected function readSettings()
121  {
122  if (!$this->obj_id) {
123  return;
124  }
125  $query = 'select * from orgu_obj_pos_settings ' . 'where obj_id = '
126  . $this->db->quote($this->obj_id, 'integer');
127  $res = $this->db->query($query);
128  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
129  $this->active = (bool) $row->active;
130  }
131 
132  return;
133  }
134 }
Stores object activation status of orgunit position settings.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
lookupActive($a_obj_id)
Lookup activation status.
foreach($_POST as $key=> $value) $res
$query
isActive()
Check if position access is active.