ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 1387 of file class.ilDclTable.php.

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

Referenced by ilObjDataCollection\reorderTables().

1388  {
1389  global $DIC;
1390  $ilDB = $DIC['ilDB'];
1391  $result = $ilDB->query('SELECT id FROM il_dcl_table WHERE title = ' . $ilDB->quote($title, 'text') . ' AND obj_id = '
1392  . $ilDB->quote($obj_id, 'integer'));
1393  $id = 0;
1394  while ($rec = $ilDB->fetchAssoc($result)) {
1395  $id = $rec['id'];
1396  }
1397 
1398  return $id;
1399  }
$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 1476 of file class.ilDclTable.php.

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

Referenced by ilDclFieldEditGUI\checkInput().

1477  {
1478  global $DIC;
1479  $ilDB = $DIC['ilDB'];
1480  $result = $ilDB->query('SELECT * FROM il_dcl_field WHERE table_id = ' . $ilDB->quote($obj_id, 'integer') . ' AND title = '
1481  . $ilDB->quote($title, 'text'));
1482 
1483  return ($ilDB->numRows($result)) ? true : false;
1484  }
$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 1350 of file class.ilDclTable.php.

References getRecords().

1351  {
1352  return (count($this->getRecords()) > 0) ? true : false;
1353  }
+ 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 1370 of file class.ilDclTable.php.

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

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

1371  {
1372  global $DIC;
1373  $ilDB = $DIC['ilDB'];
1374  $query = "SELECT * FROM il_dcl_table WHERE id = " . $table_id;
1375  $result = $ilDB->query($query);
1376 
1377  return $result->numRows() != 0;
1378  }
$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 1359 of file class.ilDclTable.php.

1360  {
1361  $this->all_fields[$field->getId()] = $field;
1362  }

◆ afterClone()

ilDclTable::afterClone ( )

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

References getFields(), and getRecords().

1338  {
1339  foreach ($this->getFields() as $field) {
1340  $field->afterClone($this->getRecords());
1341  }
1342  }
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 900 of file class.ilDclTable.php.

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

Referenced by doCreate().

901  {
902  $fields = $this->getFields();
903  $this->sortByOrder($fields);
904  $count = 10;
905  $offset = 10;
906  foreach ($fields as $field) {
907  if (!is_null($field->getOrder())) {
908  $field->setOrder($count);
909  $count = $count + $offset;
910  $field->doUpdate();
911  }
912  }
913  }
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 842 of file class.ilDclTable.php.

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

Referenced by hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

843  {
844  if ($this->getLimited()) {
845  $now = new ilDateTime(date("Y-m-d H:i:s"), IL_CAL_DATE);
846  $from = new ilDateTime($this->getLimitStart(), IL_CAL_DATE);
847  $to = new ilDateTime($this->getLimitEnd(), IL_CAL_DATE);
848 
849  return ($from <= $now && $now <= $to);
850  }
851 
852  return true;
853  }
$from
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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 1262 of file class.ilDclTable.php.

References $default_sort_field, array, 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().

1263  {
1264  $this->setTitle($original->getTitle());
1265  $this->setDescription($original->getDescription());
1266  $this->setIsVisible($original->getIsVisible());
1267  $this->setEditByOwner($original->getEditByOwner());
1268  $this->setAddPerm($original->getAddPerm());
1269  $this->setEditPerm($original->getEditPerm());
1270  $this->setDeleteByOwner($original->getDeleteByOwner());
1271  $this->setSaveConfirmation($original->getSaveConfirmation());
1272  $this->setDeletePerm($original->getDeletePerm());
1273  $this->setLimited($original->getLimited());
1274  $this->setLimitStart($original->getLimitStart());
1275  $this->setLimitEnd($original->getLimitEnd());
1276  $this->setViewOwnRecordsPerm($original->getViewOwnRecordsPerm());
1277  $this->setExportEnabled($original->getExportEnabled());
1278  $this->setImportEnabled($original->getImportEnabled());
1281  $this->setOrder($original->getOrder());
1282 
1283  $this->doCreate(true, false);
1284  // reset stdFields to get new for the created object
1285 
1286  $default_sort_field = 0;
1287  // Clone standard-fields
1288  $org_std_fields = $original->getStandardFields();
1289  foreach ($this->getStandardFields() as $element_key => $std_field) {
1290  $std_field->cloneStructure($org_std_fields[$element_key]);
1291  if ($std_field->getId() === $original->getDefaultSortField()) {
1292  $default_sort_field = $std_field->getId();
1293  }
1294  }
1295 
1296  // Clone fields
1297  $new_fields = array();
1298  foreach ($original->getFields() as $orig_field) {
1299  if (!$orig_field->isStandardField()) {
1300  $class_name = get_class($orig_field);
1301  $new_field = new $class_name();
1302  $new_field->setTableId($this->getId());
1303  $new_field->cloneStructure($orig_field->getId());
1304  $new_fields[$orig_field->getId()] = $new_field;
1305 
1306  if ($orig_field->getId() === $original->getDefaultSortField()) {
1307  $default_sort_field = $new_field->getId();
1308  }
1309  }
1310  }
1311 
1313  $this->doUpdate();
1314 
1315  // Clone Records with recordfields
1316  foreach ($original->getRecords() as $orig_record) {
1317  $new_record = new ilDclBaseRecordModel();
1318  $new_record->setTableId($this->getId());
1319  $new_record->cloneStructure($orig_record->getId(), $new_fields);
1320  }
1321 
1322  //clone tableviews (includes pageobjects)
1323  foreach ($original->getTableViews() as $orig_tableview) {
1324  $new_tableview = new ilDclTableView();
1325  $new_tableview->setTableId($this->getId());
1326  $new_tableview->cloneStructure($orig_tableview, $new_fields);
1327  }
1328 
1329  // mandatory for all cloning functions
1330  ilDclCache::setCloneOf($original->getId(), $this->getId(), ilDclCache::TYPE_TABLE);
1331  }
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)
Create styles array
The data for the language used.
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 1243 of file class.ilDclTable.php.

1244  {
1245  if (is_null($a->getOrder() == null) && is_null($b->getOrder() == null)) {
1246  return 0;
1247  }
1248  if (is_null($a->getOrder())) {
1249  return 1;
1250  }
1251  if (is_null($b->getOrder())) {
1252  return -1;
1253  }
1254 
1255  return $a->getOrder() < $b->getOrder() ? -1 : 1;
1256  }

◆ deleteField()

ilDclTable::deleteField (   $field_id)
Parameters
$field_id

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

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

408  {
409  $field = ilDclCache::getFieldCache($field_id);
410  $records = $this->getRecords();
411 
412  foreach ($records as $record) {
413  $record->deleteField($field_id);
414  }
415 
416  $field->doDelete();
417  }
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 830 of file class.ilDclTable.php.

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

Referenced by hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

831  {
832  global $DIC;
833  $ilUser = $DIC['ilUser'];
834 
835  return ($ilUser->getId() == $record->getOwner());
836  }
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 267 of file class.ilDclTable.php.

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

268  {
269  global $DIC;
270  $ilDB = $DIC['ilDB'];
271 
272  $ilDB->update("il_dcl_table", array(
273  "obj_id" => array( "integer", $this->getObjId() ),
274  "title" => array( "text", $this->getTitle() ),
275  "add_perm" => array( "integer", (int) $this->getAddPerm() ),
276  "edit_perm" => array( "integer", (int) $this->getEditPerm() ),
277  "delete_perm" => array( "integer", (int) $this->getDeletePerm() ),
278  "edit_by_owner" => array( "integer", (int) $this->getEditByOwner() ),
279  "limited" => array( "integer", $this->getLimited() ),
280  "limit_start" => array( "timestamp", $this->getLimitStart() ),
281  "limit_end" => array( "timestamp", $this->getLimitEnd() ),
282  "is_visible" => array( "integer", $this->getIsVisible() ? 1 : 0 ),
283  "export_enabled" => array( "integer", $this->getExportEnabled() ? 1 : 0 ),
284  "import_enabled" => array( "integer", $this->getImportEnabled() ? 1 : 0 ),
285  "description" => array( "text", $this->getDescription() ),
286  "default_sort_field_id" => array( "text", $this->getDefaultSortField() ),
287  "default_sort_field_order" => array( "text", $this->getDefaultSortFieldOrder() ),
288  "public_comments" => array( "integer", $this->getPublicCommentsEnabled() ? 1 : 0 ),
289  "view_own_records_perm" => array( "integer", $this->getViewOwnRecordsPerm() ),
290  'delete_by_owner' => array( 'integer', $this->getDeleteByOwner() ? 1 : 0 ),
291  'save_confirmation' => array( 'integer', $this->getSaveConfirmation() ? 1 : 0 ),
292  'table_order' => array( 'integer', $this->getOrder() ),
293  ), array(
294  "id" => array( "integer", $this->getId() )
295  ));
296  }
global $DIC
Definition: saml.php:7
getId()
Get table id.
Create styles array
The data for the language used.
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 949 of file class.ilDclTable.php.

