/** * Returns staff group of the staff user. * Result is cached until the end of script. * * @param bool $reload True to reload data from server. False to use the cached value (if present). * @return kyStaffGroup */ public function getStaffGroup($reload = false) { if ($this->staff_group !== null && !$reload) { return $this->staff_group; } if ($this->staff_group_id === null || $this->staff_group_id <= 0) { return null; } $this->staff_group = kyStaffGroup::get($this->staff_group_id); return $this->staff_group; }
/** * Returns staff groups that this news item will be visible to. * Result is cached until the end of script. * * @param bool $reload True to reload data from server. False to use the cached value (if present). * @return kyResultSet */ public function getStaffGroups($reload = false) { foreach ($this->staff_group_ids as $staff_group_id) { if (!is_array($this->staff_groups) || !array_key_exists($staff_group_id, $this->staff_groups) || $reload) { $this->staff_groups[$staff_group_id] = kyStaffGroup::get($staff_group_id); } } return new kyResultSet(array_values($this->staff_groups)); }