Beispiel #1
0
 public function __construct($attrs = array())
 {
     parent::__construct($attrs);
     // convert
     if (!is_array($this->searchFields)) {
         $this->searchFields = explode(',', $this->searchFields);
     }
 }
Beispiel #2
0
 public function __construct($properties = array())
 {
     $this->objects = array();
     $this->restrict = false;
     parent::__construct($properties);
     // convert data
     if (is_array($this->menu)) {
         $this->menu = new \Meta\Menu\Item($this->menu);
     }
 }
Beispiel #3
0
 public function __construct($id = null)
 {
     if ($id) {
         $row = (array) Db::query('select id, login, name, isAdmin from users where id = ?', array($id))->fetch(\PDO::FETCH_ASSOC);
         // let Base class to set properties
         if (is_array($row)) {
             parent::__construct($row);
         }
         $this->groups = Db::query('select group_id, groups.name from user_groups inner join groups on (groups.id = user_groups.group_id) where user_id = ? order by groups.name', array($id))->fetchAll(\PDO::FETCH_KEY_PAIR);
         $this->groupPages = Db::query('select distinct p.page from user_groups inner join groups on (groups.id = user_groups.group_id) inner join group_pages p on (p.group_id = groups.id) where user_id = ?', array($id))->fetchAll(\PDO::FETCH_COLUMN);
     }
 }