References $add_perm.

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

950  {
951  return (bool) $this->add_perm;
952  }
+ Here is the caller graph for this function:

◆ getCollectionObject()

ilDclTable::getCollectionObject ( )
Returns
ilObjDataCollection

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

References $obj, and loadObj().

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

◆ getCustomFields()

ilDclTable::getCustomFields ( )

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

References $fields, and fields.

488  {
489  if (!$this->fields) {
490  $this->loadCustomFields();
491  }
492  return $this->fields;
493  }
$errors fields
Definition: imgupload.php:51

◆ getDefaultSortField()

ilDclTable::getDefaultSortField ( )
Returns
string

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

References $default_sort_field.

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

1145  {
1147  }
+ Here is the caller graph for this function:

◆ getDefaultSortFieldOrder()

ilDclTable::getDefaultSortFieldOrder ( )
Returns
string

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

References $default_sort_field_order.

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

1166  {
1168  }
+ Here is the caller graph for this function:

◆ getDeleteByOwner()

ilDclTable::getDeleteByOwner ( )
Returns
boolean

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

References $delete_by_owner.

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

1001  {
1002  return (bool) $this->delete_by_owner;
1003  }
+ Here is the caller graph for this function:

◆ getDeletePerm()

ilDclTable::getDeletePerm ( )
Returns
boolean

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

References $delete_perm.

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

971  {
972  return (bool) $this->delete_perm;
973  }
+ Here is the caller graph for this function:

◆ getDescription()

ilDclTable::getDescription ( )
Returns
string

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

References $description.

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

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

◆ getEditableFields()

ilDclTable::getEditableFields ( )
Returns
array

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

References $fields, array, and getRecordFields().

686  {
687  $fields = $this->getRecordFields();
688  $editableFields = array();
689 
690  foreach ($fields as $field) {
691  if (!$field->getLocked()) {
692  $editableFields[] = $field;
693  }
694  }
695 
696  return $editableFields;
697  }
getRecordFields()
Returns all fields of this table which are NOT standard fields.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getEditByOwner()

ilDclTable::getEditByOwner ( )
Returns
boolean

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

References $edit_by_owner.

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

992  {
993  return (bool) $this->edit_by_owner;
994  }
+ Here is the caller graph for this function:

◆ getEditPerm()

ilDclTable::getEditPerm ( )
Returns
boolean

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

References $edit_perm.

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

1034  {
1035  return (bool) $this->edit_perm;
1036  }
+ 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 704 of file class.ilDclTable.php.

References $fields, array, and getFields().

705  {
706  $fields = $this->getFields();
707  $exportableFields = array();
708  foreach ($fields as $field) {
709  if ($field->getExportable()) {
710  $exportableFields[] = $field;
711  }
712  }
713 
714  return $exportableFields;
715  }
getFields()
Returns all fields of this table including the standard fields.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getExportEnabled()

ilDclTable::getExportEnabled ( )
Returns
boolean

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

References $export_enabled.

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

1414  {
1415  return $this->export_enabled;
1416  }
+ Here is the caller graph for this function:

◆ getField()

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

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

References $fields, and getFields().

Referenced by _hasFieldByTitle().

426  {
427  $fields = $this->getFields();
428  $field = null;
429  foreach ($fields as $field_1) {
430  if ($field_1->getId() == $field_id) {
431  $field = $field_1;
432  }
433  }
434 
435  return $field;
436  }
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 923 of file class.ilDclTable.php.

References $title, and getFields().

Referenced by _hasFieldByTitle().

924  {
925  $return = null;
926  foreach ($this->getFields() as $field) {
927  if ($field->getTitle() == $title) {
928  $return = $field;
929  break;
930  }
931  }
932 
933  return $return;
934  }
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 442 of file class.ilDclTable.php.

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

443  {
444  $field_ids = array();
445  foreach ($this->getFields() as $field) {
446  if ($field->getId()) {
447  $field_ids[] = $field->getId();
448  }
449  }
450  return $field_ids;
451  }
getFields()
Returns all fields of this table including the standard fields.
Create styles array
The data for the language used.
+ 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 546 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().

547  {
548  if ($this->all_fields == null) {
549  $this->reloadFields();
550  }
551 
552  return $this->all_fields;
553  }
+ 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 605 of file class.ilDclTable.php.

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

