1 | <?php |
||
42 | class ProfileVisibilityHandler extends XoopsPersistableObjectHandler |
||
|
|||
43 | { |
||
44 | /** |
||
45 | * @param null|XoopsDatabase $db |
||
46 | */ |
||
47 | public function __construct(XoopsDatabase $db) |
||
51 | |||
52 | /** |
||
53 | * Get fields visible to the $user_groups on a $profile_groups profile |
||
54 | * |
||
55 | * @param array $profile_groups groups of the user to be accessed |
||
56 | * @param array $user_groups groups of the visitor, default as $GLOBALS['xoopsUser'] |
||
57 | * |
||
58 | * @return array |
||
59 | */ |
||
60 | public function getVisibleFields($profile_groups, $user_groups = null) |
||
74 | |||
75 | /** |
||
76 | * get all rows matching a condition |
||
77 | * |
||
78 | * @param CriteriaElement $criteria {@link CriteriaElement} to match |
||
79 | * |
||
80 | * @return array of row arrays, indexed by field_id |
||
81 | */ |
||
82 | public function getAllByFieldId(CriteriaElement $criteria = null) |
||
95 | |||
96 | /** |
||
97 | * compare two arrays, each a row from profile_visibility |
||
98 | * The comparison is on three columns, 'field_id', 'user_group', 'profile_group' considered in that |
||
99 | * order for comparison |
||
100 | * |
||
101 | * @param array $a associative array with 3 numeric entries 'field_id', 'user_group', 'profile_group' |
||
102 | * @param array $b associative array with 3 numeric entries 'field_id', 'user_group', 'profile_group' |
||
103 | * |
||
104 | * @return int integer less that zero if $a is less than $b |
||
105 | * integer zero if $a and $b are equal |
||
106 | * integer greater than zero if $a is greater than $b |
||
107 | */ |
||
108 | protected function visibilitySort($a, $b) |
||
121 | } |
||
122 |
Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.