Beispiel #1
0
 /**
  * Returns user group of the 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 kyUserGroup
  */
 public function getUserGroup($reload = false)
 {
     if ($this->user_group !== null && !$reload) {
         return $this->user_group;
     }
     if ($this->user_group_id === null) {
         return null;
     }
     $this->user_group = kyUserGroup::get($this->user_group_id);
     return $this->user_group;
 }
 /**
  * Returns user 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 getUserGroups($reload = false)
 {
     foreach ($this->user_group_ids as $user_group_id) {
         if (!is_array($this->user_groups) || !array_key_exists($user_group_id, $this->user_groups) || $reload) {
             $this->user_groups[$user_group_id] = kyUserGroup::get($user_group_id);
         }
     }
     return new kyResultSet(array_values($this->user_groups));
 }