|
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 | 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) |
|
|
static | $mode = self::MODE_DEFAULT |
|
static | $config = array() |
|
static | $reserved_slots = array('value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id') |
|
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
◆ 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 | $widget | Widget to add |
int | $width | Width of the widget |
int | $height | Height of the widget |
mixed | $x | Optional X position of the widget, defaults to first free position at the the end of the grid |
mixed | $y | Optional Y position of the widget, defaults to first free position at the the end of the grid |
- Returns
- Element
◆ configure()
static configure |
( |
|
$config = [] | ) |
|
|
staticprotected |
Configures the model.
- Parameters
-
array | $config | Configuration array |
◆ contains()
Returns whether this container contains the widget in question.
- Parameters
-
- Returns
- bool
◆ 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 | $range | Range to create the widget container folder |
String | $scope | Optional scope identifier, defaults to 'default' |
mixed | $default_id | Optional id for the appropriate default container |
- Returns
- Container
◆ equals()
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
-
- Returns
- bool
Implements Comparable.
◆ findByRange()
static findByRange |
( |
Range |
$range, |
|
|
|
$scope = 'default' |
|
) |
| |
|
static |
Finds a collection of container by range and scope.
- Parameters
-
Range | $range | Range to create the widget container folder |
String | $scope | Optional scope identifier, defaults to 'default' |
- Returns
- SimpleORMapCollection of Containers
◆ findOneByRange()
static findOneByRange |
( |
Range |
$range, |
|
|
|
$scope = 'default' |
|
) |
| |
|
static |
Finds one container by range and scope.
- Parameters
-
Range | $range | Range to create the widget container folder |
String | $scope | Optional 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 | $grouped | Return grouped by range type? |
- Returns
- array of containers (1-dimensional, optionally 2-dimensional grouped by range type)
◆ 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_type | Type of the range |
string | $default_id | Id for the default entry (often null, for user based containers it's the permission) |
string | $scope | Selected scope |
- Returns
- Container instance
◆ getDefaultId()
Returns the default id for this container.
- Returns
- string;
◆ 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_self | Includes this container in the returned array |
- Returns
- array of container ids
◆ getMode()
Returns the current mode for all containers.
- Returns
- string
◆ getTemplateName()
Returns the template name for this container.
- Returns
- string
◆ getTemplateVariables()
getTemplateVariables |
( |
array |
$variables = [] | ) |
|
|
protected |
Returns neccessary variables to render the container template.
- Parameters
-
array | $variables | Optional additional variables |
- Returns
- array of variables
◆ 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 | $variables | Optional additional variables |
- Returns
- string
- Todo:
- Should this really be in the model???
◆ 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
◆ setDefault()
setDefault |
( |
|
$default = true | ) |
|
Sets the flag that indicates that this container is a default container. Handle this with care!
- Parameters
-
bool | $default | Default state |
◆ setDefaultId()
Sets the default id for this container
- Parameters
-
◆ setMode()
Set the global mode for all containers. Seems a little error prone but works pretty well so far.
- Parameters
-
◆ 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
◆ transferElements()
Transfers elements from this container to another container. In this process, the elements are cloned since they are unique to a container.
- Parameters
-
◆ $default
◆ $default_id
◆ $mode
$mode = self::MODE_DEFAULT |
|
staticprotected |
◆ MODE_ADMIN
const MODE_ADMIN = 'admin' |
◆ MODE_DEFAULT
const MODE_DEFAULT = 'default' |
◆ WIDTH
The documentation for this class was generated from the following file: