ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilDataCollectionReferenceField Class Reference

Class ilDataCollectionField. More...

+ Inheritance diagram for ilDataCollectionReferenceField:
+ Collaboration diagram for ilDataCollectionReferenceField:

Public Member Functions

 __construct (ilDataCollectionRecord $record, ilDataCollectionField $field)
 
 getExportValue ()
 
 getValueFromExcel ($excel, $row, $col)
 
 getReferenceFromValue ($value)
 
- Public Member Functions inherited from ilDataCollectionRecordField
 __construct (ilDataCollectionRecord $record, ilDataCollectionField $field)
 
 doUpdate ()
 Update object in database. More...
 
 delete ()
 Delete record field in database. More...
 
 getValue ()
 
 setValue ($value, $omit_parsing=false)
 Set value for record field. More...
 
 setValueFromForm (&$form)
 
 getValueFromExcel ($excel, $row, $col)
 
 fillFormInput (&$form)
 
 getExportValue ()
 
 fillExcelExport ($worksheet, &$row, &$col)
 
 getPlainText ()
 
 getHTML ($link=true)
 
 getSortingValue ($link=true)
 
 getSingleHTML ()
 
 getField ()
 
 getId ()
 
 getRecord ()
 

Protected Member Functions

 getLinkHTML ($link_name=NULL, $value)
 
- Protected Member Functions inherited from ilDataCollectionRecordField
 doRead ()
 Read object data from database. More...
 
 doCreate ()
 Creates an Id and a database entry. More...
 
 getFormInput ()
 
 loadValue ()
 Load the value. More...
 

Protected Attributes

 $dcl_obj_id
 
 $properties = array()
 
- Protected Attributes inherited from ilDataCollectionRecordField
 $id
 
 $field
 
 $record
 
 $value
 
 $user
 
 $ctrl
 
 $db
 
 $lng
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDataCollectionReferenceField::__construct ( ilDataCollectionRecord  $record,
ilDataCollectionField  $field 
)
Parameters
ilDataCollectionRecord$record
ilDataCollectionField$field

Definition at line 39 of file class.ilDataCollectionReferenceField.php.

References $html, $ilDB, $query, ilDataCollectionRecordField\$value, ilDataCollectionRecordField\getField(), ilDataCollectionRecordField\getHTML(), getLinkHTML(), ilDataCollectionCache\getRecordCache(), ilDataCollectionCache\getTableCache(), ilDataCollectionRecordField\getValue(), and ilDataCollectionField\PROPERTYID_REFERENCE_LINK.

39  {
40  parent::__construct($record, $field);
41  $dclTable = ilDataCollectionCache::getTableCache($this->getField()->getTableId());
42  $this->dcl_obj_id = $dclTable->getCollectionObject()->getId();
43  $this->properties = $this->field->getProperties();
44  }
+ Here is the call graph for this function:

Member Function Documentation

◆ getExportValue()

ilDataCollectionReferenceField::getExportValue ( )
Returns
int|string

Definition at line 116 of file class.ilDataCollectionReferenceField.php.

References ilDataCollectionRecordField\getField(), ilDataCollectionCache\getRecordCache(), and ilDataCollectionRecordField\getValue().

116  {
117  if ($this->getValue()) {
118  $ref_rec = ilDataCollectionCache::getRecordCache($this->getValue());
119  $exp_value = $ref_rec->getRecordField($this->getField()->getFieldRef())->getExportValue();
120  if ($exp_value instanceof stdClass) {
121  return json_encode($exp_value);
122  }
123  return $exp_value;
124  } else {
125  return "";
126  }
127  }
static getRecordCache($record_id=0)
+ Here is the call graph for this function:

◆ getLinkHTML()

ilDataCollectionReferenceField::getLinkHTML (   $link_name = NULL,
  $value 
)
protected
Parameters
null$link_name
$value
Returns
string

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

References $html, $ilCtrl, ilDataCollectionRecordField\$value, and ilDataCollectionCache\getRecordCache().

Referenced by __construct().

94  {
95  global $ilCtrl;
96 
97  if (!$value || $value == "-") {
98  return "";
99  }
100  $record_field = $this;
102  if (!$link_name) {
103  $link_name = $ref_record->getRecordFieldHTML($record_field->getField()->getFieldRef());
104  }
105  $ilCtrl->setParameterByClass("ildatacollectionrecordviewgui", "record_id", $ref_record->getId());
106  $html = "<a href='" . $ilCtrl->getLinkTargetByClass("ilDataCollectionRecordViewGUI", "renderRecord") . "&disable_paging=1'>" . $link_name
107  . "</a>";
108 
109  return $html;
110  }
static getRecordCache($record_id=0)
global $ilCtrl
Definition: ilias.php:18
$html
Definition: example_001.php:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReferenceFromValue()

ilDataCollectionReferenceField::getReferenceFromValue (   $value)
Parameters
$fieldilDataCollectionField
$value
Returns
int

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

References ilDataCollectionRecordField\$field, ilDataCollectionRecordField\$record, ilDataCollectionRecordField\$value, ilDataCollectionCache\getFieldCache(), ilDataCollectionCache\getTableCache(), and ilDataCollectionRecordField\getValue().

Referenced by ilDataCollectionNReferenceField\getReferencesFromString(), and getValueFromExcel().

149  {
150  $field = ilDataCollectionCache::getFieldCache($this->field->getFieldRef());
151  $table = ilDataCollectionCache::getTableCache($field->getTableId());
152  $record_id = 0;
153  foreach ($table->getRecords() as $record) {
154  $record_value = $record->getRecordField($field->getId())->getValue();
155  // in case of a url-field
156  if ($json = json_decode($record_value,true)) {
157  $record_value = array_shift($json);
158  }
159  if ($record_value == $value) {
160  $record_id = $record->getId();
161  }
162  }
163 
164  return $record_id;
165  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValueFromExcel()

ilDataCollectionReferenceField::getValueFromExcel (   $excel,
  $row,
  $col 
)

Definition at line 129 of file class.ilDataCollectionReferenceField.php.

References ilDataCollectionRecordField\$lng, $row, ilDataCollectionRecordField\$value, ilDataCollectionImporter\getExcelCharForInteger(), and getReferenceFromValue().

129  {
130  global $lng;
131  $value = $excel->val($row, $col);
132  $old = $value;
134  if (!$value) {
135  $warning = "(" . $col . ", " . ilDataCollectionImporter::getExcelCharForInteger($col) . ") " . $lng->txt("dcl_no_such_reference") . " "
136  . $old;
137  return array('warning' => $warning);
138  }
139 
140  return $value;
141  }
+ Here is the call graph for this function:

Field Documentation

◆ $dcl_obj_id

ilDataCollectionReferenceField::$dcl_obj_id
protected

Definition at line 28 of file class.ilDataCollectionReferenceField.php.

◆ $properties

ilDataCollectionReferenceField::$properties = array()
protected

Definition at line 32 of file class.ilDataCollectionReferenceField.php.


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