ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilDclTable Class Reference
+ Collaboration diagram for ilDclTable:

Public Member Functions

 __construct (int $a_id=0)
 
 doRead ()
 Read table. More...
 
 doDelete (bool $delete_only_content=false, bool $omit_notification=false)
 Delete table Attention this does not delete the maintable of it's the maintable of the collection. More...
 
 doCreate (bool $create_tablefield_setting=true, bool $create_standardview=true)
 
 doUpdate ()
 
 setId (int $a_id)
 Set table id. More...
 
 getId ()
 Get table id. More...
 
 setObjId (int $a_id)
 
 getObjId ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 getCollectionObject ()
 
 getRecords ()
 
 loadRecords ()
 
 deleteField (int $field_id)
 
 getField (string $field_id)
 
 getFieldIds ()
 
 getCustomFields ()
 
 getNewFieldOrder ()
 getNewOrder More...
 
 getNewTableviewOrder ()
 
 sortTableViews (?array $tableviews=null)
 
 getFields ()
 Returns all fields of this table including the standard fields. More...
 
 reloadFields ()
 
 getTableViews ()
 
 getVisibleTableViews (int $ref_id, bool $with_active_detailedview=false, int $user_id=0)
 For current user. More...
 
 getFirstTableViewId (int $ref_id, int $user_id=0, bool $with_detailed_view=false)
 get id of first (for current user) available view More...
 
 getFieldsForFormula ()
 Returns all fields of this table including the standard fields, wich are supported for formulas. More...
 
 getRecordFields ()
 Returns all fields of this table which are NOT standard fields. More...
 
 getEditableFields (bool $creation_mode)
 
 getExportableFields ()
 Return all the fields that are marked as exportable. More...
 
 hasPermissionToEditRecord (int $ref_id, ilDclBaseRecordModel $record)
 
 hasPermissionToDeleteRecord (int $ref_id, ilDclBaseRecordModel $record)
 
 hasPermissionToDeleteRecords (int $ref_id)
 
 hasPermissionToViewRecord (int $ref_id, ilDclBaseRecordModel $record, int $user_id=0)
 
 checkLimit ()
 
 updateFields ()
 Update fields. More...
 
 sortFields (array &$fields)
 sortFields More...
 
 buildOrderFields ()
 buildOrderFields orders the fields. More...
 
 getFieldByTitle (string $title)
 Get a field by title. More...
 
 setAddPerm (bool $add_perm)
 
 getAddPerm ()
 
 setDeletePerm (bool $delete_perm)
 
 getDeletePerm ()
 
 setEditByOwner (bool $edit_by_owner)
 
 getEditByOwner ()
 
 getDeleteByOwner ()
 
 setDeleteByOwner (bool $delete_by_owner)
 
 setEditPerm (bool $edit_perm)
 
 getEditPerm ()
 
 setLimited (bool $limited)
 
 getLimited ()
 
 setLimitEnd (string $limit_end)
 
 getLimitEnd ()
 
 setLimitStart (string $limit_start)
 
 getLimitStart ()
 
 setIsVisible (bool $is_visible)
 
 getIsVisible ()
 
 setDescription (string $description)
 
 getDescription ()
 
 setDefaultSortField (string $default_sort_field)
 
 getDefaultSortField ()
 
 setDefaultSortFieldOrder (string $default_sort_field_order)
 
 getDefaultSortFieldOrder ()
 
 setPublicCommentsEnabled (bool $public_comments)
 
 getPublicCommentsEnabled ()
 
 setViewOwnRecordsPerm (bool $view_own_perm)
 
 getViewOwnRecordsPerm ()
 
 getSaveConfirmation ()
 
 setSaveConfirmation (bool $save_confirmation)
 
 hasCustomFields ()
 
 compareOrder (ilDclBaseFieldModel $a, ilDclBaseFieldModel $b)
 
 cloneStructure (ilDclTable $original)
 
 afterClone ()
 
 _hasRecords ()
 _hasRecords More...
 
 addField (ilDclBaseFieldModel $field)
 
 setExportEnabled (bool $export_enabled)
 
 getExportEnabled ()
 
 getOrder ()
 
 updateOrder ()
 
 setOrder (int $table_order)
 
 setImportEnabled (bool $import_enabled)
 
 getImportEnabled ()
 
 getPartialRecords (string $ref_id, string $sort, string $direction, ?int $limit, int $offset, array $filter=[])
 Return only the needed subset of record objects for the table, according to sorting, paging and filters. More...
 
 showInvalidFields (bool $value)
 

Static Public Member Functions

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

Protected Member Functions

 loadObj ()
 
 loadCustomFields ()
 
 doesRecordBelongToUser (ilDclBaseRecordModel $record)
 
 sortByOrder (array &$array)
 

Protected Attributes

int $id = 0
 
int $objId = null
 
ilObjDataCollection $obj = null
 
string $title = ""
 
array $fields = []
 
array $stdFields = []
 
array $records = []
 
bool $is_visible = false
 
bool $add_perm = false
 
bool $edit_perm = false
 
bool $delete_perm = false
 
bool $edit_by_owner = false
 
bool $delete_by_owner = false
 
bool $save_confirmation = false
 
bool $limited = false
 
string $limit_start = ""
 
string $limit_end = ""
 
bool $export_enabled = false
 
int $table_order = 0
 
bool $import_enabled = false
 
string $default_sort_field = "0"
 
string $default_sort_field_order = 'asc'
 Default sort-order (asc|desc) More...
 
string $description = ''
 Description for this table displayed above records. More...
 
bool $public_comments = false
 True if users can add comments on each record of this table. More...
 
int $view_own_records_perm = 0
 True if user can only view his/her own entries in the table. More...
 
array $all_fields = null
 table fields and std fields combined More...
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ilObjUser $user
 
ilDBInterface $db
 
bool $show_invalid = false
 

Detailed Description

Definition at line 24 of file class.ilDclTable.php.

Constructor & Destructor Documentation

◆ __construct()

ilDclTable::__construct ( int  $a_id = 0)

Definition at line 83 of file class.ilDclTable.php.

References $DIC, doRead(), ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

84  {
85  global $DIC;
86 
87  $this->http = $DIC->http();
88  $this->refinery = $DIC->refinery();
89  $this->db = $DIC->database();
90  $this->user = $DIC->user();
91 
92  if ($a_id != 0) {
93  $this->id = $a_id;
94  $this->doRead();
95  }
96  }
doRead()
Read table.
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ _getTableIdByTitle()

static ilDclTable::_getTableIdByTitle ( string  $title,
int  $obj_id 
)
static
Parameters
int$obj_idDatacollection object ID where the table belongs to

Definition at line 1136 of file class.ilDclTable.php.

References $DIC, $id, and $ilDB.

Referenced by ilObjDataCollection\reorderTables().

1136  : int
1137  {
1138  global $DIC;
1139  $ilDB = $DIC['ilDB'];
1140 
1141  $result = $ilDB->query(
1142  'SELECT id FROM il_dcl_table WHERE title = ' . $ilDB->quote($title, 'text') . ' AND obj_id = '
1143  . $ilDB->quote($obj_id, 'integer')
1144  );
1145  $id = 0;
1146  while ($rec = $ilDB->fetchAssoc($result)) {
1147  $id = $rec['id'];
1148  }
1149 
1150  return $id;
1151  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _hasFieldByTitle()

static ilDclTable::_hasFieldByTitle ( string  $title,
int  $obj_id 
)
static

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

Parameters
string$titleTitle of field
int$obj_idof the table

Definition at line 1205 of file class.ilDclTable.php.

References $DIC, and $ilDB.

Referenced by ilDclFieldEditGUI\checkInput().

1205  : bool
1206  {
1207  global $DIC;
1208  $ilDB = $DIC['ilDB'];
1209  $result = $ilDB->query(
1210  'SELECT * FROM il_dcl_field WHERE table_id = ' . $ilDB->quote($obj_id, 'integer') . ' AND title = '
1211  . $ilDB->quote($title, 'text')
1212  );
1213 
1214  return (bool) $ilDB->numRows($result);
1215  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _hasRecords()

ilDclTable::_hasRecords ( )

_hasRecords

Definition at line 1106 of file class.ilDclTable.php.

References getRecords().

1106  : bool
1107  {
1108  return count($this->getRecords()) > 0;
1109  }
+ Here is the call graph for this function:

◆ _tableExists()

static ilDclTable::_tableExists ( int  $table_id)
static
Returns
bool returns true if there exists a table with id $table_id

Definition at line 1122 of file class.ilDclTable.php.

References $DIC, and $ilDB.

Referenced by ilDclBaseRecordModel\doCreate(), and ilDclBaseFieldModel\doCreate().

1122  : bool
1123  {
1124  global $DIC;
1125  $ilDB = $DIC['ilDB'];
1126 
1127  $query = "SELECT * FROM il_dcl_table WHERE id = " . $table_id;
1128  $result = $ilDB->query($query);
1129 
1130  return $result->numRows() != 0;
1131  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ addField()

ilDclTable::addField ( ilDclBaseFieldModel  $field)
Parameters
ilDclBaseFieldModel$fieldadd an already created field for eg. ordering.

Definition at line 1114 of file class.ilDclTable.php.

References ilDclBaseFieldModel\getId().

1114  : void
1115  {
1116  $this->all_fields[$field->getId()] = $field;
1117  }
+ Here is the call graph for this function:

◆ afterClone()

ilDclTable::afterClone ( )

Definition at line 1096 of file class.ilDclTable.php.

References getFields(), and getRecords().

1096  : void
1097  {
1098  foreach ($this->getFields() as $field) {
1099  $field->afterClone($this->getRecords());
1100  }
1101  }
getFields()
Returns all fields of this table including the standard fields.
+ Here is the call graph for this function:

◆ buildOrderFields()

ilDclTable::buildOrderFields ( )

buildOrderFields orders the fields.

Definition at line 803 of file class.ilDclTable.php.

References getFields(), and sortByOrder().

Referenced by doCreate().

803  : void
804  {
805  $fields = $this->getFields();
806  $this->sortByOrder($fields);
807  $count = 10;
808  $offset = 10;
809  foreach ($fields as $field) {
810  if (!is_null($field->getOrder())) {
811  $field->setOrder($count);
812  $count = $count + $offset;
813  $field->doUpdate();
814  }
815  }
816  }
sortByOrder(array &$array)
getFields()
Returns all fields of this table including the standard fields.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkLimit()

ilDclTable::checkLimit ( )

Definition at line 730 of file class.ilDclTable.php.

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

Referenced by hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

730  : bool
731  {
732  if ($this->getLimited()) {
733  $from = null;
734  $to = null;
735  $now = new ilDateTime(date("Y-m-d H:i:s"), IL_CAL_DATE);
736 
737  if ($this->getLimitStart() != "") {
738  $from = new ilDateTime($this->getLimitStart(), IL_CAL_DATE);
739  }
740  if ($this->getLimitEnd() != "") {
741  $to = new ilDateTime($this->getLimitEnd(), IL_CAL_DATE);
742  }
743 
744  if ($from == null && $to == null) {
745  return true;
746  }
747  if ($from <= $now && $now <= $to) {
748  return true;
749  }
750  if ($from <= $now && $to == null) {
751  return true;
752  }
753  if ($from == null && $now <= $to) {
754  return true;
755  }
756 
757  return ($from <= $now && $now <= $to);
758  }
759 
760  return true;
761  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneStructure()

ilDclTable::cloneStructure ( ilDclTable  $original)

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

References doCreate(), doUpdate(), getAddPerm(), getDefaultSortField(), getDefaultSortFieldOrder(), getDeleteByOwner(), getDeletePerm(), getDescription(), getEditByOwner(), getEditPerm(), getExportEnabled(), ilDclReferenceFieldModel\getFieldRef(), getFields(), getId(), getImportEnabled(), getIsVisible(), getLimited(), getLimitEnd(), getLimitStart(), getOrder(), getPublicCommentsEnabled(), getRecords(), getSaveConfirmation(), getTableViews(), getTitle(), getViewOwnRecordsPerm(), setAddPerm(), ilDclCache\setCloneOf(), setDefaultSortField(), setDefaultSortFieldOrder(), setDeleteByOwner(), setDeletePerm(), setDescription(), setEditByOwner(), setEditPerm(), setExportEnabled(), setImportEnabled(), setIsVisible(), setLimited(), setLimitEnd(), setLimitStart(), setOrder(), setPublicCommentsEnabled(), setSaveConfirmation(), setTitle(), setViewOwnRecordsPerm(), and ilDclCache\TYPE_TABLE.

1022  : void
1023  {
1024  $this->setTitle($original->getTitle());
1025  $this->setDescription($original->getDescription());
1026  $this->setIsVisible($original->getIsVisible());
1027  $this->setEditByOwner($original->getEditByOwner());
1028  $this->setAddPerm($original->getAddPerm());
1029  $this->setEditPerm($original->getEditPerm());
1030  $this->setDeleteByOwner($original->getDeleteByOwner());
1031  $this->setSaveConfirmation($original->getSaveConfirmation());
1032  $this->setDeletePerm($original->getDeletePerm());
1033  $this->setLimited($original->getLimited());
1034  $this->setLimitStart($original->getLimitStart());
1035  $this->setLimitEnd($original->getLimitEnd());
1036  $this->setViewOwnRecordsPerm($original->getViewOwnRecordsPerm());
1037  $this->setExportEnabled($original->getExportEnabled());
1038  $this->setImportEnabled($original->getImportEnabled());
1041  $this->setOrder($original->getOrder());
1042 
1043  $this->doCreate(true, false);
1044  // reset stdFields to get new for the created object
1045 
1046  $default_sort_field = 0;
1047  // Clone standard-fields
1048  $org_std_fields = $original->getStandardFields();
1049  foreach ($this->getStandardFields() as $element_key => $std_field) {
1050  $std_field->clone($org_std_fields[$element_key]);
1051  if ($std_field->getId() === $original->getDefaultSortField()) {
1052  $default_sort_field = $std_field->getId();
1053  }
1054  }
1055 
1056  // Clone fields
1057  $new_fields = [];
1058  foreach ($original->getFields() as $orig_field) {
1059  if (!$orig_field->isStandardField()) {
1060  $class_name = get_class($orig_field);
1061  $new_field = new $class_name();
1062  if ($new_field instanceof ilDclReferenceFieldModel && $new_field->getFieldRef()->getTableId() === 0) {
1063  continue;
1064  }
1065  $new_field->setTableId($this->getId());
1066  $new_field->cloneStructure((int) $orig_field->getId());
1067  $new_fields[$orig_field->getId()] = $new_field;
1068 
1069  if ($orig_field->getId() === $original->getDefaultSortField()) {
1070  $default_sort_field = $new_field->getId();
1071  }
1072  }
1073  }
1074 
1075  $this->setDefaultSortField((string) $default_sort_field);
1076  $this->doUpdate();
1077 
1078  // Clone Records with recordfields
1079  foreach ($original->getRecords() as $orig_record) {
1080  $new_record = new ilDclBaseRecordModel();
1081  $new_record->setTableId($this->getId());
1082  $new_record->cloneStructure($orig_record->getId(), $new_fields);
1083  }
1084 
1085  //clone tableviews (includes pageobjects)
1086  foreach ($original->getTableViews() as $orig_tableview) {
1087  $new_tableview = new ilDclTableView();
1088  $new_tableview->setTableId($this->getId());
1089  $new_tableview->cloneStructure($orig_tableview, $new_fields);
1090  }
1091 
1092  // mandatory for all cloning functions
1093  ilDclCache::setCloneOf($original->getId(), $this->getId(), ilDclCache::TYPE_TABLE);
1094  }
setIsVisible(bool $is_visible)
setEditByOwner(bool $edit_by_owner)
setDeleteByOwner(bool $delete_by_owner)
setEditPerm(bool $edit_perm)
getFields()
Returns all fields of this table including the standard fields.
setLimitStart(string $limit_start)
getId()
Get table id.
setDefaultSortFieldOrder(string $default_sort_field_order)
setOrder(int $table_order)
setTitle(string $a_title)
setLimitEnd(string $limit_end)
static setCloneOf(int $old, int $new, string $type)
string $default_sort_field
setExportEnabled(bool $export_enabled)
setSaveConfirmation(bool $save_confirmation)
setAddPerm(bool $add_perm)
setDeletePerm(bool $delete_perm)
setImportEnabled(bool $import_enabled)
setDescription(string $description)
doCreate(bool $create_tablefield_setting=true, bool $create_standardview=true)
setDefaultSortField(string $default_sort_field)
setViewOwnRecordsPerm(bool $view_own_perm)
setPublicCommentsEnabled(bool $public_comments)
setLimited(bool $limited)
+ Here is the call graph for this function:

◆ compareOrder()

ilDclTable::compareOrder ( ilDclBaseFieldModel  $a,
ilDclBaseFieldModel  $b 
)

Definition at line 1007 of file class.ilDclTable.php.

References ilDclBaseFieldModel\getOrder(), and null.

1007  : int
1008  {
1009  if (is_null($a->getOrder() == null) && is_null($b->getOrder() == null)) {
1010  return 0;
1011  }
1012  if (is_null($a->getOrder())) {
1013  return 1;
1014  }
1015  if (is_null($b->getOrder())) {
1016  return -1;
1017  }
1018 
1019  return $a->getOrder() < $b->getOrder() ? -1 : 1;
1020  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ deleteField()

ilDclTable::deleteField ( int  $field_id)

Definition at line 336 of file class.ilDclTable.php.

References ilDclCache\getFieldCache(), and getRecords().

336  : void
337  {
338  $field = ilDclCache::getFieldCache($field_id);
339  $records = $this->getRecords();
340 
341  foreach ($records as $record) {
342  $record->deleteField($field_id);
343  }
344 
345  $field->doDelete();
346  }
static getFieldCache(int $field_id=0)
+ Here is the call graph for this function:

◆ doCreate()

ilDclTable::doCreate ( bool  $create_tablefield_setting = true,
bool  $create_standardview = true 
)

Definition at line 168 of file class.ilDclTable.php.

References buildOrderFields(), ilDclTableView\createOrGetStandardView(), getAddPerm(), getDefaultSortField(), getDefaultSortFieldOrder(), getDeleteByOwner(), getDeletePerm(), getDescription(), getEditByOwner(), getEditPerm(), getExportEnabled(), getId(), getImportEnabled(), getIsVisible(), getLimited(), getLimitEnd(), getLimitStart(), getObjId(), getOrder(), getPublicCommentsEnabled(), getSaveConfirmation(), getTitle(), getViewOwnRecordsPerm(), and setId().

Referenced by cloneStructure().

168  : void
169  {
170  $id = $this->db->nextId("il_dcl_table");
171  $this->setId($id);
172  $query = "INSERT INTO il_dcl_table (" . "id" . ", obj_id" . ", title" . ", add_perm" . ", edit_perm" . ", delete_perm" . ", edit_by_owner"
173  . ", limited" . ", limit_start" . ", limit_end" . ", is_visible" . ", export_enabled" . ", import_enabled" . ", default_sort_field_id"
174  . ", default_sort_field_order" . ", description" . ", public_comments" . ", view_own_records_perm"
175  . ", delete_by_owner, save_confirmation , table_order ) VALUES (" . $this->db->quote(
176  $this->getId(),
177  "integer"
178  ) . ","
179  . $this->db->quote($this->getObjId(), "integer") . "," . $this->db->quote($this->getTitle(), "text") . ","
180  . $this->db->quote($this->getAddPerm() ? 1 : 0, "integer") . "," . $this->db->quote(
181  $this->getEditPerm() ? 1 : 0,
182  "integer"
183  ) . ","
184  . $this->db->quote(
185  $this->getDeletePerm() ? 1 : 0,
186  "integer"
187  ) . "," . $this->db->quote($this->getEditByOwner() ? 1 : 0, "integer") . ","
188  . $this->db->quote($this->getLimited() ? 1 : 0, "integer") . "," . $this->db->quote(
189  $this->getLimitStart(),
190  "timestamp"
191  ) . ","
192  . $this->db->quote($this->getLimitEnd(), "timestamp") . "," . $this->db->quote(
193  $this->getIsVisible() ? 1 : 0,
194  "integer"
195  ) . ","
196  . $this->db->quote(
197  $this->getExportEnabled() ? 1 : 0,
198  "integer"
199  ) . "," . $this->db->quote($this->getImportEnabled() ? 1 : 0, "integer") . ","
200  . $this->db->quote($this->getDefaultSortField(), "text") . "," . $this->db->quote(
201  $this->getDefaultSortFieldOrder(),
202  "text"
203  ) . ","
204  . $this->db->quote($this->getDescription(), "text") . "," . $this->db->quote(
205  $this->getPublicCommentsEnabled(),
206  "integer"
207  ) . ","
208  . $this->db->quote(
209  $this->getViewOwnRecordsPerm(),
210  "integer"
211  ) . "," . $this->db->quote($this->getDeleteByOwner() ? 1 : 0, 'integer') . ","
212  . $this->db->quote($this->getSaveConfirmation() ? 1 : 0, 'integer') . "," . $this->db->quote(
213  $this->getOrder(),
214  'integer'
215  ) . ")";
216 
217  $this->db->manipulate($query);
218 
219  if ($create_standardview) {
220  //standard tableview
222  }
223 
224  if ($create_tablefield_setting) {
225  $this->buildOrderFields();
226  }
227  }
static createOrGetStandardView(int $table_id)
setId(int $a_id)
Set table id.
getId()
Get table id.
buildOrderFields()
buildOrderFields orders the fields.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doDelete()

ilDclTable::doDelete ( bool  $delete_only_content = false,
bool  $omit_notification = false 
)

Delete table Attention this does not delete the maintable of it's the maintable of the collection.

unlink the the maintable in the collections object to make this work.

Definition at line 142 of file class.ilDclTable.php.

References getId(), getRecordFields(), and getRecords().

142  : void
143  {
144  foreach ($this->getRecords() as $record) {
145  $record->doDelete($omit_notification);
146  }
147 
148  foreach ($this->getRecordFields() as $field) {
149  $field->doDelete();
150  }
151 
152  // // SW: Fix #12794 und #11405
153  // // Problem is that when the DC object gets deleted, $this::getCollectionObject() tries to load the DC but it's not in the DB anymore
154  // // If $delete_main_table is true, avoid getting the collection object
155  // $exec_delete = false;
156  // if ($delete_main_table) {
157  // $exec_delete = true;
158  // }
159  // if (!$exec_delete && $this->getCollectionObject()->getFirstVisibleTableId() != $this->getId()) {
160  // $exec_delete = true;
161  // }
162  if (!$delete_only_content) {
163  $query = "DELETE FROM il_dcl_table WHERE id = " . $this->db->quote($this->getId(), "integer");
164  $this->db->manipulate($query);
165  }
166  }
getId()
Get table id.
getRecordFields()
Returns all fields of this table which are NOT standard fields.
+ Here is the call graph for this function:

◆ doesRecordBelongToUser()

ilDclTable::doesRecordBelongToUser ( ilDclBaseRecordModel  $record)
protected

Definition at line 725 of file class.ilDclTable.php.

References ilDclBaseRecordModel\getOwner(), and ILIAS\Repository\user().

Referenced by hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

725  : bool
726  {
727  return ($this->user->getId() == $record->getOwner());
728  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doRead()

ilDclTable::doRead ( )

Read table.

Definition at line 101 of file class.ilDclTable.php.

References getId(), null, setAddPerm(), setDefaultSortField(), setDefaultSortFieldOrder(), setDeleteByOwner(), setDeletePerm(), setDescription(), setEditByOwner(), setEditPerm(), setExportEnabled(), setImportEnabled(), setIsVisible(), setLimited(), setLimitEnd(), setLimitStart(), setObjId(), setOrder(), setPublicCommentsEnabled(), setSaveConfirmation(), setTitle(), and setViewOwnRecordsPerm().

Referenced by __construct().

101  : void
102  {
103  $query = "SELECT * FROM il_dcl_table WHERE id = " . $this->db->quote($this->getId(), "integer");
104  $set = $this->db->query($query);
105  $rec = $this->db->fetchAssoc($set);
106 
107  $this->setObjId($rec["obj_id"]);
108  if (null !== $rec["title"]) {
109  $this->setTitle($rec["title"]);
110  }
111  $this->setAddPerm((bool) $rec["add_perm"]);
112  $this->setEditPerm((bool) $rec["edit_perm"]);
113  $this->setDeletePerm((bool) $rec["delete_perm"]);
114  $this->setEditByOwner((bool) $rec["edit_by_owner"]);
115  if (null !== $rec["export_enabled"]) {
116  $this->setExportEnabled((bool) $rec["export_enabled"]);
117  }
118  $this->setImportEnabled((bool) $rec["import_enabled"]);
119  $this->setLimited((bool) $rec["limited"]);
120  $this->setLimitStart((string) $rec["limit_start"]);
121  $this->setLimitEnd((string) $rec["limit_end"]);
122  $this->setIsVisible((bool) $rec["is_visible"]);
123  if (null !== $rec['description']) {
124  $this->setDescription($rec['description']);
125  }
126  $this->setDefaultSortField((string) $rec['default_sort_field_id']);
127  $this->setDefaultSortFieldOrder($rec['default_sort_field_order']);
128  $this->setPublicCommentsEnabled((bool) $rec['public_comments']);
129  $this->setViewOwnRecordsPerm((bool) $rec['view_own_records_perm']);
130  $this->setDeleteByOwner((bool) $rec['delete_by_owner']);
131  $this->setSaveConfirmation((bool) $rec['save_confirmation']);
132  if (null !== $rec['table_order']) {
133  $this->setOrder($rec['table_order']);
134  }
135  }
setIsVisible(bool $is_visible)
setObjId(int $a_id)
setEditByOwner(bool $edit_by_owner)
setDeleteByOwner(bool $delete_by_owner)
setEditPerm(bool $edit_perm)
setLimitStart(string $limit_start)
getId()
Get table id.
setDefaultSortFieldOrder(string $default_sort_field_order)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setOrder(int $table_order)
setTitle(string $a_title)
setLimitEnd(string $limit_end)
setExportEnabled(bool $export_enabled)
setSaveConfirmation(bool $save_confirmation)
setAddPerm(bool $add_perm)
setDeletePerm(bool $delete_perm)
setImportEnabled(bool $import_enabled)
setDescription(string $description)
setDefaultSortField(string $default_sort_field)
setViewOwnRecordsPerm(bool $view_own_perm)
setPublicCommentsEnabled(bool $public_comments)
setLimited(bool $limited)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUpdate()

ilDclTable::doUpdate ( )

Definition at line 229 of file class.ilDclTable.php.

References getAddPerm(), getDefaultSortField(), getDefaultSortFieldOrder(), getDeleteByOwner(), getDeletePerm(), getDescription(), getEditByOwner(), getEditPerm(), getExportEnabled(), getId(), getImportEnabled(), getIsVisible(), getLimited(), getLimitEnd(), getLimitStart(), getObjId(), getOrder(), getPublicCommentsEnabled(), getSaveConfirmation(), getTitle(), and getViewOwnRecordsPerm().

Referenced by cloneStructure(), and ilDclTableEditGUI\setAsDefault().

229  : void
230  {
231  $this->db->update(
232  "il_dcl_table",
233  [
234  "obj_id" => ["integer", $this->getObjId()],
235  "title" => ["text", $this->getTitle()],
236  "add_perm" => ["integer", (int) $this->getAddPerm()],
237  "edit_perm" => ["integer", (int) $this->getEditPerm()],
238  "delete_perm" => ["integer", (int) $this->getDeletePerm()],
239  "edit_by_owner" => ["integer", (int) $this->getEditByOwner()],
240  "limited" => ["integer", $this->getLimited()],
241  "limit_start" => ["timestamp", $this->getLimitStart()],
242  "limit_end" => ["timestamp", $this->getLimitEnd()],
243  "is_visible" => ["integer", $this->getIsVisible() ? 1 : 0],
244  "export_enabled" => ["integer", $this->getExportEnabled() ? 1 : 0],
245  "import_enabled" => ["integer", $this->getImportEnabled() ? 1 : 0],
246  "description" => ["text", $this->getDescription()],
247  "default_sort_field_id" => ["text", $this->getDefaultSortField()],
248  "default_sort_field_order" => ["text", $this->getDefaultSortFieldOrder()],
249  "public_comments" => ["integer", $this->getPublicCommentsEnabled() ? 1 : 0],
250  "view_own_records_perm" => ["integer", $this->getViewOwnRecordsPerm()],
251  'delete_by_owner' => ['integer', $this->getDeleteByOwner() ? 1 : 0],
252  'save_confirmation' => ['integer', $this->getSaveConfirmation() ? 1 : 0],
253  'table_order' => ['integer', $this->getOrder()],
254  ],
255  [
256  "id" => ["integer", $this->getId()],
257  ]
258  );
259  }
getId()
Get table id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAddPerm()

ilDclTable::getAddPerm ( )

Definition at line 839 of file class.ilDclTable.php.

References $add_perm.

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

839  : bool
840  {
841  return $this->add_perm;
842  }
+ Here is the caller graph for this function:

◆ getCollectionObject()

ilDclTable::getCollectionObject ( )

Definition at line 297 of file class.ilDclTable.php.

References $obj, and loadObj().

298  {
299  $this->loadObj();
300 
301  return $this->obj;
302  }
ilObjDataCollection $obj
+ Here is the call graph for this function:

◆ getCustomFields()

ilDclTable::getCustomFields ( )
Returns
ilDclBaseFieldModel[]

Definition at line 410 of file class.ilDclTable.php.

References $fields, and loadCustomFields().

410  : array
411  {
412  if (!$this->fields) {
413  $this->loadCustomFields();
414  }
415 
416  return $this->fields;
417  }
+ Here is the call graph for this function:

◆ getDefaultSortField()

ilDclTable::getDefaultSortField ( )

Definition at line 952 of file class.ilDclTable.php.

References $default_sort_field.

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

952  : string
953  {
955  }
string $default_sort_field
+ Here is the caller graph for this function:

◆ getDefaultSortFieldOrder()

ilDclTable::getDefaultSortFieldOrder ( )

Definition at line 965 of file class.ilDclTable.php.

References $default_sort_field_order.

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

965  : string
966  {
968  }
string $default_sort_field_order
Default sort-order (asc|desc)
+ Here is the caller graph for this function:

◆ getDeleteByOwner()

ilDclTable::getDeleteByOwner ( )

Definition at line 870 of file class.ilDclTable.php.

References $delete_by_owner.

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

870  : bool
871  {
872  return $this->delete_by_owner;
873  }
+ Here is the caller graph for this function:

◆ getDeletePerm()

ilDclTable::getDeletePerm ( )

Definition at line 852 of file class.ilDclTable.php.

References $delete_perm.

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

852  : bool
853  {
854  return $this->delete_perm;
855  }
+ Here is the caller graph for this function:

◆ getDescription()

ilDclTable::getDescription ( )

Definition at line 941 of file class.ilDclTable.php.

References $description.

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

941  : string
942  {
943  return $this->description;
944  }
string $description
Description for this table displayed above records.
+ Here is the caller graph for this function:

◆ getEditableFields()

ilDclTable::getEditableFields ( bool  $creation_mode)
Parameters
bool$creation_mode
Returns
array

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

References getRecordFields(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

593  : array
594  {
595  $fields = $this->getRecordFields();
596  $editableFields = [];
597 
598  foreach ($fields as $field) {
599  $tableview_id = $this->http->wrapper()->post()->retrieve(
600  'tableview_id',
601  $this->refinery->kindlyTo()->int()
602  );
603  if (!$field->getViewSetting($tableview_id)->isLocked($creation_mode)) {
604  $editableFields[] = $field;
605  }
606  }
607 
608  return $editableFields;
609  }
static http()
Fetches the global http state from ILIAS.
getRecordFields()
Returns all fields of this table which are NOT standard fields.
+ Here is the call graph for this function:

◆ getEditByOwner()

ilDclTable::getEditByOwner ( )

Definition at line 865 of file class.ilDclTable.php.

References $edit_by_owner.

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

865  : bool
866  {
867  return $this->edit_by_owner;
868  }
+ Here is the caller graph for this function:

◆ getEditPerm()

ilDclTable::getEditPerm ( )

Definition at line 891 of file class.ilDclTable.php.

References $edit_perm.

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

891  : bool
892  {
893  return $this->edit_perm;
894  }
+ Here is the caller graph for this function:

◆ getExportableFields()

ilDclTable::getExportableFields ( )

Return all the fields that are marked as exportable.

Returns
ilDclBaseFieldModel[]

Definition at line 615 of file class.ilDclTable.php.

References getFields().

615  : array
616  {
617  $fields = $this->getFields();
618  $exportableFields = [];
619  foreach ($fields as $field) {
620  if ($field->getExportable()) {
621  $exportableFields[] = $field;
622  }
623  }
624 
625  return $exportableFields;
626  }
getFields()
Returns all fields of this table including the standard fields.
+ Here is the call graph for this function:

◆ getExportEnabled()

ilDclTable::getExportEnabled ( )

Definition at line 1158 of file class.ilDclTable.php.

References $export_enabled.

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

1158  : bool
1159  {
1160  return $this->export_enabled;
1161  }
+ Here is the caller graph for this function:

◆ getField()

ilDclTable::getField ( string  $field_id)

Definition at line 348 of file class.ilDclTable.php.

References getFields(), and null.

Referenced by getPartialRecords().

349  {
350  $fields = $this->getFields();
351  $field = null;
352  foreach ($fields as $field_1) {
353  if ($field_1->getId() == $field_id) {
354  $field = $field_1;
355  }
356  }
357 
358  return $field;
359  }
getFields()
Returns all fields of this table including the standard fields.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFieldByTitle()

ilDclTable::getFieldByTitle ( string  $title)

Get a field by title.

Definition at line 821 of file class.ilDclTable.php.

References $title, getFields(), and null.

Referenced by getPartialRecords().

822  {
823  $return = null;
824  foreach ($this->getFields() as $field) {
825  if ($field->getTitle() == $title) {
826  $return = $field;
827  break;
828  }
829  }
830 
831  return $return;
832  }
getFields()
Returns all fields of this table including the standard fields.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFieldIds()

ilDclTable::getFieldIds ( )
Returns
int[]

Definition at line 364 of file class.ilDclTable.php.

References getFields().

364  : array
365  {
366  $field_ids = [];
367  foreach ($this->getFields() as $field) {
368  if ($field->getId()) {
369  $field_ids[] = $field->getId();
370  }
371  }
372 
373  return $field_ids;
374  }
getFields()
Returns all fields of this table including the standard fields.
+ Here is the call graph for this function:

◆ getFields()

ilDclTable::getFields ( )

Returns all fields of this table including the standard fields.

Parameters
bool$force_include_commentsby default false, so comments will only load when enabled in tablesettings
Returns
ilDclBaseFieldModel[]

Definition at line 466 of file class.ilDclTable.php.

References $all_fields, null, and reloadFields().

Referenced by afterClone(), buildOrderFields(), cloneStructure(), ilDclContentExporter\fillHeaderExcel(), ilDclContentExporter\fillRowExcel(), getExportableFields(), getField(), getFieldByTitle(), getFieldIds(), getFieldsForFormula(), getNewFieldOrder(), and updateFields().

466  : array
467  {
468  if ($this->all_fields == null) {
469  $this->reloadFields();
470  }
471 
472  return $this->all_fields;
473  }
array $all_fields
table fields and std fields combined
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFieldsForFormula()

ilDclTable::getFieldsForFormula ( )

Returns all fields of this table including the standard fields, wich are supported for formulas.

Returns
ilDclBaseFieldModel[]

Definition at line 533 of file class.ilDclTable.php.

References $stdFields, ilDclStandardField\_getStandardFields(), getFields(), getPublicCommentsEnabled(), null, and ilDclFormulaFieldModel\SUPPORTED_FIELDS.

533  : array
534  {
535  $syntax_chars = array_merge(
536  array_map(static fn(Operators $function): string => $function->value, Operators::cases()),
537  array_map(static fn(Functions $function): string => $function->value, Functions::cases()),
538  ['(', ')', ',']
539  );
540  foreach ($this->getFields() as $field) {
541  if (in_array($field->getDatatypeId(), ilDclFormulaFieldModel::SUPPORTED_FIELDS)) {
542  foreach ($syntax_chars as $element) {
543  if (str_contains($field->getTitle(), $element)) {
544  continue 2;
545  }
546  }
547  $return[] = $field;
548  }
549  }
550 
551  return $return;
552  }
getFields()
Returns all fields of this table including the standard fields.
+ Here is the call graph for this function:

◆ getFirstTableViewId()

ilDclTable::getFirstTableViewId ( int  $ref_id,
int  $user_id = 0,
bool  $with_detailed_view = false 
)

get id of first (for current user) available view

Definition at line 520 of file class.ilDclTable.php.

References $user_id, getVisibleTableViews(), and null.

520  : ?int
521  {
522  $uid = $user_id;
523  $array = $this->getVisibleTableViews($ref_id, $with_detailed_view, $uid);
524  $tableview = array_shift($array);
525 
526  return $tableview ? $tableview->getId() : null;
527  }
getVisibleTableViews(int $ref_id, bool $with_active_detailedview=false, int $user_id=0)
For current user.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ getId()

ilDclTable::getId ( )

Get table id.

Definition at line 272 of file class.ilDclTable.php.

References $id.

Referenced by cloneStructure(), doCreate(), doDelete(), doRead(), doUpdate(), ilDclTableListGUI\getActions(), getNewTableviewOrder(), getPartialRecords(), getTableViews(), loadCustomFields(), ilDclTableEditGUI\setAsDefault(), and updateOrder().

272  : int
273  {
274  return $this->id;
275  }
+ Here is the caller graph for this function:

◆ getImportEnabled()

ilDclTable::getImportEnabled ( )

Definition at line 1195 of file class.ilDclTable.php.

References $import_enabled.

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

1195  : bool
1196  {
1197  return $this->import_enabled;
1198  }
+ Here is the caller graph for this function:

◆ getIsVisible()

ilDclTable::getIsVisible ( )

Definition at line 931 of file class.ilDclTable.php.

References $is_visible.

Referenced by cloneStructure(), doCreate(), doUpdate(), and ilDclTableListGUI\getActions().

931  : bool
932  {
933  return $this->is_visible;
934  }
+ Here is the caller graph for this function:

◆ getLimited()

ilDclTable::getLimited ( )

Definition at line 901 of file class.ilDclTable.php.

References $limited.

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

901  : bool
902  {
903  return $this->limited;
904  }
+ Here is the caller graph for this function:

◆ getLimitEnd()

ilDclTable::getLimitEnd ( )

Definition at line 911 of file class.ilDclTable.php.

References $limit_end.

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

911  : string
912  {
913  return $this->limit_end;
914  }
+ Here is the caller graph for this function:

◆ getLimitStart()

ilDclTable::getLimitStart ( )

Definition at line 921 of file class.ilDclTable.php.

References $limit_start.

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

921  : string
922  {
923  return $this->limit_start;
924  }
string $limit_start
+ Here is the caller graph for this function:

◆ getNewFieldOrder()

ilDclTable::getNewFieldOrder ( )

getNewOrder

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

Definition at line 423 of file class.ilDclTable.php.

References getFields().

423  : int
424  {
425  $fields = $this->getFields();
426  $place = 0;
427  foreach ($fields as $field) {
428  if (!$field->isStandardField()) {
429  $place = $field->getOrder() + 1;
430  }
431  }
432 
433  return $place;
434  }
getFields()
Returns all fields of this table including the standard fields.
+ Here is the call graph for this function:

◆ getNewTableviewOrder()

ilDclTable::getNewTableviewOrder ( )
Returns
int

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

References ilDclTableView\getCountForTableId(), and getId().

439  : int
440  {
441  return (ilDclTableView::getCountForTableId($this->getId()) + 1) * 10;
442  }
getId()
Get table id.
static getCountForTableId(int $table_id)
+ Here is the call graph for this function:

◆ getObjId()

ilDclTable::getObjId ( )

◆ getOrder()

ilDclTable::getOrder ( )

Definition at line 1163 of file class.ilDclTable.php.

References $table_order, and updateOrder().

Referenced by cloneStructure(), doCreate(), doUpdate(), and ilDclTableListGUI\getActions().

1163  : int
1164  {
1165  if (!$this->table_order) {
1166  $this->updateOrder();
1167  }
1168 
1169  return $this->table_order;
1170  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPartialRecords()

ilDclTable::getPartialRecords ( string  $ref_id,
string  $sort,
string  $direction,
?int  $limit,
int  $offset,
array  $filter = [] 
)

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 1226 of file class.ilDclTable.php.

References Vendor\Package\$a, Vendor\Package\$b, $DIC, $id, $records, getField(), getFieldByTitle(), getId(), getObjId(), ilDclCache\getRecordCache(), getViewOwnRecordsPerm(), ilObjDataCollectionAccess\hasEditAccess(), ilObjDataCollectionAccess\hasWriteAccess(), null, ilSession\set(), and ILIAS\Repository\user().

Referenced by ilDclRecordListGUI\getRecordListTableGUI().

1233  : array {
1234  $sort_field = $this->getFieldByTitle($sort);
1235  $direction = strtolower($direction);
1236  $direction = (in_array($direction, ['desc', 'asc'])) ? $direction : 'asc';
1237 
1238  // Sorting by a status from an ILIAS Ref field. This column is added dynamically to the table, there is no field model
1239  $sort_by_status = false;
1240  if (substr($sort, 0, 8) == '_status_') {
1241  $sort_by_status = true;
1242  $sort_field = $this->getFieldByTitle(substr($sort, 8));
1243  }
1244 
1245  if (is_null($sort_field)) {
1246  $sort_field = $this->getField('id');
1247  }
1248 
1249  $sort_query_object = $sort_field->getRecordQuerySortObject($direction, $sort_by_status);
1250 
1251  $select_str = ($sort_query_object != null) ? $sort_query_object->getSelectStatement() : '';
1252  $join_str = ($sort_query_object != null) ? $sort_query_object->getJoinStatement() : '';
1253  $where_str = ($sort_query_object != null) ? $sort_query_object->getWhereStatement() : '';
1254  $order_str = ($sort_query_object != null) ? $sort_query_object->getOrderStatement() : '';
1255  $group_str = ($sort_query_object != null) ? $sort_query_object->getGroupStatement() : '';
1256 
1257  if (count($filter)) {
1258  foreach ($filter as $key => $filter_value) {
1259  $filter_field_id = substr($key, 7);
1260  $filter_field = $this->getField($filter_field_id);
1261  $filter_record_query_object = $filter_field->getRecordQueryFilterObject($filter_value, $sort_field);
1262 
1263  if ($filter_record_query_object) {
1264  $select_str .= $filter_record_query_object->getSelectStatement();
1265  $join_str .= $filter_record_query_object->getJoinStatement();
1266  $where_str .= $filter_record_query_object->getWhereStatement();
1267  $group_str .= $filter_record_query_object->getGroupStatement();
1268  }
1269  }
1270  }
1271 
1272  // Build the query string
1273  $sql = "SELECT DISTINCT record.id, record.owner";
1274  if ($select_str) {
1275  $sql .= ', ';
1276  }
1277 
1278  $as = ' AS ';
1279 
1280  $sql .= rtrim($select_str, ',') . " FROM il_dcl_record $as record ";
1281  $sql .= $join_str;
1282  $sql .= " WHERE record.table_id = " . $this->db->quote($this->getId(), 'integer');
1283 
1284  if (strlen($where_str) > 0) {
1285  $sql .= $where_str;
1286  }
1287 
1288  if (strlen($group_str) > 0) {
1289  $sql .= " GROUP BY " . $group_str;
1290  }
1291 
1292  if (strlen($order_str) > 0) {
1293  $sql .= " ORDER BY " . $order_str;
1294  }
1295 
1296  $set = $this->db->query($sql);
1297  $total_record_ids = [];
1298 
1300  while ($rec = $this->db->fetchAssoc($set)) {
1301  // Quick check if the current user is allowed to view the record
1302  if (!$is_allowed_to_view && ($this->getViewOwnRecordsPerm() && $this->user->getId() != $rec['owner'])) {
1303  continue;
1304  }
1305  $total_record_ids[] = $rec['id'];
1306  }
1307  // Save record-ids in session to enable prev/next links in detail view
1308  ilSession::set('dcl_table_id', $this->getId());
1309  ilSession::set('dcl_record_ids', $total_record_ids);
1310 
1311  if ($sort_query_object != null) {
1312  $total_record_ids = $sort_query_object->applyCustomSorting($sort_field, $total_record_ids, $direction);
1313  }
1314 
1315  if ($sort === 'n_comments') {
1316  global $DIC;
1317  $comments_nr = [];
1318  foreach ($total_record_ids as $id) {
1319  $comments_nr[$id] = $DIC->notes()->domain()->getNrOfCommentsForContext($DIC->notes()->data()->context($this->getObjId(), $id, 'dcl'));
1320  }
1321  uasort($comments_nr, static fn($a, $b) => ($direction === 'asc' ? 1 : -1) * ($a <=> $b));
1322  $total_record_ids = array_keys($comments_nr);
1323  }
1324 
1325  // Now slice the array to load only the needed records in memory
1326  $record_ids = array_slice($total_record_ids, $offset, $limit);
1327 
1328  $records = [];
1329  foreach ($record_ids as $id) {
1331  }
1332 
1333  return ['records' => $records, 'total' => count($total_record_ids)];
1334  }
getFieldByTitle(string $title)
Get a field by title.
getId()
Get table id.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:22
static hasWriteAccess(int $ref, ?int $user_id=0)
getField(string $field_id)
static getRecordCache(?int $record_id)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
static hasEditAccess(int $ref, ?int $user_id=0)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPublicCommentsEnabled()

ilDclTable::getPublicCommentsEnabled ( )

Definition at line 975 of file class.ilDclTable.php.

References $public_comments.

Referenced by cloneStructure(), doCreate(), doUpdate(), ilDclTableListGUI\getActions(), and getFieldsForFormula().

975  : bool
976  {
977  return $this->public_comments;
978  }
bool $public_comments
True if users can add comments on each record of this table.
+ Here is the caller graph for this function:

◆ getRecordFields()

ilDclTable::getRecordFields ( )

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

Returns
ilDclBaseFieldModel[]

Definition at line 582 of file class.ilDclTable.php.

References $fields, and loadCustomFields().

Referenced by doDelete(), getEditableFields(), and ilDclContentImporter\getImportFieldsFromTitles().

582  : array
583  {
584  $this->loadCustomFields();
585 
586  return $this->fields;
587  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecords()

ilDclTable::getRecords ( )
Returns
ilDclBaseRecordModel[]

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

References $records, loadRecords(), and null.

Referenced by _hasRecords(), afterClone(), cloneStructure(), deleteField(), and doDelete().

314  : array
315  {
316  if ($this->records == null) {
317  $this->loadRecords();
318  }
319 
320  return $this->records;
321  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSaveConfirmation()

ilDclTable::getSaveConfirmation ( )

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

References $save_confirmation.

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

990  : bool
991  {
993  }
bool $save_confirmation
+ Here is the caller graph for this function:

◆ getTableViews()

ilDclTable::getTableViews ( )
Returns
ilDclTableView[] all tableviews ordered by tableview_order

Definition at line 489 of file class.ilDclTable.php.

References ilDclTableView\getAllForTableId(), and getId().

Referenced by cloneStructure(), getVisibleTableViews(), and sortTableViews().

489  : array
490  {
491  return ilDclTableView::getAllForTableId($this->getId());
492  }
getId()
Get table id.
static getAllForTableId(int $table_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilDclTable::getTitle ( )

Definition at line 292 of file class.ilDclTable.php.

References $title.

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

292  : string
293  {
294  return $this->title;
295  }
+ Here is the caller graph for this function:

◆ getViewOwnRecordsPerm()

ilDclTable::getViewOwnRecordsPerm ( )

Definition at line 985 of file class.ilDclTable.php.

References $view_own_records_perm.

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

985  : bool
986  {
987  return (bool) $this->view_own_records_perm;
988  }
int $view_own_records_perm
True if user can only view his/her own entries in the table.
+ Here is the caller graph for this function:

◆ getVisibleTableViews()

ilDclTable::getVisibleTableViews ( int  $ref_id,
bool  $with_active_detailedview = false,
int  $user_id = 0 
)

For current user.

Returns
ilDclTableView[]

Definition at line 498 of file class.ilDclTable.php.

References $user_id, getTableViews(), ilObjDataCollectionAccess\hasAccessToTableView(), and ilObjDataCollectionAccess\hasWriteAccess().

Referenced by getFirstTableViewId().

498  : array
499  {
500  if (ilObjDataCollectionAccess::hasWriteAccess($ref_id, $user_id) && !$with_active_detailedview) {
501  return $this->getTableViews();
502  }
503 
504  $visible_views = [];
505  foreach ($this->getTableViews() as $tableView) {
507  $page = new ilDclDetailedViewDefinitionGUI($tableView->getId());
508  if (!$with_active_detailedview || $page->getPageObject()->isActive()) {
509  $visible_views[] = $tableView;
510  }
511  }
512  }
513 
514  return $visible_views;
515  }
static hasAccessToTableView(ilDclTableView $tableview, ?int $user_id=0)
ilDclDetailedViewDefinitionGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector ilDcl...
$ref_id
Definition: ltiauth.php:65
static hasWriteAccess(int $ref, ?int $user_id=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasCustomFields()

ilDclTable::hasCustomFields ( )

Definition at line 1000 of file class.ilDclTable.php.

References loadCustomFields().

1000  : bool
1001  {
1002  $this->loadCustomFields();
1003 
1004  return count($this->fields) > 0;
1005  }
+ Here is the call graph for this function:

◆ hasPermissionToDeleteRecord()

ilDclTable::hasPermissionToDeleteRecord ( int  $ref_id,
ilDclBaseRecordModel  $record 
)
Parameters
int$ref_idthe reference id of the current datacollection object
ilDclBaseRecordModel$recordthe record which will be deleted

Definition at line 664 of file class.ilDclTable.php.

References ilObject\_lookupObjectId(), checkLimit(), doesRecordBelongToUser(), getDeleteByOwner(), getDeletePerm(), getObjId(), ilObjDataCollectionAccess\hasAddRecordAccess(), and ilObjDataCollectionAccess\hasWriteAccess().

664  : bool
665  {
667  return false;
668  }
670  return true;
671  }
673  return false;
674  }
675  if (!$this->checkLimit()) {
676  return false;
677  }
678  if ($this->getDeletePerm() && !$this->getDeleteByOwner()) {
679  return true;
680  }
681  if ($this->getDeleteByOwner()) {
682  return $this->doesRecordBelongToUser($record);
683  }
684 
685  return false;
686  }
static hasAddRecordAccess(int $ref, ?int $user_id=0)
doesRecordBelongToUser(ilDclBaseRecordModel $record)
$ref_id
Definition: ltiauth.php:65
static _lookupObjectId(int $ref_id)
static hasWriteAccess(int $ref, ?int $user_id=0)
+ Here is the call graph for this function:

◆ hasPermissionToDeleteRecords()

ilDclTable::hasPermissionToDeleteRecords ( int  $ref_id)
Parameters
$ref_id
Returns
bool

Definition at line 692 of file class.ilDclTable.php.

References ilObject\_lookupObjectId(), getDeletePerm(), getObjId(), ilObjDataCollectionAccess\hasAddRecordAccess(), and ilObjDataCollectionAccess\hasWriteAccess().

692  : bool
693  {
695  return false;
696  }
697 
700  }
static hasAddRecordAccess(int $ref, ?int $user_id=0)
$ref_id
Definition: ltiauth.php:65
static _lookupObjectId(int $ref_id)
static hasWriteAccess(int $ref, ?int $user_id=0)
+ Here is the call graph for this function:

◆ hasPermissionToEditRecord()

ilDclTable::hasPermissionToEditRecord ( int  $ref_id,
ilDclBaseRecordModel  $record 
)
Parameters
$ref_idint the reference id of the current datacollection object
$recordilDclBaseRecordModel the record which will be edited
Returns
bool

Definition at line 633 of file class.ilDclTable.php.

References ilObject\_lookupObjectId(), checkLimit(), doesRecordBelongToUser(), getEditByOwner(), getEditPerm(), getObjId(), ilObjDataCollectionAccess\hasAddRecordAccess(), ilObjDataCollectionAccess\hasEditAccess(), and ilObjDataCollectionAccess\hasWriteAccess().

633  : bool
634  {
636  return false;
637  }
639  return true;
640  }
642  return false;
643  }
644  if ($this->getEditByOwner()) {
645  return $this->doesRecordBelongToUser($record);
646  }
647  if (!$this->checkLimit()) {
648  return false;
649  }
651  return true;
652  }
653  if ($this->getEditPerm() && !$this->getEditByOwner()) {
654  return true;
655  }
656 
657  return false;
658  }
static hasAddRecordAccess(int $ref, ?int $user_id=0)
doesRecordBelongToUser(ilDclBaseRecordModel $record)
$ref_id
Definition: ltiauth.php:65
static _lookupObjectId(int $ref_id)
static hasWriteAccess(int $ref, ?int $user_id=0)
static hasEditAccess(int $ref, ?int $user_id=0)
+ Here is the call graph for this function:

◆ hasPermissionToViewRecord()

ilDclTable::hasPermissionToViewRecord ( int  $ref_id,
ilDclBaseRecordModel  $record,
int  $user_id = 0 
)

Definition at line 702 of file class.ilDclTable.php.

References $user_id, ilObject\_lookupObjectId(), getObjId(), ilDclBaseRecordModel\getOwner(), getViewOwnRecordsPerm(), ilObjDataCollectionAccess\hasEditAccess(), ilObjDataCollectionAccess\hasReadAccess(), ilObjDataCollectionAccess\hasWriteAccess(), and ILIAS\Repository\user().

702  : bool
703  {
705  return false;
706  }
708  $ref_id,
709  $user_id
711  return true;
712  }
714  // Check for view only own entries setting
715  if ($this->getViewOwnRecordsPerm() && ($user_id ?: $this->user->getId()) != $record->getOwner()) {
716  return false;
717  }
718 
719  return true;
720  }
721 
722  return false;
723  }
$ref_id
Definition: ltiauth.php:65
static _lookupObjectId(int $ref_id)
static hasWriteAccess(int $ref, ?int $user_id=0)
static hasReadAccess(int $ref, ?int $user_id=0)
static hasEditAccess(int $ref, ?int $user_id=0)
+ Here is the call graph for this function:

