Stud.IP  4.2 Revision
Container Class Reference
Inheritance diagram for Container:
Inheritance graph
Collaboration diagram for Container:
Collaboration graph

Public Member Functions

 addWidget (WidgetInterface $widget, $width=1, $height=1, $x=null, $y=null)
 
 getAvailableWidgets ($scope=null)
 
 contains (WidgetInterface $widget)
 
 equals ($other)
 
 setDefault ($default=true)
 
 isDefault ()
 
 setDefaultId ($id)
 
 getDefaultId ()
 
 render (array $variables=[])
 
 store ()
 
 transferElements (Container $other)
 
 getDerivedContainerIds ($include_self=false)
 
 renderPreview ()
 
- Public Member Functions inherited from SimpleORMap
 __construct ($id=null)
 
 __clone ()
 
 getRelationOptions ($relation)
 
 getTableMetadata ()
 
 hasAutoIncrementColumn ()
 
 setId ($id)
 
 getId ()
 
 getNewId ()
 
 toArray ($only_these_fields=null)
 
 toRawArray ($only_these_fields=null)
 
 toArrayRecursive ($only_these_fields=null)
 
 getValue ($field)
 
 getRelationValue ($relation, $field)
 
 getDefaultValue ($field)
 
 setValue ($field, $value)
 
 __get ($field)
 
 __set ($field, $value)
 
 __isset ($field)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 getIterator ()
 
 count ()
 
 isField ($field)
 
 isAdditionalField ($field)
 
 isAliasField ($field)
 
 isI18nField ($field)
 
 setData ($data, $reset=false)
 
 isNew ()
 
 isDeleted ()
 
 setNew ($is_new)
 
 getWhereQuery ()
 
 restore ()
 
 store ()
 
 triggerChdate ()
 
 delete ()
 
 isDirty ()
 
 isFieldDirty ($field)
 
 revertValue ($field)
 
 getPristineValue ($field)
 
 initRelation ($relation)
 
 resetRelation ($relation)
 
 cleanup ()
 

Static Public Member Functions

static setMode ($mode)
 
static getMode ()
 
static createForRange (Range $range, $scope='default', $default_id=null)
 
static getDefaultContainerForRange ($range_type, $default_id, $scope)
 
static getAllDefaultContainers ($grouped=false)
 
static findByRange (Range $range, $scope='default')
 
static findOneByRange (Range $range, $scope='default')
 
- Static Public Member Functions inherited from SimpleORMap
static tableScheme ($db_table)
 
static expireTableScheme ()
 
static find ($id)
 
static exists ($id)
 
static countBySql ($sql=1, $params=array())
 
static create ($data)
 
static build ($data, $is_new=true)
 
static buildExisting ($data)
 
static import ($data)
 
static findBySQL ($sql, $params=array())
 
static findOneBySQL ($where, $params=array())
 
static findThru ($foreign_key_value, $options)
 
static findEachBySQL ($callable, $sql, $params=array())
 
static findMany ($pks=array(), $order='', $order_params=array())
 
static findEachMany ($callable, $pks=array(), $order='', $order_params=array())
 
static findAndMapBySQL ($callable, $where, $params=array())
 
static findAndMapMany ($callable, $pks=array(), $order='', $order_params=array())
 
static deleteBySQL ($where, $params=array())
 
static toObject ($id_or_object)
 
static __callStatic ($name, $arguments)
 

Data Fields

const WIDTH = 6
 
const MODE_DEFAULT = 'default'
 
const MODE_ADMIN = 'admin'
 

Protected Member Functions

 getTemplateName ()
 
 getTemplateVariables (array $variables=[])
 
- Protected Member Functions inherited from SimpleORMap
 _getId ($field)
 
 _setId ($field, $value)
 
 _getAdditionalValueFromRelation ($field)
 
 _setAdditionalValueFromRelation ($field, $value)
 
 _getAdditionalValue ($field)
 
 _setAdditionalValue ($field, $value)
 
 parseRelationOptions ($type, $name, $options)
 
 storeRelations ($only_these=null)
 
 deleteRelations ()
 
 initializeContent ()
 
 applyCallbacks ($type)
 
 registerCallback ($types, $cb)
 
 unregisterCallback ($types, $cb)
 
 cbAutoIncrementColumn ($type)
 
 cbAutoKeyCreation ()
 
 cbNotificationMapper ($cb_type)
 
 cbAfterInitialize ($cb_type)
 
 setSerializedValue ($field, $value)
 
 setI18nValue ($field, $value)
 
 cbI18N ($type)
 

Static Protected Member Functions

static configure ($config=[])
 
- Static Protected Member Functions inherited from SimpleORMap
static configure ($config=array())
 
static config ($key)
 

Protected Attributes

 $default = false
 
 $default_id = null
 
- Protected Attributes inherited from SimpleORMap
 $content = array()
 
 $content_db = array()
 
 $is_new = true
 
 $is_deleted = false
 
 $db_table = ''
 
 $db_fields = null
 
 $pk = null
 
 $default_values = array()
 
 $serialized_fields = array()
 
 $alias_fields = array()
 
 $i18n_fields = array()
 
 $additional_fields = array()
 
 $relations = array()
 
 $has_many = array()
 
 $has_one = array()
 
 $belongs_to = array()
 
 $has_and_belongs_to_many = array()
 
 $registered_callbacks = array()
 
 $known_slots = array()
 
 $notification_map = array()
 
 $additional_data = array()
 
 $getter_setter_map = array()
 

Static Protected Attributes

static $mode = self::MODE_DEFAULT
 
- Static Protected Attributes inherited from SimpleORMap
static $config = array()
 
static $reserved_slots = array('value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id')
 

Additional Inherited Members

- Static Public Attributes inherited from SimpleORMap
static $schemes = null
 

Detailed Description

This model represents a widget container that consists of many widget elements that again contain a widget.

Author
Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m GPL2 or any later version
Since
Stud.IP 4.1

Member Function Documentation

◆ addWidget()

addWidget ( WidgetInterface  $widget,
  $width = 1,
  $height = 1,
  $x = null,
  $y = null 
)

Adds a widget to the container by creating a new Element.

Be aware that this method does not do any sanity checks and might lead to a collision with another widget. Usually, the widget is added as a placeholder and before the container is loaded again, the client will have sent a new layout that is collision free (in other words: the widget grid lib in javascript will handle this).

Parameters
Widget$widgetWidget to add
int$widthWidth of the widget
int$heightHeight of the widget
mixed$xOptional X position of the widget, defaults to first free position at the the end of the grid
mixed$yOptional Y position of the widget, defaults to first free position at the the end of the grid
Returns
Element
Here is the call graph for this function:
Here is the caller graph for this function:

◆ configure()

static configure (   $config = [])
staticprotected

Configures the model.

Parameters
array$configConfiguration array
Here is the call graph for this function:

◆ contains()

contains ( WidgetInterface  $widget)

Returns whether this container contains the widget in question.

Parameters
Widget$widgetWidget to test
Returns
bool
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createForRange()

static createForRange ( Range  $range,
  $scope = 'default',
  $default_id = null 
)
static

Creates a container for the specified range and scope. If no container exists, a new one is created.

Parameters
Range$rangeRange to create the widget container folder
String$scopeOptional scope identifier, defaults to 'default'
mixed$default_idOptional id for the appropriate default container
Returns
Container
Here is the call graph for this function:
Here is the caller graph for this function:

◆ equals()

equals (   $other)

Determines whether this container equals another container. Two container are equal if all of the following conditions match:

  • Same range type and scope
  • Same number of elements
  • Same position of equal widgets (by id/type) with same settings/options
Parameters
Container$otherContainer to test equality against
Returns
bool

Implements Comparable.

◆ findByRange()

static findByRange ( Range  $range,
  $scope = 'default' 
)
static

Finds a collection of container by range and scope.

Parameters
Range$rangeRange to create the widget container folder
String$scopeOptional scope identifier, defaults to 'default'
Returns
SimpleORMapCollection of Containers
Here is the call graph for this function:

◆ findOneByRange()

static findOneByRange ( Range  $range,
  $scope = 'default' 
)
static

Finds one container by range and scope.

Parameters
Range$rangeRange to create the widget container folder
String$scopeOptional scope identifier, defaults to 'default'
Returns
mixed (Container|null)

◆ getAllDefaultContainers()

static getAllDefaultContainers (   $grouped = false)
static

Returns a list of all default containers - optionally grouped by range type.

Parameters
bool$groupedReturn grouped by range type?
Returns
array of containers (1-dimensional, optionally 2-dimensional grouped by range type)
Here is the call graph for this function:

◆ getAvailableWidgets()

getAvailableWidgets (   $scope = null)

Returns a list of available widgets that might be added to the container.

Returns
array of Widget

◆ getDefaultContainerForRange()

static getDefaultContainerForRange (   $range_type,
  $default_id,
  $scope 
)
static

Returns the default container for a specific range identified by type, a default and a scope.

Parameters
string$range_typeType of the range
string$default_idId for the default entry (often null, for user based containers it's the permission)
string$scopeSelected scope
Returns
Container instance
Here is the call graph for this function:

◆ getDefaultId()

getDefaultId ( )

Returns the default id for this container.

Returns
string;
Here is the caller graph for this function:

◆ getDerivedContainerIds()

getDerivedContainerIds (   $include_self = false)

Return all container ids that are derived from this containers. This implies that the current container is a default container.

Parameters
bool$include_selfIncludes this container in the returned array
Returns
array of container ids
Here is the call graph for this function:

◆ getMode()

static getMode ( )
static

Returns the current mode for all containers.

Returns
string

◆ getTemplateName()

getTemplateName ( )
protected

Returns the template name for this container.

Returns
string

◆ getTemplateVariables()

getTemplateVariables ( array  $variables = [])
protected

Returns neccessary variables to render the container template.

Parameters
array$variablesOptional additional variables
Returns
array of variables

◆ isDefault()

isDefault ( )

Returns whether this container is a default container or not.

Returns
bool

◆ render()

render ( array  $variables = [])

Renders this container and sets up the sidebar (if possible).

Parameters
array$variablesOptional additional variables
Returns
string
Todo:
Should this really be in the model???
Here is the call graph for this function:

◆ renderPreview()

renderPreview ( )

Renders a preview of this container which displays the raw layout of the widgets with no content and functionality.

This method also adds the required squeeze package for the preview to the page layout.

Returns
string containg the preview as HTML
Here is the call graph for this function:

◆ setDefault()

setDefault (   $default = true)

Sets the flag that indicates that this container is a default container. Handle this with care!

Parameters
bool$defaultDefault state

◆ setDefaultId()

setDefaultId (   $id)

Sets the default id for this container

Parameters
string$idDefault id

◆ setMode()

static setMode (   $mode)
static

Set the global mode for all containers. Seems a little error prone but works pretty well so far.

Parameters
string$modeMode to set

◆ store()

store ( )

Stores the container.

If the container is equal to the default container of it's range and scope, the parent id of the default container is preserved. If anything has changed, the default id will be removed and the container will not be changed when the default layout is changed.

If no parent id is set, the container is treated as a default container. This means that all containers that have this container as a parent, will be adjusted to match the layout of this container.

Returns
int number of rows stored
Here is the caller graph for this function:

◆ transferElements()

transferElements ( Container  $other)

Transfers elements from this container to another container. In this process, the elements are cloned since they are unique to a container.

Parameters
Container$otherContainer to transfer the element to.
Here is the call graph for this function:

Field Documentation

◆ $default

$default = false
protected

◆ $default_id

$default_id = null
protected

◆ $mode

$mode = self::MODE_DEFAULT
staticprotected

◆ MODE_ADMIN

const MODE_ADMIN = 'admin'

◆ MODE_DEFAULT

const MODE_DEFAULT = 'default'

◆ WIDTH

const WIDTH = 6

The documentation for this class was generated from the following file: