24 parent::initializeAttributes();
26 $this->attributes[
'type'] =
"group";
27 $this->attributes += self::getExternalAttributes();
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;
111 return $object->
save();
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)) {
386 $mode = self::CONTENT_ACCESS_MODE_UNRESTRICTED;
388 $mode = self::CONTENT_ACCESS_MODE_MEMBERS_ONLY;
390 $this->content_access_mode =
$mode;
394 if (
$mode === self::CONTENT_ACCESS_MODE_MEMBERS_ONLY) {
397 return self::CONTENT_ACCESS_MODE_UNRESTRICTED;
410 if (
$mode !== self::CONTENT_ACCESS_MODE_MEMBERS_ONLY) {
411 $mode = self::CONTENT_ACCESS_MODE_UNRESTRICTED;
414 $this->content_access_mode =
$mode;
452 $params = array(
'group' => $this,
'user' => $user);
468 $params = array(
'group' => $this,
'user' => $user);
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(
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.
countObjects($subtype="")
For compatibility with Friendable.
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:
_elgg_cache_entity(\ElggEntity $entity)
Cache an entity.
if($screenshots) $description
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)
Sanitize a string for database use.
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()
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
initialise_attributes($pre18_api=true)
Initialise the attributes array.
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.
const CONTENT_ACCESS_MODE_MEMBERS_ONLY
isPublicMembership()
Returns whether the current group has open membership or not.
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?
canComment($user_guid=0)
Can a user comment on 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.