19 declare(strict_types=1);
82 return "il_dcl_tableview";
90 public function setId(
int $id): void
122 $this->tableview_order = $order;
158 public function sleep($field_name): ?string
160 if ($field_name ==
'roles') {
161 return json_encode($this->roles);
171 public function wakeUp($field_name, $field_value): ?array
173 if ($field_name ==
'roles') {
174 return json_decode($field_value);
180 public function delete():
void 199 return parent::findOrGetInstance($primary_key, $add_constructor_args);
211 "tableview_id" => $this->
id,
213 'il_dcl_tfield_set.table_id' => $this->
getTableId(),
215 )->innerjoin(
'il_dcl_tfield_set',
'field',
'field', [])
216 ->orderBy(
'il_dcl_tfield_set.field_order')
226 if (!$this->visible_fields_cache) {
229 "tableview_id" => $this->
id,
231 'il_dcl_tfield_set.table_id' => $this->
getTableId(),
238 )->orderBy(
'il_dcl_tfield_set.field_order')->get();
240 foreach ($visible as $field_rec) {
241 $fields[] = $field_rec->getFieldObject();
243 $this->visible_fields_cache = $fields;
257 'tableview_id' => $this->
getId(),
258 'il_dcl_tfield_set.table_id' => $this->
getTableId(),
260 )->innerjoin(
'il_dcl_tfield_set',
'field',
'field', [])->orderBy(
'il_dcl_tfield_set.field_order')->get();
263 foreach ($settings as $setting) {
264 $datatype = $setting->getFieldObject()->getDatatypeId();
266 $result[] = $setting;
280 'tableview_id' => $this->
getId(),
285 public function create(
bool $create_default_settings =
true): void
288 if ($create_default_settings) {
300 foreach ($table->getFieldIds() as $field_id) {
306 if (!$table->getPublicCommentsEnabled()) {
319 'tableview_id' => $this->
id,
320 'field' => $field_id,
325 $field_set->setTableviewId($this->
id);
326 $field_set->setField($field_id);
328 $field_set->setFilterChangeable(
true);
329 $field_set->setLockedCreate(
false);
330 $field_set->setLockedEdit(
false);
331 $field_set->setRequiredCreate(
false);
332 $field_set->setRequiredEdit(
false);
333 $field_set->setVisibleCreate(
true);
334 $field_set->setVisibleEdit(
true);
335 $field_set->create();
347 $this->
setTitle($orig->
getTitle() .
' ' . $DIC->language()->txt(
'copy_of_suffix'));
359 $new_fieldsetting->setTableviewId($this->
getId());
360 if ($new_fields[$orig_fieldsetting->getField()] ??
null) {
362 $new_fieldsetting->setField($new_fields[$orig_fieldsetting->getField()]->getId());
365 $new_fieldsetting->setField($orig_fieldsetting->getField());
367 $new_field_id = $new_fieldsetting->cloneStructure($orig_fieldsetting);
370 $datatype = $orig_fieldsetting->getFieldObject()->getDatatypeId();
371 $match = ilDclTableViewBaseDefaultValue::findSingle($datatype, $orig_fieldsetting->getId());
373 if (!is_null($match)) {
374 $new_default_value =
$f->create($datatype);
375 $new_default_value->setTviewSetId($new_field_id);
376 $new_default_value->setValue($match->getValue());
377 $new_default_value->create();
397 return self::where([
'table_id' => $table_id])->orderBy(
'title')->get();
402 return self::where([
'table_id' => $table_id])->orderBy(
'tableview_order')->count();
411 if ($standardview = self::where([
'table_id' => $table_id])->
orderBy(
'tableview_order')->
first()) {
412 return $standardview;
416 $rbacreview = $DIC[
'rbacreview'];
417 $http = $DIC->http();
423 foreach ($rbacreview->getParentRoleIds(
$ref_id) as $role_array) {
424 $roles[] = $role_array[
'obj_id'];
429 $hasRefId =
$http->wrapper()->query()->has(
'ref_id');
433 $rbacreview = $DIC[
'rbacreview'];
438 foreach ($rbacreview->getParentRoleIds(
$ref_id) as $role_array) {
439 $roles[] = $role_array[
'obj_id'];
441 $view->setRoles(array_merge($roles, $rbacreview->getLocalRoles(
$ref_id)));
443 $view->setTableId($table_id);
446 $view->setTitle(
$lng->txt(
'dcl_title_standardview'));
447 $view->setTableviewOrder(10);
static createOrGetStandardView(int $table_id)
cloneStructure(ilDclTableView $orig, array $new_fields)
createFieldSetting($field_id)
create ilDclTableViewFieldSetting for this tableview and the given field id
wakeUp($field_name, $field_value)
static findOrGetInstance($primary_key, array $add_constructor_args=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static orderBy(string $orderBy, string $orderDirection='ASC')
getFilterableFieldSettings()
getFilterableFields Returns all fieldsetting-objects of this tableview which have set their filterabl...
static where($where, $operator=null)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setDescription(string $description)
static returnDbTableName()
static getAllDatatype(bool $force=false)
Get all possible Datatypes.
createDefaultSettings()
create default ilDclTableViewFieldSetting entries
static getCountForTableId(int $table_id)
static getTableCache(?int $table_id=null)
static setCloneOf(int $old, int $new, string $type)
static _isStandardField($field_id)
array $visible_fields_cache
create(bool $create_default_settings=true)
copy(int $a_id, string $a_parent_type="", int $a_new_parent_id=0, bool $a_clone_mobs=false, int $obj_copy_id=0, bool $overwrite_existing=true)
Copy page.
getVisibleFields()
Returns all field-objects of this tableview which have set their visibility to true, including standard fields.
static getAllForTableId(int $table_id)
setTableId(int $table_id)
getFieldSetting($field_id)
setTableviewOrder(int $tableview_order)