ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 144 of file class.ilDclTable.php.

References doRead().

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

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

Referenced by ilObjDataCollection\reorderTables().

1317  {
1318  global $DIC;
1319  $ilDB = $DIC['ilDB'];
1320  $result = $ilDB->query('SELECT id FROM il_dcl_table WHERE title = ' . $ilDB->quote($title, 'text') . ' AND obj_id = '
1321  . $ilDB->quote($obj_id, 'integer'));
1322  $id = 0;
1323  while ($rec = $ilDB->fetchAssoc($result)) {
1324  $id = $rec['id'];
1325  }
1326 
1327  return $id;
1328  }
$result
global $ilDB
global $DIC
+ 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 1400 of file class.ilDclTable.php.

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

Referenced by ilDclFieldEditGUI\checkInput().

1400  {
1401  global $DIC;
1402  $ilDB = $DIC['ilDB'];
1403  $result = $ilDB->query('SELECT * FROM il_dcl_field WHERE table_id = ' . $ilDB->quote($obj_id, 'integer') . ' AND title = '
1404  . $ilDB->quote($title, 'text'));
1405 
1406  return ($ilDB->numRows($result)) ? true : false;
1407  }
$result
global $ilDB
global $DIC
+ 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 1283 of file class.ilDclTable.php.

References getRecords().

1283  {
1284  return (count($this->getRecords()) > 0) ? true : false;
1285  }
+ 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 1301 of file class.ilDclTable.php.

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

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

1301  {
1302  global $DIC;
1303  $ilDB = $DIC['ilDB'];
1304  $query = "SELECT * FROM il_dcl_table WHERE id = " . $table_id;
1305  $result = $ilDB->query($query);
1306 
1307  return $result->numRows() != 0;
1308  }
$result
global $ilDB
global $DIC
+ 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 1291 of file class.ilDclTable.php.

1291  {
1292  $this->all_fields[$field->getId()] = $field;
1293  }

◆ afterClone()

ilDclTable::afterClone ( )

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

References getFields(), and getRecords().

1271  {
1272  foreach ($this->getFields() as $field) {
1273  $field->afterClone($this->getRecords());
1274  }
1275  }
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 868 of file class.ilDclTable.php.

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

Referenced by doCreate().

868  {
869  $fields = $this->getFields();
870  $this->sortByOrder($fields);
871  $count = 10;
872  $offset = 10;
873  foreach ($fields as $field) {
874  if (!is_null($field->getOrder())) {
875  $field->setOrder($count);
876  $count = $count + $offset;
877  $field->doUpdate();
878  }
879  }
880  }
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 814 of file class.ilDclTable.php.

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

Referenced by hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

814  {
815  if ($this->getLimited()) {
816  $now = new ilDateTime(date("Y-m-d H:i:s"), IL_CAL_DATE);
817  $from = new ilDateTime($this->getLimitStart(), IL_CAL_DATE);
818  $to = new ilDateTime($this->getLimitEnd(), IL_CAL_DATE);
819 
820  return ($from <= $now && $now <= $to);
821  }
822 
823  return true;
824  }
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 1197 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().

1197  {
1198  $this->setTitle($original->getTitle());
1199  $this->setDescription($original->getDescription());
1200  $this->setIsVisible($original->getIsVisible());
1201  $this->setEditByOwner($original->getEditByOwner());
1202  $this->setAddPerm($original->getAddPerm());
1203  $this->setEditPerm($original->getEditPerm());
1204  $this->setDeleteByOwner($original->getDeleteByOwner());
1205  $this->setSaveConfirmation($original->getSaveConfirmation());
1206  $this->setDeletePerm($original->getDeletePerm());
1207  $this->setLimited($original->getLimited());
1208  $this->setLimitStart($original->getLimitStart());
1209  $this->setLimitEnd($original->getLimitEnd());
1210  $this->setViewOwnRecordsPerm($original->getViewOwnRecordsPerm());
1211  $this->setExportEnabled($original->getExportEnabled());
1212  $this->setImportEnabled($original->getImportEnabled());
1215  $this->setOrder($original->getOrder());
1216 
1217  $this->doCreate(true, false);
1218  // reset stdFields to get new for the created object
1219 
1220  $default_sort_field = 0;
1221  // Clone standard-fields
1222  $org_std_fields = $original->getStandardFields();
1223  foreach ($this->getStandardFields() as $element_key => $std_field) {
1224  $std_field->cloneStructure($org_std_fields[$element_key]);
1225  if ($std_field->getId() === $original->getDefaultSortField()) {
1226  $default_sort_field = $std_field->getId();
1227  }
1228  }
1229 
1230  // Clone fields
1231  $new_fields = array();
1232  foreach ($original->getFields() as $orig_field) {
1233  if (!$orig_field->isStandardField()) {
1234  $new_field = new ilDclBaseFieldModel();
1235  $new_field->setTableId($this->getId());
1236  $new_field->cloneStructure($orig_field->getId());
1237  $new_fields[$orig_field->getId()] = $new_field;
1238 
1239  if ($orig_field->getId() === $original->getDefaultSortField()) {
1240  $default_sort_field = $new_field->getId();
1241  }
1242  }
1243  }
1244 
1246  $this->doUpdate();
1247 
1248  // Clone Records with recordfields
1249  foreach($original->getRecords() as $orig_record){
1250  $new_record = new ilDclBaseRecordModel();
1251  $new_record->setTableId($this->getId());
1252  $new_record->cloneStructure($orig_record->getId(), $new_fields);
1253  }
1254 
1255  //clone tableviews (includes pageobjects)
1256  foreach ($original->getTableViews() as $orig_tableview) {
1257  $new_tableview = new ilDclTableView();
1258  $new_tableview->setTableId($this->getId());
1259  $new_tableview->cloneStructure($orig_tableview, $new_fields);
1260 
1261  }
1262 
1263  // mandatory for all cloning functions
1264  ilDclCache::setCloneOf($original->getId(), $this->getId(), ilDclCache::TYPE_TABLE);
1265  }
Class ilDclBaseFieldModel.
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 1179 of file class.ilDclTable.php.

1179  {
1180  if (is_null($a->getOrder() == NULL) && is_null($b->getOrder() == NULL)) {
1181  return 0;
1182  }
1183  if (is_null($a->getOrder())) {
1184  return 1;
1185  }
1186  if (is_null($b->getOrder())) {
1187  return - 1;
1188  }
1189 
1190  return $a->getOrder() < $b->getOrder() ? - 1 : 1;
1191  }

◆ deleteField()

ilDclTable::deleteField (   $field_id)
Parameters
$field_id

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

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

391  {
392  $field = ilDclCache::getFieldCache($field_id);
393  $records = $this->getRecords();
394 
395  foreach ($records as $record) {
396  $record->deleteField($field_id);
397  }
398 
399  $field->doDelete();
400  }
static getFieldCache($field_id=0)
+ Here is the call graph for this function:

◆ doCreate()

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

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

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

Referenced by cloneStructure().

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

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

Referenced by hasPermissionToDeleteRecord(), and hasPermissionToEditRecord().

803  {
804  global $DIC;
805  $ilUser = $DIC['ilUser'];
806 
807  return ($ilUser->getId() == $record->getOwner());
808  }
$ilUser
Definition: imgupload.php:18
global $DIC
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doRead()

ilDclTable::doRead ( )

Read table.

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

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

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

◆ getAddPerm()

ilDclTable::getAddPerm ( )
Returns
boolean

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

References $add_perm.

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

914  {
915  return (bool)$this->add_perm;
916  }
+ Here is the caller graph for this function:

◆ getCollectionObject()

ilDclTable::getCollectionObject ( )
Returns
ilObjDataCollection

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

References $obj, and loadObj().

348  {
349  $this->loadObj();
350 
351  return $this->obj;
352  }
+ Here is the call graph for this function:

◆ getCustomFields()

ilDclTable::getCustomFields ( )

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

References $fields, and fields.

469  {
470  if (!$this->fields) {
471  $this->loadCustomFields();
472  }
473  return $this->fields;
474  }
$errors fields
Definition: imgupload.php:52

◆ getDefaultSortField()

ilDclTable::getDefaultSortField ( )
Returns
string

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

References $default_sort_field.

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

1090  {
1092  }
+ Here is the caller graph for this function:

◆ getDefaultSortFieldOrder()

ilDclTable::getDefaultSortFieldOrder ( )
Returns
string

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

References $default_sort_field_order.

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

1109  {
1111  }
+ Here is the caller graph for this function:

◆ getDeleteByOwner()

ilDclTable::getDeleteByOwner ( )
Returns
boolean

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

References $delete_by_owner.

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

961  {
962  return (bool)$this->delete_by_owner;
963  }
+ Here is the caller graph for this function:

◆ getDeletePerm()

ilDclTable::getDeletePerm ( )
Returns
boolean

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

References $delete_perm.

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

933  {
934 
935  return (bool)$this->delete_perm;
936  }
+ Here is the caller graph for this function:

◆ getDescription()

ilDclTable::getDescription ( )
Returns
string

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

References $description.

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

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

◆ getEditableFields()

ilDclTable::getEditableFields ( )
Returns
array

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

References $fields, array, and getRecordFields().

664  {
665  $fields = $this->getRecordFields();
666  $editableFields = array();
667 
668  foreach ($fields as $field) {
669  if (!$field->getLocked()) {
670  $editableFields[] = $field;
671  }
672  }
673 
674  return $editableFields;
675  }
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 953 of file class.ilDclTable.php.

References $edit_by_owner.

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

953  {
954  return (bool)$this->edit_by_owner;
955  }
+ Here is the caller graph for this function:

◆ getEditPerm()

ilDclTable::getEditPerm ( )
Returns
boolean

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

References $edit_perm.

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

991  {
992  return (bool)$this->edit_perm;
993  }
+ 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 682 of file class.ilDclTable.php.

References $fields, array, and getFields().

682  {
683  $fields = $this->getFields();
684  $exportableFields = array();
685  foreach ($fields as $field) {
686  if ($field->getExportable()) {
687  $exportableFields[] = $field;
688  }
689  }
690 
691  return $exportableFields;
692  }
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 1341 of file class.ilDclTable.php.

References $export_enabled.

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

1341  {
1342  return $this->export_enabled;
1343  }
+ Here is the caller graph for this function:

◆ getField()

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

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

References $fields, and getFields().

Referenced by _hasFieldByTitle().

408  {
409  $fields = $this->getFields();
410  $field = NULL;
411  foreach ($fields as $field_1) {
412  if ($field_1->getId() == $field_id) {
413  $field = $field_1;
414  }
415  }
416 
417  return $field;
418  }
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 890 of file class.ilDclTable.php.

References $title, and getFields().

Referenced by _hasFieldByTitle().

890  {
891  $return = NULL;
892  foreach ($this->getFields() as $field) {
893  if ($field->getTitle() == $title) {
894  $return = $field;
895  break;
896  }
897  }
898 
899  return $return;
900  }
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 424 of file class.ilDclTable.php.

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

424  {
425  $field_ids = array();
426  foreach ($this->getFields() as $field)
427  {
428  if ($field->getId())
429  {
430  $field_ids[] = $field->getId();
431  }
432  }
433  return $field_ids;
434  }
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 529 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().

529  {
530  if($this->all_fields == null) {
531  $this->reloadFields();
532  }
533 
534  return $this->all_fields;
535  }
+ 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 588 of file class.ilDclTable.php.

References $ref_id, $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.

588  {
589  $tableview = array_shift($this->getVisibleTableViews($ref_id, false, $user_id));
590  return $tableview ? $tableview->getId() : false;
591  }
getVisibleTableViews($ref_id, $with_active_detailedview=false, $user_id=0)
For current user.
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:

◆ getId()

ilDclTable::getId ( )

Get table id.

Returns
int

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

References $id.

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

308  {
309  return $this->id;
310  }
+ Here is the caller graph for this function:

◆ getImportEnabled()

ilDclTable::getImportEnabled ( )
Returns
boolean

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

References $import_enabled.

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

1387  {
1388  return $this->import_enabled;
1389  }
+ Here is the caller graph for this function:

◆ getIsVisible()

ilDclTable::getIsVisible ( )
Returns
boolean

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

References $is_visible.

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

1055  {
1056  return $this->is_visible;
1057  }
+ Here is the caller graph for this function:

◆ getLimited()

ilDclTable::getLimited ( )
Returns
boolean

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

References $limited.

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

1007  {
1008  return $this->limited;
1009  }
+ Here is the caller graph for this function:

◆ getLimitEnd()

ilDclTable::getLimitEnd ( )
Returns
string

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

References $limit_end.

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

1023  {
1024  return $this->limit_end;
1025  }
+ Here is the caller graph for this function:

◆ getLimitStart()

ilDclTable::getLimitStart ( )
Returns
string

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

References $limit_start.

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

1039  {
1040  return $this->limit_start;
1041  }
+ 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 482 of file class.ilDclTable.php.

References $fields, and getFields().

482  {
483  $fields = $this->getFields();
484  $place = 0;
485  foreach ($fields as $field) {
486  if (!$field->isStandardField()) {
487  $place = $field->getOrder() + 1;
488  }
489  }
490 
491  return $place;
492  }
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 497 of file class.ilDclTable.php.

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

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

◆ getObjId()

ilDclTable::getObjId ( )
Returns
int

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

References $objId.

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

324  {
325  return $this->objId;
326  }
+ Here is the caller graph for this function:

◆ getOrder()

ilDclTable::getOrder ( )
Returns
int

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

References $table_order, and updateOrder().

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

1349  {
1350  if (!$this->table_order) {
1351  $this->updateOrder();
1352  }
1353  return $this->table_order;
1354  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPublicCommentsEnabled()

ilDclTable::getPublicCommentsEnabled ( )
Returns
boolean

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

References $public_comments.

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

1125  {
1126  return $this->public_comments;
1127  }
+ 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 655 of file class.ilDclTable.php.

References $fields.

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

655  {
656  $this->loadCustomFields();
657 
658  return $this->fields;
659  }
+ Here is the caller graph for this function:

◆ getRecords()

ilDclTable::getRecords ( )
Returns
ilDclBaseRecordModel[]

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

References $records, and loadRecords().

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

365  {
366  if ($this->records == NULL) {
367  $this->loadRecords();
368  }
369 
370  return $this->records;
371  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSaveConfirmation()

ilDclTable::getSaveConfirmation ( )
Returns
boolean

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

References $save_confirmation.

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

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

◆ getTableViews()

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

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

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

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

550  {
551  return ilDclTableView::getAllForTableId($this->getId());
552  }
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 340 of file class.ilDclTable.php.

References $title.

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

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

◆ getViewOwnRecordsPerm()

ilDclTable::getViewOwnRecordsPerm ( )
Returns
boolean

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

References $view_own_records_perm.

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

1141  {
1142  return (bool)$this->view_own_records_perm;
1143  }
+ 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 561 of file class.ilDclTable.php.

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

Referenced by getFirstTableViewId().

561  {
562  if (ilObjDataCollectionAccess::hasWriteAccess($ref_id, $user_id) && !$with_active_detailedview)
563  {
564  return $this->getTableViews();
565  }
566 
567  $visible_views = array();
568  foreach ($this->getTableViews() as $tableView)
569  {
570  if (ilObjDataCollectionAccess::hasAccessToTableView($tableView, $user_id))
571  {
572  if (!$with_active_detailedview || ilDclDetailedViewDefinition::isActive($tableView->getId()))
573  {
574  $visible_views[] = $tableView;
575  }
576  }
577  }
578  return $visible_views;
579  }
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.
$ref_id
Definition: sahs_server.php:39
+ 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 1167 of file class.ilDclTable.php.

References fields.

1167  {
1168  $this->loadCustomFields();
1169 
1170  return (count($this->fields) > 0) ? true : false;
1171  }
$errors fields
Definition: imgupload.php:52

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

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

731  {
733  return false;
734  }
736  return true;
737  }
739  return false;
740  }
741  if (!$this->checkLimit()) {
742  return false;
743  }
744  if ($this->getDeletePerm() && !$this->getDeleteByOwner()) {
745  return true;
746  }
747  if ($this->getDeleteByOwner()) {
748  return $this->doesRecordBelongToUser($record);
749  }
750 
751  return false;
752  }
static _lookupObjectId($a_ref_id)
doesRecordBelongToUser(ilDclBaseRecordModel $record)
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:

◆ hasPermissionToDeleteRecords()

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

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

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

760  {
762  return false;
763  }
766  }
static _lookupObjectId($a_ref_id)
$ref_id
Definition: sahs_server.php:39
+ 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 701 of file class.ilDclTable.php.

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

701  {
703  return false;
704  }
706  return true;
707  }
709  return false;
710  }
711  if (!$this->checkLimit()) {
712  return false;
713  }
714  if ($this->getEditPerm() && !$this->getEditByOwner()) {
715  return true;
716  }
717  if ($this->getEditByOwner()) {
718  return $this->doesRecordBelongToUser($record);
719  }
720 
721  return false;
722  }
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.
$ref_id
Definition: sahs_server.php:39
+ 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 776 of file class.ilDclTable.php.

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

776  {
777  global $DIC;
778  $ilUser = $DIC['ilUser'];
780  return false;
781  }
783  return true;
784  }
786  // Check for view only own entries setting
787  if ($this->getViewOwnRecordsPerm() && ($user_id ? $user_id : $ilUser->getId()) != $record->getOwner()) {
788  return false;
789  }
790 
791  return true;
792  }
793 
794  return false;
795  }
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
$ref_id
Definition: sahs_server.php:39
global $DIC
+ Here is the call graph for this function:

◆ loadObj()

ilDclTable::loadObj ( )
protected

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

Referenced by getCollectionObject().

355  {
356  if ($this->obj == NULL) {
357  $this->obj = new ilObjDataCollection($this->objId, false);
358  }
359  }
Class ilObjDataCollection.
+ Here is the caller graph for this function:

◆ loadRecords()

ilDclTable::loadRecords ( )

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

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

Referenced by getRecords().

373  {
374  global $DIC;
375  $ilDB = $DIC['ilDB'];
376 
377  $records = array();
378  $query = "SELECT id FROM il_dcl_record WHERE table_id = " . $ilDB->quote($this->id, "integer");
379  $set = $ilDB->query($query);
380 
381  while ($rec = $ilDB->fetchAssoc($set)) {
382  $records[$rec['id']] = ilDclCache::getRecordCache($rec['id']);
383  }
384 
385  $this->records = $records;
386  }
static getRecordCache($record_id=0)
Create styles array
The data for the language used.
global $ilDB
global $DIC
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reloadFields()

ilDclTable::reloadFields ( )

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

References $fields, fields, and sortByOrder().

Referenced by getFields().

537  {
538  $this->loadCustomFields();
539  $this->stdFields = $this->getStandardFields();
540  $fields = array_merge($this->fields, $this->stdFields);
541 
542  $this->sortByOrder($fields);
543 
544  $this->all_fields = $fields;
545  }
sortByOrder(&$array)
$errors fields
Definition: imgupload.php:52
+ 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 906 of file class.ilDclTable.php.

References $add_perm.

Referenced by cloneStructure(), and doRead().

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

◆ setDefaultSortField()

ilDclTable::setDefaultSortField (   $default_sort_field)

/**

Parameters
string$default_sort_field

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

References $default_sort_field.

Referenced by cloneStructure(), and doRead().

1081  {
1082  $default_sort_field = ($default_sort_field) ? $default_sort_field : 0; // Change null or empty strings to zero
1083  $this->default_sort_field = $default_sort_field;
1084  }
+ Here is the caller graph for this function:

◆ setDefaultSortFieldOrder()

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

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

References $default_sort_field_order, and array.

Referenced by cloneStructure(), and doRead().

1098  {
1099  if (!in_array($default_sort_field_order, array( 'asc', 'desc' ))) {
1100  $default_sort_field_order = 'asc';
1101  }
1102  $this->default_sort_field_order = $default_sort_field_order;
1103  }
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 969 of file class.ilDclTable.php.

References $delete_by_owner, and setDeletePerm().

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

969  {
970  $this->delete_by_owner = $delete_by_owner;
971  if ($delete_by_owner) {
972  $this->setDeletePerm(true);
973  }
974  }
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 922 of file class.ilDclTable.php.

References $delete_perm, and setDeleteByOwner().

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

922  {
923  $this->delete_perm = $delete_perm;
924  if (!$delete_perm) {
925  $this->setDeleteByOwner(false);
926  }
927  }
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 1063 of file class.ilDclTable.php.

References $description.

Referenced by cloneStructure(), and doRead().

1063  {
1064  $this->description = $description;
1065  }
+ Here is the caller graph for this function:

◆ setEditByOwner()

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

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

References $edit_by_owner, and setEditPerm().

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

942  {
943  $this->edit_by_owner = $edit_by_owner;
944  if ($edit_by_owner) {
945  $this->setEditPerm(true);
946  }
947  }
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 980 of file class.ilDclTable.php.

References $edit_perm, and setEditByOwner().

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

980  {
981  $this->edit_perm = $edit_perm;
982  if (!$edit_perm) {
983  $this->setEditByOwner(false);
984  }
985  }
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 1333 of file class.ilDclTable.php.

References $export_enabled.

Referenced by cloneStructure(), and doRead().

1333  {
1334  $this->export_enabled = $export_enabled;
1335  }
+ Here is the caller graph for this function:

◆ setId()

ilDclTable::setId (   $a_id)

Set table id.

Parameters
int$a_id

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

Referenced by doCreate().

298  {
299  $this->id = $a_id;
300  }
+ Here is the caller graph for this function:

◆ setImportEnabled()

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

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

References $import_enabled.

Referenced by cloneStructure(), and doRead().

1379  {
1380  $this->import_enabled = $import_enabled;
1381  }
+ Here is the caller graph for this function:

◆ setIsVisible()

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

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

References $is_visible.

Referenced by cloneStructure(), and doRead().

1047  {
1048  $this->is_visible = $is_visible;
1049  }
+ Here is the caller graph for this function:

◆ setLimited()

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

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

References $limited.

Referenced by cloneStructure(), and doRead().

999  {
1000  $this->limited = $limited;
1001  }
+ Here is the caller graph for this function:

◆ setLimitEnd()

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

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

References $limit_end.

Referenced by cloneStructure(), and doRead().

1015  {
1016  $this->limit_end = $limit_end;
1017  }
+ Here is the caller graph for this function:

◆ setLimitStart()

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

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

References $limit_start.

Referenced by cloneStructure(), and doRead().

1031  {
1032  $this->limit_start = $limit_start;
1033  }
+ Here is the caller graph for this function:

◆ setObjId()

ilDclTable::setObjId (   $a_id)
Parameters
$a_id

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

Referenced by doRead().

316  {
317  $this->objId = $a_id;
318  }
+ Here is the caller graph for this function:

◆ setOrder()

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

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

References $table_order.

Referenced by cloneStructure(), and doRead().

1371  {
1372  $this->table_order = $table_order;
1373  }
+ Here is the caller graph for this function:

◆ setPublicCommentsEnabled()

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

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

References $public_comments.

Referenced by cloneStructure(), and doRead().

1117  {
1118  $this->public_comments = $public_comments;
1119  }
+ Here is the caller graph for this function:

◆ setSaveConfirmation()

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

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

References $save_confirmation.

Referenced by cloneStructure(), and doRead().

1157  {
1158  $this->save_confirmation = $save_confirmation;
1159  }
+ Here is the caller graph for this function:

◆ setTitle()

ilDclTable::setTitle (   $a_title)
Parameters
$a_title

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

Referenced by cloneStructure(), and doRead().

332  {
333  $this->title = $a_title;
334  }
+ Here is the caller graph for this function:

◆ setViewOwnRecordsPerm()

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

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

Referenced by cloneStructure(), and doRead().

1133  {
1134  $this->view_own_records_perm = (int)$view_own_perm;
1135  }
+ Here is the caller graph for this function:

◆ sortByOrder()

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

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

References array.

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

857  {
858  // php-bug: https://bugs.php.net/bug.php?id=50688
859  // fixed in php 7 but for now we need the @ a workaround
860  @usort($array, array( $this, "compareOrder" ));
861  }
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 841 of file class.ilDclTable.php.

References $fields, array, and sortByOrder().

841  {
842  $this->sortByOrder($fields);
843  //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.
844  $named = array();
845  foreach ($fields as $field) {
846  $named[$field->getId()] = $field;
847  }
848 
849  $fields = $named;
850  }
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 505 of file class.ilDclTable.php.

References getTableViews().

506  {
507  if ($tableviews == null)
508  {
509  $tableviews = $this->getTableViews();
510  }
511 
512  $order = 10;
513  foreach($tableviews as $tableview)
514  {
515  $tableview->setTableviewOrder($order);
516  $tableview->update();
517  $order += 10;
518  }
519 
520  }
+ Here is the call graph for this function:

◆ updateFields()

ilDclTable::updateFields ( )

Update fields.

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

References getFields().

830  {
831  foreach ($this->getFields() as $field) {
832  $field->doUpdate();
833  }
834  }
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 1359 of file class.ilDclTable.php.

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

Referenced by getOrder().

1359  {
1360  global $DIC;
1361  $ilDB = $DIC['ilDB'];
1362  $result = $ilDB->query('SELECT MAX(table_order) AS table_order FROM il_dcl_table WHERE obj_id = ' . $ilDB->quote($this->getCollectionObject()->getId(), 'integer'));
1363  $this->table_order = $ilDB->fetchObject($result)->table_order + 10;
1364  $ilDB->query('UPDATE il_dcl_table SET table_order = ' . $ilDB->quote($this->table_order, 'integer') . ' WHERE id = ' . $ilDB->quote($this->getId(), 'integer'));
1365  }
$result
getId()
Get table id.
global $ilDB
global $DIC
+ 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 58 of file class.ilDclTable.php.

Referenced by getAddPerm(), and setAddPerm().

◆ $all_fields

ilDclTable::$all_fields = null
protected

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

Referenced by getFields().

◆ $default_sort_field

ilDclTable::$default_sort_field = 0
protected

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

Referenced by getDefaultSortFieldOrder(), and setDefaultSortFieldOrder().

◆ $delete_by_owner

ilDclTable::$delete_by_owner
protected

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

Referenced by getDeleteByOwner(), and setDeleteByOwner().

◆ $delete_perm

ilDclTable::$delete_perm
protected

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

Referenced by getDeletePerm(), and setDeletePerm().

◆ $description

ilDclTable::$description = ''
protected

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

Referenced by getDescription(), and setDescription().

◆ $edit_by_owner

ilDclTable::$edit_by_owner
protected

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

Referenced by getEditByOwner(), and setEditByOwner().

◆ $edit_perm

ilDclTable::$edit_perm
protected

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

Referenced by getEditPerm(), and setEditPerm().

◆ $export_enabled

ilDclTable::$export_enabled
protected

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

Referenced by getExportEnabled(), and setExportEnabled().

◆ $fields

◆ $id

ilDclTable::$id = 0
protected

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

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

◆ $import_enabled

ilDclTable::$import_enabled
protected

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

Referenced by getImportEnabled(), and setImportEnabled().

◆ $is_visible

ilDclTable::$is_visible
protected

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

Referenced by getIsVisible(), and setIsVisible().

◆ $limit_end

ilDclTable::$limit_end
protected

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

Referenced by getLimitEnd(), and setLimitEnd().

◆ $limit_start

ilDclTable::$limit_start
protected

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

Referenced by getLimitStart(), and setLimitStart().

◆ $limited

ilDclTable::$limited
protected

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

Referenced by getLimited(), and setLimited().

◆ $obj

ilDclTable::$obj
protected

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

Referenced by getCollectionObject().

◆ $objId

ilDclTable::$objId
protected

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

Referenced by getObjId().

◆ $public_comments

ilDclTable::$public_comments = 0
protected

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

Referenced by getPublicCommentsEnabled(), and setPublicCommentsEnabled().

◆ $records

ilDclTable::$records
protected

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

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

◆ $save_confirmation

ilDclTable::$save_confirmation
protected

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

Referenced by getSaveConfirmation(), and setSaveConfirmation().

◆ $stdFields

ilDclTable::$stdFields
protected

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

Referenced by getFirstTableViewId().

◆ $table_order

ilDclTable::$table_order
protected

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

Referenced by getViewOwnRecordsPerm().


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