ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilDclTable Class Reference

Class ilDclBaseFieldModel. More...

+ Collaboration diagram for ilDclTable:

Public Member Functions

 __construct ($a_id=0)
 
 doRead ()
 Read table. More...
 
 doCreate ($create_tablefield_setting=true, $create_standardview=true)
 
 doUpdate ()
 
 setId ($a_id)
 Set table id. More...
 
 getId ()
 Get table id. More...
 
 setObjId ($a_id)
 
 getObjId ()
 
 setTitle ($a_title)
 
 getTitle ()
 
 getCollectionObject ()
 
 getRecords ()
 
 loadRecords ()
 
 deleteField ($field_id)
 
 getField ($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 ($ref_id, $with_active_detailedview=false, $user_id=0)
 For current user. More...
 
 getFirstTableViewId ($ref_id, $user_id=0)
 get id of first (for current user) available view More...
 
 getRecordFields ()
 Returns all fields of this table which are NOT standard fields. More...
 
 getEditableFields ()
 
 getExportableFields ()
 Return all the fields that are marked as exportable. More...
 
 hasPermissionToEditRecord ($ref_id, ilDclBaseRecordModel $record)
 
 hasPermissionToDeleteRecord ($ref_id, ilDclBaseRecordModel $record)
 
 hasPermissionToDeleteRecords ($ref_id)
 
 hasPermissionToViewRecord ($ref_id, $record, $user_id=0)
 
 checkLimit ()
 
 updateFields ()
 Update fields. More...
 
 sortFields (&$fields)
 sortFields More...
 
 buildOrderFields ()
 buildOrderFields orders the fields. More...
 
 getFieldByTitle ($title)
 Get a field by title. More...
 
 setAddPerm ($add_perm)
 
 getAddPerm ()
 
 setDeletePerm ($delete_perm)
 
 getDeletePerm ()
 
 setEditByOwner ($edit_by_owner)
 
 getEditByOwner ()
 
 getDeleteByOwner ()
 
 setDeleteByOwner ($delete_by_owner)
 
 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)
 /** More...
 
 getDefaultSortField ()
 
 setDefaultSortFieldOrder ($default_sort_field_order)
 
 getDefaultSortFieldOrder ()
 
 setPublicCommentsEnabled ($public_comments)
 
 getPublicCommentsEnabled ()
 
 setViewOwnRecordsPerm ($view_own_perm)
 
 getViewOwnRecordsPerm ()
 
 getSaveConfirmation ()
 
 setSaveConfirmation ($save_confirmation)
 
 hasCustomFields ()
 hasCustomFields More...
 
 compareOrder ($a, $b)
 
 cloneStructure (ilDclTable $original)
 
 afterClone ()
 
 _hasRecords ()
 _hasRecords More...
 
 addField ($field)
 
 setExportEnabled ($export_enabled)
 
 getExportEnabled ()
 
 getOrder ()
 
 updateOrder ()
 
 setOrder ($table_order)
 
 setImportEnabled ($import_enabled)
 
 getImportEnabled ()
 

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. More...
 

Protected Member Functions

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

Protected Attributes

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References doRead().

142  {
143  if ($a_id != 0) {
144  $this->id = $a_id;
145  $this->doRead();
146  }
147  }
doRead()
Read table.
+ Here is the call graph for this function:

Member Function Documentation

◆ _getTableIdByTitle()

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

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

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

Referenced by ilObjDataCollection\reorderTables().

1413  {
1414  global $DIC;
1415  $ilDB = $DIC['ilDB'];
1416  $result = $ilDB->query(
1417  'SELECT id FROM il_dcl_table WHERE title = ' . $ilDB->quote($title, 'text') . ' AND obj_id = '
1418  . $ilDB->quote($obj_id, 'integer')
1419  );
1420  $id = 0;
1421  while ($rec = $ilDB->fetchAssoc($result)) {
1422  $id = $rec['id'];
1423  }
1424 
1425  return $id;
1426  }
$result
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _hasFieldByTitle()

static ilDclTable::_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 1508 of file class.ilDclTable.php.

References $_SESSION, $DIC, $id, $ilDB, $ilUser, $records, $result, $title, getField(), getFieldByTitle(), getId(), ilDclCache\getRecordCache(), getViewOwnRecordsPerm(), ilObjDataCollectionAccess\hasEditAccess(), and ilObjDataCollectionAccess\hasWriteAccess().

Referenced by ilDclFieldEditGUI\checkInput().

1509  {
1510  global $DIC;
1511  $ilDB = $DIC['ilDB'];
1512  $result = $ilDB->query(
1513  'SELECT * FROM il_dcl_field WHERE table_id = ' . $ilDB->quote($obj_id, 'integer') . ' AND title = '
1514  . $ilDB->quote($title, 'text')
1515  );
1516 
1517  return ($ilDB->numRows($result)) ? true : false;
1518  }
$result
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _hasRecords()

ilDclTable::_hasRecords ( )

_hasRecords

Returns
boolean

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

References getRecords().

1376  {
1377  return (count($this->getRecords()) > 0) ? true : false;
1378  }
+ Here is the call graph for this function:

◆ _tableExists()

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

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

References $DIC, $ilDB, $query, and $result.

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

1396  {
1397  global $DIC;
1398  $ilDB = $DIC['ilDB'];
1399  $query = "SELECT * FROM il_dcl_table WHERE id = " . $table_id;
1400  $result = $ilDB->query($query);
1401 
1402  return $result->numRows() != 0;
1403  }
$result
$query
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ addField()

ilDclTable::addField (   $field)
Parameters
$fieldilDclBaseFieldModel add an already created field for eg. ordering.

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

1385  {
1386  $this->all_fields[$field->getId()] = $field;
1387  }

◆ afterClone()

ilDclTable::afterClone ( )

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

References getFields(), and getRecords().

1363  {
1364  foreach ($this->getFields() as $field) {
1365  $field->afterClone($this->getRecords());
1366  }
1367  }
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 924 of file class.ilDclTable.php.

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

Referenced by doCreate().

925  {
926  $fields = $this->getFields();
927  $this->sortByOrder($fields);
928  $count = 10;
929  $offset = 10;
930  foreach ($fields as $field) {
931  if (!is_null($field->getOrder())) {
932  $field->setOrder($count);
933  $count = $count + $offset;
934  $field->doUpdate();
935  }
936  }
937  }
sortByOrder(&$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 ( )
Returns
bool

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

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

Referenced by hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

866  {
867  if ($this->getLimited()) {
868  $now = new ilDateTime(date("Y-m-d H:i:s"), IL_CAL_DATE);
869  $from = new ilDateTime($this->getLimitStart(), IL_CAL_DATE);
870  $to = new ilDateTime($this->getLimitEnd(), IL_CAL_DATE);
871 
872  return ($from <= $now && $now <= $to);
873  }
874 
875  return true;
876  }
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)
Parameters
ilDclTable$original

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

References $default_sort_field, cloneStructure(), doCreate(), doUpdate(), getAddPerm(), getDefaultSortField(), getDefaultSortFieldOrder(), getDeleteByOwner(), getDeletePerm(), getDescription(), getEditByOwner(), getEditPerm(), getExportEnabled(), 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.

Referenced by cloneStructure().

1288  {
1289  $this->setTitle($original->getTitle());
1290  $this->setDescription($original->getDescription());
1291  $this->setIsVisible($original->getIsVisible());
1292  $this->setEditByOwner($original->getEditByOwner());
1293  $this->setAddPerm($original->getAddPerm());
1294  $this->setEditPerm($original->getEditPerm());
1295  $this->setDeleteByOwner($original->getDeleteByOwner());
1296  $this->setSaveConfirmation($original->getSaveConfirmation());
1297  $this->setDeletePerm($original->getDeletePerm());
1298  $this->setLimited($original->getLimited());
1299  $this->setLimitStart($original->getLimitStart());
1300  $this->setLimitEnd($original->getLimitEnd());
1301  $this->setViewOwnRecordsPerm($original->getViewOwnRecordsPerm());
1302  $this->setExportEnabled($original->getExportEnabled());
1303  $this->setImportEnabled($original->getImportEnabled());
1306  $this->setOrder($original->getOrder());
1307 
1308  $this->doCreate(true, false);
1309  // reset stdFields to get new for the created object
1310 
1311  $default_sort_field = 0;
1312  // Clone standard-fields
1313  $org_std_fields = $original->getStandardFields();
1314  foreach ($this->getStandardFields() as $element_key => $std_field) {
1315  $std_field->cloneStructure($org_std_fields[$element_key]);
1316  if ($std_field->getId() === $original->getDefaultSortField()) {
1317  $default_sort_field = $std_field->getId();
1318  }
1319  }
1320 
1321  // Clone fields
1322  $new_fields = array();
1323  foreach ($original->getFields() as $orig_field) {
1324  if (!$orig_field->isStandardField()) {
1325  $class_name = get_class($orig_field);
1326  $new_field = new $class_name();
1327  $new_field->setTableId($this->getId());
1328  $new_field->cloneStructure($orig_field->getId());
1329  $new_fields[$orig_field->getId()] = $new_field;
1330 
1331  if ($orig_field->getId() === $original->getDefaultSortField()) {
1332  $default_sort_field = $new_field->getId();
1333  }
1334  }
1335  }
1336 
1338  $this->doUpdate();
1339 
1340  // Clone Records with recordfields
1341  foreach ($original->getRecords() as $orig_record) {
1342  $new_record = new ilDclBaseRecordModel();
1343  $new_record->setTableId($this->getId());
1344  $new_record->cloneStructure($orig_record->getId(), $new_fields);
1345  }
1346 
1347  //clone tableviews (includes pageobjects)
1348  foreach ($original->getTableViews() as $orig_tableview) {
1349  $new_tableview = new ilDclTableView();
1350  $new_tableview->setTableId($this->getId());
1351  $new_tableview->cloneStructure($orig_tableview, $new_fields);
1352  }
1353 
1354  // mandatory for all cloning functions
1355  ilDclCache::setCloneOf($original->getId(), $this->getId(), ilDclCache::TYPE_TABLE);
1356  }
static setCloneOf($old, $new, $type)
setAddPerm($add_perm)
setTitle($a_title)
setEditByOwner($edit_by_owner)
setPublicCommentsEnabled($public_comments)
setDefaultSortField($default_sort_field)
/**
setLimitEnd($limit_end)
setEditPerm($edit_perm)
getFields()
Returns all fields of this table including the standard fields.
setDescription($description)
getId()
Get table id.
setExportEnabled($export_enabled)
cloneStructure(ilDclTable $original)
setDeletePerm($delete_perm)
Class ilDclTableView.
setOrder($table_order)
setSaveConfirmation($save_confirmation)
setLimitStart($limit_start)
setViewOwnRecordsPerm($view_own_perm)
Class ilDclBaseRecordModel.
setIsVisible($is_visible)
doCreate($create_tablefield_setting=true, $create_standardview=true)
setImportEnabled($import_enabled)
setDeleteByOwner($delete_by_owner)
setDefaultSortFieldOrder($default_sort_field_order)
setLimited($limited)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compareOrder()

ilDclTable::compareOrder (   $a,
  $b 
)
Parameters
$a
$b
Returns
int

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

References Vendor\Package\$a, and Vendor\Package\$b.

1269  {
1270  if (is_null($a->getOrder() == null) && is_null($b->getOrder() == null)) {
1271  return 0;
1272  }
1273  if (is_null($a->getOrder())) {
1274  return 1;
1275  }
1276  if (is_null($b->getOrder())) {
1277  return -1;
1278  }
1279 
1280  return $a->getOrder() < $b->getOrder() ? -1 : 1;
1281  }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

◆ deleteField()

ilDclTable::deleteField (   $field_id)
Parameters
$field_id

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

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

411  {
412  $field = ilDclCache::getFieldCache($field_id);
413  $records = $this->getRecords();
414 
415  foreach ($records as $record) {
416  $record->deleteField($field_id);
417  }
418 
419  $field->doDelete();
420  }
static getFieldCache($field_id=0)
+ Here is the call graph for this function:

◆ doCreate()

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

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

References $DIC, $id, $ilDB, $query, 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().

227  {
228  global $DIC;
229  $ilDB = $DIC['ilDB'];
230 
231  $id = $ilDB->nextId("il_dcl_table");
232  $this->setId($id);
233  $query = "INSERT INTO il_dcl_table (" . "id" . ", obj_id" . ", title" . ", add_perm" . ", edit_perm" . ", delete_perm" . ", edit_by_owner"
234  . ", limited" . ", limit_start" . ", limit_end" . ", is_visible" . ", export_enabled" . ", import_enabled" . ", default_sort_field_id"
235  . ", default_sort_field_order" . ", description" . ", public_comments" . ", view_own_records_perm"
236  . ", delete_by_owner, save_confirmation , table_order ) VALUES (" . $ilDB->quote($this->getId(), "integer") . ","
237  . $ilDB->quote($this->getObjId(), "integer") . "," . $ilDB->quote($this->getTitle(), "text") . ","
238  . $ilDB->quote($this->getAddPerm() ? 1 : 0, "integer") . "," . $ilDB->quote($this->getEditPerm() ? 1 : 0, "integer") . ","
239  . $ilDB->quote($this->getDeletePerm() ? 1 : 0, "integer") . "," . $ilDB->quote($this->getEditByOwner() ? 1 : 0, "integer") . ","
240  . $ilDB->quote($this->getLimited() ? 1 : 0, "integer") . "," . $ilDB->quote($this->getLimitStart(), "timestamp") . ","
241  . $ilDB->quote($this->getLimitEnd(), "timestamp") . "," . $ilDB->quote($this->getIsVisible() ? 1 : 0, "integer") . ","
242  . $ilDB->quote($this->getExportEnabled() ? 1 : 0, "integer") . "," . $ilDB->quote($this->getImportEnabled() ? 1 : 0, "integer") . ","
243  . $ilDB->quote($this->getDefaultSortField(), "text") . "," . $ilDB->quote($this->getDefaultSortFieldOrder(), "text") . ","
244  . $ilDB->quote($this->getDescription(), "text") . "," . $ilDB->quote($this->getPublicCommentsEnabled(), "integer") . ","
245  . $ilDB->quote($this->getViewOwnRecordsPerm(), "integer") . "," . $ilDB->quote($this->getDeleteByOwner() ? 1 : 0, 'integer') . ","
246  . $ilDB->quote($this->getSaveConfirmation() ? 1 : 0, 'integer') . "," . $ilDB->quote($this->getOrder(), 'integer') . ")";
247 
248  $ilDB->manipulate($query);
249 
250  if ($create_standardview) {
251  //standard tableview
253  }
254 
255  if ($create_tablefield_setting) {
256  $this->buildOrderFields();
257  }
258  }
setId($a_id)
Set table id.
getId()
Get table id.
$query
static createOrGetStandardView($table_id, $create_default_settings=true)
global $ilDB
$DIC
Definition: xapitoken.php:46
buildOrderFields()
buildOrderFields orders the fields.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doesRecordBelongToUser()

ilDclTable::doesRecordBelongToUser ( ilDclBaseRecordModel  $record)
protected
Parameters
ilDclBaseRecordModel$record
Returns
bool

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

References $DIC, $ilUser, and ilDclBaseRecordModel\getOwner().

Referenced by hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

854  {
855  global $DIC;
856  $ilUser = $DIC['ilUser'];
857 
858  return ($ilUser->getId() == $record->getOwner());
859  }
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doRead()

ilDclTable::doRead ( )

Read table.

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

References $DIC, $ilDB, $query, getId(), getRecordFields(), getRecords(), setAddPerm(), setDefaultSortField(), setDefaultSortFieldOrder(), setDeleteByOwner(), setDeletePerm(), setDescription(), setEditByOwner(), setEditPerm(), setExportEnabled(), setImportEnabled(), setIsVisible(), setLimited(), setLimitEnd(), setLimitStart(), setObjId(), setOrder(), setPublicCommentsEnabled(), setSaveConfirmation(), setTitle(), and setViewOwnRecordsPerm().

Referenced by __construct().

154  {
155  global $DIC;
156  $ilDB = $DIC['ilDB'];
157 
158  $query = "SELECT * FROM il_dcl_table WHERE id = " . $ilDB->quote($this->getId(), "integer");
159  $set = $ilDB->query($query);
160  $rec = $ilDB->fetchAssoc($set);
161 
162  $this->setObjId($rec["obj_id"]);
163  $this->setTitle($rec["title"]);
164  $this->setAddPerm($rec["add_perm"]);
165  $this->setEditPerm($rec["edit_perm"]);
166  $this->setDeletePerm($rec["delete_perm"]);
167  $this->setEditByOwner($rec["edit_by_owner"]);
168  $this->setExportEnabled($rec["export_enabled"]);
169  $this->setImportEnabled($rec["import_enabled"]);
170  $this->setLimited($rec["limited"]);
171  $this->setLimitStart($rec["limit_start"]);
172  $this->setLimitEnd($rec["limit_end"]);
173  $this->setIsVisible($rec["is_visible"]);
174  $this->setDescription($rec['description']);
175  $this->setDefaultSortField($rec['default_sort_field_id']);
176  $this->setDefaultSortFieldOrder($rec['default_sort_field_order']);
177  $this->setPublicCommentsEnabled($rec['public_comments']);
178  $this->setViewOwnRecordsPerm($rec['view_own_records_perm']);
179  $this->setDeleteByOwner($rec['delete_by_owner']);
180  $this->setSaveConfirmation($rec['save_confirmation']);
181  $this->setOrder($rec['table_order']);
182  }
setAddPerm($add_perm)
setTitle($a_title)
setEditByOwner($edit_by_owner)
setPublicCommentsEnabled($public_comments)
setDefaultSortField($default_sort_field)
/**
setLimitEnd($limit_end)
setEditPerm($edit_perm)
setDescription($description)
getId()
Get table id.
setExportEnabled($export_enabled)
setDeletePerm($delete_perm)
setOrder($table_order)
$query
setSaveConfirmation($save_confirmation)
setLimitStart($limit_start)
setViewOwnRecordsPerm($view_own_perm)
global $ilDB
setIsVisible($is_visible)
$DIC
Definition: xapitoken.php:46
setImportEnabled($import_enabled)
setDeleteByOwner($delete_by_owner)
setDefaultSortFieldOrder($default_sort_field_order)
setLimited($limited)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUpdate()

ilDclTable::doUpdate ( )

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

References $DIC, $ilDB, 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().

265  {
266  global $DIC;
267  $ilDB = $DIC['ilDB'];
268 
269  $ilDB->update(
270  "il_dcl_table",
271  array(
272  "obj_id" => array("integer", $this->getObjId()),
273  "title" => array("text", $this->getTitle()),
274  "add_perm" => array("integer", (int) $this->getAddPerm()),
275  "edit_perm" => array("integer", (int) $this->getEditPerm()),
276  "delete_perm" => array("integer", (int) $this->getDeletePerm()),
277  "edit_by_owner" => array("integer", (int) $this->getEditByOwner()),
278  "limited" => array("integer", $this->getLimited()),
279  "limit_start" => array("timestamp", $this->getLimitStart()),
280  "limit_end" => array("timestamp", $this->getLimitEnd()),
281  "is_visible" => array("integer", $this->getIsVisible() ? 1 : 0),
282  "export_enabled" => array("integer", $this->getExportEnabled() ? 1 : 0),
283  "import_enabled" => array("integer", $this->getImportEnabled() ? 1 : 0),
284  "description" => array("text", $this->getDescription()),
285  "default_sort_field_id" => array("text", $this->getDefaultSortField()),
286  "default_sort_field_order" => array("text", $this->getDefaultSortFieldOrder()),
287  "public_comments" => array("integer", $this->getPublicCommentsEnabled() ? 1 : 0),
288  "view_own_records_perm" => array("integer", $this->getViewOwnRecordsPerm()),
289  'delete_by_owner' => array('integer', $this->getDeleteByOwner() ? 1 : 0),
290  'save_confirmation' => array('integer', $this->getSaveConfirmation() ? 1 : 0),
291  'table_order' => array('integer', $this->getOrder()),
292  ),
293  array(
294  "id" => array("integer", $this->getId()),
295  )
296  );
297  }
getId()
Get table id.
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAddPerm()

ilDclTable::getAddPerm ( )
Returns
boolean

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

References $add_perm.

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

974  {
975  return (bool) $this->add_perm;
976  }
+ Here is the caller graph for this function:

◆ getCollectionObject()

ilDclTable::getCollectionObject ( )
Returns
ilObjDataCollection

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

References $obj, and loadObj().

362  {
363  $this->loadObj();
364 
365  return $this->obj;
366  }
+ Here is the call graph for this function:

◆ getCustomFields()

ilDclTable::getCustomFields ( )

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

References $fields, and fields.

496  {
497  if (!$this->fields) {
498  $this->loadCustomFields();
499  }
500 
501  return $this->fields;
502  }
$errors fields
Definition: imgupload.php:51

◆ getDefaultSortField()

ilDclTable::getDefaultSortField ( )
Returns
string

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

References $default_sort_field.

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

1169  {
1171  }
+ Here is the caller graph for this function:

◆ getDefaultSortFieldOrder()

ilDclTable::getDefaultSortFieldOrder ( )
Returns
string

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

References $default_sort_field_order.

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

1190  {
1192  }
+ Here is the caller graph for this function:

◆ getDeleteByOwner()

ilDclTable::getDeleteByOwner ( )
Returns
boolean

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

References $delete_by_owner.

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

1025  {
1026  return (bool) $this->delete_by_owner;
1027  }
+ Here is the caller graph for this function:

◆ getDeletePerm()

ilDclTable::getDeletePerm ( )
Returns
boolean

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

References $delete_perm.

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

995  {
996  return (bool) $this->delete_perm;
997  }
+ Here is the caller graph for this function:

◆ getDescription()

ilDclTable::getDescription ( )
Returns
string

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

References $description.

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

1148  {
1149  return $this->description;
1150  }
+ Here is the caller graph for this function:

◆ getEditableFields()

ilDclTable::getEditableFields ( )
Returns
array

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

References $fields, and getRecordFields().

707  {
708  $fields = $this->getRecordFields();
709  $editableFields = array();
710 
711  foreach ($fields as $field) {
712  if (!$field->getLocked()) {
713  $editableFields[] = $field;
714  }
715  }
716 
717  return $editableFields;
718  }
getRecordFields()
Returns all fields of this table which are NOT standard fields.
+ Here is the call graph for this function:

◆ getEditByOwner()

ilDclTable::getEditByOwner ( )
Returns
boolean

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

References $edit_by_owner.

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

1016  {
1017  return (bool) $this->edit_by_owner;
1018  }
+ Here is the caller graph for this function:

◆ getEditPerm()

ilDclTable::getEditPerm ( )
Returns
boolean

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

References $edit_perm.

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

1058  {
1059  return (bool) $this->edit_perm;
1060  }
+ Here is the caller graph for this function:

◆ getExportableFields()

ilDclTable::getExportableFields ( )

Return all the fields that are marked as exportable.

Returns
array ilDclBaseFieldModel

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

References $fields, and getFields().

727  {
728  $fields = $this->getFields();
729  $exportableFields = array();
730  foreach ($fields as $field) {
731  if ($field->getExportable()) {
732  $exportableFields[] = $field;
733  }
734  }
735 
736  return $exportableFields;
737  }
getFields()
Returns all fields of this table including the standard fields.
+ Here is the call graph for this function:

◆ getExportEnabled()

ilDclTable::getExportEnabled ( )
Returns
boolean

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

References $export_enabled.

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

1442  {
1443  return $this->export_enabled;
1444  }
+ Here is the caller graph for this function:

◆ getField()

ilDclTable::getField (   $field_id)
Parameters
$field_id
Returns
ilDclBaseFieldModel|null

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

References $fields, and getFields().

Referenced by _hasFieldByTitle().

429  {
430  $fields = $this->getFields();
431  $field = null;
432  foreach ($fields as $field_1) {
433  if ($field_1->getId() == $field_id) {
434  $field = $field_1;
435  }
436  }
437 
438  return $field;
439  }
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:

◆ getFieldByTitle()

ilDclTable::getFieldByTitle (   $title)

Get a field by title.

Parameters
$title
Returns
ilDclBaseFieldModel

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

References $title, and getFields().

Referenced by _hasFieldByTitle().

948  {
949  $return = null;
950  foreach ($this->getFields() as $field) {
951  if ($field->getTitle() == $title) {
952  $return = $field;
953  break;
954  }
955  }
956 
957  return $return;
958  }
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:

◆ getFieldIds()

ilDclTable::getFieldIds ( )
Parameters
bool$force_include_comments
Returns
array

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

References $DIC, $fields, $ilDB, $query, ilDclCache\buildFieldFromRecord(), fields, getFields(), getId(), and ilDclCache\preloadFieldProperties().

448  {
449  $field_ids = array();
450  foreach ($this->getFields() as $field) {
451  if ($field->getId()) {
452  $field_ids[] = $field->getId();
453  }
454  }
455 
456  return $field_ids;
457  }
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 558 of file class.ilDclTable.php.

References $all_fields, and reloadFields().

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

559  {
560  if ($this->all_fields == null) {
561  $this->reloadFields();
562  }
563 
564  return $this->all_fields;
565  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFirstTableViewId()

ilDclTable::getFirstTableViewId (   $ref_id,
  $user_id = 0 
)

get id of first (for current user) available view

Parameters
$ref_id
int$user_id
Returns
bool

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

References $stdFields, ilDclStandardField\_getStandardFields(), fields, getPublicCommentsEnabled(), getVisibleTableViews(), ilDclDatatype\INPUTFORMAT_FILE, ilDclDatatype\INPUTFORMAT_FORMULA, ilDclDatatype\INPUTFORMAT_ILIAS_REF, ilDclDatatype\INPUTFORMAT_MOB, ilDclDatatype\INPUTFORMAT_RATING, ilDclDatatype\INPUTFORMAT_REFERENCE, and ilDclDatatype\INPUTFORMAT_REFERENCELIST.

625  {
626  $tableview = array_shift($this->getVisibleTableViews($ref_id, false, $user_id));
627 
628  return $tableview ? $tableview->getId() : false;
629  }
getVisibleTableViews($ref_id, $with_active_detailedview=false, $user_id=0)
For current user.
+ Here is the call graph for this function:

◆ getId()

ilDclTable::getId ( )

Get table id.

Returns
int

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

References $id.

Referenced by ilDclTableViewTableGUI\__construct(), _hasFieldByTitle(), cloneStructure(), doCreate(), doRead(), doUpdate(), getFieldIds(), getNewTableviewOrder(), getTableViews(), and updateOrder().

317  {
318  return $this->id;
319  }
+ Here is the caller graph for this function:

◆ getImportEnabled()

ilDclTable::getImportEnabled ( )
Returns
boolean

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

References $import_enabled.

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

1495  {
1496  return $this->import_enabled;
1497  }
+ Here is the caller graph for this function:

◆ getIsVisible()

ilDclTable::getIsVisible ( )
Returns
boolean

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

References $is_visible.

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

1130  {
1131  return $this->is_visible;
1132  }
+ Here is the caller graph for this function:

◆ getLimited()

ilDclTable::getLimited ( )
Returns
boolean

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

References $limited.

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

1076  {
1077  return $this->limited;
1078  }
+ Here is the caller graph for this function:

◆ getLimitEnd()

ilDclTable::getLimitEnd ( )
Returns
string

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

References $limit_end.

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

1094  {
1095  return $this->limit_end;
1096  }
+ Here is the caller graph for this function:

◆ getLimitStart()

ilDclTable::getLimitStart ( )
Returns
string

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

References $limit_start.

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

1112  {
1113  return $this->limit_start;
1114  }
+ 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 510 of file class.ilDclTable.php.

References $fields, and getFields().

511  {
512  $fields = $this->getFields();
513  $place = 0;
514  foreach ($fields as $field) {
515  if (!$field->isStandardField()) {
516  $place = $field->getOrder() + 1;
517  }
518  }
519 
520  return $place;
521  }
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 527 of file class.ilDclTable.php.

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

528  {
529  return (ilDclTableView::getCountForTableId($this->getId()) + 1) * 10;
530  }
static getCountForTableId($table_id)
getId()
Get table id.
+ Here is the call graph for this function:

◆ getObjId()

ilDclTable::getObjId ( )
Returns
int

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

References $objId.

Referenced by doCreate(), doUpdate(), hasPermissionToDeleteRecord(), hasPermissionToDeleteRecords(), hasPermissionToEditRecord(), and hasPermissionToViewRecord().

335  {
336  return $this->objId;
337  }
+ Here is the caller graph for this function:

◆ getOrder()

ilDclTable::getOrder ( )
Returns
int

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

References $table_order, and updateOrder().

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

1451  {
1452  if (!$this->table_order) {
1453  $this->updateOrder();
1454  }
1455 
1456  return $this->table_order;
1457  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPublicCommentsEnabled()

ilDclTable::getPublicCommentsEnabled ( )
Returns
boolean

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

References $public_comments.

Referenced by cloneStructure(), doCreate(), doUpdate(), getFirstTableViewId(), and ilObjDataCollectionTest\testDefaultTable().

1208  {
1209  return $this->public_comments;
1210  }
+ 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 695 of file class.ilDclTable.php.

References $fields.

Referenced by doRead(), getEditableFields(), and ilObjDataCollectionTest\testDefaultTable().

696  {
697  $this->loadCustomFields();
698 
699  return $this->fields;
700  }
+ Here is the caller graph for this function:

◆ getRecords()

ilDclTable::getRecords ( )
Returns
ilDclBaseRecordModel[]

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

References $records, and loadRecords().

Referenced by _hasRecords(), afterClone(), cloneStructure(), deleteField(), doRead(), and ilObjDataCollectionTest\testDefaultTable().

381  {
382  if ($this->records == null) {
383  $this->loadRecords();
384  }
385 
386  return $this->records;
387  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSaveConfirmation()

ilDclTable::getSaveConfirmation ( )
Returns
boolean

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

References $save_confirmation.

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

1235  {
1236  return $this->save_confirmation;
1237  }
+ Here is the caller graph for this function:

◆ getTableViews()

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

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

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

Referenced by cloneStructure(), getVisibleTableViews(), sortTableViews(), and ilObjDataCollectionTest\testDefaultTableViewCreated().

584  {
585  return ilDclTableView::getAllForTableId($this->getId());
586  }
static getAllForTableId($table_id)
getId()
Get table id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilDclTable::getTitle ( )
Returns
string

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

References $title.

Referenced by cloneStructure(), doCreate(), doUpdate(), and ilObjDataCollectionTest\testDefaultTable().

353  {
354  return $this->title;
355  }
+ Here is the caller graph for this function:

◆ getViewOwnRecordsPerm()

ilDclTable::getViewOwnRecordsPerm ( )
Returns
boolean

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

References $view_own_records_perm.

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

1226  {
1227  return (bool) $this->view_own_records_perm;
1228  }
+ Here is the caller graph for this function:

◆ getVisibleTableViews()

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

For current user.

Parameters
int$ref_idDataCollections reference
int$user_id
Returns
ilDclTableView[]

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

References getTableViews(), ilObjDataCollectionAccess\hasAccessToTableView(), ilObjDataCollectionAccess\hasWriteAccess(), and ilDclDetailedViewDefinition\isActive().

Referenced by getFirstTableViewId().

598  {
599  if (ilObjDataCollectionAccess::hasWriteAccess($ref_id, $user_id) && !$with_active_detailedview) {
600  return $this->getTableViews();
601  }
602 
603  $visible_views = array();
604  foreach ($this->getTableViews() as $tableView) {
605  if (ilObjDataCollectionAccess::hasAccessToTableView($tableView, $user_id)) {
606  if (!$with_active_detailedview || ilDclDetailedViewDefinition::isActive($tableView->getId())) {
607  $visible_views[] = $tableView;
608  }
609  }
610  }
611 
612  return $visible_views;
613  }
static hasAccessToTableView($tableview, $user_id=0)
This only checks access to the tableview - if the full access check is required, use hasAccessTo($ref...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasCustomFields()

ilDclTable::hasCustomFields ( )

hasCustomFields

Returns
boolean

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

References fields.

1255  {
1256  $this->loadCustomFields();
1257 
1258  return (count($this->fields) > 0) ? true : false;
1259  }
$errors fields
Definition: imgupload.php:51

◆ hasPermissionToDeleteRecord()

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

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

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

778  {
779  if ($this->getObjId() != ilObjDataCollection::_lookupObjectId($ref_id)) {
780  return false;
781  }
783  return true;
784  }
786  return false;
787  }
788  if (!$this->checkLimit()) {
789  return false;
790  }
791  if ($this->getDeletePerm() && !$this->getDeleteByOwner()) {
792  return true;
793  }
794  if ($this->getDeleteByOwner()) {
795  return $this->doesRecordBelongToUser($record);
796  }
797 
798  return false;
799  }
static _lookupObjectId($a_ref_id)
doesRecordBelongToUser(ilDclBaseRecordModel $record)
+ Here is the call graph for this function:

◆ hasPermissionToDeleteRecords()

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

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

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

808  {
809  if ($this->getObjId() != ilObjDataCollection::_lookupObjectId($ref_id)) {
810  return false;
811  }
812 
813  return ((ilObjDataCollectionAccess::hasAddRecordAccess($ref_id) && $this->getDeletePerm())
815  }
static _lookupObjectId($a_ref_id)
+ Here is the call graph for this function:

◆ hasPermissionToEditRecord()

ilDclTable::hasPermissionToEditRecord (   $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 746 of file class.ilDclTable.php.

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

747  {
748  if ($this->getObjId() != ilObjDataCollection::_lookupObjectId($ref_id)) {
749  return false;
750  }
752  return true;
753  }
755  return false;
756  }
757  if (!$this->checkLimit()) {
758  return false;
759  }
760  if ($this->getEditPerm() && !$this->getEditByOwner()) {
761  return true;
762  }
763  if ($this->getEditByOwner()) {
764  return $this->doesRecordBelongToUser($record);
765  }
766 
767  return false;
768  }
static _lookupObjectId($a_ref_id)
doesRecordBelongToUser(ilDclBaseRecordModel $record)
static hasEditAccess($ref, $user_id=0)
Has permission to view and edit all entries event when he is not the owner.
+ Here is the call graph for this function:

◆ hasPermissionToViewRecord()

ilDclTable::hasPermissionToViewRecord (   $ref_id,
  $record,
  $user_id = 0 
)
Parameters
int$ref_id
$recordilDclBaseRecordModel
int$user_id
Returns
bool

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

References $DIC, $ilUser, ilObject2\_lookupObjectId(), getObjId(), getViewOwnRecordsPerm(), ilObjDataCollectionAccess\hasEditAccess(), ilObjDataCollectionAccess\hasReadAccess(), and ilObjDataCollectionAccess\hasWriteAccess().

826  {
827  global $DIC;
828  $ilUser = $DIC['ilUser'];
829  if ($this->getObjId() != ilObjDataCollection::_lookupObjectId($ref_id)) {
830  return false;
831  }
832  if (ilObjDataCollectionAccess::hasWriteAccess($ref_id, $user_id) || ilObjDataCollectionAccess::hasEditAccess($ref_id, $user_id)) {
833  return true;
834  }
836  // Check for view only own entries setting
837  if ($this->getViewOwnRecordsPerm() && ($user_id ? $user_id : $ilUser->getId()) != $record->getOwner()) {
838  return false;
839  }
840 
841  return true;
842  }
843 
844  return false;
845  }
static _lookupObjectId($a_ref_id)
static hasEditAccess($ref, $user_id=0)
Has permission to view and edit all entries event when he is not the owner.
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ loadObj()

ilDclTable::loadObj ( )
protected

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

Referenced by getCollectionObject().

370  {
371  if ($this->obj == null) {
372  $this->obj = new ilObjDataCollection($this->objId, false);
373  }
374  }
Class ilObjDataCollection.
+ Here is the caller graph for this function:

◆ loadRecords()

ilDclTable::loadRecords ( )

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

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

Referenced by getRecords().

391  {
392  global $DIC;
393  $ilDB = $DIC['ilDB'];
394 
395  $records = array();
396  $query = "SELECT id FROM il_dcl_record WHERE table_id = " . $ilDB->quote($this->id, "integer");
397  $set = $ilDB->query($query);
398 
399  while ($rec = $ilDB->fetchAssoc($set)) {
400  $records[$rec['id']] = ilDclCache::getRecordCache($rec['id']);
401  }
402 
403  $this->records = $records;
404  }
static getRecordCache($record_id=0)
$query
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reloadFields()

ilDclTable::reloadFields ( )

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

References $fields, fields, and sortByOrder().

Referenced by getFields().

569  {
570  $this->loadCustomFields();
571  $this->stdFields = $this->getStandardFields();
572  $fields = array_merge($this->fields, $this->stdFields);
573 
574  $this->sortByOrder($fields);
575 
576  $this->all_fields = $fields;
577  }
sortByOrder(&$array)
$errors fields
Definition: imgupload.php:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAddPerm()

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

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

References $add_perm.

Referenced by cloneStructure(), and doRead().

965  {
966  $this->add_perm = $add_perm;
967  }
+ Here is the caller graph for this function:

◆ setDefaultSortField()

ilDclTable::setDefaultSortField (   $default_sort_field)

/**

Parameters
string$default_sort_field

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

References $default_sort_field.

Referenced by cloneStructure(), and doRead().

1159  {
1160  $default_sort_field = ($default_sort_field) ? $default_sort_field : 0; // Change null or empty strings to zero
1161  $this->default_sort_field = $default_sort_field;
1162  }
+ Here is the caller graph for this function:

◆ setDefaultSortFieldOrder()

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

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

References $default_sort_field_order.

Referenced by cloneStructure(), and doRead().

1178  {
1179  if (!in_array($default_sort_field_order, array('asc', 'desc'))) {
1180  $default_sort_field_order = 'asc';
1181  }
1182  $this->default_sort_field_order = $default_sort_field_order;
1183  }
+ Here is the caller graph for this function:

◆ setDeleteByOwner()

ilDclTable::setDeleteByOwner (   $delete_by_owner)
Parameters
boolean$delete_by_owner

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

References $delete_by_owner, and setDeletePerm().

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

1034  {
1035  $this->delete_by_owner = $delete_by_owner;
1036  if ($delete_by_owner) {
1037  $this->setDeletePerm(true);
1038  }
1039  }
setDeletePerm($delete_perm)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDeletePerm()

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

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

References $delete_perm, and setDeleteByOwner().

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

983  {
984  $this->delete_perm = $delete_perm;
985  if (!$delete_perm) {
986  $this->setDeleteByOwner(false);
987  }
988  }
setDeleteByOwner($delete_by_owner)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDescription()

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

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

References $description.

Referenced by cloneStructure(), and doRead().

1139  {
1140  $this->description = $description;
1141  }
+ Here is the caller graph for this function:

◆ setEditByOwner()

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

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

References $edit_by_owner, and setEditPerm().

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

1004  {
1005  $this->edit_by_owner = $edit_by_owner;
1006  if ($edit_by_owner) {
1007  $this->setEditPerm(true);
1008  }
1009  }
setEditPerm($edit_perm)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setEditPerm()

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

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

References $edit_perm, and setEditByOwner().

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

1046  {
1047  $this->edit_perm = $edit_perm;
1048  if (!$edit_perm) {
1049  $this->setEditByOwner(false);
1050  }
1051  }
setEditByOwner($edit_by_owner)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setExportEnabled()

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

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

References $export_enabled.

Referenced by cloneStructure(), and doRead().

1433  {
1434  $this->export_enabled = $export_enabled;
1435  }
+ Here is the caller graph for this function:

◆ setId()

ilDclTable::setId (   $a_id)

Set table id.

Parameters
int$a_id

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

Referenced by doCreate().

306  {
307  $this->id = $a_id;
308  }
+ Here is the caller graph for this function:

◆ setImportEnabled()

ilDclTable::setImportEnabled (   $import_enabled)
Parameters
boolean$import_enabled

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

References $import_enabled.

Referenced by cloneStructure(), and doRead().

1486  {
1487  $this->import_enabled = $import_enabled;
1488  }
+ Here is the caller graph for this function:

◆ setIsVisible()

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

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

References $is_visible.

Referenced by cloneStructure(), and doRead().

1121  {
1122  $this->is_visible = $is_visible;
1123  }
+ Here is the caller graph for this function:

◆ setLimited()

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

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

References $limited.

Referenced by cloneStructure(), and doRead().

1067  {
1068  $this->limited = $limited;
1069  }
+ Here is the caller graph for this function:

◆ setLimitEnd()

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

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

References $limit_end.

Referenced by cloneStructure(), and doRead().

1085  {
1086  $this->limit_end = $limit_end;
1087  }
+ Here is the caller graph for this function:

◆ setLimitStart()

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

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

References $limit_start.

Referenced by cloneStructure(), and doRead().

1103  {
1104  $this->limit_start = $limit_start;
1105  }
+ Here is the caller graph for this function:

◆ setObjId()

ilDclTable::setObjId (   $a_id)
Parameters
$a_id

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

Referenced by doRead().

326  {
327  $this->objId = $a_id;
328  }
+ Here is the caller graph for this function:

◆ setOrder()

ilDclTable::setOrder (   $table_order)
Parameters
int$table_order

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

References $table_order.

Referenced by cloneStructure(), and doRead().

1477  {
1478  $this->table_order = $table_order;
1479  }
+ Here is the caller graph for this function:

◆ setPublicCommentsEnabled()

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

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

References $public_comments.

Referenced by cloneStructure(), and doRead().

1199  {
1200  $this->public_comments = $public_comments;
1201  }
+ Here is the caller graph for this function:

◆ setSaveConfirmation()

ilDclTable::setSaveConfirmation (   $save_confirmation)
Parameters
boolean$save_confirmation

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

References $save_confirmation.

Referenced by cloneStructure(), and doRead().

1244  {
1245  $this->save_confirmation = $save_confirmation;
1246  }
+ Here is the caller graph for this function:

◆ setTitle()

ilDclTable::setTitle (   $a_title)
Parameters
$a_title

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

Referenced by cloneStructure(), and doRead().

344  {
345  $this->title = $a_title;
346  }
+ Here is the caller graph for this function:

◆ setViewOwnRecordsPerm()

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

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

Referenced by cloneStructure(), and doRead().

1217  {
1218  $this->view_own_records_perm = (int) $view_own_perm;
1219  }
+ Here is the caller graph for this function:

◆ sortByOrder()

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

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

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

913  {
914  // php-bug: https://bugs.php.net/bug.php?id=50688
915  // fixed in php 7 but for now we need the @ a workaround
916  @usort($array, array($this, "compareOrder"));
917  }
+ Here is the caller graph for this function:

◆ sortFields()

ilDclTable::sortFields ( $fields)

sortFields

Parameters
$fieldsilDclBaseFieldModel[]

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

References $fields, and sortByOrder().

896  {
897  $this->sortByOrder($fields);
898  //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.
899  $named = array();
900  foreach ($fields as $field) {
901  $named[$field->getId()] = $field;
902  }
903 
904  $fields = $named;
905  }
sortByOrder(&$array)
+ Here is the call graph for this function:

◆ sortTableViews()

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

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

References getTableViews().

537  {
538  if ($tableviews == null) {
539  $tableviews = $this->getTableViews();
540  }
541 
542  $order = 10;
543  foreach ($tableviews as $tableview) {
544  $tableview->setTableviewOrder($order);
545  $tableview->update();
546  $order += 10;
547  }
548  }
+ Here is the call graph for this function:

◆ updateFields()

ilDclTable::updateFields ( )

Update fields.

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

References getFields().

883  {
884  foreach ($this->getFields() as $field) {
885  $field->doUpdate();
886  }
887  }
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 1463 of file class.ilDclTable.php.

References $DIC, $ilDB, $result, and getId().

Referenced by getOrder().

1464  {
1465  global $DIC;
1466  $ilDB = $DIC['ilDB'];
1467  $result = $ilDB->query('SELECT MAX(table_order) AS table_order FROM il_dcl_table WHERE obj_id = ' . $ilDB->quote($this->getCollectionObject()->getId(), 'integer'));
1468  $this->table_order = $ilDB->fetchObject($result)->table_order + 10;
1469  $ilDB->query('UPDATE il_dcl_table SET table_order = ' . $ilDB->quote($this->table_order, 'integer') . ' WHERE id = ' . $ilDB->quote($this->getId(), 'integer'));
1470  }
$result
getId()
Get table id.
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $add_perm

ilDclTable::$add_perm
protected

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

Referenced by getAddPerm(), and setAddPerm().

◆ $all_fields

ilDclTable::$all_fields = null
protected

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

Referenced by getFields().

◆ $default_sort_field

ilDclTable::$default_sort_field = 0
protected

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

Referenced by cloneStructure(), getDefaultSortField(), and setDefaultSortField().

◆ $default_sort_field_order

ilDclTable::$default_sort_field_order = 'asc'
protected

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

Referenced by getDefaultSortFieldOrder(), and setDefaultSortFieldOrder().

◆ $delete_by_owner

ilDclTable::$delete_by_owner
protected

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

Referenced by getDeleteByOwner(), and setDeleteByOwner().

◆ $delete_perm

ilDclTable::$delete_perm
protected

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

Referenced by getDeletePerm(), and setDeletePerm().

◆ $description

ilDclTable::$description = ''
protected

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

Referenced by getDescription(), and setDescription().

◆ $edit_by_owner

ilDclTable::$edit_by_owner
protected

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

Referenced by getEditByOwner(), and setEditByOwner().

◆ $edit_perm

ilDclTable::$edit_perm
protected

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

Referenced by getEditPerm(), and setEditPerm().

◆ $export_enabled

ilDclTable::$export_enabled
protected

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

Referenced by getExportEnabled(), and setExportEnabled().

◆ $fields

◆ $id

ilDclTable::$id = 0
protected

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

Referenced by _getTableIdByTitle(), _hasFieldByTitle(), doCreate(), and getId().

◆ $import_enabled

ilDclTable::$import_enabled
protected

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

Referenced by getImportEnabled(), and setImportEnabled().

◆ $is_visible

ilDclTable::$is_visible
protected

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

Referenced by getIsVisible(), and setIsVisible().

◆ $limit_end

ilDclTable::$limit_end
protected

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

Referenced by getLimitEnd(), and setLimitEnd().

◆ $limit_start

ilDclTable::$limit_start
protected

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

Referenced by getLimitStart(), and setLimitStart().

◆ $limited

ilDclTable::$limited
protected

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

Referenced by getLimited(), and setLimited().

◆ $obj

ilDclTable::$obj
protected

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

Referenced by getCollectionObject().

◆ $objId

ilDclTable::$objId
protected

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

Referenced by getObjId().

◆ $public_comments

ilDclTable::$public_comments = 0
protected

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

Referenced by getPublicCommentsEnabled(), and setPublicCommentsEnabled().

◆ $records

ilDclTable::$records
protected

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

Referenced by _hasFieldByTitle(), deleteField(), getRecords(), and loadRecords().

◆ $save_confirmation

ilDclTable::$save_confirmation
protected

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

Referenced by getSaveConfirmation(), and setSaveConfirmation().

◆ $stdFields

ilDclTable::$stdFields
protected

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

Referenced by getFirstTableViewId().

◆ $table_order

ilDclTable::$table_order
protected

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

Referenced by getOrder(), and setOrder().

◆ $title

ilDclTable::$title
protected

◆ $view_own_records_perm

ilDclTable::$view_own_records_perm = 0
protected

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

Referenced by getViewOwnRecordsPerm().


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