ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDataCollectionTable Class Reference

Class ilDataCollectionField. More...

+ Collaboration diagram for ilDataCollectionTable:

Public Member Functions

 __construct ($a_id=0)
 doRead ()
 Read table.
 doCreate ($create_views=true)
 doUpdate ()
 setId ($a_id)
 Set table id.
 getId ()
 Get table id.
 setObjId ($a_id)
 getObjId ()
 setTitle ($a_title)
 getTitle ()
 getCollectionObject ()
 getRecords ()
 getRecordsByFilter (array $filter=array())
 getRecordsByFilter
 getAll ($a_id)
 deleteField ($field_id)
 getField ($field_id)
 getFieldIds ()
 getNewOrder ()
 getNewOrder
 getFields ()
 Returns all fields of this table including the standard fields.
 getRecordFields ()
 Returns all fields of this table which are NOT standard fields.
 getVisibleFields ()
 Returns all fields of this table who have set their visibility to true, including standard fields.
 getEditableFields ()
 getFilterableFields ()
 getFilterableFields Returns all fields of this table who have set their filterable to true, including standard fields.
 getExportableFields ()
 Return all the fields that are marked as exportable.
 hasPermissionToFields ($ref_id)
 hasPermissionToAddTable ($ref_id)
 hasPermissionToAddRecord ($ref_id)
 hasPermissionToEditRecord ($ref_id, ilDataCollectionRecord $record)
 hasPermissionToDeleteRecord ($ref_id, ilDataCollectionRecord $record)
 hasPermissionToDeleteRecords ($ref_id)
 updateFields ()
 Update fields.
 sortFields (&$fields)
 sortFields
 buildOrderFields ()
 buildOrderFields orders the fields.
 getFieldByTitle ($title)
 Get a field by title.
 setAddPerm ($add_perm)
 getAddPerm ()
 setDeletePerm ($delete_perm)
 getDeletePerm ()
 setEditByOwner ($edit_by_owner)
 getEditByOwner ()
 setEditPerm ($edit_perm)
 getEditPerm ()
 setLimited ($limited)
 getLimited ()
 setLimitEnd ($limit_end)
 getLimitEnd ()
 setLimitStart ($limit_start)
 getLimitStart ()
 setIsVisible ($is_visible)
 getIsVisible ()
 setDescription ($description)
 getDescription ()
 setDefaultSortField ($default_sort_field)
 /**
 getDefaultSortField ()
 setDefaultSortFieldOrder ($default_sort_field_order)
 getDefaultSortFieldOrder ()
 setPublicCommentsEnabled ($public_comments)
 getPublicCommentsEnabled ()
 setViewOwnRecordsPerm ($view_own_perm)
 getViewOwnRecordsPerm ()
 hasCustomFields ()
 hasCustomFields
 compareOrder ($a, $b)
 cloneStructure (ilDataCollectionTable $original)
 _hasRecords ()
 _hasRecords
 addField ($field)
 setExportEnabled ($export_enabled)
 getExportEnabled ()
 getPartialRecords ($sort, $direction, $limit, $offset, array $filter=array())
 Return only the needed subset of record objects for the table, according to sorting, paging and filters.

Static Public Member Functions

static _tableExists ($table_id)
static _getTableIdByTitle ($title, $obj_id)
static _hasFieldByTitle ($title, $obj_id)
 Checks if a table has a field with the given title.

Protected Member Functions

 loadObj ()
 loadRecords ()
 loadFields ()
 checkEditByOwner (ilDataCollectionRecord $record)
 checkLimit ()
 sortByOrder (&$array)

Protected Attributes

 $id = 0
 $objId
 $obj
 $title
 $fields
 $stdFields
 $records
 $is_visible
 $add_perm
 $edit_perm
 $delete_perm
 $edit_by_owner
 $limited
 $limit_start
 $limit_end
 $export_enabled
 $default_sort_field = 0
 $default_sort_field_order = 'asc'
 $description = ''
 $public_comments = 0
 $view_own_records_perm = 0

Detailed Description

Constructor & Destructor Documentation

ilDataCollectionTable::__construct (   $a_id = 0)
Parameters
int$a_id

Definition at line 121 of file class.ilDataCollectionTable.php.

References doRead().

{
if ($a_id != 0) {
$this->id = $a_id;
$this->doRead();
}
}

+ Here is the call graph for this function:

Member Function Documentation

static ilDataCollectionTable::_getTableIdByTitle (   $title,
  $obj_id 
)
static
Parameters
$titleTitle of table
$obj_idDataCollection object ID where the table belongs to
Returns
int

Definition at line 1255 of file class.ilDataCollectionTable.php.

References $id, $ilDB, $result, and $title.

Referenced by ilObjDataCollection\cloneStructure().

{
global $ilDB;
$result = $ilDB->query('SELECT id FROM il_dcl_table WHERE title = ' . $ilDB->quote($title, 'text') . ' AND obj_id = '
. $ilDB->quote($obj_id, 'integer'));
$id = 0;
while ($rec = $ilDB->fetchAssoc($result)) {
$id = $rec['id'];
}
return $id;
}

+ Here is the caller graph for this function:

static ilDataCollectionTable::_hasFieldByTitle (   $title,
  $obj_id 
)
static

Checks if a table has a field with the given title.

Parameters
$titleTitle of field
$obj_idObj-ID of the table
Returns
bool

Definition at line 1292 of file class.ilDataCollectionTable.php.

References $ilDB, $result, and $title.

Referenced by ilDataCollectionFieldEditGUI\checkInput().

{
global $ilDB;
$result = $ilDB->query('SELECT * FROM il_dcl_field WHERE table_id = ' . $ilDB->quote($obj_id, 'integer') . ' AND title = '
. $ilDB->quote($title, 'text'));
return ($ilDB->numRows($result)) ? true : false;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::_hasRecords ( )

_hasRecords

Returns
boolean

Definition at line 1222 of file class.ilDataCollectionTable.php.

References getRecords().

{
return (count($this->getRecords()) > 0) ? true : false;
}

+ Here is the call graph for this function:

static ilDataCollectionTable::_tableExists (   $table_id)
static
Parameters
$table_idint
Returns
bool returns true iff there exists a table with id $table_id

Definition at line 1240 of file class.ilDataCollectionTable.php.

References $ilDB, $query, and $result.

Referenced by ilDataCollectionRecord\doCreate(), and ilDataCollectionField\doCreate().

{
global $ilDB;
$query = "SELECT * FROM il_dcl_table WHERE id = " . $table_id;
$result = $ilDB->query($query);
return $result->numRows() != 0;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::addField (   $field)
Parameters
$fieldilDataCollectionField add an already created field for eg. ordering.

Definition at line 1230 of file class.ilDataCollectionTable.php.

References fields.

{
$this->fields[$field->getId()] = $field;
}
ilDataCollectionTable::buildOrderFields ( )

buildOrderFields orders the fields.

Definition at line 871 of file class.ilDataCollectionTable.php.

References $fields, getFields(), and sortByOrder().

Referenced by doCreate().

{
$fields = $this->getFields();
$count = 10;
$offset = 10;
foreach ($fields as $field) {
if (! is_null($field->getOrder())) {
$field->setOrder($count);
$count = $count + $offset;
$field->doUpdate();
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::checkEditByOwner ( ilDataCollectionRecord  $record)
protected
Parameters
ilDataCollectionRecord$record
Returns
bool

Definition at line 809 of file class.ilDataCollectionTable.php.

References $ilUser, and ilDataCollectionRecord\getOwner().

Referenced by hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

{
global $ilUser;
return ($ilUser->getId() == $record->getOwner());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::checkLimit ( )
protected
Returns
bool

Definition at line 819 of file class.ilDataCollectionTable.php.

References getLimited(), getLimitEnd(), getLimitStart(), and IL_CAL_DATE.

Referenced by hasPermissionToAddRecord(), hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

{
if ($this->getLimited()) {
$now = new ilDateTime(date("Y-m-d H:i:s"), IL_CAL_DATE);
$from = new ilDateTime($this->getLimitStart(), IL_CAL_DATE);
$to = new ilDateTime($this->getLimitEnd(), IL_CAL_DATE);
return ($from <= $now && $now <= $to);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::cloneStructure ( ilDataCollectionTable  $original)
Parameters
ilDataCollectionTable$original

Definition at line 1151 of file class.ilDataCollectionTable.php.

References $default_sort_field, cloneStructure(), doCreate(), doUpdate(), getAddPerm(), getDefaultSortField(), getDefaultSortFieldOrder(), getDeletePerm(), getDescription(), getEditByOwner(), getEditPerm(), getExportEnabled(), getFields(), getId(), ilDataCollectionRecordViewViewdefinition\getIdByTableId(), getIsVisible(), getLimited(), getLimitEnd(), getLimitStart(), getPublicCommentsEnabled(), getTitle(), getViewOwnRecordsPerm(), setAddPerm(), setDefaultSortField(), setDefaultSortFieldOrder(), setDeletePerm(), setDescription(), setEditByOwner(), setEditPerm(), setExportEnabled(), setIsVisible(), setLimited(), setLimitEnd(), setLimitStart(), setPublicCommentsEnabled(), setTitle(), and setViewOwnRecordsPerm().

Referenced by cloneStructure().

{
$this->setTitle($original->getTitle());
$this->setDescription($original->getDescription());
$this->setIsVisible($original->getIsVisible());
$this->setEditByOwner($original->getEditByOwner());
$this->setAddPerm($original->getAddPerm());
$this->setEditPerm($original->getEditPerm());
$this->setDeletePerm($original->getDeletePerm());
$this->setLimited($original->getLimited());
$this->setLimitStart($original->getLimitStart());
$this->setLimitEnd($original->getLimitEnd());
$this->setExportEnabled($original->getExportEnabled());
$this->doCreate();
// reset stdFields to get new for the created object
// Clone standard-fields
$org_std_fields = $original->getStandardFields();
foreach ($this->getStandardFields() as $element_key => $std_field) {
$std_field->cloneStructure($org_std_fields[$element_key]);
if ($std_field->getId() == $original->getDefaultSortField()) {
$default_sort_field = $std_field->getId();
}
}
// Clone fields
$new_fields = array();
foreach ($original->getFields() as $orig_field) {
if (! $orig_field->isStandardField()) {
$new_field = new ilDataCollectionField();
$new_field->setTableId($this->getId());
$new_field->cloneStructure($orig_field->getId());
$new_fields[$orig_field->getId()] = $new_field;
if ($orig_field->getId() == $original->getDefaultSortField()) {
$default_sort_field = $new_field->getId();
}
}
}
$this->doUpdate();
//TODO: Find better way to copy data (include referenced data)
// Clone Records with recordfields
/*foreach($original->getRecords() as $orig_record){
$new_record = new ilDataCollectionRecord();
$new_record->setTableId($this->getId());
$new_record->cloneStructure($orig_record->getId(), $new_fields);
}*/
$old_view = new ilDataCollectionRecordViewViewdefinition($old_view_id);
$old_view->setTableId($original->getId());
$viewdef->setTableId($this->id);
$viewdef->setXMLContent($old_view->getXMLContent(false));
$viewdef->create();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::compareOrder (   $a,
  $b 
)

Definition at line 1133 of file class.ilDataCollectionTable.php.

{
if (is_null($a->getOrder() == NULL) && is_null($b->getOrder() == NULL)) {
return 0;
}
if (is_null($a->getOrder())) {
return 1;
}
if (is_null($b->getOrder())) {
return - 1;
}
return $a->getOrder() < $b->getOrder() ? - 1 : 1;
}
ilDataCollectionTable::deleteField (   $field_id)
Parameters
$field_id

Definition at line 439 of file class.ilDataCollectionTable.php.

References $records, ilDataCollectionCache\getFieldCache(), and getRecords().

{
$records = $this->getRecords();
foreach ($records as $record) {
$record->deleteField($field_id);
}
$field->doDelete();
}

+ Here is the call graph for this function:

ilDataCollectionTable::doCreate (   $create_views = true)
Parameters
bool$create_views

Definition at line 208 of file class.ilDataCollectionTable.php.

References $id, $ilDB, $query, buildOrderFields(), ilDataCollectionField\EDIT_VIEW, ilDataCollectionField\EXPORTABLE_VIEW, ilDataCollectionField\FILTER_VIEW, getAddPerm(), getDefaultSortField(), getDefaultSortFieldOrder(), getDeletePerm(), getDescription(), getEditByOwner(), getEditPerm(), getExportEnabled(), getId(), getIsVisible(), getLimited(), getLimitEnd(), getLimitStart(), getObjId(), getPublicCommentsEnabled(), getTitle(), getViewOwnRecordsPerm(), setId(), and ilDataCollectionField\VIEW_VIEW.

Referenced by cloneStructure().

{
global $ilDB;
$id = $ilDB->nextId("il_dcl_table");
$this->setId($id);
$query = "INSERT INTO il_dcl_table (" . "id" . ", obj_id" . ", title" . ", add_perm" . ", edit_perm" . ", delete_perm" . ", edit_by_owner"
. ", limited" . ", limit_start" . ", limit_end" . ", is_visible" . ", export_enabled" . ", default_sort_field_id"
. ", default_sort_field_order" . ", description" . ", public_comments" . ", view_own_records_perm" . " ) VALUES ("
. $ilDB->quote($this->getId(), "integer") . "," . $ilDB->quote($this->getObjId(), "integer") . ","
. $ilDB->quote($this->getTitle(), "text") . "," . $ilDB->quote($this->getAddPerm() ? 1 : 0, "integer") . ","
. $ilDB->quote($this->getEditPerm() ? 1 : 0, "integer") . "," . $ilDB->quote($this->getDeletePerm() ? 1 : 0, "integer") . ","
. $ilDB->quote($this->getEditByOwner() ? 1 : 0, "integer") . "," . $ilDB->quote($this->getLimited() ? 1 : 0, "integer") . ","
. $ilDB->quote($this->getLimitStart(), "timestamp") . "," . $ilDB->quote($this->getLimitEnd(), "timestamp") . ","
. $ilDB->quote($this->getIsVisible() ? 1 : 0, "integer") . "," . $ilDB->quote($this->getExportEnabled() ? 1 : 0, "integer") . ","
. $ilDB->quote($this->getDefaultSortField(), "text") . "," . $ilDB->quote($this->getDefaultSortFieldOrder(), "text") . ","
. $ilDB->quote($this->getDescription(), "text") . "," . $ilDB->quote($this->getPublicCommentsEnabled(), "integer") . ","
. $ilDB->quote($this->getViewOwnRecordsPerm(), "integer") . ")";
$ilDB->manipulate($query);
if ($create_views) {
//add view definition
$view_id = $ilDB->nextId("il_dcl_view");
$query = "INSERT INTO il_dcl_view (id, table_id, type, formtype) VALUES (" . $ilDB->quote($view_id, "integer") . ", "
. $ilDB->quote($this->id, "integer") . ", " . $ilDB->quote(ilDataCollectionField::VIEW_VIEW, "integer") . ", "
. $ilDB->quote(1, "integer") . ")";
$ilDB->manipulate($query);
//add edit definition
$view_id = $ilDB->nextId("il_dcl_view");
$query = "INSERT INTO il_dcl_view (id, table_id, type, formtype) VALUES (" . $ilDB->quote($view_id, "integer") . ", "
. $ilDB->quote($this->id, "integer") . ", " . $ilDB->quote(ilDataCollectionField::EDIT_VIEW, "integer") . ", "
. $ilDB->quote(1, "integer") . ")";
$ilDB->manipulate($query);
//add filter definition
$view_id = $ilDB->nextId("il_dcl_view");
$query = "INSERT INTO il_dcl_view (id, table_id, type, formtype) VALUES (" . $ilDB->quote($view_id, "integer") . ", "
. $ilDB->quote($this->id, "integer") . ", " . $ilDB->quote(ilDataCollectionField::FILTER_VIEW, "integer") . ", "
. $ilDB->quote(1, "integer") . ")";
$ilDB->manipulate($query);
//add filter definition
$view_id = $ilDB->nextId("il_dcl_view");
$query = "INSERT INTO il_dcl_view (id, table_id, type, formtype) VALUES (" . $ilDB->quote($view_id, "integer") . ", "
. $ilDB->quote($this->id, "integer") . ", " . $ilDB->quote(ilDataCollectionField::EXPORTABLE_VIEW, "integer") . ", "
. $ilDB->quote(1, "integer") . ")";
$ilDB->manipulate($query);
$this->buildOrderFields();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::doRead ( )

Read table.

Definition at line 132 of file class.ilDataCollectionTable.php.

References $ilDB, $query, getId(), setAddPerm(), setDefaultSortField(), setDefaultSortFieldOrder(), setDeletePerm(), setDescription(), setEditByOwner(), setEditPerm(), setExportEnabled(), setIsVisible(), setLimited(), setLimitEnd(), setLimitStart(), setObjId(), setPublicCommentsEnabled(), setTitle(), and setViewOwnRecordsPerm().

Referenced by __construct().

{
global $ilDB;
$query = "SELECT * FROM il_dcl_table WHERE id = " . $ilDB->quote($this->getId(), "integer");
$set = $ilDB->query($query);
$rec = $ilDB->fetchAssoc($set);
$this->setObjId($rec["obj_id"]);
$this->setTitle($rec["title"]);
$this->setAddPerm($rec["add_perm"]);
$this->setEditPerm($rec["edit_perm"]);
$this->setDeletePerm($rec["delete_perm"]);
$this->setEditByOwner($rec["edit_by_owner"]);
$this->setExportEnabled($rec["export_enabled"]);
$this->setLimited($rec["limited"]);
$this->setLimitStart($rec["limit_start"]);
$this->setLimitEnd($rec["limit_end"]);
$this->setIsVisible($rec["is_visible"]);
$this->setDescription($rec['description']);
$this->setDefaultSortField($rec['default_sort_field_id']);
$this->setDefaultSortFieldOrder($rec['default_sort_field_order']);
$this->setPublicCommentsEnabled($rec['public_comments']);
$this->setViewOwnRecordsPerm($rec['view_own_records_perm']);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::doUpdate ( )

Definition at line 265 of file class.ilDataCollectionTable.php.

References $ilDB, getAddPerm(), getDefaultSortField(), getDefaultSortFieldOrder(), getDeletePerm(), getDescription(), getEditByOwner(), getEditPerm(), getExportEnabled(), getId(), getIsVisible(), getLimited(), getLimitEnd(), getLimitStart(), getObjId(), getPublicCommentsEnabled(), getTitle(), and getViewOwnRecordsPerm().

Referenced by cloneStructure().

{
global $ilDB;
$ilDB->update("il_dcl_table", array(
"obj_id" => array( "integer", $this->getObjId() ),
"title" => array( "text", $this->getTitle() ),
"add_perm" => array( "integer", $this->getAddPerm() ),
"edit_perm" => array( "integer", $this->getEditPerm() ),
"delete_perm" => array( "integer", $this->getDeletePerm() ),
"edit_by_owner" => array( "integer", $this->getEditByOwner() ),
"limited" => array( "integer", $this->getLimited() ),
"limit_start" => array( "timestamp", $this->getLimitStart() ),
"limit_end" => array( "timestamp", $this->getLimitEnd() ),
"is_visible" => array( "integer", $this->getIsVisible() ? 1 : 0 ),
"export_enabled" => array( "integer", $this->getExportEnabled() ? 1 : 0 ),
"description" => array( "text", $this->getDescription() ),
"default_sort_field_id" => array( "text", $this->getDefaultSortField() ),
"default_sort_field_order" => array( "text", $this->getDefaultSortFieldOrder() ),
"public_comments" => array( "integer", $this->getPublicCommentsEnabled() ? 1 : 0 ),
"view_own_records_perm" => array( "integer", $this->getViewOwnRecordsPerm() ),
), array(
"id" => array( "integer", $this->getId() )
));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::getAddPerm ( )
Returns
boolean

Definition at line 917 of file class.ilDataCollectionTable.php.

References $add_perm.

Referenced by cloneStructure(), doCreate(), doUpdate(), and hasPermissionToAddRecord().

{
return (bool) $this->add_perm;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getAll (   $a_id)
Parameters
$a_id
Returns
array

Definition at line 420 of file class.ilDataCollectionTable.php.

References $ilDB, and $query.

Referenced by ilDataCollectionRecordListViewdefinitionGUI\initForm().

{
global $ilDB;
// build query
$query = "SELECT * FROM il_dcl_table WHERE obj_id = " . $ilDB->quote($a_id, "integer");
$set = $ilDB->query($query);
$all = array();
while ($rec = $ilDB->fetchAssoc($set)) {
$all[$rec['id']] = $rec;
}
return $all;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getCollectionObject ( )
Returns
ilObjDataCollection

Definition at line 346 of file class.ilDataCollectionTable.php.

References $obj, and loadObj().

{
$this->loadObj();
return $this->obj;
}

+ Here is the call graph for this function:

ilDataCollectionTable::getDefaultSortField ( )
Returns
string

Definition at line 1065 of file class.ilDataCollectionTable.php.

References $default_sort_field.

Referenced by cloneStructure(), doCreate(), and doUpdate().

+ Here is the caller graph for this function:

ilDataCollectionTable::getDefaultSortFieldOrder ( )
Returns
string

Definition at line 1084 of file class.ilDataCollectionTable.php.

References $default_sort_field_order.

Referenced by cloneStructure(), doCreate(), and doUpdate().

+ Here is the caller graph for this function:

ilDataCollectionTable::getDeletePerm ( )
Returns
boolean

Definition at line 933 of file class.ilDataCollectionTable.php.

References $delete_perm.

Referenced by cloneStructure(), doCreate(), doUpdate(), hasPermissionToDeleteRecord(), and hasPermissionToDeleteRecords().

{
return (bool) $this->delete_perm;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getDescription ( )
Returns
string

Definition at line 1046 of file class.ilDataCollectionTable.php.

References $description.

Referenced by cloneStructure(), doCreate(), and doUpdate().

{
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getEditableFields ( )
Returns
array

Definition at line 623 of file class.ilDataCollectionTable.php.

References $fields, and getRecordFields().

{
$editableFields = array();
foreach ($fields as $field) {
if (! $field->getLocked()) {
$editableFields[] = $field;
}
}
return $editableFields;
}

+ Here is the call graph for this function:

ilDataCollectionTable::getEditByOwner ( )
Returns
boolean

Definition at line 950 of file class.ilDataCollectionTable.php.

References $edit_by_owner.

Referenced by cloneStructure(), doCreate(), doUpdate(), hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

{
return (bool) $this->edit_by_owner;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getEditPerm ( )
Returns
boolean

Definition at line 966 of file class.ilDataCollectionTable.php.

References $edit_perm.

Referenced by cloneStructure(), doCreate(), doUpdate(), and hasPermissionToEditRecord().

{
return (bool) $this->edit_perm;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getExportableFields ( )

Return all the fields that are marked as exportable.

Returns
array ilDataCollectionField

Definition at line 662 of file class.ilDataCollectionTable.php.

References $fields, and getFields().

{
$fields = $this->getFields();
$exportableFields = array();
foreach ($fields as $field) {
if ($field->getExportable()) {
$exportableFields[] = $field;
}
}
return $exportableFields;
}

+ Here is the call graph for this function:

ilDataCollectionTable::getExportEnabled ( )
Returns
boolean

Definition at line 1279 of file class.ilDataCollectionTable.php.

References $export_enabled.

Referenced by cloneStructure(), doCreate(), and doUpdate().

{
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getField (   $field_id)
Parameters
$field_id
Returns
ilDataCollectionField|null

Definition at line 456 of file class.ilDataCollectionTable.php.

References $fields, and getFields().

Referenced by getPartialRecords().

{
$fields = $this->getFields();
$field = NULL;
foreach ($fields as $field_1) {
if ($field_1->getId() == $field_id) {
$field = $field_1;
}
}
return $field;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::getFieldByTitle (   $title)

Get a field by title.

Parameters
$title
Returns
ilDataCollectionField

Definition at line 893 of file class.ilDataCollectionTable.php.

References $title, and getFields().

Referenced by getPartialRecords().

{
$return = NULL;
foreach ($this->getFields() as $field) {
if ($field->getTitle() == $title) {
$return = $field;
break;
}
}
return $return;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::getFieldIds ( )
Returns
array

Definition at line 472 of file class.ilDataCollectionTable.php.

References getFields().

{
return array_keys($this->getFields());
}

+ Here is the call graph for this function:

ilDataCollectionTable::getFields ( )

Returns all fields of this table including the standard fields.

Returns
ilDataCollectionField[]

Definition at line 522 of file class.ilDataCollectionTable.php.

References $fields, fields, loadFields(), and sortByOrder().

Referenced by buildOrderFields(), cloneStructure(), getExportableFields(), getField(), getFieldByTitle(), getFieldIds(), getFilterableFields(), getNewOrder(), getVisibleFields(), and updateFields().

{
$this->loadFields();
$this->stdFields = $this->getStandardFields();
$fields = array_merge($this->fields, $this->stdFields);
return $fields;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::getFilterableFields ( )

getFilterableFields Returns all fields of this table who have set their filterable to true, including standard fields.

Returns
ilDataCollectionField[]

Definition at line 643 of file class.ilDataCollectionTable.php.

References $fields, and getFields().

{
$fields = $this->getFields();
$filterableFields = array();
foreach ($fields as $field) {
if ($field->isFilterable()) {
$filterableFields[] = $field;
}
}
return $filterableFields;
}

+ Here is the call graph for this function:

ilDataCollectionTable::getId ( )

Get table id.

Returns
int

Definition at line 306 of file class.ilDataCollectionTable.php.

References $id.

Referenced by cloneStructure(), doCreate(), doRead(), doUpdate(), getPartialRecords(), ilDataCollectionRecordViewGUI\hasTableValidViewDefinition(), and loadFields().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getIsVisible ( )
Returns
boolean

Definition at line 1030 of file class.ilDataCollectionTable.php.

References $is_visible.

Referenced by cloneStructure(), doCreate(), and doUpdate().

{
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getLimited ( )
Returns
boolean

Definition at line 982 of file class.ilDataCollectionTable.php.

References $limited.

Referenced by checkLimit(), cloneStructure(), doCreate(), and doUpdate().

{
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getLimitEnd ( )
Returns
string

Definition at line 998 of file class.ilDataCollectionTable.php.

References $limit_end.

Referenced by checkLimit(), cloneStructure(), doCreate(), and doUpdate().

{
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getLimitStart ( )
Returns
string

Definition at line 1014 of file class.ilDataCollectionTable.php.

References $limit_start.

Referenced by checkLimit(), cloneStructure(), doCreate(), and doUpdate().

{
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getNewOrder ( )

getNewOrder

Returns
int returns the place where a new field should be placed.

Definition at line 504 of file class.ilDataCollectionTable.php.

References $fields, and getFields().

{
$fields = $this->getFields();
$place = 0;
foreach ($fields as $field) {
if (! $field->isStandardField()) {
$place = $field->getOrder() + 1;
}
}
return $place;
}

+ Here is the call graph for this function:

ilDataCollectionTable::getObjId ( )
Returns
int

Definition at line 322 of file class.ilDataCollectionTable.php.

References $objId.

Referenced by doCreate(), doUpdate(), and getPartialRecords().

{
return $this->objId;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getPartialRecords (   $sort,
  $direction,
  $limit,
  $offset,
array  $filter = array() 
)

Return only the needed subset of record objects for the table, according to sorting, paging and filters.

Parameters
string$sortTitle of a field where the ilTable2GUI is sorted
string$direction'desc' or 'asc'
int$limitLimit of records
int$offsetOffset from records
array$filterContaining the filter values
Returns
array Array with two keys: 'record' => Contains the record objects, 'total' => Number of total records (without slicing)

Definition at line 1312 of file class.ilDataCollectionTable.php.

References $_SESSION, $id, $ilDB, $ilUser, $records, ilObject\_getAllReferences(), getField(), getFieldByTitle(), ilDataCollectionCache\getFieldCache(), getId(), getObjId(), ilDataCollectionCache\getRecordCache(), ilDataCollectionCache\getRecordFieldCache(), getViewOwnRecordsPerm(), ilObjDataCollectionAccess\hasWriteAccess(), ilDataCollectionDatatype\INPUTFORMAT_BOOLEAN, ilDataCollectionDatatype\INPUTFORMAT_DATETIME, ilDataCollectionDatatype\INPUTFORMAT_FILE, ilDataCollectionDatatype\INPUTFORMAT_FORMULA, ilDataCollectionDatatype\INPUTFORMAT_ILIAS_REF, ilDataCollectionDatatype\INPUTFORMAT_MOB, ilDataCollectionDatatype\INPUTFORMAT_NUMBER, ilDataCollectionDatatype\INPUTFORMAT_RATING, ilDataCollectionDatatype\INPUTFORMAT_REFERENCE, ilDataCollectionDatatype\INPUTFORMAT_TEXT, and ilDataCollectionField\PROPERTYID_N_REFERENCE.

{
global $ilDB, $ilUser, $rbacreview;
$sort_field = ($sort) ? $this->getFieldByTitle($sort) : $this->getField('id');
$direction = strtolower($direction);
$direction = (in_array($direction, array( 'desc', 'asc' ))) ? $direction : 'asc';
// Sorting by a status from an ILIAS Ref field. This column is added dynamically to the table, there is no field model
$sort_by_status = false;
if (substr($sort, 0, 8) == '_status_') {
$sort_by_status = true;
$sort_field = $this->getFieldByTitle(substr($sort, 8));
}
if (is_null($sort_field)) {
$sort_field = $this->getField('id');
}
$id = $sort_field->getId();
$stl = $sort_field->getStorageLocation();
$select_str = '';
$join_str = '';
$where_additions = '';
$has_nref = false;
if ($sort_field->isStandardField()) {
if ($id == 'owner' || $id == 'last_edit_by') {
$join_str .= "LEFT JOIN usr_data AS sort_usr_data_{$id} ON (sort_usr_data_{$id}.usr_id = record.{$id})";
$select_str .= " sort_usr_data_{$id}.login AS field_{$id},";
} elseif ($id != 'comments') {
$select_str .= " record.{$id} AS field_{$id},";
}
} else {
switch ($sort_field->getDatatypeId()) {
$rating_joined = true;
// FSX Bugfix 0015735: The average is multiplied with 10000 and added to the amount of votes
$join_str .= "LEFT JOIN (SELECT (ROUND(AVG(rating), 1) * 10000 + COUNT(rating)) as rating, obj_id FROM il_rating GROUP BY obj_id) AS average ON average.obj_id = record.id";
$select_str .= " average.rating AS field_{$id},";
break;
$join_str .=
"LEFT JOIN il_dcl_record_field AS sort_record_field_{$id} ON (sort_record_field_{$id}.record_id = record.id AND sort_record_field_{$id}.field_id = "
. $ilDB->quote($sort_field->getId(), 'integer') . ") ";
$join_str .= "LEFT JOIN il_dcl_stloc{$stl}_value AS sort_stloc_{$id} ON (sort_stloc_{$id}.record_field_id = sort_record_field_{$id}.id) ";
$join_str .= "LEFT JOIN object_reference AS sort_object_reference_{$id} ON (sort_object_reference_{$id}.ref_id = sort_stloc_{$id}.value AND sort_object_reference_{$id}.deleted IS NULL)";
$join_str .= "LEFT JOIN object_data AS sort_object_data_{$id} ON (sort_object_data_{$id}.obj_id = sort_object_reference_{$id}.obj_id)";
if ($sort_by_status) {
global $ilUser;
$join_str .= "LEFT JOIN ut_lp_marks AS ut ON (ut.obj_id = sort_object_data_{$id}.obj_id AND ut.usr_id = "
. $ilDB->quote($ilUser->getId(), 'integer') . ") ";
}
$select_str .= (! $sort_by_status) ? " sort_object_data_{$id}.title AS field_{$id}," : " ut.status AS field_{$id}";
break;
$join_str .=
"LEFT JOIN il_dcl_record_field AS sort_record_field_{$id} ON (sort_record_field_{$id}.record_id = record.id AND sort_record_field_{$id}.field_id = "
. $ilDB->quote($sort_field->getId(), 'integer') . ") ";
$join_str .= "LEFT JOIN il_dcl_stloc{$stl}_value AS sort_stloc_{$id} ON (sort_stloc_{$id}.record_field_id = sort_record_field_{$id}.id) ";
$join_str .= "LEFT JOIN object_data AS sort_object_data_{$id} ON (sort_object_data_{$id}.obj_id = sort_stloc_{$id}.value) ";
$select_str .= " sort_object_data_{$id}.title AS field_{$id},";
break;
$prop = $sort_field->getPropertyvalues();
$ref_field = ilDataCollectionCache::getFieldCache($sort_field->getFieldRef());
if ($n_ref) {
$has_nref = true;
}
$select_str .= ($n_ref) ? " GROUP_CONCAT(stloc_{$id}_joined.value) AS field_{$id}" : "stloc_{$id}_joined.value AS field_{$id},";
$join_str .=
"LEFT JOIN il_dcl_record_field AS record_field_{$id} ON (record_field_{$id}.record_id = record.id AND record_field_{$id}.field_id = "
. $ilDB->quote($sort_field->getId(), 'integer') . ") ";
$join_str .= "LEFT JOIN il_dcl_stloc{$stl}_value AS stloc_{$id} ON (stloc_{$id}.record_field_id = record_field_{$id}.id) ";
$join_str .=
"LEFT JOIN il_dcl_record_field AS record_field_{$id}_joined ON (record_field_{$id}_joined.record_id = stloc_{$id}.value AND record_field_{$id}_joined.field_id = "
. $ilDB->quote($ref_field->getId(), 'integer') . ") ";
$join_str .= "LEFT JOIN il_dcl_stloc{$ref_field->getStorageLocation()}_value AS stloc_{$id}_joined ON (stloc_{$id}_joined.record_field_id = record_field_{$id}_joined.id) ";
break;
$select_str .= " sort_stloc_{$id}.value AS field_{$id},";
$join_str .=
"LEFT JOIN il_dcl_record_field AS sort_record_field_{$id} ON (sort_record_field_{$id}.record_id = record.id AND sort_record_field_{$id}.field_id = "
. $ilDB->quote($sort_field->getId(), 'integer') . ") ";
$join_str .= "LEFT JOIN il_dcl_stloc{$stl}_value AS sort_stloc_{$id} ON (sort_stloc_{$id}.record_field_id = sort_record_field_{$id}.id) ";
break;
}
}
if (count($filter)) {
foreach ($filter as $key => $filter_value) {
$filter_field_id = substr($key, 7);
$filter_field = $this->getField($filter_field_id);
switch ($filter_field->getDatatypeId()) {
if(!$rating_joined) {
$join_str .= "LEFT JOIN (SELECT (ROUND(AVG(rating), 1) * 10000 + COUNT(rating)) as rating, obj_id FROM il_rating GROUP BY obj_id) AS average ON average.obj_id = record.id";
}
// FSX Bugfix 0015735: The average is multiplied with 10000 and added to the amount of votes
$where_additions .= " AND average.rating >= " . $ilDB->quote($filter_value * 10000, 'integer');
break;
$join_str .=
"INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
. $ilDB->quote($filter_field_id, 'integer') . ") ";
$join_str .= "INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id) ";
$join_str .= "INNER JOIN object_reference AS filter_object_reference_{$filter_field_id} ON (filter_object_reference_{$filter_field_id}.ref_id = filter_stloc_{$filter_field_id}.value ) ";
$join_str .=
"INNER JOIN object_data AS filter_object_data_{$filter_field_id} ON (filter_object_data_{$filter_field_id}.obj_id = filter_object_reference_{$filter_field_id}.obj_id AND filter_object_data_{$filter_field_id}.title LIKE "
. $ilDB->quote("%$filter_value%", 'text') . ") ";
break;
$join_str .=
"INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
. $ilDB->quote($filter_field_id, 'integer') . ") ";
$join_str .= "INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id) ";
$join_str .=
"INNER JOIN object_data AS filter_object_data_{$filter_field_id} ON (filter_object_data_{$filter_field_id}.obj_id = filter_stloc_{$filter_field_id}.value AND filter_object_data_{$filter_field_id}.title LIKE "
. $ilDB->quote("%$filter_value%", 'text') . ") ";
break;
$date_from = (isset($filter_value['from']) && is_object($filter_value['from'])) ? $filter_value['from'] : NULL;
$date_to = (isset($filter_value['to']) && is_object($filter_value['to'])) ? $filter_value['to'] : NULL;
if ($filter_field->isStandardField()) {
if ($date_from) {
$where_additions .= " AND (record.{$filter_field_id} >= " . $ilDB->quote($date_from, 'date') . ")";
}
if ($date_to) {
$where_additions .= " AND (record.{$filter_field_id} <= " . $ilDB->quote($date_to, 'date') . ")";
}
} else {
$join_str .=
"INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
. $ilDB->quote($filter_field_id, 'integer') . ") ";
$join_str .= "INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id ";
if ($date_from) {
$join_str .= "AND filter_stloc_{$filter_field_id}.value >= " . $ilDB->quote($date_from, 'date') . " ";
}
if ($date_to) {
$join_str .= "AND filter_stloc_{$filter_field_id}.value <= " . $ilDB->quote($date_to, 'date') . " ";
}
$join_str .= ") ";
}
break;
$from = (isset($filter_value['from'])) ? (int)$filter_value['from'] : NULL;
$to = (isset($filter_value['to'])) ? (int)$filter_value['to'] : NULL;
if ($filter_field->isStandardField()) {
if (! is_null($from)) {
$where_additions .= " AND record.{$filter_field_id} >= " . $ilDB->quote($from, 'integer');
}
if (! is_null($to)) {
$where_additions .= " AND record.{$filter_field_id} <= " . $ilDB->quote($to, 'integer');
}
} else {
$join_str .=
"INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
. $ilDB->quote($filter_field_id, 'integer') . ") ";
$join_str .= "INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id";
if (! is_null($from)) {
$join_str .= " AND filter_stloc_{$filter_field_id}.value >= " . $ilDB->quote($from, 'integer');
}
if (! is_null($to)) {
$join_str .= " AND filter_stloc_{$filter_field_id}.value <= " . $ilDB->quote($to, 'integer');
}
$join_str .= ") ";
}
break;
if ($filter_value == "checked") {
$join_str .=
"INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
. $ilDB->quote($filter_field_id, 'integer') . ") ";
$join_str .= "INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id";
$join_str .= " AND filter_stloc_{$filter_field_id}.value = " . $ilDB->quote(1, 'integer');
} else {
$join_str .=
"INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
. $ilDB->quote($filter_field_id, 'integer') . ") ";
$join_str .= "LEFT JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id";
$where_additions .= " AND (filter_stloc_{$filter_field_id}.value <> " . $ilDB->quote(1, 'integer')
. " OR filter_stloc_{$filter_field_id}.value is NULL)";
}
$join_str .= " ) ";
break;
if ($filter_field->isStandardField()) {
$join_str .=
"INNER JOIN usr_data AS filter_usr_data_{$filter_field_id} ON (filter_usr_data_{$filter_field_id}.usr_id = record.{$filter_field_id} AND filter_usr_data_{$filter_field_id}.login LIKE "
. $ilDB->quote("%$filter_value%", 'text') . ") ";
} else {
$join_str .=
" INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
. $ilDB->quote($filter_field_id, 'integer') . ") ";
$join_str .=
" INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id AND filter_stloc_{$filter_field_id}.value LIKE "
. $ilDB->quote("%$filter_value%", 'text') . ") ";
}
break;
$join_str .=
" INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
. $ilDB->quote($filter_field_id, 'integer') . ") ";
$prop = $filter_field->getPropertyvalues();
if ($n_ref) {
$join_str .=
" INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id AND filter_stloc_{$filter_field_id}.value LIKE "
. $ilDB->quote("%$filter_value%", 'text') . ") ";
} else {
$join_str .=
" INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id AND filter_stloc_{$filter_field_id}.value = "
. $ilDB->quote($filter_value, 'integer') . ") ";
}
break;
}
}
}
// Build the query string
$sql = "SELECT DISTINCT record.id, record.owner";
if($select_str) {
$sql .= ', ';
}
$sql .= rtrim($select_str, ',') . " FROM il_dcl_record AS record ";
$sql .= $join_str;
$sql .= " WHERE record.table_id = " . $ilDB->quote($this->getId(), 'integer') . $where_additions;
if ($has_nref) {
$sql .= " GROUP BY record.id, record.owner";
}
if($id != 'comments' && $sort_field->getDatatypeId() != ilDataCollectionDatatype::INPUTFORMAT_FORMULA) {
$sql .= " ORDER BY field_{$id} {$direction}";
}
$set = $ilDB->query($sql);
$total_record_ids = array();
// Save record-ids in session to enable prev/next links in detail view
$_SESSION['dcl_record_ids'] = array();
$_SESSION['dcl_table_id'] = $this->getId();
while ($rec = $ilDB->fetchAssoc($set)) {
// Quick check if the current user is allowed to view the record
if (!$is_allowed_to_view && ($this->getViewOwnRecordsPerm() && $ilUser->getId() != $rec['owner'])) {
continue;
}
$total_record_ids[] = $rec['id'];
$_SESSION['dcl_record_ids'][] = $rec['id'];
}
// Sort by formula
if ($sort_field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FORMULA) {
$sort_array = array();
foreach ($total_record_ids as $id) {
$formula_field = ilDataCollectionCache::getRecordFieldCache(new ilDataCollectionRecord($id), $sort_field);
$sort_array[$id] = $formula_field->getValue();
}
switch ($direction) {
case 'asc':
case 'ASC':
asort($sort_array);
break;
case 'desc':
case 'DESC':
arsort($sort_array);
break;
}
$total_record_ids = array_keys($sort_array);
}
// Now slice the array to load only the needed records in memory
$record_ids = array_slice($total_record_ids, $offset, $limit);
$records = array();
foreach ($record_ids as $id) {
}
return array( 'records' => $records, 'total' => count($total_record_ids) );
}

+ Here is the call graph for this function:

ilDataCollectionTable::getPublicCommentsEnabled ( )
Returns
boolean

Definition at line 1100 of file class.ilDataCollectionTable.php.

References $public_comments.

Referenced by cloneStructure(), doCreate(), and doUpdate().

+ Here is the caller graph for this function:

ilDataCollectionTable::getRecordFields ( )

Returns all fields of this table which are NOT standard fields.

Returns
ilDataCollectionField[]

Definition at line 593 of file class.ilDataCollectionTable.php.

References $fields, and loadFields().

Referenced by getEditableFields().

{
$this->loadFields();
return $this->fields;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::getRecords ( )
Returns
ilDataCollectionRecord[]

Definition at line 363 of file class.ilDataCollectionTable.php.

References $records, and loadRecords().

Referenced by _hasRecords(), deleteField(), and getRecordsByFilter().

{
$this->loadRecords();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::getRecordsByFilter ( array  $filter = array())

getRecordsByFilter

Parameters
$filterfilter is of the form array("filter_{field_id}" => filter); For dates and integers this filter must be of the form array("from" => from, "to" => to). In case of dates from and to have to be ilDateTime objects in case of integers they have to be integers as well.
Returns
ilDataCollectionRecord[]

Definition at line 381 of file class.ilDataCollectionTable.php.

References $records, getRecords(), and loadRecords().

{
$this->loadRecords();
// Only pass records trough filter if there is filtering required #performance-improvements
if (! count($filter)) {
}
$filtered = array();
foreach ($this->getRecords() as $record) {
if ($record->passThroughFilter($filter)) {
$filtered[] = $record;
}
}
return $filtered;
}

+ Here is the call graph for this function:

ilDataCollectionTable::getTitle ( )
Returns
string

Definition at line 338 of file class.ilDataCollectionTable.php.

References $title.

Referenced by cloneStructure(), doCreate(), and doUpdate().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getViewOwnRecordsPerm ( )
Returns
boolean

Definition at line 1116 of file class.ilDataCollectionTable.php.

References $view_own_records_perm.

Referenced by cloneStructure(), doCreate(), doUpdate(), and getPartialRecords().

{
}

+ Here is the caller graph for this function:

ilDataCollectionTable::getVisibleFields ( )

Returns all fields of this table who have set their visibility to true, including standard fields.

Returns
ilDataCollectionField[]

Definition at line 605 of file class.ilDataCollectionTable.php.

References $fields, and getFields().

{
$fields = $this->getFields();
$visibleFields = array();
foreach ($fields as $field) {
if ($field->isVisible()) {
$visibleFields[] = $field;
}
}
return $visibleFields;
}

+ Here is the call graph for this function:

ilDataCollectionTable::hasCustomFields ( )

hasCustomFields

Returns
boolean

Definition at line 1126 of file class.ilDataCollectionTable.php.

References fields, and loadFields().

{
$this->loadFields();
return (count($this->fields) > 0) ? true : false;
}

+ Here is the call graph for this function:

ilDataCollectionTable::hasPermissionToAddRecord (   $ref_id)
Parameters
int$ref_id*y
Returns
bool

Definition at line 701 of file class.ilDataCollectionTable.php.

References $ref_id, checkLimit(), getAddPerm(), ilObjDataCollectionAccess\hasAddRecordAccess(), and ilObjDataCollectionAccess\hasWriteAccess().

{
return true;
}
return false;
}
return ($this->getAddPerm() AND $this->checkLimit());
}

+ Here is the call graph for this function:

ilDataCollectionTable::hasPermissionToAddTable (   $ref_id)
Parameters
int$ref_id
Returns
bool

Definition at line 690 of file class.ilDataCollectionTable.php.

References $ref_id, and ilObjDataCollectionAccess\hasWriteAccess().

+ Here is the call graph for this function:

ilDataCollectionTable::hasPermissionToDeleteRecord (   $ref_id,
ilDataCollectionRecord  $record 
)
Parameters
$ref_idint the reference id of the current datacollection object
$recordilDataCollectionRecord the record which will be deleted
Returns
bool

Definition at line 747 of file class.ilDataCollectionTable.php.

References $ref_id, checkEditByOwner(), checkLimit(), getDeletePerm(), getEditByOwner(), ilObjDataCollectionAccess\hasAddRecordAccess(), and ilObjDataCollectionAccess\hasWriteAccess().

{
return true;
}
return false;
}
if (!$this->checkLimit()) {
return false;
}
if ($this->getDeletePerm() && !$this->getEditByOwner()) {
return true;
}
if ($this->getEditByOwner()) {
// Edit by owner is set... user is only allowed to edit her own entries
return $this->checkEditByOwner($record);
}
return false;
}

+ Here is the call graph for this function:

ilDataCollectionTable::hasPermissionToDeleteRecords (   $ref_id)
Parameters
$ref_id
Returns
bool

Definition at line 774 of file class.ilDataCollectionTable.php.

References $ref_id, getDeletePerm(), and ilObjDataCollectionAccess\hasWriteAccess().

+ Here is the call graph for this function:

ilDataCollectionTable::hasPermissionToEditRecord (   $ref_id,
ilDataCollectionRecord  $record 
)
Parameters
$ref_idint the reference id of the current datacollection object
$recordilDataCollectionRecord the record which will be edited
Returns
bool

Definition at line 719 of file class.ilDataCollectionTable.php.

References $ref_id, checkEditByOwner(), checkLimit(), getEditByOwner(), getEditPerm(), ilObjDataCollectionAccess\hasAddRecordAccess(), and ilObjDataCollectionAccess\hasWriteAccess().

{
return true;
}
return false;
}
if (!$this->checkLimit()) {
return false;
}
if ($this->getEditPerm() && !$this->getEditByOwner()) {
return true;
}
if ($this->getEditByOwner()) {
// Edit by owner is set... user is only allowed to edit her own entries
return $this->checkEditByOwner($record);
}
return false;
}

+ Here is the call graph for this function:

ilDataCollectionTable::hasPermissionToFields (   $ref_id)
Parameters
int$ref_id
Returns
bool

Definition at line 680 of file class.ilDataCollectionTable.php.

References $ref_id, and ilObjDataCollectionAccess\hasWriteAccess().

+ Here is the call graph for this function:

ilDataCollectionTable::loadFields ( )
protected

Definition at line 477 of file class.ilDataCollectionTable.php.

References $fields, $ilDB, $query, ilDataCollectionCache\buildFieldFromRecord(), fields, getId(), and sortByOrder().

Referenced by getFields(), getRecordFields(), and hasCustomFields().

{
if ($this->fields == NULL) {
global $ilDB;
$query = "SELECT DISTINCT field.* FROM il_dcl_field AS field
INNER JOIN il_dcl_view AS view ON view.table_id = field.table_id
INNER JOIN il_dcl_viewdefinition AS def ON def.view_id = view.id
WHERE field.table_id =" . $ilDB->quote($this->getId(), "integer") . "
ORDER BY def.field_order DESC";
$fields = array();
$set = $ilDB->query($query);
while ($rec = $ilDB->fetchAssoc($set)) {
$fields[$field->getId()] = $field;
}
$this->fields = $fields;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::loadObj ( )
protected

Definition at line 353 of file class.ilDataCollectionTable.php.

Referenced by getCollectionObject().

{
if ($this->obj == NULL) {
$this->obj = new ilObjDataCollection($this->objId, false);
}
}

+ Here is the caller graph for this function:

ilDataCollectionTable::loadRecords ( )
protected

Definition at line 398 of file class.ilDataCollectionTable.php.

References $ilDB, $query, $records, and ilDataCollectionCache\getRecordCache().

Referenced by getRecords(), and getRecordsByFilter().

{
if ($this->records == NULL) {
global $ilDB;
$records = array();
$query = "SELECT id FROM il_dcl_record WHERE table_id = " . $ilDB->quote($this->id, "integer");
$set = $ilDB->query($query);
while ($rec = $ilDB->fetchAssoc($set)) {
}
$this->records = $records;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionTable::setAddPerm (   $add_perm)
Parameters
boolean$add_perm

Definition at line 909 of file class.ilDataCollectionTable.php.

References $add_perm.

Referenced by cloneStructure(), and doRead().

{
$this->add_perm = $add_perm;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setDefaultSortField (   $default_sort_field)

/**

Parameters
string$default_sort_field

Definition at line 1056 of file class.ilDataCollectionTable.php.

References $default_sort_field.

Referenced by cloneStructure(), and doRead().

{
$default_sort_field = ($default_sort_field) ? $default_sort_field : 0; // Change null or empty strings to zero
$this->default_sort_field = $default_sort_field;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setDefaultSortFieldOrder (   $default_sort_field_order)
Parameters
string$default_sort_field_order

Definition at line 1073 of file class.ilDataCollectionTable.php.

References $default_sort_field_order.

Referenced by cloneStructure(), and doRead().

{
if (! in_array($default_sort_field_order, array( 'asc', 'desc' ))) {
}
$this->default_sort_field_order = $default_sort_field_order;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setDeletePerm (   $delete_perm)
Parameters
boolean$delete_perm

Definition at line 925 of file class.ilDataCollectionTable.php.

References $delete_perm.

Referenced by cloneStructure(), and doRead().

{
$this->delete_perm = $delete_perm;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setDescription (   $description)
Parameters
string$description

Definition at line 1038 of file class.ilDataCollectionTable.php.

References $description.

Referenced by cloneStructure(), and doRead().

{
$this->description = $description;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setEditByOwner (   $edit_by_owner)
Parameters
boolean$edit_by_owner

Definition at line 942 of file class.ilDataCollectionTable.php.

References $edit_by_owner.

Referenced by cloneStructure(), and doRead().

{
$this->edit_by_owner = $edit_by_owner;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setEditPerm (   $edit_perm)
Parameters
boolean$edit_perm

Definition at line 958 of file class.ilDataCollectionTable.php.

References $edit_perm.

Referenced by cloneStructure(), and doRead().

{
$this->edit_perm = $edit_perm;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setExportEnabled (   $export_enabled)
Parameters
boolean$export_enabled

Definition at line 1271 of file class.ilDataCollectionTable.php.

References $export_enabled.

Referenced by cloneStructure(), and doRead().

{
$this->export_enabled = $export_enabled;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setId (   $a_id)

Set table id.

Parameters
int$a_id

Definition at line 296 of file class.ilDataCollectionTable.php.

Referenced by doCreate().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setIsVisible (   $is_visible)
Parameters
boolean$is_visible

Definition at line 1022 of file class.ilDataCollectionTable.php.

References $is_visible.

Referenced by cloneStructure(), and doRead().

{
$this->is_visible = $is_visible;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setLimited (   $limited)
Parameters
boolean$limited

Definition at line 974 of file class.ilDataCollectionTable.php.

References $limited.

Referenced by cloneStructure(), and doRead().

{
$this->limited = $limited;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setLimitEnd (   $limit_end)
Parameters
string$limit_end

Definition at line 990 of file class.ilDataCollectionTable.php.

References $limit_end.

Referenced by cloneStructure(), and doRead().

{
$this->limit_end = $limit_end;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setLimitStart (   $limit_start)
Parameters
string$limit_start

Definition at line 1006 of file class.ilDataCollectionTable.php.

References $limit_start.

Referenced by cloneStructure(), and doRead().

{
$this->limit_start = $limit_start;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setObjId (   $a_id)
Parameters
$a_id

Definition at line 314 of file class.ilDataCollectionTable.php.

Referenced by doRead().

{
$this->objId = $a_id;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setPublicCommentsEnabled (   $public_comments)
Parameters
boolean$public_comments

Definition at line 1092 of file class.ilDataCollectionTable.php.

References $public_comments.

Referenced by cloneStructure(), and doRead().

{
$this->public_comments = $public_comments;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setTitle (   $a_title)
Parameters
$a_title

Definition at line 330 of file class.ilDataCollectionTable.php.

Referenced by cloneStructure(), and doRead().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::setViewOwnRecordsPerm (   $view_own_perm)
Parameters
boolean$view_own_perm

Definition at line 1108 of file class.ilDataCollectionTable.php.

Referenced by cloneStructure(), and doRead().

{
$this->view_own_records_perm = (int)$view_own_perm;
}

+ Here is the caller graph for this function:

ilDataCollectionTable::sortByOrder ( $array)
protected
Parameters
$arrayilDataCollectionField[] the array to sort

Definition at line 862 of file class.ilDataCollectionTable.php.

Referenced by buildOrderFields(), getFields(), loadFields(), and sortFields().

{
usort($array, array( $this, "compareOrder" ));
}

+ Here is the caller graph for this function:

ilDataCollectionTable::sortFields ( $fields)

sortFields

Parameters
$fieldsilDataCollectionField[]

Definition at line 846 of file class.ilDataCollectionTable.php.

References $fields, and sortByOrder().

{
//After sorting the array loses it's keys respectivly their keys are set form $field->id to 1,2,3... so we reset the keys.
$named = array();
foreach ($fields as $field) {
$named[$field->getId()] = $field;
}
$fields = $named;
}

+ Here is the call graph for this function:

ilDataCollectionTable::updateFields ( )

Update fields.

Definition at line 834 of file class.ilDataCollectionTable.php.

References getFields().

{
foreach ($this->getFields() as $field) {
$field->doUpdate();
}
}

+ Here is the call graph for this function:

Field Documentation

ilDataCollectionTable::$add_perm
protected

Definition at line 57 of file class.ilDataCollectionTable.php.

Referenced by getAddPerm(), and setAddPerm().

ilDataCollectionTable::$default_sort_field = 0
protected
ilDataCollectionTable::$default_sort_field_order = 'asc'
protected
ilDataCollectionTable::$delete_perm
protected

Definition at line 65 of file class.ilDataCollectionTable.php.

Referenced by getDeletePerm(), and setDeletePerm().

ilDataCollectionTable::$description = ''
protected

Definition at line 103 of file class.ilDataCollectionTable.php.

Referenced by getDescription(), and setDescription().

ilDataCollectionTable::$edit_by_owner
protected

Definition at line 69 of file class.ilDataCollectionTable.php.

Referenced by getEditByOwner(), and setEditByOwner().

ilDataCollectionTable::$edit_perm
protected

Definition at line 61 of file class.ilDataCollectionTable.php.

Referenced by getEditPerm(), and setEditPerm().

ilDataCollectionTable::$export_enabled
protected

Definition at line 85 of file class.ilDataCollectionTable.php.

Referenced by getExportEnabled(), and setExportEnabled().

ilDataCollectionTable::$id = 0
protected
ilDataCollectionTable::$is_visible
protected

Definition at line 53 of file class.ilDataCollectionTable.php.

Referenced by getIsVisible(), and setIsVisible().

ilDataCollectionTable::$limit_end
protected

Definition at line 81 of file class.ilDataCollectionTable.php.

Referenced by getLimitEnd(), and setLimitEnd().

ilDataCollectionTable::$limit_start
protected

Definition at line 77 of file class.ilDataCollectionTable.php.

Referenced by getLimitStart(), and setLimitStart().

ilDataCollectionTable::$limited
protected

Definition at line 73 of file class.ilDataCollectionTable.php.

Referenced by getLimited(), and setLimited().

ilDataCollectionTable::$obj
protected

Definition at line 33 of file class.ilDataCollectionTable.php.

Referenced by getCollectionObject().

ilDataCollectionTable::$objId
protected

Definition at line 29 of file class.ilDataCollectionTable.php.

Referenced by getObjId().

ilDataCollectionTable::$public_comments = 0
protected
ilDataCollectionTable::$records
protected
ilDataCollectionTable::$stdFields
protected

Definition at line 45 of file class.ilDataCollectionTable.php.

ilDataCollectionTable::$title
protected
ilDataCollectionTable::$view_own_records_perm = 0
protected

Definition at line 115 of file class.ilDataCollectionTable.php.

Referenced by getViewOwnRecordsPerm().


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