4 require_once
"Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php";
29 return self::TYPE_SELECT;
40 $def->setNumeric(
false);
60 if($a_values !== null)
62 foreach($a_values as $idx => $value)
64 $a_values[$idx] = trim($value);
67 unset($a_values[$idx]);
70 $a_values = array_unique($a_values);
73 $this->options = $a_values;
105 return array($lng->txt(
"meta_advmd_select_options") => implode(
",", $this->
getOptions()));
118 $field =
new ilTextInputGUI($lng->txt(
"meta_advmd_select_options"),
"opts");
120 $field->setMulti(
true,
true);
121 $field->setMaxLength(255);
128 $field->setValue(array_shift(
$options));
133 $field->setDisabled(
true);
145 $recipes = $a_form->
getInput(
"conf_det");
149 $sum = $a_form->
getInput(
"conf_det_act");
155 foreach($recipes as $old_option => $recipe)
157 $sum_act = $sum[$old_option];
158 $sgl_act = $sgl[$old_option];
168 foreach(array_keys($sgl_act) as $obj_idx)
170 if($sum_act == self::REMOVE_ACTION_ID)
174 $res[$old_option][$obj_idx] = $sum_act;
180 foreach($sgl_act as $sgl_index => $sgl_item)
186 else if($sgl_item == self::REMOVE_ACTION_ID)
188 $sgl_act[$sgl_index] =
"";
192 $res[$old_option] = $sgl_act;
214 if(!is_array($this->confirmed_objects))
224 $this->confirm_objects =
array();
225 foreach($in_use as $item)
243 global
$lng, $objDefinition;
247 if(
sizeof($this->confirm_objects))
249 $new_options = $a_form->
getInput(
"opts");
252 $sec->setTitle($lng->txt(
"md_adv_confirm_definition_select_section"));
255 foreach($this->confirm_objects as $old_option => $items)
257 $details =
new ilRadioGroupInputGUI($lng->txt(
"md_adv_confirm_definition_select_option").
': "'.$old_option.
'"',
"conf_det[".$this->getFieldId().
"][".$old_option.
"]");
258 $details->setRequired(
true);
259 $details->setValue(
"sum");
268 $sum =
new ilRadioOption($lng->txt(
"md_adv_confirm_definition_select_option_all"),
"sum");
269 $details->addOption($sum);
271 $sel =
new ilSelectInputGUI($lng->txt(
"md_adv_confirm_definition_select_option_all_action"),
272 "conf_det_act[".$this->getFieldId().
"][".$old_option.
"]");
273 $sel->setRequired(
true);
275 "" => $lng->txt(
"please_select"),
276 self::REMOVE_ACTION_ID => $lng->txt(
"md_adv_confirm_definition_select_option_remove")
278 foreach($new_options as $new_option)
280 $options[$new_option] = $lng->txt(
"md_adv_confirm_definition_select_option_overwrite").
': "'.$new_option.
'"';
283 $sum->addSubItem($sel);
294 $sel->setAlert($lng->txt(
"msg_input_is_required"));
299 $single =
new ilRadioOption($lng->txt(
"md_adv_confirm_definition_select_option_single"),
"sgl");
300 $details->addOption($single);
302 foreach($items as $item)
305 $sub_type = $item[1];
308 $item_id = $obj_id.
"_".$sub_type.
"_".$sub_id;
311 $type_title = $lng->txt(
"obj_".$type);
312 $title =
' "'.ilObject::_lookupTitle($obj_id).
'"';
316 $class =
"ilObj".$objDefinition->getClassName($type);
317 $class_path = $objDefinition->getLocation($type);
318 include_once $class_path.
"/class.".$class.
".php";
319 if(class_implements($class, ilAdvancedMetaDataSubItem))
321 $sub_title = $class::getAdvMDSubItemTitle($obj_id, $sub_type, $sub_id);
324 $title .=
' ('.$sub_title.
')';
330 "conf[".$this->getFieldId().
"][".$old_option.
"][".$item_id.
"]");
331 $sel->setRequired(
true);
333 "" => $lng->txt(
"please_select"),
334 self::REMOVE_ACTION_ID => $lng->txt(
"md_adv_confirm_definition_select_option_remove")
336 foreach($new_options as $new_option)
338 $options[$new_option] = $lng->txt(
"md_adv_confirm_definition_select_option_overwrite").
': "'.$new_option.
'"';
351 $sel->setAlert($lng->txt(
"msg_input_is_required"));
356 $single->addSubItem($sel);
371 if(
sizeof($this->confirmed_objects))
374 foreach($this->confirmed_objects as $old_option => $item_ids)
376 foreach($item_ids as $item => $new_option)
378 $item = explode(
"_", $item);
380 $sub_type = $item[1];
387 "obj_id" =>
array(
"integer", $obj_id),
388 "sub_type" =>
array(
"text", $sub_type),
389 "sub_id" =>
array(
"integer", $sub_id),
398 "obj_id" =>
array(
"integer", $obj_id),
399 "sub_type" =>
array(
"text", $sub_type),
400 "sub_id" =>
array(
"integer", $sub_id),
406 if($sub_type ==
"wpg")
409 include_once
"Modules/Wiki/classes/class.ilPCAMDPageList.php";
426 $a_writer->
xmlElement(
'FieldValue',null,$value);
432 $this->options[] = $a_value;
442 return $element->getSelection();
447 $this->
getADT()->setSelection($a_cdata);
459 $a_enum->setAutoSort(
false);
This class represents an option in a radio group.
prepareCustomDefinitionFormConfirmation(ilPropertyFormGUI $a_form)
static initActiveRecordByType()
Init active record by type.
AMD field abstract base class.
getFieldDefinitionForTableGUI()
getADT()
Get ADT instance.
importXMLProperty($a_key, $a_value)
importValueFromXML($a_cdata)
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
addPropertiesToXML(ilXmlWriter $a_writer)
static writeByPrimary($a_table, array $a_primary, $a_type, $a_value)
Write directly.
static getInstance()
Get singleton.
importFieldDefinition(array $a_def)
addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, $a_disabled=false)
Add input elements to definition form.
static deleteByPrimary($a_table, array $a_primary, $a_type=null)
Delete values by (partial) primary key.
importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form)
Import custom post values from definition form.
setOptions(array $a_values=null)
Set options.
static migrateField($a_obj_id, $a_field_id, $old_option, $new_option, $a_is_multi=false)
Migrate search/filter values on advmd change.
static readByPrimary($a_table, array $a_primary, $a_type=null)
Read directly.
This class represents a text property in a property form.
importDefinitionFormPostValuesNeedsConfirmation()
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
prepareElementForEditor(ilADTFormBridge $a_enum)
getFieldId()
Get field_id.
getValueForXML(ilADT $element)
buildConfirmedObjects(ilPropertyFormGUI $a_form)
Process custom post values from definition form.