XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
visibility.php
Go to the documentation of this file.
1 <?php
21 defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined");
22 
24 {
25  function __construct()
26  {
27  $this->initVar('field_id', XOBJ_DTYPE_INT);
28  $this->initVar('user_group', XOBJ_DTYPE_INT);
29  $this->initVar('profile_group', XOBJ_DTYPE_INT);
30  }
31 
32  function ProfileVisibility()
33  {
34  $this->__construct();
35  }
36 }
37 
39 {
41  {
42  $this->__construct($db);
43  }
44 
45  function __construct(&$db)
46  {
47  parent::__construct($db, 'profile_visibility', 'profilevisibility', 'field_id');
48  }
49 
58  function getVisibleFields($profile_groups, $user_groups = null)
59  {
60  $profile_groups[] = $user_groups[] = 0;
61  $sql = "SELECT field_id FROM {$this->table} WHERE profile_group IN (" . implode(',', $profile_groups) . ")";
62  $sql .= " AND user_group IN (" . implode(',', $user_groups) . ")";
63  $field_ids = array();
64  if ($result = $this->db->query($sql)) {
65  while (list($field_id) = $this->db->fetchRow($result)) {
66  $field_ids[] = $field_id;
67  }
68  }
69  return $field_ids;
70  }
71 }
72 ?>