2 require_once(
"./Modules/DataCollection/classes/Fields/NReference/class.ilDclNReferenceFieldGUI.php");
40 if (!is_array($values)) {
41 $values =
array( $values );
43 $datatype = $this->
getField()->getDatatype();
45 $query =
"DELETE FROM il_dcl_stloc" . $datatype->getStorageLocation() .
"_value WHERE record_field_id = " 46 .
$ilDB->quote($this->
id,
"integer");
49 if (!count($values) || $values[0] == 0) {
53 $query =
"INSERT INTO il_dcl_stloc" . $datatype->getStorageLocation() .
"_value (value, record_field_id, id) VALUES";
54 foreach ($values as
$value) {
55 $next_id =
$ilDB->nextId(
"il_dcl_stloc" . $datatype->getStorageLocation() .
"_value");
56 $query .=
" (" .
$ilDB->quote($value, $datatype->getDbType()) .
", " .
$ilDB->quote($this->getId(),
"integer") .
", " 57 .
$ilDB->quote($next_id,
"integer") .
"),";
75 if ($this->value === NULL) {
79 $datatype = $this->
getField()->getDatatype();
82 $supported_internal_types =
array(
88 $supported_types = array_merge(
array(
92 ), $supported_internal_types);
93 $datatypeId = $refField->getDatatypeId();
94 if (in_array($datatypeId, $supported_types)) {
95 if (in_array($datatypeId, $supported_internal_types)) {
96 $query =
"SELECT stlocOrig.value AS value, ilias_object.title AS value_ref ";
98 $query =
"SELECT stlocOrig.value AS value, stlocRef.value AS value_ref ";
100 $query .=
"FROM il_dcl_stloc" . $datatype->getStorageLocation() .
"_value AS stlocOrig ";
102 $query .=
" INNER JOIN il_dcl_record_field AS refField ON stlocOrig.value = refField.record_id AND refField.field_id = " 103 .
$ilDB->quote($refField->getId(),
"integer");
104 $query .=
" INNER JOIN il_dcl_stloc" . $refField->getStorageLocation()
105 .
"_value AS stlocRef ON stlocRef.record_field_id = refField.id ";
107 $query =
"SELECT stlocOrig.value AS value ";
108 $query .=
"FROM il_dcl_stloc" . $datatype->getStorageLocation() .
"_value AS stlocOrig ";
111 switch ($datatypeId) {
113 $query .=
" INNER JOIN object_reference AS ilias_ref ON ilias_ref.ref_id = stlocRef.value ";
114 $query .=
" INNER JOIN object_data AS ilias_object ON ilias_object.obj_id = ilias_ref.obj_id ";
118 $query .=
" INNER JOIN object_data AS ilias_object ON ilias_object.obj_id = stlocRef.value ";
121 $query .=
" WHERE stlocOrig.record_field_id = " .
$ilDB->quote($this->
id,
"integer");
122 if (in_array($datatypeId, $supported_types)) {
123 $query .=
" ORDER BY value_ref ASC";
128 $this->value =
array();
129 while ($rec =
$ilDB->fetchAssoc($set)) {
130 $this->value[] = $rec[
'value'];
137 if ($this->value === NULL) {
139 $ilDB = $DIC[
'ilDB'];
140 $datatype = $this->
getField()->getDatatype();
141 $query =
"SELECT * FROM il_dcl_stloc" . $datatype->getStorageLocation() .
"_value WHERE record_field_id = " 142 .
$ilDB->quote($this->
id,
"integer");
144 $this->value =
array();
145 while ($rec =
$ilDB->fetchAssoc($set)) {
146 $this->value[] = $rec[
'value'];
159 return $ilDataCollectionNReferenceFieldGUI->getSingleHTML(
$options);
171 if ($link ==
"[" . $this->
getField()->getTitle() .
"]") {
175 return parent::getLinkHTML($link,
$value);
184 return $ilDataCollectionNReferenceFieldGUI->getHTML();
190 $stringValue = parent::getValueFromExcel($excel,
$row, $col);
193 if (!count($referenceIds) && $stringValue) {
196 return array(
'warning' => $warning);
199 return $referenceIds;
208 foreach ($values as
$value) {
211 $names[] = $ref_rec->getRecordField($this->
getField()->getFieldRef())->getValue();
215 foreach (
$names as $name) {
216 $string .= $name .
", ";
221 $string = substr($string, 0, - 2);
234 $slicedStrings = explode(
", ", $stringValues);
235 $slicedReferences =
array();
237 for($i = 0; $i < count($slicedStrings); $i++) {
240 $searchString = implode(array_slice($slicedStrings, $resolved, $i - $resolved + 1));
242 $slicedReferences[] = $ref;
249 $searchString = $slicedStrings[$i];
251 $slicedReferences[] = $ref;
256 return $slicedReferences;
setMaxReferenceLength($max_reference_length)
getLinkHTML($link, $value)
static getFieldCache($field_id=0)
const INPUTFORMAT_BOOLEAN
getValueFromExcel($excel, $row, $col)
getSingleHTML($options=NULL)
this funciton is used to in the viewdefinition of a single record.
Class ilDclNReferenceFieldGUI.
if(!is_array($argv)) $options
static getRecordCache($record_id=0)
Class ilDclBaseFieldModel.
const INPUTFORMAT_ILIAS_REF
getReferencesFromString($stringValues)
This method tries to get as many valid references out of a string separated by commata.
Create styles array
The data for the language used.
static getExcelCharForInteger($int)
getReferenceFromValue($value)