24 parent::initializeAttributes();
26 $this->attributes[
'type'] =
"group";
28 $this->tables_split = 2;
42 'description' =>
null,
64 if (
$row instanceof \stdClass) {
67 $msg =
"Failed to load new " . get_class() .
" for GUID:" .
$row->guid;
68 throw new \IOException($msg);
72 elgg_deprecated_notice(
'This type of usage of the \ElggGroup constructor was deprecated. Please use the clone method.', 1.7);
76 }
else if (is_numeric(
$row)) {
80 throw new \IOException(
"Failed to load new " . get_class() .
" from GUID:" .
$row);
83 throw new \InvalidParameterException(
"Unrecognized value passed to constuctor.");
99 $this->
name = $displayName;
146 if (
$name ==
'username') {
147 return 'group:' . $this->
getGUID();
149 return parent::__get(
$name);
346 'relationship' =>
'member',
347 'relationship_guid' => $this->
getGUID(),
348 'inverse_relationship' =>
true,
355 $options[
'relationship'] =
'member';
357 $options[
'inverse_relationship'] =
true;
381 $mode = $this->content_access_mode;
383 if (!is_string(
$mode)) {
390 $this->content_access_mode =
$mode;
394 if (
$mode === self::CONTENT_ACCESS_MODE_MEMBERS_ONLY) {
410 if (
$mode !== self::CONTENT_ACCESS_MODE_MEMBERS_ONLY) {
414 $this->content_access_mode =
$mode;
482 $attr_loader = new \Elgg\AttributeLoader(get_class(),
'group', $this->attributes);
483 $attr_loader->requires_access_control = !($this instanceof \ElggPlugin);
484 $attr_loader->secondary_loader =
'get_group_entity_as_row';
486 $attrs = $attr_loader->getRequiredAttributes(
$guid);
491 $this->attributes =
$attrs;
492 $this->tables_loaded = 2;
505 if (!parent::update()) {
509 $guid = (int)$this->guid;
513 $query =
"UPDATE {$CONFIG->dbprefix}groups_entity set"
514 .
" name='$name', description='$description' where guid=$guid";
516 return $this->
getDatabase()->updateData($query) !==
false;
525 $guid = parent::create();
535 $query =
"INSERT into {$CONFIG->dbprefix}groups_entity"
536 .
" (guid, name, description) values ($guid, '$name', '$description')";
568 return array_merge(parent::getExportableValues(), array(
$mode
Configure site maintenance mode.
if(! $site) if(!($site instanceof ElggSite)) $site description
if($guid==elgg_get_logged_in_user_guid()) $name
$user_guid
Avatar remove action.
getDatabase()
Provides a pointer to the database object.
initialise_attributes($pre18_api=true)
Initialise the attributes array.
loadAdditionalSelectValues(array $data)
Stores non-attributes from the loading of the entity as volatile data.
getGUID()
Returns the guid.
getExportableValues()
Return an array of fields which can be exported.
addFriend($friend_guid)
Start friendable compatibility block:
getMembers($options=array(), $offset=0, $count=false)
End friendable compatibility block.
isPublicMembership()
Returns whether the current group has open membership or not.
isFriendsWith($user_guid)
For compatibility with Friendable.
static getExternalAttributes()
Get default values for attributes stored in a separate table.
getFriendsObjects($subtype="", $limit=10, $offset=0)
For compatibility with Friendable.
create()
{Create a new entry in the entities table.Saves the base information in the entities table for the en...
update()
{Update the entity in the database.bool Whether the update was successful.}
countObjects($subtype="")
For compatibility with Friendable.
getFriends($subtype="", $limit=10, $offset=0)
For compatibility with Friendable.
initializeAttributes()
Sets the type to group.
setContentAccessMode($mode)
Set the content access mode used by group_gatekeeper()
isFriendOf($user_guid)
For compatibility with Friendable.
const CONTENT_ACCESS_MODE_MEMBERS_ONLY
isMember(\ElggUser $user=null)
Is the given user a member of this group?
load($guid)
Load the \ElggGroup data from the database.
canComment($user_guid=0)
Can a user comment on this group?
leave(\ElggUser $user)
Remove a user from the group.
__get($name)
Wrapper around \ElggEntity::__get()
const CONTENT_ACCESS_MODE_UNRESTRICTED
join(\ElggUser $user)
Join a user to this group.
isFriend()
For compatibility with Friendable.
__construct($row=null)
Construct a new group entity.
getFriendsOf($subtype="", $limit=10, $offset=0)
For compatibility with Friendable.
addObjectToGroup(\ElggObject $object)
Add an \ElggObject to this group.
getDisplayName()
{Get the entity's display name.string The title or name of this entity.}
getObjects($subtype="", $limit=10, $offset=0)
Get objects contained in this group.
removeObjectFromGroup($object)
Remove an object from this containing group and sets the container to be object's owner.
getContentAccessMode()
Return the content access mode used by group_gatekeeper()
removeFriend($friend_guid)
For compatibility with Friendable.
prepareObject($object)
{Prepare an object copy for toObject()Object representation of the entity \stdClass}
setDisplayName($displayName)
{Sets the title or name of this entity.The title or name of this entity. void}
$guid
Removes an admin notice.
get_objects_in_group($group_guid, $subtype="", $owner_guid=0, $site_guid=0, $order_by="", $limit=10, $offset=0, $count=FALSE)
Return an array of objects in a given container.
get_group_members($group_guid, $limit=10, $offset=0, $site_guid=0, $count=false)
Return a list of this group's members.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
sanitize_string($string)
Sanitize a string for database use.
elgg_instanceof($entity, $type=null, $subtype=null, $class=null)
Checks if $entity is an \ElggEntity and optionally for type and subtype.
_elgg_cache_entity(\ElggEntity $entity)
Cache an entity.
get_entity($guid)
Loads and returns an entity object from a guid.
if($screenshots) $description
elgg_get_entities_from_relationship($options)
Return entities matching a given query joining against a relationship.
add_entity_relationship($guid_one, $relationship, $guid_two)
Create a relationship between two entities.
remove_entity_relationship($guid_one, $relationship, $guid_two)
Delete a relationship between two entities.
check_entity_relationship($guid_one, $relationship, $guid_two)
Check if a relationship exists between two entities.
get_user($guid)
Get a user object from a GUID.