ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 145 of file class.ilDclTable.php.

References doRead().

146  {
147  if ($a_id != 0) {
148  $this->id = $a_id;
149  $this->doRead();
150  }
151  }
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 1415 of file class.ilDclTable.php.

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

Referenced by ilObjDataCollection\reorderTables().

1416  {
1417  global $DIC;
1418  $ilDB = $DIC['ilDB'];
1419  $result = $ilDB->query(
1420  'SELECT id FROM il_dcl_table WHERE title = ' . $ilDB->quote($title, 'text') . ' AND obj_id = '
1421  . $ilDB->quote($obj_id, 'integer')
1422  );
1423  $id = 0;
1424  while ($rec = $ilDB->fetchAssoc($result)) {
1425  $id = $rec['id'];
1426  }
1427 
1428  return $id;
1429  }
$result
global $DIC
Definition: saml.php:7
global $ilDB
+ 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 1511 of file class.ilDclTable.php.

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

Referenced by ilDclFieldEditGUI\checkInput().

1512  {
1513  global $DIC;
1514  $ilDB = $DIC['ilDB'];
1515  $result = $ilDB->query(
1516  'SELECT * FROM il_dcl_field WHERE table_id = ' . $ilDB->quote($obj_id, 'integer') . ' AND title = '
1517  . $ilDB->quote($title, 'text')
1518  );
1519 
1520  return ($ilDB->numRows($result)) ? true : false;
1521  }
$result
global $DIC
Definition: saml.php:7
global $ilDB
+ 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 1378 of file class.ilDclTable.php.

References getRecords().

1379  {
1380  return (count($this->getRecords()) > 0) ? true : false;
1381  }
+ 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 1398 of file class.ilDclTable.php.

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

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

1399  {
1400  global $DIC;
1401  $ilDB = $DIC['ilDB'];
1402  $query = "SELECT * FROM il_dcl_table WHERE id = " . $table_id;
1403  $result = $ilDB->query($query);
1404 
1405  return $result->numRows() != 0;
1406  }
$result
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ 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 1387 of file class.ilDclTable.php.

1388  {
1389  $this->all_fields[$field->getId()] = $field;
1390  }

◆ afterClone()

ilDclTable::afterClone ( )

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

References getFields(), and getRecords().

1366  {
1367  foreach ($this->getFields() as $field) {
1368  $field->afterClone($this->getRecords());
1369  }
1370  }
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 927 of file class.ilDclTable.php.

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

Referenced by doCreate().

928  {
929  $fields = $this->getFields();
930  $this->sortByOrder($fields);
931  $count = 10;
932  $offset = 10;
933  foreach ($fields as $field) {
934  if (!is_null($field->getOrder())) {
935  $field->setOrder($count);
936  $count = $count + $offset;
937  $field->doUpdate();
938  }
939  }
940  }
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 868 of file class.ilDclTable.php.

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

Referenced by hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

869  {
870  if ($this->getLimited()) {
871  $now = new ilDateTime(date("Y-m-d H:i:s"), IL_CAL_DATE);
872  $from = new ilDateTime($this->getLimitStart(), IL_CAL_DATE);
873  $to = new ilDateTime($this->getLimitEnd(), IL_CAL_DATE);
874 
875  return ($from <= $now && $now <= $to);
876  }
877 
878  return true;
879  }
$from
Date and time handling
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 1290 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().

1291  {
1292  $this->setTitle($original->getTitle());
1293  $this->setDescription($original->getDescription());
1294  $this->setIsVisible($original->getIsVisible());
1295  $this->setEditByOwner($original->getEditByOwner());
1296  $this->setAddPerm($original->getAddPerm());
1297  $this->setEditPerm($original->getEditPerm());
1298  $this->setDeleteByOwner($original->getDeleteByOwner());
1299  $this->setSaveConfirmation($original->getSaveConfirmation());
1300  $this->setDeletePerm($original->getDeletePerm());
1301  $this->setLimited($original->getLimited());
1302  $this->setLimitStart($original->getLimitStart());
1303  $this->setLimitEnd($original->getLimitEnd());
1304  $this->setViewOwnRecordsPerm($original->getViewOwnRecordsPerm());
1305  $this->setExportEnabled($original->getExportEnabled());
1306  $this->setImportEnabled($original->getImportEnabled());
1309  $this->setOrder($original->getOrder());
1310 
1311  $this->doCreate(true, false);
1312  // reset stdFields to get new for the created object
1313 
1314  $default_sort_field = 0;
1315  // Clone standard-fields
1316  $org_std_fields = $original->getStandardFields();
1317  foreach ($this->getStandardFields() as $element_key => $std_field) {
1318  $std_field->cloneStructure($org_std_fields[$element_key]);
1319  if ($std_field->getId() === $original->getDefaultSortField()) {
1320  $default_sort_field = $std_field->getId();
1321  }
1322  }
1323 
1324  // Clone fields
1325  $new_fields = array();
1326  foreach ($original->getFields() as $orig_field) {
1327  if (!$orig_field->isStandardField()) {
1328  $class_name = get_class($orig_field);
1329  $new_field = new $class_name();
1330  $new_field->setTableId($this->getId());
1331  $new_field->cloneStructure($orig_field->getId());
1332  $new_fields[$orig_field->getId()] = $new_field;
1333 
1334  if ($orig_field->getId() === $original->getDefaultSortField()) {
1335  $default_sort_field = $new_field->getId();
1336  }
1337  }
1338  }
1339 
1341  $this->doUpdate();
1342 
1343  // Clone Records with recordfields
1344  foreach ($original->getRecords() as $orig_record) {
1345  $new_record = new ilDclBaseRecordModel();
1346  $new_record->setTableId($this->getId());
1347  $new_record->cloneStructure($orig_record->getId(), $new_fields);
1348  }
1349 
1350  //clone tableviews (includes pageobjects)
1351  foreach ($original->getTableViews() as $orig_tableview) {
1352  $new_tableview = new ilDclTableView();
1353  $new_tableview->setTableId($this->getId());
1354  $new_tableview->cloneStructure($orig_tableview, $new_fields);
1355  }
1356 
1357  // mandatory for all cloning functions
1358  ilDclCache::setCloneOf($original->getId(), $this->getId(), ilDclCache::TYPE_TABLE);
1359  }
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 1271 of file class.ilDclTable.php.

1272  {
1273  if (is_null($a->getOrder() == null) && is_null($b->getOrder() == null)) {
1274  return 0;
1275  }
1276  if (is_null($a->getOrder())) {
1277  return 1;
1278  }
1279  if (is_null($b->getOrder())) {
1280  return -1;
1281  }
1282 
1283  return $a->getOrder() < $b->getOrder() ? -1 : 1;
1284  }

◆ deleteField()

ilDclTable::deleteField (   $field_id)
Parameters
$field_id

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

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

415  {
416  $field = ilDclCache::getFieldCache($field_id);
417  $records = $this->getRecords();
418 
419  foreach ($records as $record) {
420  $record->deleteField($field_id);
421  }
422 
423  $field->doDelete();
424  }
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 230 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().

231  {
232  global $DIC;
233  $ilDB = $DIC['ilDB'];
234 
235  $id = $ilDB->nextId("il_dcl_table");
236  $this->setId($id);
237  $query = "INSERT INTO il_dcl_table (" . "id" . ", obj_id" . ", title" . ", add_perm" . ", edit_perm" . ", delete_perm" . ", edit_by_owner"
238  . ", limited" . ", limit_start" . ", limit_end" . ", is_visible" . ", export_enabled" . ", import_enabled" . ", default_sort_field_id"
239  . ", default_sort_field_order" . ", description" . ", public_comments" . ", view_own_records_perm"
240  . ", delete_by_owner, save_confirmation , table_order ) VALUES (" . $ilDB->quote($this->getId(), "integer") . ","
241  . $ilDB->quote($this->getObjId(), "integer") . "," . $ilDB->quote($this->getTitle(), "text") . ","
242  . $ilDB->quote($this->getAddPerm() ? 1 : 0, "integer") . "," . $ilDB->quote($this->getEditPerm() ? 1 : 0, "integer") . ","
243  . $ilDB->quote($this->getDeletePerm() ? 1 : 0, "integer") . "," . $ilDB->quote($this->getEditByOwner() ? 1 : 0, "integer") . ","
244  . $ilDB->quote($this->getLimited() ? 1 : 0, "integer") . "," . $ilDB->quote($this->getLimitStart(), "timestamp") . ","
245  . $ilDB->quote($this->getLimitEnd(), "timestamp") . "," . $ilDB->quote($this->getIsVisible() ? 1 : 0, "integer") . ","
246  . $ilDB->quote($this->getExportEnabled() ? 1 : 0, "integer") . "," . $ilDB->quote($this->getImportEnabled() ? 1 : 0, "integer") . ","
247  . $ilDB->quote($this->getDefaultSortField(), "text") . "," . $ilDB->quote($this->getDefaultSortFieldOrder(), "text") . ","
248  . $ilDB->quote($this->getDescription(), "text") . "," . $ilDB->quote($this->getPublicCommentsEnabled(), "integer") . ","
249  . $ilDB->quote($this->getViewOwnRecordsPerm(), "integer") . "," . $ilDB->quote($this->getDeleteByOwner() ? 1 : 0, 'integer') . ","
250  . $ilDB->quote($this->getSaveConfirmation() ? 1 : 0, 'integer') . "," . $ilDB->quote($this->getOrder(), 'integer') . ")";
251 
252  $ilDB->manipulate($query);
253 
254  if ($create_standardview) {
255  //standard tableview
257  }
258 
259  if ($create_tablefield_setting) {
260  $this->buildOrderFields();
261  }
262  }
setId($a_id)
Set table id.
global $DIC
Definition: saml.php:7
getId()
Get table id.
$query
static createOrGetStandardView($table_id, $create_default_settings=true)
global $ilDB
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 856 of file class.ilDclTable.php.

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

Referenced by hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

857  {
858  global $DIC;
859  $ilUser = $DIC['ilUser'];
860 
861  return ($ilUser->getId() == $record->getOwner());
862  }
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doRead()

ilDclTable::doRead ( )

Read table.

Definition at line 157 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().

158  {
159  global $DIC;
160  $ilDB = $DIC['ilDB'];
161 
162  $query = "SELECT * FROM il_dcl_table WHERE id = " . $ilDB->quote($this->getId(), "integer");
163  $set = $ilDB->query($query);
164  $rec = $ilDB->fetchAssoc($set);
165 
166  $this->setObjId($rec["obj_id"]);
167  $this->setTitle($rec["title"]);
168  $this->setAddPerm($rec["add_perm"]);
169  $this->setEditPerm($rec["edit_perm"]);
170  $this->setDeletePerm($rec["delete_perm"]);
171  $this->setEditByOwner($rec["edit_by_owner"]);
172  $this->setExportEnabled($rec["export_enabled"]);
173  $this->setImportEnabled($rec["import_enabled"]);
174  $this->setLimited($rec["limited"]);
175  $this->setLimitStart($rec["limit_start"]);
176  $this->setLimitEnd($rec["limit_end"]);
177  $this->setIsVisible($rec["is_visible"]);
178  $this->setDescription($rec['description']);
179  $this->setDefaultSortField($rec['default_sort_field_id']);
180  $this->setDefaultSortFieldOrder($rec['default_sort_field_order']);
181  $this->setPublicCommentsEnabled($rec['public_comments']);
182  $this->setViewOwnRecordsPerm($rec['view_own_records_perm']);
183  $this->setDeleteByOwner($rec['delete_by_owner']);
184  $this->setSaveConfirmation($rec['save_confirmation']);
185  $this->setOrder($rec['table_order']);
186  }
setAddPerm($add_perm)
setTitle($a_title)
global $DIC
Definition: saml.php:7
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)
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 268 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().

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

◆ getAddPerm()

ilDclTable::getAddPerm ( )
Returns
boolean

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

References $add_perm.

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

977  {
978  return (bool) $this->add_perm;
979  }
+ Here is the caller graph for this function:

◆ getCollectionObject()

ilDclTable::getCollectionObject ( )
Returns
ilObjDataCollection

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

References $obj, and loadObj().

366  {
367  $this->loadObj();
368 
369  return $this->obj;
370  }
+ Here is the call graph for this function:

◆ getCustomFields()

ilDclTable::getCustomFields ( )

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

References $fields, and fields.

500  {
501  if (!$this->fields) {
502  $this->loadCustomFields();
503  }
504 
505  return $this->fields;
506  }
$errors fields
Definition: imgupload.php:51

◆ getDefaultSortField()

ilDclTable::getDefaultSortField ( )
Returns
string

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

References $default_sort_field.

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

1172  {
1174  }
+ Here is the caller graph for this function:

◆ getDefaultSortFieldOrder()

ilDclTable::getDefaultSortFieldOrder ( )
Returns
string

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

References $default_sort_field_order.

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

1193  {
1195  }
+ Here is the caller graph for this function:

◆ getDeleteByOwner()

ilDclTable::getDeleteByOwner ( )
Returns
boolean

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

References $delete_by_owner.

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

1028  {
1029  return (bool) $this->delete_by_owner;
1030  }
+ Here is the caller graph for this function:

◆ getDeletePerm()

ilDclTable::getDeletePerm ( )
Returns
boolean

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

References $delete_perm.

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

998  {
999  return (bool) $this->delete_perm;
1000  }
+ Here is the caller graph for this function:

◆ getDescription()

ilDclTable::getDescription ( )
Returns
string

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

References $description.

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

1151  {
1152  return $this->description;
1153  }
+ Here is the caller graph for this function:

◆ getEditableFields()

ilDclTable::getEditableFields ( )
Returns
array

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

References $fields, and getRecordFields().

711  {
712  $fields = $this->getRecordFields();
713  $editableFields = array();
714 
715  foreach ($fields as $field) {
716  if (!$field->getLocked()) {
717  $editableFields[] = $field;
718  }
719  }
720 
721  return $editableFields;
722  }
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 1018 of file class.ilDclTable.php.

References $edit_by_owner.

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

1019  {
1020  return (bool) $this->edit_by_owner;
1021  }
+ Here is the caller graph for this function:

◆ getEditPerm()

ilDclTable::getEditPerm ( )
Returns
boolean

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

References $edit_perm.

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

1061  {
1062  return (bool) $this->edit_perm;
1063  }
+ 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 730 of file class.ilDclTable.php.

References $fields, and getFields().

731  {
732  $fields = $this->getFields();
733  $exportableFields = array();
734  foreach ($fields as $field) {
735  if ($field->getExportable()) {
736  $exportableFields[] = $field;
737  }
738  }
739 
740  return $exportableFields;
741  }
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 1444 of file class.ilDclTable.php.

References $export_enabled.

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

1445  {
1446  return $this->export_enabled;
1447  }
+ Here is the caller graph for this function:

◆ getField()

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

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

References $fields, and getFields().

Referenced by _hasFieldByTitle().

433  {
434  $fields = $this->getFields();
435  $field = null;
436  foreach ($fields as $field_1) {
437  if ($field_1->getId() == $field_id) {
438  $field = $field_1;
439  }
440  }
441 
442  return $field;
443  }
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 950 of file class.ilDclTable.php.

References $title, and getFields().

Referenced by _hasFieldByTitle().

951  {
952  $return = null;
953  foreach ($this->getFields() as $field) {
954  if ($field->getTitle() == $title) {
955  $return = $field;
956  break;
957  }
958  }
959 
960  return $return;
961  }
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 451 of file class.ilDclTable.php.

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

452  {
453  $field_ids = array();
454  foreach ($this->getFields() as $field) {
455  if ($field->getId()) {
456  $field_ids[] = $field->getId();
457  }
458  }
459 
460  return $field_ids;
461  }
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 562 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().

563  {
564  if ($this->all_fields == null) {
565  $this->reloadFields();
566  }
567 
568  return $this->all_fields;
569  }
+ 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 628 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.

629  {
630  $tableview = array_shift($this->getVisibleTableViews($ref_id, false, $user_id));
631 
632  return $tableview ? $tableview->getId() : false;
633  }
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 320 of file class.ilDclTable.php.

References $id.

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

321  {
322  return $this->id;
323  }
+ Here is the caller graph for this function:

◆ getImportEnabled()

ilDclTable::getImportEnabled ( )
Returns
boolean

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

References $import_enabled.

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

1498  {
1499  return $this->import_enabled;
1500  }
+ Here is the caller graph for this function:

◆ getIsVisible()

ilDclTable::getIsVisible ( )
Returns
boolean

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

References $is_visible.

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

1133  {
1134  return $this->is_visible;
1135  }
+ Here is the caller graph for this function:

◆ getLimited()

ilDclTable::getLimited ( )
Returns
boolean

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

References $limited.

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

1079  {
1080  return $this->limited;
1081  }
+ Here is the caller graph for this function:

◆ getLimitEnd()

ilDclTable::getLimitEnd ( )
Returns
string

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

References $limit_end.

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

1097  {
1098  return $this->limit_end;
1099  }
+ Here is the caller graph for this function:

◆ getLimitStart()

ilDclTable::getLimitStart ( )
Returns
string

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

References $limit_start.

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

1115  {
1116  return $this->limit_start;
1117  }
+ 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 514 of file class.ilDclTable.php.

References $fields, and getFields().

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

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

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

◆ getObjId()

ilDclTable::getObjId ( )
Returns
int

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

References $objId.

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

339  {
340  return $this->objId;
341  }
+ Here is the caller graph for this function:

◆ getOrder()

ilDclTable::getOrder ( )
Returns
int

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

References $table_order, and updateOrder().

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

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

◆ getPublicCommentsEnabled()

ilDclTable::getPublicCommentsEnabled ( )
Returns
boolean

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

References $public_comments.

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

1211  {
1212  return $this->public_comments;
1213  }
+ 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 699 of file class.ilDclTable.php.

References $fields.

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

700  {
701  $this->loadCustomFields();
702 
703  return $this->fields;
704  }
+ Here is the caller graph for this function:

◆ getRecords()

ilDclTable::getRecords ( )
Returns
ilDclBaseRecordModel[]

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

References $records, and loadRecords().

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

385  {
386  if ($this->records == null) {
387  $this->loadRecords();
388  }
389 
390  return $this->records;
391  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSaveConfirmation()

ilDclTable::getSaveConfirmation ( )
Returns
boolean

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

References $save_confirmation.

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

1238  {
1239  return $this->save_confirmation;
1240  }
+ Here is the caller graph for this function:

◆ getTableViews()

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

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

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

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

588  {
589  return ilDclTableView::getAllForTableId($this->getId());
590  }
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 356 of file class.ilDclTable.php.

References $title.

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

357  {
358  return $this->title;
359  }
+ Here is the caller graph for this function:

◆ getViewOwnRecordsPerm()

ilDclTable::getViewOwnRecordsPerm ( )
Returns
boolean

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

References $view_own_records_perm.

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

1229  {
1230  return (bool) $this->view_own_records_perm;
1231  }
+ 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 601 of file class.ilDclTable.php.

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

Referenced by getFirstTableViewId().

602  {
603  if (ilObjDataCollectionAccess::hasWriteAccess($ref_id, $user_id) && !$with_active_detailedview) {
604  return $this->getTableViews();
605  }
606 
607  $visible_views = array();
608  foreach ($this->getTableViews() as $tableView) {
609  if (ilObjDataCollectionAccess::hasAccessToTableView($tableView, $user_id)) {
610  if (!$with_active_detailedview || ilDclDetailedViewDefinition::isActive($tableView->getId())) {
611  $visible_views[] = $tableView;
612  }
613  }
614  }
615 
616  return $visible_views;
617  }
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 1257 of file class.ilDclTable.php.

References fields.

1258  {
1259  $this->loadCustomFields();
1260 
1261  return (count($this->fields) > 0) ? true : false;
1262  }
$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 781 of file class.ilDclTable.php.

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

782  {
783  if ($this->getObjId() != ilObjDataCollection::_lookupObjectId($ref_id)) {
784  return false;
785  }
787  return true;
788  }
790  return false;
791  }
792  if (!$this->checkLimit()) {
793  return false;
794  }
795  if ($this->getDeletePerm() && !$this->getDeleteByOwner()) {
796  return true;
797  }
798  if ($this->getDeleteByOwner()) {
799  return $this->doesRecordBelongToUser($record);
800  }
801 
802  return false;
803  }
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 811 of file class.ilDclTable.php.

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

812  {
813  if ($this->getObjId() != ilObjDataCollection::_lookupObjectId($ref_id)) {
814  return false;
815  }
816  return ((ilObjDataCollectionAccess::hasAddRecordAccess($ref_id) && $this->getDeletePerm())
818  }
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 750 of file class.ilDclTable.php.

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

751  {
752  if ($this->getObjId() != ilObjDataCollection::_lookupObjectId($ref_id)) {
753  return false;
754  }
756  return true;
757  }
759  return false;
760  }
761  if (!$this->checkLimit()) {
762  return false;
763  }
764  if ($this->getEditPerm() && !$this->getEditByOwner()) {
765  return true;
766  }
767  if ($this->getEditByOwner()) {
768  return $this->doesRecordBelongToUser($record);
769  }
770 
771  return false;
772  }
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 828 of file class.ilDclTable.php.

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

829  {
830  global $DIC;
831  $ilUser = $DIC['ilUser'];
832  if ($this->getObjId() != ilObjDataCollection::_lookupObjectId($ref_id)) {
833  return false;
834  }
835  if (ilObjDataCollectionAccess::hasWriteAccess($ref_id, $user_id) || ilObjDataCollectionAccess::hasEditAccess($ref_id, $user_id)) {
836  return true;
837  }
839  // Check for view only own entries setting
840  if ($this->getViewOwnRecordsPerm() && ($user_id ? $user_id : $ilUser->getId()) != $record->getOwner()) {
841  return false;
842  }
843 
844  return true;
845  }
846 
847  return false;
848  }
global $DIC
Definition: saml.php:7
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
+ Here is the call graph for this function:

◆ loadObj()

ilDclTable::loadObj ( )
protected

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

Referenced by getCollectionObject().

374  {
375  if ($this->obj == null) {
376  $this->obj = new ilObjDataCollection($this->objId, false);
377  }
378  }
Class ilObjDataCollection.
+ Here is the caller graph for this function:

◆ loadRecords()

ilDclTable::loadRecords ( )

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

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

Referenced by getRecords().

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

◆ reloadFields()

ilDclTable::reloadFields ( )

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

References $fields, fields, and sortByOrder().

Referenced by getFields().

573  {
574  $this->loadCustomFields();
575  $this->stdFields = $this->getStandardFields();
576  $fields = array_merge($this->fields, $this->stdFields);
577 
578  $this->sortByOrder($fields);
579 
580  $this->all_fields = $fields;
581  }
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 967 of file class.ilDclTable.php.

References $add_perm.

Referenced by cloneStructure(), and doRead().

968  {
969  $this->add_perm = $add_perm;
970  }
+ Here is the caller graph for this function:

◆ setDefaultSortField()

ilDclTable::setDefaultSortField (   $default_sort_field)

/**

Parameters
string$default_sort_field

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

References $default_sort_field.

Referenced by cloneStructure(), and doRead().

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

◆ setDefaultSortFieldOrder()

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

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

References $default_sort_field_order.

Referenced by cloneStructure(), and doRead().

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

◆ setDeleteByOwner()

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

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

References $delete_by_owner, and setDeletePerm().

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

1037  {
1038  $this->delete_by_owner = $delete_by_owner;
1039  if ($delete_by_owner) {
1040  $this->setDeletePerm(true);
1041  }
1042  }
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 985 of file class.ilDclTable.php.

References $delete_perm, and setDeleteByOwner().

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

986  {
987  $this->delete_perm = $delete_perm;
988  if (!$delete_perm) {
989  $this->setDeleteByOwner(false);
990  }
991  }
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 1141 of file class.ilDclTable.php.

References $description.

Referenced by cloneStructure(), and doRead().

1142  {
1143  $this->description = $description;
1144  }
+ Here is the caller graph for this function:

◆ setEditByOwner()

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

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

References $edit_by_owner, and setEditPerm().

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

1007  {
1008  $this->edit_by_owner = $edit_by_owner;
1009  if ($edit_by_owner) {
1010  $this->setEditPerm(true);
1011  }
1012  }
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 1048 of file class.ilDclTable.php.

References $edit_perm, and setEditByOwner().

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

1049  {
1050  $this->edit_perm = $edit_perm;
1051  if (!$edit_perm) {
1052  $this->setEditByOwner(false);
1053  }
1054  }
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 1435 of file class.ilDclTable.php.

References $export_enabled.

Referenced by cloneStructure(), and doRead().

1436  {
1437  $this->export_enabled = $export_enabled;
1438  }
+ Here is the caller graph for this function:

◆ setId()

ilDclTable::setId (   $a_id)

Set table id.

Parameters
int$a_id

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

Referenced by doCreate().

310  {
311  $this->id = $a_id;
312  }
+ Here is the caller graph for this function:

◆ setImportEnabled()

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

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

References $import_enabled.

Referenced by cloneStructure(), and doRead().

1489  {
1490  $this->import_enabled = $import_enabled;
1491  }
+ Here is the caller graph for this function:

◆ setIsVisible()

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

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

References $is_visible.

Referenced by cloneStructure(), and doRead().

1124  {
1125  $this->is_visible = $is_visible;
1126  }
+ Here is the caller graph for this function:

◆ setLimited()

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

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

References $limited.

Referenced by cloneStructure(), and doRead().

1070  {
1071  $this->limited = $limited;
1072  }
+ Here is the caller graph for this function:

◆ setLimitEnd()

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

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

References $limit_end.

Referenced by cloneStructure(), and doRead().

1088  {
1089  $this->limit_end = $limit_end;
1090  }
+ Here is the caller graph for this function:

◆ setLimitStart()

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

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

References $limit_start.

Referenced by cloneStructure(), and doRead().

1106  {
1107  $this->limit_start = $limit_start;
1108  }
+ Here is the caller graph for this function:

◆ setObjId()

ilDclTable::setObjId (   $a_id)
Parameters
$a_id

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

Referenced by doRead().

330  {
331  $this->objId = $a_id;
332  }
+ Here is the caller graph for this function:

◆ setOrder()

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

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

References $table_order.

Referenced by cloneStructure(), and doRead().

1480  {
1481  $this->table_order = $table_order;
1482  }
+ Here is the caller graph for this function:

◆ setPublicCommentsEnabled()

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

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

References $public_comments.

Referenced by cloneStructure(), and doRead().

1202  {
1203  $this->public_comments = $public_comments;
1204  }
+ Here is the caller graph for this function:

◆ setSaveConfirmation()

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

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

References $save_confirmation.

Referenced by cloneStructure(), and doRead().

1247  {
1248  $this->save_confirmation = $save_confirmation;
1249  }
+ Here is the caller graph for this function:

◆ setTitle()

ilDclTable::setTitle (   $a_title)
Parameters
$a_title

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

Referenced by cloneStructure(), and doRead().

348  {
349  $this->title = $a_title;
350  }
+ Here is the caller graph for this function:

◆ setViewOwnRecordsPerm()

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

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

Referenced by cloneStructure(), and doRead().

1220  {
1221  $this->view_own_records_perm = (int) $view_own_perm;
1222  }
+ Here is the caller graph for this function:

◆ sortByOrder()

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

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

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

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

◆ sortFields()

ilDclTable::sortFields ( $fields)

sortFields

Parameters
$fieldsilDclBaseFieldModel[]

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

References $fields, and sortByOrder().

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

◆ sortTableViews()

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

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

References getTableViews().

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

◆ updateFields()

ilDclTable::updateFields ( )

Update fields.

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

References getFields().

886  {
887  foreach ($this->getFields() as $field) {
888  $field->doUpdate();
889  }
890  }
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 1466 of file class.ilDclTable.php.

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

Referenced by getOrder().

1467  {
1468  global $DIC;
1469  $ilDB = $DIC['ilDB'];
1470  $result = $ilDB->query('SELECT MAX(table_order) AS table_order FROM il_dcl_table WHERE obj_id = ' . $ilDB->quote($this->getCollectionObject()->getId(), 'integer'));
1471  $this->table_order = $ilDB->fetchObject($result)->table_order + 10;
1472  $ilDB->query('UPDATE il_dcl_table SET table_order = ' . $ilDB->quote($this->table_order, 'integer') . ' WHERE id = ' . $ilDB->quote($this->getId(), 'integer'));
1473  }
$result
global $DIC
Definition: saml.php:7
getId()
Get table id.
global $ilDB
+ 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 59 of file class.ilDclTable.php.

Referenced by getAddPerm(), and setAddPerm().

◆ $all_fields

ilDclTable::$all_fields = null
protected

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

Referenced by getFields().

◆ $default_sort_field

ilDclTable::$default_sort_field = 0
protected

Definition at line 109 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 115 of file class.ilDclTable.php.

Referenced by getDefaultSortFieldOrder(), and setDefaultSortFieldOrder().

◆ $delete_by_owner

ilDclTable::$delete_by_owner
protected

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

Referenced by getDeleteByOwner(), and setDeleteByOwner().

◆ $delete_perm

ilDclTable::$delete_perm
protected

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

Referenced by getDeletePerm(), and setDeletePerm().

◆ $description

ilDclTable::$description = ''
protected

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

Referenced by getDescription(), and setDescription().

◆ $edit_by_owner

ilDclTable::$edit_by_owner
protected

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

Referenced by getEditByOwner(), and setEditByOwner().

◆ $edit_perm

ilDclTable::$edit_perm
protected

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

Referenced by getEditPerm(), and setEditPerm().

◆ $export_enabled

ilDclTable::$export_enabled
protected

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

Referenced by getExportEnabled(), and setExportEnabled().

◆ $fields

◆ $id

ilDclTable::$id = 0
protected

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

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

◆ $import_enabled

ilDclTable::$import_enabled
protected

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

Referenced by getImportEnabled(), and setImportEnabled().

◆ $is_visible

ilDclTable::$is_visible
protected

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

Referenced by getIsVisible(), and setIsVisible().

◆ $limit_end

ilDclTable::$limit_end
protected

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

Referenced by getLimitEnd(), and setLimitEnd().

◆ $limit_start

ilDclTable::$limit_start
protected

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

Referenced by getLimitStart(), and setLimitStart().

◆ $limited

ilDclTable::$limited
protected

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

Referenced by getLimited(), and setLimited().

◆ $obj

ilDclTable::$obj
protected

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

Referenced by getCollectionObject().

◆ $objId

ilDclTable::$objId
protected

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

Referenced by getObjId().

◆ $public_comments

ilDclTable::$public_comments = 0
protected

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

Referenced by getPublicCommentsEnabled(), and setPublicCommentsEnabled().

◆ $records

ilDclTable::$records
protected

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

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

◆ $save_confirmation

ilDclTable::$save_confirmation
protected

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

Referenced by getSaveConfirmation(), and setSaveConfirmation().

◆ $stdFields

ilDclTable::$stdFields
protected

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

Referenced by getFirstTableViewId().

◆ $table_order

ilDclTable::$table_order
protected

Definition at line 99 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 133 of file class.ilDclTable.php.

Referenced by getViewOwnRecordsPerm().


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