◆ loadCustomFields()

ilDclTable::loadCustomFields ( )
protected

Definition at line 376 of file class.ilDclTable.php.

References $fields, ilDclCache\buildFieldFromRecord(), ilDclDatatype\getAllDatatype(), getId(), and ilDclCache\preloadFieldProperties().

Referenced by getCustomFields(), getRecordFields(), hasCustomFields(), and reloadFields().

376  : void
377  {
378  if (!$this->fields) {
379  $query
380  = "SELECT DISTINCT il_dcl_field.*, il_dcl_tfield_set.field_order
381  FROM il_dcl_field
382  INNER JOIN il_dcl_tfield_set
383  ON ( il_dcl_tfield_set.field NOT IN ('owner',
384  'last_update',
385  'last_edit_by',
386  'id',
387  'create_date')
388  AND il_dcl_tfield_set.table_id = il_dcl_field.table_id
389  AND il_dcl_tfield_set.field = " . $this->db->cast("il_dcl_field.id", "text") . ")
390  WHERE il_dcl_field.table_id = %s
391  ORDER BY il_dcl_tfield_set.field_order ASC";
392 
393  $set = $this->db->queryF($query, ['integer'], [$this->getId()]);
394  $fields = [];
395  while ($rec = $this->db->fetchAssoc($set)) {
396  $field = ilDclCache::buildFieldFromRecord($rec);
397  if ($this->show_invalid || in_array($field->getDatatypeId(), array_keys(ilDclDatatype::getAllDatatype()))) {
398  $fields[] = $field;
399  }
400  }
401  $this->fields = $fields;
402 
404  }
405  }
static preloadFieldProperties(array $fields)
Preloads field properties.
getId()
Get table id.
static getAllDatatype(bool $force=false)
Get all possible Datatypes.
static buildFieldFromRecord(array $rec)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadObj()

ilDclTable::loadObj ( )
protected

Definition at line 304 of file class.ilDclTable.php.

References null.

Referenced by getCollectionObject().

304  : void
305  {
306  if ($this->obj == null) {
307  $this->obj = new ilObjDataCollection($this->objId, false);
308  }
309  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ loadRecords()

ilDclTable::loadRecords ( )

Definition at line 323 of file class.ilDclTable.php.

References $records, and ilDclCache\getRecordCache().

Referenced by getRecords().

323  : void
324  {
325  $records = [];
326  $query = "SELECT id FROM il_dcl_record WHERE table_id = " . $this->db->quote($this->id, "integer");
327  $set = $this->db->query($query);
328 
329  while ($rec = $this->db->fetchAssoc($set)) {
330  $records[$rec['id']] = ilDclCache::getRecordCache($rec['id']);
331  }
332 
333  $this->records = $records;
334  }
static getRecordCache(?int $record_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reloadFields()

ilDclTable::reloadFields ( )

Definition at line 475 of file class.ilDclTable.php.

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

Referenced by getFields().

475  : void
476  {
477  $this->loadCustomFields();
478  $this->stdFields = $this->getStandardFields();
479  $fields = array_merge($this->fields, $this->stdFields);
480 
481  $this->sortByOrder($fields);
482 
483  $this->all_fields = $fields;
484  }
sortByOrder(array &$array)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAddPerm()

ilDclTable::setAddPerm ( bool  $add_perm)

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

References $add_perm.

Referenced by cloneStructure(), and doRead().

834  : void
835  {
836  $this->add_perm = $add_perm;
837  }
+ Here is the caller graph for this function:

◆ setDefaultSortField()

ilDclTable::setDefaultSortField ( string  $default_sort_field)

Definition at line 946 of file class.ilDclTable.php.

References $default_sort_field.

Referenced by cloneStructure(), and doRead().

946  : void
947  {
948  $default_sort_field = ($default_sort_field) ?: ""; // Change null or empty strings to zero
949  $this->default_sort_field = $default_sort_field;
950  }
string $default_sort_field
+ Here is the caller graph for this function:

◆ setDefaultSortFieldOrder()

ilDclTable::setDefaultSortFieldOrder ( string  $default_sort_field_order)

Definition at line 957 of file class.ilDclTable.php.

References $default_sort_field_order.

Referenced by cloneStructure(), and doRead().

957  : void
958  {
959  if (!in_array($default_sort_field_order, ['asc', 'desc'])) {
961  }
962  $this->default_sort_field_order = $default_sort_field_order;
963  }
string $default_sort_field_order
Default sort-order (asc|desc)
+ Here is the caller graph for this function:

◆ setDeleteByOwner()

ilDclTable::setDeleteByOwner ( bool  $delete_by_owner)

Definition at line 875 of file class.ilDclTable.php.

References $delete_by_owner, and setDeletePerm().

Referenced by cloneStructure(), doRead(), and setDeletePerm().

875  : void
876  {
877  $this->delete_by_owner = $delete_by_owner;
878  if ($delete_by_owner) {
879  $this->setDeletePerm(true);
880  }
881  }
setDeletePerm(bool $delete_perm)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDeletePerm()

ilDclTable::setDeletePerm ( bool  $delete_perm)

Definition at line 844 of file class.ilDclTable.php.

References $delete_perm, and setDeleteByOwner().

Referenced by cloneStructure(), doRead(), and setDeleteByOwner().

844  : void
845  {
846  $this->delete_perm = $delete_perm;
847  if (!$delete_perm) {
848  $this->setDeleteByOwner(false);
849  }
850  }
setDeleteByOwner(bool $delete_by_owner)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDescription()

ilDclTable::setDescription ( string  $description)

Definition at line 936 of file class.ilDclTable.php.

References $description.

Referenced by cloneStructure(), and doRead().

936  : void
937  {
938  $this->description = $description;
939  }
string $description
Description for this table displayed above records.
+ Here is the caller graph for this function:

◆ setEditByOwner()

ilDclTable::setEditByOwner ( bool  $edit_by_owner)

Definition at line 857 of file class.ilDclTable.php.

References $edit_by_owner, and setEditPerm().

Referenced by cloneStructure(), doRead(), and setEditPerm().

857  : void
858  {
859  $this->edit_by_owner = $edit_by_owner;
860  if ($edit_by_owner) {
861  $this->setEditPerm(true);
862  }
863  }
setEditPerm(bool $edit_perm)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setEditPerm()

ilDclTable::setEditPerm ( bool  $edit_perm)

Definition at line 883 of file class.ilDclTable.php.

References $edit_perm, and setEditByOwner().

Referenced by cloneStructure(), doRead(), and setEditByOwner().

883  : void
884  {
885  $this->edit_perm = $edit_perm;
886  if (!$edit_perm) {
887  $this->setEditByOwner(false);
888  }
889  }
setEditByOwner(bool $edit_by_owner)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setExportEnabled()

ilDclTable::setExportEnabled ( bool  $export_enabled)

Definition at line 1153 of file class.ilDclTable.php.

References $export_enabled.

Referenced by cloneStructure(), and doRead().

1153  : void
1154  {
1155  $this->export_enabled = $export_enabled;
1156  }
+ Here is the caller graph for this function:

◆ setId()

ilDclTable::setId ( int  $a_id)

Set table id.

Definition at line 264 of file class.ilDclTable.php.

Referenced by doCreate().

264  : void
265  {
266  $this->id = $a_id;
267  }
+ Here is the caller graph for this function:

◆ setImportEnabled()

ilDclTable::setImportEnabled ( bool  $import_enabled)

Definition at line 1190 of file class.ilDclTable.php.

References $import_enabled.

Referenced by cloneStructure(), and doRead().

1190  : void
1191  {
1192  $this->import_enabled = $import_enabled;
1193  }
+ Here is the caller graph for this function:

◆ setIsVisible()

ilDclTable::setIsVisible ( bool  $is_visible)

Definition at line 926 of file class.ilDclTable.php.

References $is_visible.

Referenced by cloneStructure(), and doRead().

926  : void
927  {
928  $this->is_visible = $is_visible;
929  }
+ Here is the caller graph for this function:

◆ setLimited()

ilDclTable::setLimited ( bool  $limited)

Definition at line 896 of file class.ilDclTable.php.

References $limited.

Referenced by cloneStructure(), and doRead().

896  : void
897  {
898  $this->limited = $limited;
899  }
+ Here is the caller graph for this function:

◆ setLimitEnd()

ilDclTable::setLimitEnd ( string  $limit_end)

Definition at line 906 of file class.ilDclTable.php.

References $limit_end.

Referenced by cloneStructure(), and doRead().

906  : void
907  {
908  $this->limit_end = $limit_end;
909  }
+ Here is the caller graph for this function:

◆ setLimitStart()

ilDclTable::setLimitStart ( string  $limit_start)

Definition at line 916 of file class.ilDclTable.php.

References $limit_start.

Referenced by cloneStructure(), and doRead().

916  : void
917  {
918  $this->limit_start = $limit_start;
919  }
string $limit_start
+ Here is the caller graph for this function:

◆ setObjId()

ilDclTable::setObjId ( int  $a_id)

Definition at line 277 of file class.ilDclTable.php.

Referenced by doRead().

277  : void
278  {
279  $this->objId = $a_id;
280  }
+ Here is the caller graph for this function:

◆ setOrder()

ilDclTable::setOrder ( int  $table_order)

Definition at line 1185 of file class.ilDclTable.php.

References $table_order.

Referenced by cloneStructure(), doRead(), and ilDclTableEditGUI\setAsDefault().

1185  : void
1186  {
1187  $this->table_order = $table_order;
1188  }
+ Here is the caller graph for this function:

◆ setPublicCommentsEnabled()

ilDclTable::setPublicCommentsEnabled ( bool  $public_comments)

Definition at line 970 of file class.ilDclTable.php.

References $public_comments.

Referenced by cloneStructure(), and doRead().

970  : void
971  {
972  $this->public_comments = $public_comments;
973  }
bool $public_comments
True if users can add comments on each record of this table.
+ Here is the caller graph for this function:

◆ setSaveConfirmation()

ilDclTable::setSaveConfirmation ( bool  $save_confirmation)

Definition at line 995 of file class.ilDclTable.php.

References $save_confirmation.

Referenced by cloneStructure(), and doRead().

995  : void
996  {
997  $this->save_confirmation = $save_confirmation;
998  }
bool $save_confirmation
+ Here is the caller graph for this function:

◆ setTitle()

ilDclTable::setTitle ( string  $a_title)

Definition at line 287 of file class.ilDclTable.php.

Referenced by cloneStructure(), and doRead().

287  : void
288  {
289  $this->title = $a_title;
290  }
+ Here is the caller graph for this function:

◆ setViewOwnRecordsPerm()

ilDclTable::setViewOwnRecordsPerm ( bool  $view_own_perm)

Definition at line 980 of file class.ilDclTable.php.

References ILIAS\Repository\int().

Referenced by cloneStructure(), and doRead().

980  : void
981  {
982  $this->view_own_records_perm = (int) $view_own_perm;
983  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showInvalidFields()

ilDclTable::showInvalidFields ( bool  $value)

Definition at line 1336 of file class.ilDclTable.php.

1336  : void
1337  {
1338  $this->show_invalid = $value;
1339  }

◆ sortByOrder()

ilDclTable::sortByOrder ( array &  $array)
protected
Parameters
ilDclBaseFieldModel[]$array the array to sort

Definition at line 792 of file class.ilDclTable.php.

Referenced by buildOrderFields(), reloadFields(), and sortFields().

792  : void
793  {
794  // php-bug: https://bugs.php.net/bug.php?id=50688
795  // fixed in php 7 but for now we need the @ a workaround
796  usort($array, [$this, "compareOrder"]);
797  }
+ Here is the caller graph for this function:

◆ sortFields()

ilDclTable::sortFields ( array &  $fields)

sortFields

Parameters
ilDclBaseFieldModel[]$fields

Definition at line 777 of file class.ilDclTable.php.

References sortByOrder().

777  : void
778  {
779  $this->sortByOrder($fields);
780  //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.
781  $named = [];
782  foreach ($fields as $field) {
783  $named[$field->getId()] = $field;
784  }
785 
786  $fields = $named;
787  }
sortByOrder(array &$array)
+ Here is the call graph for this function:

◆ sortTableViews()

ilDclTable::sortTableViews ( ?array  $tableviews = null)
Parameters
ilDclTableView[]$tableviews

Definition at line 447 of file class.ilDclTable.php.

References getTableViews(), and null.

447  : void
448  {
449  if ($tableviews == null) {
450  $tableviews = $this->getTableViews();
451  }
452 
453  $order = 10;
454  foreach ($tableviews as $tableview) {
455  $tableview->setTableviewOrder($order);
456  $tableview->update();
457  $order += 10;
458  }
459  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ updateFields()

ilDclTable::updateFields ( )

Update fields.

Definition at line 766 of file class.ilDclTable.php.

References getFields().

766  : void
767  {
768  foreach ($this->getFields() as $field) {
769  $field->doUpdate();
770  }
771  }
getFields()
Returns all fields of this table including the standard fields.
+ Here is the call graph for this function:

◆ updateOrder()

ilDclTable::updateOrder ( )

Definition at line 1172 of file class.ilDclTable.php.

References getId().

Referenced by getOrder().

1172  : void
1173  {
1174  $result = $this->db->query('SELECT MAX(table_order) AS table_order FROM il_dcl_table WHERE obj_id = ' . $this->db->quote(
1175  $this->getCollectionObject()->getId(),
1176  'integer'
1177  ));
1178  $this->table_order = $this->db->fetchObject($result)->table_order + 10;
1179  $this->db->query('UPDATE il_dcl_table SET table_order = ' . $this->db->quote(
1180  $this->table_order,
1181  'integer'
1182  ) . ' WHERE id = ' . $this->db->quote($this->getId(), 'integer'));
1183  }
getId()
Get table id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $add_perm

bool ilDclTable::$add_perm = false
protected

Definition at line 43 of file class.ilDclTable.php.

Referenced by getAddPerm(), and setAddPerm().

◆ $all_fields

array ilDclTable::$all_fields = null
protected

table fields and std fields combined

Definition at line 76 of file class.ilDclTable.php.

Referenced by getFields().

◆ $db

ilDBInterface ilDclTable::$db
protected

Definition at line 80 of file class.ilDclTable.php.

◆ $default_sort_field

string ilDclTable::$default_sort_field = "0"
protected

Definition at line 56 of file class.ilDclTable.php.

Referenced by getDefaultSortField(), and setDefaultSortField().

◆ $default_sort_field_order

string ilDclTable::$default_sort_field_order = 'asc'
protected

Default sort-order (asc|desc)

Definition at line 60 of file class.ilDclTable.php.

Referenced by getDefaultSortFieldOrder(), and setDefaultSortFieldOrder().

◆ $delete_by_owner

bool ilDclTable::$delete_by_owner = false
protected

Definition at line 47 of file class.ilDclTable.php.

Referenced by getDeleteByOwner(), and setDeleteByOwner().

◆ $delete_perm

bool ilDclTable::$delete_perm = false
protected

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

Referenced by getDeletePerm(), and setDeletePerm().

◆ $description

string ilDclTable::$description = ''
protected

Description for this table displayed above records.

Definition at line 64 of file class.ilDclTable.php.

Referenced by getDescription(), and setDescription().

◆ $edit_by_owner

bool ilDclTable::$edit_by_owner = false
protected

Definition at line 46 of file class.ilDclTable.php.

Referenced by getEditByOwner(), and setEditByOwner().

◆ $edit_perm

bool ilDclTable::$edit_perm = false
protected

Definition at line 44 of file class.ilDclTable.php.

Referenced by getEditPerm(), and setEditPerm().

◆ $export_enabled

bool ilDclTable::$export_enabled = false
protected

Definition at line 52 of file class.ilDclTable.php.

Referenced by getExportEnabled(), and setExportEnabled().

◆ $fields

array ilDclTable::$fields = []
protected

◆ $http

ILIAS HTTP Services ilDclTable::$http
protected

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

◆ $id

int ilDclTable::$id = 0
protected

Definition at line 26 of file class.ilDclTable.php.

Referenced by _getTableIdByTitle(), getId(), and getPartialRecords().

◆ $import_enabled

bool ilDclTable::$import_enabled = false
protected

Definition at line 54 of file class.ilDclTable.php.

Referenced by getImportEnabled(), and setImportEnabled().

◆ $is_visible

bool ilDclTable::$is_visible = false
protected

Definition at line 42 of file class.ilDclTable.php.

Referenced by getIsVisible(), and setIsVisible().

◆ $limit_end

string ilDclTable::$limit_end = ""
protected

Definition at line 51 of file class.ilDclTable.php.

Referenced by getLimitEnd(), and setLimitEnd().

◆ $limit_start

string ilDclTable::$limit_start = ""
protected

Definition at line 50 of file class.ilDclTable.php.

Referenced by getLimitStart(), and setLimitStart().

◆ $limited

bool ilDclTable::$limited = false
protected

Definition at line 49 of file class.ilDclTable.php.

Referenced by getLimited(), and setLimited().

◆ $obj

ilObjDataCollection ilDclTable::$obj = null
protected

Definition at line 28 of file class.ilDclTable.php.

Referenced by getCollectionObject().

◆ $objId

int ilDclTable::$objId = null
protected

Definition at line 27 of file class.ilDclTable.php.

Referenced by getObjId().

◆ $public_comments

bool ilDclTable::$public_comments = false
protected

True if users can add comments on each record of this table.

Definition at line 68 of file class.ilDclTable.php.

Referenced by getPublicCommentsEnabled(), and setPublicCommentsEnabled().

◆ $records

array ilDclTable::$records = []
protected

Definition at line 41 of file class.ilDclTable.php.

Referenced by getPartialRecords(), getRecords(), and loadRecords().

◆ $refinery

ILIAS Refinery Factory ilDclTable::$refinery
protected

Definition at line 78 of file class.ilDclTable.php.

◆ $save_confirmation

bool ilDclTable::$save_confirmation = false
protected

Definition at line 48 of file class.ilDclTable.php.

Referenced by getSaveConfirmation(), and setSaveConfirmation().

◆ $show_invalid

bool ilDclTable::$show_invalid = false
protected

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

◆ $stdFields

array ilDclTable::$stdFields = []
protected

Definition at line 37 of file class.ilDclTable.php.

Referenced by getFieldsForFormula().

◆ $table_order

int ilDclTable::$table_order = 0
protected

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

Referenced by getOrder(), and setOrder().

◆ $title

string ilDclTable::$title = ""
protected

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

Referenced by getFieldByTitle(), and getTitle().

◆ $user

ilObjUser ilDclTable::$user
protected

Definition at line 79 of file class.ilDclTable.php.

◆ $view_own_records_perm

int ilDclTable::$view_own_records_perm = 0
protected

True if user can only view his/her own entries in the table.

Definition at line 72 of file class.ilDclTable.php.

Referenced by getViewOwnRecordsPerm().


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