20 if(!is_array($values))
21 $values = array($values);
22 $datatype = $this->field->getDatatype();
24 $query =
"DELETE FROM il_dcl_stloc".$datatype->getStorageLocation().
"_value WHERE record_field_id = ".$ilDB->quote($this->
id,
"integer");
27 if(!count($values)|| $values[0] == 0)
30 $query =
"INSERT INTO il_dcl_stloc".$datatype->getStorageLocation().
"_value (value, record_field_id, id) VALUES";
31 foreach($values as
$value){
32 $next_id = $ilDB->nextId(
"il_dcl_stloc".$datatype->getStorageLocation().
"_value");
33 $query .=
" (".$ilDB->quote($value, $datatype->getDbType()).
", ".$ilDB->quote($this->getId(),
"integer").
", ".$ilDB->quote($next_id,
"integer").
"),";
44 if($this->value === NULL)
47 $datatype = $this->field->getDatatype();
48 $query =
"SELECT * FROM il_dcl_stloc".$datatype->getStorageLocation().
"_value WHERE record_field_id = ".$ilDB->quote($this->
id,
"integer");
49 $set = $ilDB->query(
$query);
50 while($rec = $ilDB->fetchAssoc($set))
51 $this->value[] = $rec[
'value'];
63 $record_field = $this;
65 if(!$values || !count($values)){
76 $tpl =
new ilTemplate(
"tpl.reference_list.html",
true,
true,
"Modules/DataCollection");
77 $tpl->setCurrentBlock(
"reference_list");
78 foreach ($values as
$value) {
80 if (!$ref_record->getTableId() || !$record_field->getField() || !$record_field->getField()->getTableId()) {
82 $record_field->setValue(0);
83 $record_field->doUpdate();
85 $tpl->setCurrentBlock(
"reference");
87 $tpl->setVariable(
"CONTENT", $ref_record->getRecordFieldHTML($this->getField()->getFieldRef()));
90 $tpl->parseCurrentBlock();
93 $tpl->parseCurrentBlock();
98 if($link ==
"[".$this->
getField()->getTitle().
"]"){
114 $record_field = $this;
116 if(!$values || !count($values)){
121 $tpl =
new ilTemplate(
"tpl.reference_hover.html",
true,
true,
"Modules/DataCollection");
122 $tpl->setCurrentBlock(
"reference_list");
123 foreach($values as
$value){
125 if(!$ref_record->getTableId() || !$record_field->getField() || !$record_field->getField()->getTableId()){
127 $record_field->setValue(NULL);
128 $record_field->doUpdate();
130 if((strlen($html) < $this->max_reference_length))
131 $html .= $ref_record->getRecordFieldHTML($this->
getField()->getFieldRef()).
", ";
134 $tpl->setCurrentBlock(
"reference");
135 $tpl->setVariable(
"CONTENT", $ref_record->getRecordFieldHTML($this->getField()->getFieldRef()));
136 $tpl->parseCurrentBlock();
139 $html = substr($html, 0, -2);
144 $tpl->setVariable(
"ALL", $html);
145 $tpl->parseCurrentBlock();
157 foreach($values as
$value){
160 $names[] = $ref_rec->getRecordField($this->
getField()->getFieldRef())->getValue();
164 foreach($names as $name){
169 $string = substr($string, 0, -2);