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.

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

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  }
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 323 of file class.ilDclTableView.php.

References createDefaultSettings().

324  {
325  parent::create();
326  if ($create_default_settings) {
327  $this->createDefaultSettings();
328  }
329  }
createDefaultSettings()
create default ilDclTableViewFieldSetting entries
+ Here is the call graph for this function:

◆ createDefaultSettings()

ilDclTableView::createDefaultSettings ( )

create default ilDclTableViewFieldSetting entries

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

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

Referenced by create().

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  }
createFieldSetting($field_id)
create ilDclTableViewFieldSetting for this tableview and the given field id
static getTableCache($table_id=0)
if(empty($password)) $table
Definition: pwgen.php:24
+ 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.

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

Referenced by createDefaultSettings().

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)
Class ilDclTableViewFieldSetting.
static _isStandardField($field_id)
+ 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.

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

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

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  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
$lng
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 243 of file class.ilDclTableView.php.

References getFieldSettings().

244  {
245  //Delete settings
246  foreach ($this->getFieldSettings() as $setting) {
247  $setting->delete();
248  }
249  parent::delete();
250  }
+ 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.

References $table_id.

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

419  {
420  return self::where(array('table_id' => $table_id))->orderBy('tableview_order')->get();
421  }
+ 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.

References $table_id.

Referenced by ilDclTable\getNewTableviewOrder().

430  {
431  return self::where(array('table_id' => $table_id))->orderBy('tableview_order')->count();
432  }
+ Here is the caller graph for this function:

◆ getDescription()

ilDclTableView::getDescription ( )
Returns
string

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

References $description.

Referenced by cloneStructure().

159  {
160  return $this->description;
161  }
+ Here is the caller graph for this function:

◆ getFieldSettings()

ilDclTableView::getFieldSettings ( )

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

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

Referenced by cloneStructure(), and delete().

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  }
static where($where, $operator=null)
+ 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.

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

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  }
static where($where, $operator=null)
+ Here is the call graph for this function:

◆ getId()

ilDclTableView::getId ( )
Returns
int

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

References $id.

Referenced by cloneStructure(), and getFieldSettings().

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

◆ getOrder()

ilDclTableView::getOrder ( )
Returns
int

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

References $tableview_order.

Referenced by cloneStructure().

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

◆ getRoles()

ilDclTableView::getRoles ( )
Returns
array

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

References $roles.

Referenced by cloneStructure().

195  {
196  return (array) $this->roles;
197  }
+ Here is the caller graph for this function:

◆ getTable()

ilDclTableView::getTable ( )
Returns
ilDclTable

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

References ilDclCache\getTableCache().

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

◆ getTableId()

ilDclTableView::getTableId ( )
Returns
int

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

References $table_id.

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

105  {
106  return $this->table_id;
107  }
+ Here is the caller graph for this function:

◆ getTableviewOrder()

ilDclTableView::getTableviewOrder ( )
Returns
int

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

References $tableview_order.

177  {
178  return $this->tableview_order;
179  }

◆ getTitle()

ilDclTableView::getTitle ( )
Returns
string

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

References $title.

Referenced by cloneStructure().

123  {
124  return $this->title;
125  }
+ 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.

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

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  }
static where($where, $operator=null)
+ 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.

78  {
79  return "il_dcl_tableview";
80  }

◆ setDescription()

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

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

References $description.

Referenced by cloneStructure().

168  {
169  $this->description = $description;
170  }
+ Here is the caller graph for this function:

◆ setId()

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

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

References $id.

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

◆ setOrder()

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

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

Referenced by cloneStructure().

150  {
151  $this->tableview_order = $order;
152  }
+ 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.

References $roles.

Referenced by cloneStructure().

204  {
205  $this->roles = $roles;
206  }
+ 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.

References $table_id.

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

◆ setTableviewOrder()

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

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

References $tableview_order.

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

◆ setTitle()

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

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

References $title.

Referenced by cloneStructure().

132  {
133  $this->title = $title;
134  }
+ Here is the caller graph for this function:

◆ sleep()

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

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

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: