ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDclTableView Class Reference

Class ilDclTableView. More...

+ Inheritance diagram for ilDclTableView:
+ Collaboration diagram for ilDclTableView:

Public Member Functions

 getId ()
 
 setId ($id)
 
 getTableId ()
 
 setTableId ($table_id)
 
 getTitle ()
 
 setTitle ($title)
 
 getOrder ()
 
 setOrder ($order)
 
 getDescription ()
 
 setDescription ($description)
 
 getTableviewOrder ()
 
 setTableviewOrder ($tableview_order)
 
 getRoles ()
 
 setRoles (array $roles)
 
 sleep ($field_name)
 
 wakeUp ($field_name, $field_value)
 
 delete ()
 
 getTable ()
 
 getFilterableFieldSettings ()
 getFilterableFields Returns all fieldsetting-objects of this tableview which have set their filterable to true, including standard fields. More...
 
 getVisibleFields ()
 Returns all field-objects of this tableview which have set their visibility to true, including standard fields. More...
 
 getFieldSettings ()
 
 create ($create_default_settings=true)
 
 createDefaultSettings ()
 create default ilDclTableViewFieldSetting entries More...
 
 createFieldSetting ($field_id)
 create ilDclTableViewFieldSetting for this tableview and the given field id More...
 
 cloneStructure (ilDclTableView $orig, array $new_fields)
 
- Public Member Functions inherited from ActiveRecord
 getArConnector ()
 
 getArFieldList ()
 
 getConnectorContainerName ()
 
 setConnectorContainerName ($connector_container_name)
 
 getPrimaryFieldValue ()
 
 setPrimaryFieldValue ($value)
 
 __construct ($primary_key=0, arConnector $connector=null)
 
 storeObjectToCache ()
 
 __getConvertedDateFieldsAsArray ($format=null)
 
 __asCsv ($separator=';', $header=false)
 
 __asArray ()
 
 __asStdClass ()
 
 __asSerializedObject ()
 
 buildFromArray (array $array)
 
 fixDateField ($field_name, $value)
 
 sleep ($field_name)
 
 wakeUp ($field_name, $field_value)
 
 getArrayForDb ()
 
 getArrayForConnector ()
 
 installConnector ()
 
 store ()
 
 save ()
 
 create ()
 
 copy ($new_id=0)
 
 afterObjectLoad ()
 
 read ()
 
 update ()
 
 delete ()
 
 __call ($name, $arguments)
 

Static Public Member Functions

static returnDbTableName ()
 
static getAllForTableId ($table_id)
 
static getCountForTableId ($table_id)
 
static createOrGetStandardView ($table_id, $create_default_settings=true)
 
- Static Public Member Functions inherited from ActiveRecord
static returnDbTableName ()
 
static installDB ()
 
static renameDBField ($old_name, $new_name)
 
static tableExists ()
 
static fieldExists ($field_name)
 
static removeDBField ($field_name)
 
static updateDB ()
 
static resetDB ()
 
static truncateDB ()
 
static flushDB ()
 
static preloadObjects ()
 
static additionalParams (array $additional_params)
 
static findOrFail ($primary_key, array $add_constructor_args=array())
 Tries to find the object and throws an Exception if object is not found, instead of returning null. More...
 
static findOrGetInstance ($primary_key, array $add_constructor_args=array())
 
static where ($where, $operator=null)
 
static innerjoinAR (ActiveRecord $ar, $on_this, $on_external, $fields=array(' *'), $operator='=', $both_external=false)
 
static innerjoin ($tablename, $on_this, $on_external, $fields=array(' *'), $operator='=', $both_external=false)
 
static leftjoin ($tablename, $on_this, $on_external, $fields=array(' *'), $operator='=', $both_external=false)
 
static orderBy ($orderBy, $orderDirection='ASC')
 
static dateFormat ($date_format='d.m.Y - H:i:s')
 
static limit ($start, $end)
 
static affectedRows ()
 
static count ()
 
static get ()
 
static debug ()
 
static first ()
 
static getCollection ()
 
static last ()
 
static getFirstFromLastQuery ()
 
static connector (arConnector $connector)
 
static raw ($set_raw=true)
 
static getArray ($key=null, $values=null)
 
static _toCamelCase ($str, $capitalise_first_char=false)
 

Protected Attributes

 $id
 
 $table_id
 
 $title
 
 $roles = array()
 
 $description
 
 $tableview_order
 
 $visible_fields_cache
 
- Protected Attributes inherited from ActiveRecord
 $ar_safe_read = true
 
 $connector_container_name = ''
 

Additional Inherited Members

- Data Fields inherited from ActiveRecord
const ACTIVE_RECORD_VERSION = '2.0.7'
 
- Protected Member Functions inherited from ActiveRecord
 serializeToCSV ($field)
 This method is called for every field of your instance if you use __asCsv. More...
 
 installDatabase ()
 
- Static Protected Member Functions inherited from ActiveRecord
static getCalledClass ()
 
static fromCamelCase ($str)
 

Detailed Description

Class ilDclTableView.

Author
Theodor Truffer tt@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 9 of file class.ilDclTableView.php.

Member Function Documentation

◆ cloneStructure()

ilDclTableView::cloneStructure ( ilDclTableView  $orig,
array  $new_fields 
)
Parameters
ilDclTableView$orig
array$new_fieldsfields mapping

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

380 {
381 //clone structure
382 $this->setTitle($orig->getTitle());
383 $this->setOrder($orig->getOrder());
384 $this->setDescription($orig->getDescription());
385 $this->setRoles($orig->getRoles());
386 $this->create(false); //create default setting, adjust them later
387
388 //clone fieldsettings
389 foreach ($orig->getFieldSettings() as $orig_fieldsetting) {
390 $new_fieldsetting = new ilDclTableViewFieldSetting();
391 $new_fieldsetting->setTableviewId($this->getId());
392 if ($new_fields[$orig_fieldsetting->getField()]) {
393 //normal fields
394 $new_fieldsetting->setField($new_fields[$orig_fieldsetting->getField()]->getId());
395 } else {
396 //standard fields
397 $new_fieldsetting->setField($orig_fieldsetting->getField());
398 }
399 $new_fieldsetting->cloneStructure($orig_fieldsetting);
400 }
401
402 //clone pageobject
404 $orig_pageobject = new ilDclDetailedViewDefinition($orig->getId());
405 $orig_pageobject->copy($this->getId());
406 }
407
408 // mandatory for all cloning functions
410 }
const TYPE_TABLEVIEW
static setCloneOf($old, $new, $type)
Class ilDclDetailedViewDefinition.
Class ilDclTableViewFieldSetting.
setDescription($description)
setRoles(array $roles)

References ActiveRecord\create(), ilDclDetailedViewDefinition\exists(), getDescription(), getFieldSettings(), getId(), getOrder(), getRoles(), getTitle(), ilDclCache\setCloneOf(), setDescription(), setOrder(), setRoles(), setTitle(), and ilDclCache\TYPE_TABLEVIEW.

+ Here is the call graph for this function:

◆ create()

ilDclTableView::create (   $create_default_settings = true)
Parameters
bool$create_default_settings

Definition at line 323 of file class.ilDclTableView.php.

324 {
325 parent::create();
326 if ($create_default_settings) {
327 $this->createDefaultSettings();
328 }
329 }
createDefaultSettings()
create default ilDclTableViewFieldSetting entries

References createDefaultSettings().

+ Here is the call graph for this function:

◆ createDefaultSettings()

ilDclTableView::createDefaultSettings ( )

create default ilDclTableViewFieldSetting entries

Definition at line 335 of file class.ilDclTableView.php.

336 {
337 $table = ilDclCache::getTableCache($this->table_id);
338
339 foreach ($table->getFieldIds() as $field_id) {
340 $this->createFieldSetting($field_id);
341 }
342
343 //ilDclTable->getFieldIds won't reuturn comments if they are disabled,
344 //still we have to create a fieldsetting for this field
345 if (!$table->getPublicCommentsEnabled()) {
346 $this->createFieldSetting('comments');
347 }
348 }
static getTableCache($table_id=0)
createFieldSetting($field_id)
create ilDclTableViewFieldSetting for this tableview and the given field id
if(empty($password)) $table
Definition: pwgen.php:24

References $table, createFieldSetting(), and ilDclCache\getTableCache().

Referenced by create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createFieldSetting()

ilDclTableView::createFieldSetting (   $field_id)

create ilDclTableViewFieldSetting for this tableview and the given field id

Parameters
$field_id

Definition at line 356 of file class.ilDclTableView.php.

357 {
359 array(
360 'tableview_id' => $this->id,
361 'field' => $field_id,
362 )
363 )->get()
364 ) {
365 $field_set = new ilDclTableViewFieldSetting();
366 $field_set->setTableviewId($this->id);
367 $field_set->setField($field_id);
368 $field_set->setVisible(!ilDclStandardField::_isStandardField($field_id));
369 $field_set->setFilterChangeable(true);
370 $field_set->create();
371 }
372 }
static where($where, $operator=null)
static _isStandardField($field_id)

References ilDclStandardField\_isStandardField(), and ActiveRecord\where().

Referenced by createDefaultSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createOrGetStandardView()

static ilDclTableView::createOrGetStandardView (   $table_id,
  $create_default_settings = true 
)
static
Parameters
$table_id
bool$create_default_settings
Returns
ilDclTableView

Definition at line 441 of file class.ilDclTableView.php.

442 {
443 if ($standardview = self::where(array('table_id' => $table_id))->orderBy('tableview_order')->first()) {
444 return $standardview;
445 }
446
447 global $DIC;
448 $rbacreview = $DIC['rbacreview'];
449 $roles = array();
450 foreach ($rbacreview->getParentRoleIds($_GET['ref_id']) as $role_array) {
451 $roles[] = $role_array['obj_id'];
452 }
453
454 $view = new self();
455
456 if ($_GET['ref_id']) {
457 global $DIC;
458 $rbacreview = $DIC['rbacreview'];
459 $roles = array();
460 foreach ($rbacreview->getParentRoleIds($_GET['ref_id']) as $role_array) {
461 $roles[] = $role_array['obj_id'];
462 }
463 $view->setRoles(array_merge($roles, $rbacreview->getLocalRoles($_GET['ref_id'])));
464 }
465 $view->setTableId($table_id);
466 // bugfix mantis 0023307
467 $lng = $DIC['lng'];
468 $view->setTitle($lng->txt('dcl_title_standardview'));
469 $view->setTableviewOrder(10);
470 $view->create($create_default_settings);
471
472 return $view;
473 }
$_GET["client_id"]
static orderBy($orderBy, $orderDirection='ASC')
global $DIC
Definition: saml.php:7
$lng

References $_GET, $DIC, $lng, $roles, $table_id, ActiveRecord\first(), and ActiveRecord\orderBy().

Referenced by ilDclTable\doCreate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilDclTableView::delete ( )

Reimplemented from ActiveRecord.

Definition at line 243 of file class.ilDclTableView.php.

244 {
245 //Delete settings
246 foreach ($this->getFieldSettings() as $setting) {
247 $setting->delete();
248 }
249 parent::delete();
250 }

References getFieldSettings().

+ Here is the call graph for this function:

◆ getAllForTableId()

static ilDclTableView::getAllForTableId (   $table_id)
static
Parameters
$table_id
Returns
ilDclTableView[]

Definition at line 418 of file class.ilDclTableView.php.

419 {
420 return self::where(array('table_id' => $table_id))->orderBy('tableview_order')->get();
421 }

References $table_id, and ActiveRecord\where().

Referenced by ilDclBaseFieldModel\addToTableViews(), ilDclTable\getTableViews(), and ilObjDataCollectionTest\testDefaultTableView().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCountForTableId()

static ilDclTableView::getCountForTableId (   $table_id)
static
Parameters
$table_id
Returns
int

Definition at line 429 of file class.ilDclTableView.php.

430 {
431 return self::where(array('table_id' => $table_id))->orderBy('tableview_order')->count();
432 }

References $table_id, and ActiveRecord\where().

Referenced by ilDclTable\getNewTableviewOrder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDescription()

ilDclTableView::getDescription ( )
Returns
string

Definition at line 158 of file class.ilDclTableView.php.

159 {
160 return $this->description;
161 }

References $description.

Referenced by cloneStructure().

+ Here is the caller graph for this function:

◆ getFieldSettings()

ilDclTableView::getFieldSettings ( )

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

310 {
312 array(
313 'tableview_id' => $this->getId(),
314 'il_dcl_tfield_set.table_id' => $this->getTableId(),
315 )
316 )->innerjoin('il_dcl_tfield_set', 'field', 'field', array('field_order'))->orderBy('field_order')->get();
317 }

References getId(), getTableId(), and ActiveRecord\where().

Referenced by cloneStructure(), and delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFilterableFieldSettings()

ilDclTableView::getFilterableFieldSettings ( )

getFilterableFields Returns all fieldsetting-objects of this tableview which have set their filterable to true, including standard fields.

Returns
ilDclBaseFieldModel[]|ilDclTableViewFieldSetting[]

Definition at line 268 of file class.ilDclTableView.php.

269 {
271 array(
272 "tableview_id" => $this->id,
273 'in_filter' => 1,
274 'il_dcl_tfield_set.table_id' => $this->getTableId(),
275 )
276 )->innerjoin('il_dcl_tfield_set', 'field', 'field', array())
277 ->orderBy('il_dcl_tfield_set.field_order')
278 ->get();
279 }

References getTableId(), and ActiveRecord\where().

+ Here is the call graph for this function:

◆ getId()

ilDclTableView::getId ( )
Returns
int

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

87 {
88 return $this->id;
89 }

References $id.

Referenced by cloneStructure(), and getFieldSettings().

+ Here is the caller graph for this function:

◆ getOrder()

ilDclTableView::getOrder ( )
Returns
int

Definition at line 140 of file class.ilDclTableView.php.

141 {
143 }

References $tableview_order.

Referenced by cloneStructure().

+ Here is the caller graph for this function:

◆ getRoles()

ilDclTableView::getRoles ( )
Returns
array

Definition at line 194 of file class.ilDclTableView.php.

195 {
196 return (array) $this->roles;
197 }

References $roles.

Referenced by cloneStructure().

+ Here is the caller graph for this function:

◆ getTable()

ilDclTableView::getTable ( )
Returns
ilDclTable

Definition at line 256 of file class.ilDclTableView.php.

257 {
258 return ilDclCache::getTableCache($this->table_id);
259 }

References ilDclCache\getTableCache().

+ Here is the call graph for this function:

◆ getTableId()

ilDclTableView::getTableId ( )
Returns
int

Definition at line 104 of file class.ilDclTableView.php.

105 {
106 return $this->table_id;
107 }

References $table_id.

Referenced by getFieldSettings(), getFilterableFieldSettings(), and getVisibleFields().

+ Here is the caller graph for this function:

◆ getTableviewOrder()

ilDclTableView::getTableviewOrder ( )
Returns
int

Definition at line 176 of file class.ilDclTableView.php.

177 {
179 }

References $tableview_order.

◆ getTitle()

ilDclTableView::getTitle ( )
Returns
string

Definition at line 122 of file class.ilDclTableView.php.

123 {
124 return $this->title;
125 }

References $title.

Referenced by cloneStructure().

+ Here is the caller graph for this function:

◆ getVisibleFields()

ilDclTableView::getVisibleFields ( )

Returns all field-objects of this tableview which have set their visibility to true, including standard fields.

Returns
ilDclBaseFieldModel[]|ilDclTableViewFieldSetting[]

Definition at line 287 of file class.ilDclTableView.php.

288 {
289 if (!$this->visible_fields_cache) {
291 where(
292 array(
293 "tableview_id" => $this->id,
294 'visible' => true,
295 'il_dcl_tfield_set.table_id' => $this->getTableId(),
296 )
297 )->innerjoin('il_dcl_tfield_set', 'field', 'field', array())->orderBy('il_dcl_tfield_set.field_order')->get();
298 $fields = array();
299 foreach ($visible as $field_rec) {
300 $fields[] = $field_rec->getFieldObject();
301 }
302 $this->visible_fields_cache = $fields;
303 }
304
306 }

References $visible_fields_cache, getTableId(), and ActiveRecord\where().

+ Here is the call graph for this function:

◆ returnDbTableName()

static ilDclTableView::returnDbTableName ( )
static
Returns
string @description Return the Name of your Database Table

Reimplemented from ActiveRecord.

Definition at line 77 of file class.ilDclTableView.php.

78 {
79 return "il_dcl_tableview";
80 }

◆ setDescription()

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

Definition at line 167 of file class.ilDclTableView.php.

168 {
169 $this->description = $description;
170 }

References $description.

Referenced by cloneStructure().

+ Here is the caller graph for this function:

◆ setId()

ilDclTableView::setId (   $id)
Parameters
int$id

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

96 {
97 $this->id = $id;
98 }

References $id.

◆ setOrder()

ilDclTableView::setOrder (   $order)
Parameters
int$order

Definition at line 149 of file class.ilDclTableView.php.

150 {
151 $this->tableview_order = $order;
152 }

Referenced by cloneStructure().

+ Here is the caller graph for this function:

◆ setRoles()

ilDclTableView::setRoles ( array  $roles)
Parameters
array$roles

Definition at line 203 of file class.ilDclTableView.php.

204 {
205 $this->roles = $roles;
206 }

References $roles.

Referenced by cloneStructure().

+ Here is the caller graph for this function:

◆ setTableId()

ilDclTableView::setTableId (   $table_id)
Parameters
int$table_id

Definition at line 113 of file class.ilDclTableView.php.

114 {
115 $this->table_id = $table_id;
116 }

References $table_id.

◆ setTableviewOrder()

ilDclTableView::setTableviewOrder (   $tableview_order)
Parameters
int$tableview_order

Definition at line 185 of file class.ilDclTableView.php.

186 {
187 $this->tableview_order = $tableview_order;
188 }

References $tableview_order.

◆ setTitle()

ilDclTableView::setTitle (   $title)
Parameters
string$title

Definition at line 131 of file class.ilDclTableView.php.

132 {
133 $this->title = $title;
134 }

References $title.

Referenced by cloneStructure().

+ Here is the caller graph for this function:

◆ sleep()

ilDclTableView::sleep (   $field_name)
Parameters
$field_name
Returns
null|string

Reimplemented from ActiveRecord.

Definition at line 214 of file class.ilDclTableView.php.

215 {
216 if ($field_name == 'roles') {
217 return json_encode($this->roles);
218 }
219
220 return null;
221 }

◆ wakeUp()

ilDclTableView::wakeUp (   $field_name,
  $field_value 
)
Parameters
$field_name
$field_value
Returns
mixed|null

Reimplemented from ActiveRecord.

Definition at line 230 of file class.ilDclTableView.php.

231 {
232 if ($field_name == 'roles') {
233 return json_decode($field_value);
234 }
235
236 return null;
237 }

Field Documentation

◆ $description

ilDclTableView::$description
protected

Definition at line 58 of file class.ilDclTableView.php.

Referenced by getDescription(), and setDescription().

◆ $id

ilDclTableView::$id
protected

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

Referenced by getId(), and setId().

◆ $roles

ilDclTableView::$roles = array()
protected

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

Referenced by createOrGetStandardView(), getRoles(), and setRoles().

◆ $table_id

ilDclTableView::$table_id
protected

◆ $tableview_order

ilDclTableView::$tableview_order
protected

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

Referenced by getOrder(), getTableviewOrder(), and setTableviewOrder().

◆ $title

ilDclTableView::$title
protected

Definition at line 42 of file class.ilDclTableView.php.

Referenced by getTitle(), and setTitle().

◆ $visible_fields_cache

ilDclTableView::$visible_fields_cache
protected

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

Referenced by getVisibleFields().


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