606  {
607  $tableview = array_shift($this->getVisibleTableViews($ref_id, false, $user_id));
608  return $tableview ? $tableview->getId() : false;
609  }
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 315 of file class.ilDclTable.php.

References $id.

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

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

◆ getImportEnabled()

ilDclTable::getImportEnabled ( )
Returns
boolean

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

References $import_enabled.

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

1463  {
1464  return $this->import_enabled;
1465  }
+ Here is the caller graph for this function:

◆ getIsVisible()

ilDclTable::getIsVisible ( )
Returns
boolean

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

References $is_visible.

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

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

◆ getLimited()

ilDclTable::getLimited ( )
Returns
boolean

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

References $limited.

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

1052  {
1053  return $this->limited;
1054  }
+ Here is the caller graph for this function:

◆ getLimitEnd()

ilDclTable::getLimitEnd ( )
Returns
string

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

References $limit_end.

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

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

◆ getLimitStart()

ilDclTable::getLimitStart ( )
Returns
string

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

References $limit_start.

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

1088  {
1089  return $this->limit_start;
1090  }
+ 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 501 of file class.ilDclTable.php.

References $fields, and getFields().

502  {
503  $fields = $this->getFields();
504  $place = 0;
505  foreach ($fields as $field) {
506  if (!$field->isStandardField()) {
507  $place = $field->getOrder() + 1;
508  }
509  }
510 
511  return $place;
512  }
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 517 of file class.ilDclTable.php.

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

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

◆ getObjId()

ilDclTable::getObjId ( )
Returns
int

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

References $objId.

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

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

◆ getOrder()

ilDclTable::getOrder ( )
Returns
int

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

References $table_order, and updateOrder().

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

1422  {
1423  if (!$this->table_order) {
1424  $this->updateOrder();
1425  }
1426  return $this->table_order;
1427  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPublicCommentsEnabled()

ilDclTable::getPublicCommentsEnabled ( )
Returns
boolean

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

References $public_comments.

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

1184  {
1185  return $this->public_comments;
1186  }
+ 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 675 of file class.ilDclTable.php.

References $fields.

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

676  {
677  $this->loadCustomFields();
678 
679  return $this->fields;
680  }
+ Here is the caller graph for this function:

◆ getRecords()

ilDclTable::getRecords ( )
Returns
ilDclBaseRecordModel[]

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

References $records, and loadRecords().

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

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

◆ getSaveConfirmation()

ilDclTable::getSaveConfirmation ( )
Returns
boolean

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

References $save_confirmation.

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

1211  {
1212  return $this->save_confirmation;
1213  }
+ Here is the caller graph for this function:

◆ getTableViews()

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

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

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

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

570  {
571  return ilDclTableView::getAllForTableId($this->getId());
572  }
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 351 of file class.ilDclTable.php.

References $title.

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

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

◆ getViewOwnRecordsPerm()

ilDclTable::getViewOwnRecordsPerm ( )
Returns
boolean

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

References $view_own_records_perm.

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

1202  {
1203  return (bool) $this->view_own_records_perm;
1204  }
+ 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 581 of file class.ilDclTable.php.

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

Referenced by getFirstTableViewId().

582  {
583  if (ilObjDataCollectionAccess::hasWriteAccess($ref_id, $user_id) && !$with_active_detailedview) {
584  return $this->getTableViews();
585  }
586 
587  $visible_views = array();
588  foreach ($this->getTableViews() as $tableView) {
589  if (ilObjDataCollectionAccess::hasAccessToTableView($tableView, $user_id)) {
590  if (!$with_active_detailedview || ilDclDetailedViewDefinition::isActive($tableView->getId())) {
591  $visible_views[] = $tableView;
592  }
593  }
594  }
595  return $visible_views;
596  }
static hasAccessToTableView($tableview, $user_id=0)
This only checks access to the tableview - if the full access check is required, use hasAccessTo($ref...
Create styles array
The data for the language used.
+ 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 1230 of file class.ilDclTable.php.

References fields.

1231  {
1232  $this->loadCustomFields();
1233 
1234  return (count($this->fields) > 0) ? true : false;
1235  }
$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 755 of file class.ilDclTable.php.

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

756  {
757  if ($this->getObjId() != ilObjDataCollection::_lookupObjectId($ref_id)) {
758  return false;
759  }
761  return true;
762  }
764  return false;
765  }
766  if (!$this->checkLimit()) {
767  return false;
768  }
769  if ($this->getDeletePerm() && !$this->getDeleteByOwner()) {
770  return true;
771  }
772  if ($this->getDeleteByOwner()) {
773  return $this->doesRecordBelongToUser($record);
774  }
775 
776  return false;
777  }
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 785 of file class.ilDclTable.php.

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

786  {
787  if ($this->getObjId() != ilObjDataCollection::_lookupObjectId($ref_id)) {
788  return false;
789  }
790  return ((ilObjDataCollectionAccess::hasAddRecordAccess($ref_id) && $this->getDeletePerm())
792  }
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 724 of file class.ilDclTable.php.

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

725  {
726  if ($this->getObjId() != ilObjDataCollection::_lookupObjectId($ref_id)) {
727  return false;
728  }
730  return true;
731  }
733  return false;
734  }
735  if (!$this->checkLimit()) {
736  return false;
737  }
738  if ($this->getEditPerm() && !$this->getEditByOwner()) {
739  return true;
740  }
741  if ($this->getEditByOwner()) {
742  return $this->doesRecordBelongToUser($record);
743  }
744 
745  return false;
746  }
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 802 of file class.ilDclTable.php.

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

803  {
804  global $DIC;
805  $ilUser = $DIC['ilUser'];
806  if ($this->getObjId() != ilObjDataCollection::_lookupObjectId($ref_id)) {
807  return false;
808  }
809  if (ilObjDataCollectionAccess::hasWriteAccess($ref_id, $user_id) || ilObjDataCollectionAccess::hasEditAccess($ref_id, $user_id)) {
810  return true;
811  }
813  // Check for view only own entries setting
814  if ($this->getViewOwnRecordsPerm() && ($user_id ? $user_id : $ilUser->getId()) != $record->getOwner()) {
815  return false;
816  }
817 
818  return true;
819  }
820 
821  return false;
822  }
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 368 of file class.ilDclTable.php.

Referenced by getCollectionObject().

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

◆ loadRecords()

ilDclTable::loadRecords ( )

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

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

Referenced by getRecords().

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

◆ reloadFields()

ilDclTable::reloadFields ( )

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

References $fields, fields, and sortByOrder().

Referenced by getFields().

556  {
557  $this->loadCustomFields();
558  $this->stdFields = $this->getStandardFields();
559  $fields = array_merge($this->fields, $this->stdFields);
560 
561  $this->sortByOrder($fields);
562 
563  $this->all_fields = $fields;
564  }
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 940 of file class.ilDclTable.php.

References $add_perm.

Referenced by cloneStructure(), and doRead().

941  {
942  $this->add_perm = $add_perm;
943  }
+ Here is the caller graph for this function:

◆ setDefaultSortField()

ilDclTable::setDefaultSortField (   $default_sort_field)

/**

Parameters
string$default_sort_field

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

References $default_sort_field.

Referenced by cloneStructure(), and doRead().

1135  {
1136  $default_sort_field = ($default_sort_field) ? $default_sort_field : 0; // Change null or empty strings to zero
1137  $this->default_sort_field = $default_sort_field;
1138  }
+ Here is the caller graph for this function:

◆ setDefaultSortFieldOrder()

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

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

References $default_sort_field_order, and array.

Referenced by cloneStructure(), and doRead().

1154  {
1155  if (!in_array($default_sort_field_order, array( 'asc', 'desc' ))) {
1156  $default_sort_field_order = 'asc';
1157  }
1158  $this->default_sort_field_order = $default_sort_field_order;
1159  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setDeleteByOwner()

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

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

References $delete_by_owner, and setDeletePerm().

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

1010  {
1011  $this->delete_by_owner = $delete_by_owner;
1012  if ($delete_by_owner) {
1013  $this->setDeletePerm(true);
1014  }
1015  }
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 958 of file class.ilDclTable.php.

References $delete_perm, and setDeleteByOwner().

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

959  {
960  $this->delete_perm = $delete_perm;
961  if (!$delete_perm) {
962  $this->setDeleteByOwner(false);
963  }
964  }
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 1114 of file class.ilDclTable.php.

References $description.

Referenced by cloneStructure(), and doRead().

1115  {
1116  $this->description = $description;
1117  }
+ Here is the caller graph for this function:

◆ setEditByOwner()

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

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

References $edit_by_owner, and setEditPerm().

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

980  {
981  $this->edit_by_owner = $edit_by_owner;
982  if ($edit_by_owner) {
983  $this->setEditPerm(true);
984  }
985  }
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 1021 of file class.ilDclTable.php.

References $edit_perm, and setEditByOwner().

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

1022  {
1023  $this->edit_perm = $edit_perm;
1024  if (!$edit_perm) {
1025  $this->setEditByOwner(false);
1026  }
1027  }
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 1404 of file class.ilDclTable.php.

References $export_enabled.

Referenced by cloneStructure(), and doRead().

1405  {
1406  $this->export_enabled = $export_enabled;
1407  }
+ Here is the caller graph for this function:

◆ setId()

ilDclTable::setId (   $a_id)

Set table id.

Parameters
int$a_id

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

Referenced by doCreate().

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

◆ setImportEnabled()

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

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

References $import_enabled.

Referenced by cloneStructure(), and doRead().

1454  {
1455  $this->import_enabled = $import_enabled;
1456  }
+ Here is the caller graph for this function:

◆ setIsVisible()

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

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

References $is_visible.

Referenced by cloneStructure(), and doRead().

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

◆ setLimited()

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

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

References $limited.

Referenced by cloneStructure(), and doRead().

1043  {
1044  $this->limited = $limited;
1045  }
+ Here is the caller graph for this function:

◆ setLimitEnd()

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

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

References $limit_end.

Referenced by cloneStructure(), and doRead().

1061  {
1062  $this->limit_end = $limit_end;
1063  }
+ Here is the caller graph for this function:

◆ setLimitStart()

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

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

References $limit_start.

Referenced by cloneStructure(), and doRead().

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

◆ setObjId()

ilDclTable::setObjId (   $a_id)
Parameters
$a_id

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

Referenced by doRead().

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

◆ setOrder()

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

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

References $table_order.

Referenced by cloneStructure(), and doRead().

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

◆ setPublicCommentsEnabled()

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

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

References $public_comments.

Referenced by cloneStructure(), and doRead().

1175  {
1176  $this->public_comments = $public_comments;
1177  }
+ Here is the caller graph for this function:

◆ setSaveConfirmation()

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

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

References $save_confirmation.

Referenced by cloneStructure(), and doRead().

1220  {
1221  $this->save_confirmation = $save_confirmation;
1222  }
+ Here is the caller graph for this function:

◆ setTitle()

ilDclTable::setTitle (   $a_title)
Parameters
$a_title

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

Referenced by cloneStructure(), and doRead().

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

◆ setViewOwnRecordsPerm()

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

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

Referenced by cloneStructure(), and doRead().

1193  {
1194  $this->view_own_records_perm = (int) $view_own_perm;
1195  }
+ Here is the caller graph for this function:

◆ sortByOrder()

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

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

References array.

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

889  {
890  // php-bug: https://bugs.php.net/bug.php?id=50688
891  // fixed in php 7 but for now we need the @ a workaround
892  @usort($array, array( $this, "compareOrder" ));
893  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ sortFields()

ilDclTable::sortFields ( $fields)

sortFields

Parameters
$fieldsilDclBaseFieldModel[]

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

References $fields, array, and sortByOrder().

872  {
873  $this->sortByOrder($fields);
874  //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.
875  $named = array();
876  foreach ($fields as $field) {
877  $named[$field->getId()] = $field;
878  }
879 
880  $fields = $named;
881  }
sortByOrder(&$array)
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ sortTableViews()

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

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

References getTableViews().

526  {
527  if ($tableviews == null) {
528  $tableviews = $this->getTableViews();
529  }
530 
531  $order = 10;
532  foreach ($tableviews as $tableview) {
533  $tableview->setTableviewOrder($order);
534  $tableview->update();
535  $order += 10;
536  }
537  }
+ Here is the call graph for this function:

◆ updateFields()

ilDclTable::updateFields ( )

Update fields.

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

References getFields().

860  {
861  foreach ($this->getFields() as $field) {
862  $field->doUpdate();
863  }
864  }
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 1432 of file class.ilDclTable.php.

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

Referenced by getOrder().

1433  {
1434  global $DIC;
1435  $ilDB = $DIC['ilDB'];
1436  $result = $ilDB->query('SELECT MAX(table_order) AS table_order FROM il_dcl_table WHERE obj_id = ' . $ilDB->quote($this->getCollectionObject()->getId(), 'integer'));
1437  $this->table_order = $ilDB->fetchObject($result)->table_order + 10;
1438  $ilDB->query('UPDATE il_dcl_table SET table_order = ' . $ilDB->quote($this->table_order, 'integer') . ' WHERE id = ' . $ilDB->quote($this->getId(), 'integer'));
1439  }
$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: