ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

Member Function Documentation

◆ cloneStructure()

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

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

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

354  {
355  //clone structure
356  $this->setTitle($orig->getTitle());
357  $this->setOrder($orig->getOrder());
358  $this->setDescription($orig->getDescription());
359  $this->setRoles($orig->getRoles());
360  $this->create(false); //create default setting, adjust them later
361 
362  //clone fieldsettings
363  foreach ($orig->getFieldSettings() as $orig_fieldsetting) {
364  $new_fieldsetting = new ilDclTableViewFieldSetting();
365  $new_fieldsetting->setTableviewId($this->getId());
366  if ($new_fields[$orig_fieldsetting->getField()]) {
367  //normal fields
368  $new_fieldsetting->setField($new_fields[$orig_fieldsetting->getField()]->getId());
369  } else {
370  //standard fields
371  $new_fieldsetting->setField($orig_fieldsetting->getField());
372  }
373  $new_fieldsetting->cloneStructure($orig_fieldsetting);
374  }
375 
376  //clone pageobject
378  $orig_pageobject = new ilDclDetailedViewDefinition($orig->getId());
379  $orig_pageobject->copy($this->getId());
380  }
381 
382  // mandatory for all cloning functions
384  }
static setCloneOf($old, $new, $type)
const TYPE_TABLEVIEW
Class ilDclTableViewFieldSetting.
setRoles(array $roles)
setDescription($description)
copy($a_id, $a_parent_type="", $a_parent_id=0, $a_clone_mobs=false)
Copy page.
Class ilDclDetailedViewDefinition.
+ Here is the call graph for this function:

◆ create()

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

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

References createDefaultSettings().

301  {
302  parent::create();
303  if ($create_default_settings) {
304  $this->createDefaultSettings();
305  }
306  }
createDefaultSettings()
create default ilDclTableViewFieldSetting entries
+ Here is the call graph for this function:

◆ createDefaultSettings()

ilDclTableView::createDefaultSettings ( )

create default ilDclTableViewFieldSetting entries

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

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

Referenced by create().

312  {
313  $table = ilDclCache::getTableCache($this->table_id);
314 
315  foreach ($table->getFieldIds() as $field_id) {
316  $this->createFieldSetting($field_id);
317  }
318 
319  //ilDclTable->getFieldIds won't reuturn comments if they are disabled,
320  //still we have to create a fieldsetting for this field
321  if (!$table->getPublicCommentsEnabled()) {
322  $this->createFieldSetting('comments');
323  }
324  }
createFieldSetting($field_id)
create ilDclTableViewFieldSetting for this tableview and the given field id
static getTableCache($table_id=0)
+ 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 332 of file class.ilDclTableView.php.

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

Referenced by createDefaultSettings().

332  {
334  array(
335  'tableview_id' => $this->id,
336  'field' => $field_id,
337  )
338  )->get()
339  ) {
340  $field_set = new ilDclTableViewFieldSetting();
341  $field_set->setTableviewId($this->id);
342  $field_set->setField($field_id);
343  $field_set->setVisible(!ilDclStandardField::_isStandardField($field_id));
344  $field_set->setFilterChangeable(true);
345  $field_set->create();
346  }
347  }
static where($where, $operator=null)
Class ilDclTableViewFieldSetting.
static _isStandardField($field_id)
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:

◆ createOrGetStandardView()

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

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

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

Referenced by ilDclTable\doCreate(), and ilDataCollectionDataSet\getXmlNamespace().

413  {
414  if ($standardview = self::where(array('table_id' => $table_id))->orderBy('tableview_order')->first()) {
415  return $standardview;
416  }
417 
418  global $DIC;
419  $rbacreview = $DIC['rbacreview'];
420  $roles = array();
421  foreach ($rbacreview->getParentRoleIds($_GET['ref_id']) as $role_array) {
422  $roles[] = $role_array['obj_id'];
423  }
424 
425  $view = new self();
426 
427  if ($_GET['ref_id']) {
428  global $DIC;
429  $rbacreview = $DIC['rbacreview'];
430  $roles = array();
431  foreach ($rbacreview->getParentRoleIds($_GET['ref_id']) as $role_array) {
432  $roles[] = $role_array['obj_id'];
433  }
434  $view->setRoles(array_merge($roles, $rbacreview->getLocalRoles($_GET['ref_id'])));
435  }
436  $view->setTableId($table_id);
437  // bugfix mantis 0023307
438  $lng = $DIC['lng'];
439  $view->setTitle($lng->txt('dcl_title_standardview'));
440  $view->setTableviewOrder(10);
441  $view->create($create_default_settings);
442 
443  return $view;
444  }
$_GET["client_id"]
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
global $DIC
static orderBy($orderBy, $orderDirection='ASC')
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilDclTableView::delete ( )

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

References getFieldSettings().

226  {
227  //Delete settings
228  foreach ($this->getFieldSettings() as $setting) {
229  $setting->delete();
230  }
231  parent::delete();
232  }
+ Here is the call graph for this function:

◆ getAllForTableId()

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

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

References $table_id, and array.

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

392  {
393  return self::where(array('table_id' => $table_id))->orderBy('tableview_order')->get();
394  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getCountForTableId()

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

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

References $table_id, and array.

Referenced by ilDclTable\getNewTableviewOrder().

402  {
403  return self::where(array('table_id' => $table_id))->orderBy('tableview_order')->count();
404  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getDescription()

ilDclTableView::getDescription ( )
Returns
string

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

References $description.

Referenced by cloneStructure().

149  {
150  return $this->description;
151  }
+ Here is the caller graph for this function:

◆ getFieldSettings()

ilDclTableView::getFieldSettings ( )

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

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

Referenced by cloneStructure(), and delete().

288  {
290  array(
291  'tableview_id' => $this->getId(),
292  'il_dcl_tfield_set.table_id' => $this->getTableId(),
293  )
294  )->innerjoin('il_dcl_tfield_set', 'field', 'field', array('field_order'))->orderBy('field_order')->get();
295  }
static where($where, $operator=null)
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:

◆ 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 249 of file class.ilDclTableView.php.

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

249  {
251  array(
252  "tableview_id" => $this->id,
253  'in_filter' => 1,
254  'il_dcl_tfield_set.table_id' => $this->getTableId(),
255  )
256  )->innerjoin('il_dcl_tfield_set', 'field', 'field', array())
257  ->orderBy('il_dcl_tfield_set.field_order')
258  ->get();
259  }
static where($where, $operator=null)
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getId()

ilDclTableView::getId ( )
Returns
int

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

References $id.

Referenced by cloneStructure(), and getFieldSettings().

85  {
86  return $this->id;
87  }
+ Here is the caller graph for this function:

◆ getOrder()

ilDclTableView::getOrder ( )
Returns
int

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

References $tableview_order.

Referenced by cloneStructure().

133  {
134  return $this->tableview_order;
135  }
+ Here is the caller graph for this function:

◆ getRoles()

ilDclTableView::getRoles ( )
Returns
array

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

References $roles, and array.

Referenced by cloneStructure().

181  {
182  return (array)$this->roles;
183  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getTable()

ilDclTableView::getTable ( )
Returns
ilDclTable

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

References ilDclCache\getTableCache().

238  {
239  return ilDclCache::getTableCache($this->table_id);
240  }
static getTableCache($table_id=0)
+ Here is the call graph for this function:

◆ getTableId()

ilDclTableView::getTableId ( )
Returns
int

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

References $table_id.

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

101  {
102  return $this->table_id;
103  }
+ Here is the caller graph for this function:

◆ getTableviewOrder()

ilDclTableView::getTableviewOrder ( )
Returns
int

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

References $tableview_order.

165  {
166  return $this->tableview_order;
167  }

◆ getTitle()

ilDclTableView::getTitle ( )
Returns
string

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

References $title.

Referenced by cloneStructure().

117  {
118  return $this->title;
119  }
+ 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 267 of file class.ilDclTableView.php.

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

267  {
268  if (!$this->visible_fields_cache) {
270  where(
271  array(
272  "tableview_id" => $this->id,
273  'visible' => true,
274  'il_dcl_tfield_set.table_id' => $this->getTableId(),
275  )
276  )->innerjoin('il_dcl_tfield_set', 'field', 'field', array())->orderBy('il_dcl_tfield_set.field_order')->get();
277  $fields = array();
278  foreach ($visible as $field_rec) {
279  $fields[] = $field_rec->getFieldObject();
280  }
281  $this->visible_fields_cache = $fields;
282  }
283 
285  }
static where($where, $operator=null)
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ returnDbTableName()

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

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

77  {
78  return "il_dcl_tableview";
79  }

◆ setDescription()

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

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

References $description.

Referenced by cloneStructure().

157  {
158  $this->description = $description;
159  }
+ Here is the caller graph for this function:

◆ setId()

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

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

References $id.

93  {
94  $this->id = $id;
95  }

◆ setOrder()

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

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

Referenced by cloneStructure().

141  {
142  $this->tableview_order = $order;
143  }
+ Here is the caller graph for this function:

◆ setRoles()

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

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

References $roles.

Referenced by cloneStructure().

189  {
190  $this->roles = $roles;
191  }
+ Here is the caller graph for this function:

◆ setTableId()

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

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

References $table_id.

109  {
110  $this->table_id = $table_id;
111  }

◆ setTableviewOrder()

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

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

References $tableview_order.

173  {
174  $this->tableview_order = $tableview_order;
175  }

◆ setTitle()

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

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

References $title.

Referenced by cloneStructure().

125  {
126  $this->title = $title;
127  }
+ Here is the caller graph for this function:

◆ sleep()

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

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

199  {
200  if ($field_name == 'roles') {
201  return json_encode($this->roles);
202  }
203 
204  return null;
205  }

◆ wakeUp()

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

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

214  {
215  if ($field_name == 'roles') {
216  return json_decode($field_value);
217  }
218 
219  return null;
220  }

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: