31 parent::initializeAttributes();
33 $this->attributes[
'type'] =
"object";
34 $this->attributes += self::getExternalAttributes();
35 $this->tables_split = 2;
49 'description' => null,
76 if (
$row instanceof \stdClass) {
79 $msg =
"Failed to load new " . get_class() .
" for GUID: " .
$row->guid;
80 throw new \IOException($msg);
84 elgg_deprecated_notice(
'This type of usage of the \ElggObject constructor was deprecated. Please use the clone method.', 1.7);
88 }
else if (is_numeric(
$row)) {
92 throw new \IOException(
"Failed to load new " . get_class() .
" from GUID:" .
$row);
95 throw new \InvalidParameterException(
"Unrecognized value passed to constuctor.");
109 $attr_loader = new \Elgg\AttributeLoader(get_class(),
'object', $this->attributes);
110 $attr_loader->requires_access_control = !($this instanceof \ElggPlugin);
111 $attr_loader->secondary_loader =
'get_object_entity_as_row';
113 $attrs = $attr_loader->getRequiredAttributes(
$guid);
118 $this->attributes =
$attrs;
119 $this->tables_loaded = 2;
132 $guid = parent::create();
141 $query =
"INSERT into {$CONFIG->dbprefix}objects_entity 142 (guid, title, description) values ($guid, '$title', '$description')";
159 if (!parent::update()) {
163 $guid = (int)$this->guid;
167 $query =
"UPDATE {$CONFIG->dbprefix}objects_entity 168 set title='$title', description='$description' where guid=$guid";
170 return $this->
getDatabase()->updateData($query) !==
false;
184 $this->
title = $displayName;
206 return parent::getSites();
217 if (is_numeric(
$site)) {
222 return parent::addToSite(
$site);
247 return array_merge(parent::getExportableValues(), array(
addToSite($site)
Add this object to a site.
static getExternalAttributes()
Get default values for attributes stored in a separate table.
getDatabase()
Provides a pointer to the database object.
get_site_objects($site_guid, $subtype="", $limit=10, $offset=0)
Get the objects belonging to a site.
loadAdditionalSelectValues(array $data)
Stores non-attributes from the loading of the entity as volatile data.
canWriteToContainer($user_guid=0, $type= 'all', $subtype= 'all')
Can a user add an entity to this container.
getSites($options="", $limit=10, $offset=0)
Return sites that this object is a member of.
_elgg_cache_entity(\ElggEntity $entity)
Cache an entity.
load($guid)
Loads the full when given a guid.
add_site_object($site_guid, $object_guid)
Add an object to a site.
if($screenshots) $description
getGUID()
Returns the guid.
initializeAttributes()
Initialize the attributes array to include the type, title, and description.
$guid
Removes an admin notice.
elgg input elgg input tags
sanitize_string($string)
Sanitize a string for database use.
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.
initialise_attributes($pre18_api=true)
Initialise the attributes array.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
elgg global
Pointer to the global context.
__construct($row=null)
Create a new .
setDisplayName($displayName)
{}
canComment($user_guid=0)
Can a user comment on this object?
getContainerEntity()
Get the container entity for this object.
$user_guid
Avatar remove action.
getExportableValues()
Return an array of fields which can be exported.