24 parent::initializeAttributes();
26 $this->attributes[
'type'] =
"group";
27 $this->attributes += self::getExternalAttributes();
41 'description' => null,
63 $msg =
"Failed to load new " . get_class() .
" for GUID:" .
$row->guid;
64 throw new \IOException($msg);
66 }
else if (is_numeric(
$row)) {
70 throw new \IOException(
"Failed to load new " . get_class() .
" from GUID:" .
$row);
73 throw new \InvalidParameterException(
"Unrecognized value passed to constuctor.");
89 $this->
name = $displayName;
101 return $object->
save();
136 if (
$name ==
'username') {
137 return 'group:' . $this->
getGUID();
139 return parent::__get(
$name);
319 'relationship' =>
'member',
320 'inverse_relationship' =>
true,
322 'relationship_join_on' =>
'owner_guid',
372 'relationship' =>
'member',
373 'relationship_guid' => $this->
getGUID(),
374 'inverse_relationship' =>
true,
381 $options[
'relationship'] =
'member';
383 $options[
'inverse_relationship'] =
true;
407 $mode = $this->content_access_mode;
409 if (!is_string(
$mode)) {
412 $mode = self::CONTENT_ACCESS_MODE_UNRESTRICTED;
414 $mode = self::CONTENT_ACCESS_MODE_MEMBERS_ONLY;
416 $this->content_access_mode =
$mode;
420 if (
$mode === self::CONTENT_ACCESS_MODE_MEMBERS_ONLY) {
423 return self::CONTENT_ACCESS_MODE_UNRESTRICTED;
435 if (!
$mode && $this->content_access_mode) {
440 if (
$mode !== self::CONTENT_ACCESS_MODE_MEMBERS_ONLY) {
441 $mode = self::CONTENT_ACCESS_MODE_UNRESTRICTED;
444 $this->content_access_mode =
$mode;
482 $params = array(
'group' => $this,
'user' => $user);
498 $params = array(
'group' => $this,
'user' => $user);
512 $attr_loader = new \Elgg\AttributeLoader(get_class(),
'group', $this->attributes);
513 $attr_loader->requires_access_control = !($this instanceof \ElggPlugin);
514 $attr_loader->secondary_loader =
'get_group_entity_as_row';
516 $attrs = $attr_loader->getRequiredAttributes(
$guid);
521 $this->attributes =
$attrs;
534 if (!parent::update()) {
538 $guid = (int)$this->guid;
542 $query =
"UPDATE {$CONFIG->dbprefix}groups_entity set" 543 .
" name='$name', description='$description' where guid=$guid";
545 return $this->
getDatabase()->updateData($query) !==
false;
554 $guid = parent::create();
564 $query =
"INSERT into {$CONFIG->dbprefix}groups_entity" 565 .
" (guid, name, description) values ($guid, '$name', '$description')";
597 return array_merge(parent::getExportableValues(), array(
countObjects($subtype="")
For compatibility with Friendable.
$object
These two snippets demonstrates triggering an event and how to register for that event.
getDatabase()
Provides a pointer to the database object.
getObjects($subtype="", $limit=10, $offset=0)
Get objects contained in this group.
addObjectToGroup(\ElggObject $object)
Add an to this group.
get_group_members($group_guid, $limit=10, $offset=0, $site_guid=0, $count=false)
Return a list of this group's members.
$mode
Configure site maintenance mode.
loadAdditionalSelectValues(array $data)
Stores non-attributes from the loading of the entity as volatile data.
add_entity_relationship($guid_one, $relationship, $guid_two)
Create a relationship between two entities.
isFriend()
For compatibility with Friendable.
getFriendsObjects($subtype="", $limit=10, $offset=0)
For compatibility with Friendable.
if($guid==elgg_get_logged_in_user_guid()) $name
remove_entity_relationship($guid_one, $relationship, $guid_two)
Delete a relationship between two entities.
getMembers($options=array(), $offset=0, $count=false)
End friendable compatibility block.
addFriend($friend_guid)
Start friendable compatibility block:
getGUID()
Returns the guid.
$guid
Removes an admin notice.
__get($name)
Wrapper around ::__get()
__construct($row=null)
Construct a new group entity.
static getExternalAttributes()
Get default values for attributes stored in a separate table.
sanitize_string($string)
Sanitizes a string for use in a query.
getFriends($subtype="", $limit=10, $offset=0)
For compatibility with Friendable.
if(!$site) if(!($site instanceof ElggSite)) $site description
elgg_instanceof($entity, $type=null, $subtype=null, $class=null)
Checks if $entity is an and optionally for type and subtype.
getContentAccessMode()
Return the content access mode used by group_gatekeeper()
if($categories) $description
get_user($guid)
Get a user object from a GUID.
getFriendsOf($subtype="", $limit=10, $offset=0)
For compatibility with Friendable.
const CONTENT_ACCESS_MODE_UNRESTRICTED
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
check_entity_relationship($guid_one, $relationship, $guid_two)
Check if a relationship exists between two entities.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
join(\ElggUser $user)
Join a user to this group.
elgg global
Pointer to the global context.
isFriendsWith($user_guid)
For compatibility with Friendable.
load($guid)
Load the data from the database.
isFriendOf($user_guid)
For compatibility with Friendable.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
const CONTENT_ACCESS_MODE_MEMBERS_ONLY
isPublicMembership()
Returns whether the current group has open membership or not.
canComment($user_guid=0, $default=null)
Can a user comment on this group?
getExportableValues()
Return an array of fields which can be exported.
leave(\ElggUser $user)
Remove a user from the group.
removeObjectFromGroup($object)
Remove an object from this containing group and sets the container to be object's owner...
setDisplayName($displayName)
{}
isMember(\ElggUser $user=null)
Is the given user a member of this group?
elgg_get_entities_from_relationship($options)
Return entities matching a given query joining against a relationship.
$user_guid
Avatar remove action.
setContentAccessMode($mode)
Set the content access mode used by group_gatekeeper()
initializeAttributes()
Sets the type to group.
removeFriend($friend_guid)
For compatibility with Friendable.
get_entity($guid)
Loads and returns an entity object from a guid.