2 require_once(
'./Modules/DataCollection/classes/Field/NReference/class.ilDataCollectionNReferenceFieldGUI.php');
39 if (!is_array($values)) {
40 $values = array( $values );
42 $datatype = $this->field->getDatatype();
44 $query =
"DELETE FROM il_dcl_stloc" . $datatype->getStorageLocation() .
"_value WHERE record_field_id = " 45 . $ilDB->quote($this->
id,
"integer");
48 if (!count($values) || $values[0] == 0) {
52 $query =
"INSERT INTO il_dcl_stloc" . $datatype->getStorageLocation() .
"_value (value, record_field_id, id) VALUES";
53 foreach ($values as
$value) {
54 $next_id = $ilDB->nextId(
"il_dcl_stloc" . $datatype->getStorageLocation() .
"_value");
55 $query .=
" (" . $ilDB->quote($value, $datatype->getDbType()) .
", " . $ilDB->quote($this->getId(),
"integer") .
", " 56 . $ilDB->quote($next_id,
"integer") .
"),";
74 if ($this->value === NULL) {
77 $datatype = $this->field->getDatatype();
80 $supported_internal_types = array(
86 $supported_types = array_merge(array(
90 ), $supported_internal_types);
91 $datatypeId = $refField->getDatatypeId();
92 if (in_array($datatypeId, $supported_types)) {
93 if (in_array($datatypeId, $supported_internal_types)) {
94 $query =
"SELECT stlocOrig.value AS value, ilias_object.title AS value_ref ";
96 $query =
"SELECT stlocOrig.value AS value, stlocRef.value AS value_ref ";
98 $query .=
"FROM il_dcl_stloc" . $datatype->getStorageLocation() .
"_value AS stlocOrig ";
100 $query .=
" INNER JOIN il_dcl_record_field AS refField ON stlocOrig.value = refField.record_id AND refField.field_id = " 101 . $ilDB->quote($refField->getId(),
"integer");
102 $query .=
" INNER JOIN il_dcl_stloc" . $refField->getStorageLocation()
103 .
"_value AS stlocRef ON stlocRef.record_field_id = refField.id ";
105 $query =
"SELECT stlocOrig.value AS value ";
106 $query .=
"FROM il_dcl_stloc" . $datatype->getStorageLocation() .
"_value AS stlocOrig ";
109 switch ($datatypeId) {
111 $query .=
" INNER JOIN object_reference AS ilias_ref ON ilias_ref.ref_id = stlocRef.value ";
112 $query .=
" INNER JOIN object_data AS ilias_object ON ilias_object.obj_id = ilias_ref.obj_id ";
116 $query .=
" INNER JOIN object_data AS ilias_object ON ilias_object.obj_id = stlocRef.value ";
119 $query .=
" WHERE stlocOrig.record_field_id = " . $ilDB->quote($this->
id,
"integer");
120 if (in_array($datatypeId, $supported_types)) {
121 $query .=
" ORDER BY value_ref ASC";
124 $set = $ilDB->query(
$query);
126 $this->value = array();
127 while ($rec = $ilDB->fetchAssoc($set)) {
128 $this->value[] = $rec[
'value'];
135 if ($this->value === NULL) {
137 $datatype = $this->field->getDatatype();
138 $query =
"SELECT * FROM il_dcl_stloc" . $datatype->getStorageLocation() .
"_value WHERE record_field_id = " 139 . $ilDB->quote($this->
id,
"integer");
140 $set = $ilDB->query(
$query);
141 $this->value = array();
142 while ($rec = $ilDB->fetchAssoc($set)) {
143 $this->value[] = $rec[
'value'];
156 return $ilDataCollectionNReferenceFieldGUI->getSingleHTML(
$options);
168 if ($link ==
"[" . $this->
getField()->getTitle() .
"]") {
172 return parent::getLinkHTML($link,
$value);
181 return $ilDataCollectionNReferenceFieldGUI->getHTML();
186 $stringValue = $excel->val(
$row, $col);
189 if (!count($referenceIds)) {
192 return array(
'warning' => $warning);
195 return $referenceIds;
204 foreach ($values as
$value) {
207 $names[] = $ref_rec->getRecordField($this->
getField()->getFieldRef())->getValue();
211 foreach ($names as $name) {
212 $string .= $name .
", ";
214 if (!count($names)) {
217 $string = substr($string, 0, - 2);
230 $slicedStrings = explode(
", ", $stringValues);
231 $slicedReferences = array();
233 for($i = 0; $i < count($slicedStrings); $i++) {
236 $searchString = implode(array_slice($slicedStrings, $resolved, $i - $resolved + 1));
238 $slicedReferences[] = $ref;
245 $searchString = $slicedStrings[$i];
247 $slicedReferences[] = $ref;
252 return $slicedReferences;
static getRecordCache($record_id=0)
setMaxReferenceLength($max_reference_length)
Class ilDataCollectionField.
getSingleHTML($options=NULL)
this funciton is used to in the viewdefinition of a single record.
Class ilDataCollectionNReferenceFieldGUI.
getLinkHTML($link, $value)
static getFieldCache($field_id=0)
getValueFromExcel($excel, $row, $col)
if(!is_array($argv)) $options
const INPUTFORMAT_ILIAS_REF
const INPUTFORMAT_BOOLEAN
getReferenceFromValue($value)
Class ilDataCollectionNReferenceField.
static getExcelCharForInteger($int)
getReferencesFromString($stringValues)
This method tries to get as many valid references out of a string separated by commata.