4 require_once
"Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php";
29 return self::TYPE_SELECT;
40 $def->setNumeric(
false);
60 if ($a_values !== null) {
61 foreach ($a_values as $idx => $value) {
62 $a_values[$idx] = trim($value);
63 if (!$a_values[$idx]) {
64 unset($a_values[$idx]);
67 $a_values = array_unique($a_values);
70 $this->options = $a_values;
121 $field->setMulti(
true,
true);
122 $field->setMaxLength(255);
128 $field->setValue(array_shift(
$options));
132 $field->setDisabled(
true);
144 $recipes = $a_form->
getInput(
"conf_det");
145 if (is_array($recipes[$this->
getFieldId()])) {
147 $sum = $a_form->
getInput(
"conf_det_act");
153 foreach ($recipes as $old_option => $recipe) {
154 $sum_act = $sum[$old_option];
155 $sgl_act = $sgl[$old_option];
157 if ($recipe ==
"sum") {
163 foreach (array_keys($sgl_act) as $obj_idx) {
164 if ($sum_act == self::REMOVE_ACTION_ID) {
167 $res[$old_option][$obj_idx] = $sum_act;
171 foreach ($sgl_act as $sgl_index => $sgl_item) {
174 } elseif ($sgl_item == self::REMOVE_ACTION_ID) {
175 $sgl_act[$sgl_index] =
"";
179 $res[$old_option] = $sgl_act;
198 if (
sizeof($missing)) {
200 if (!is_array($this->confirmed_objects)) {
208 $this->confirm_objects =
array();
209 foreach ($in_use as $item) {
229 $objDefinition = $DIC[
'objDefinition'];
233 if (is_array($this->confirm_objects) && count($this->confirm_objects) > 0) {
234 $new_options = $a_form->
getInput(
"opts");
237 $sec->setTitle(
$lng->txt(
"md_adv_confirm_definition_select_section"));
240 foreach ($this->confirm_objects as $old_option => $items) {
241 $details =
new ilRadioGroupInputGUI(
$lng->txt(
"md_adv_confirm_definition_select_option") .
': "' . $old_option .
'"',
"conf_det[" . $this->
getFieldId() .
"][" . $old_option .
"]");
243 $details->setValue(
"sum");
251 $sum =
new ilRadioOption(
$lng->txt(
"md_adv_confirm_definition_select_option_all"),
"sum");
252 $details->addOption($sum);
255 $lng->txt(
"md_adv_confirm_definition_select_option_all_action"),
256 "conf_det_act[" . $this->
getFieldId() .
"][" . $old_option .
"]" 260 "" =>
$lng->txt(
"please_select"),
261 self::REMOVE_ACTION_ID =>
$lng->txt(
"md_adv_confirm_definition_select_option_remove")
263 foreach ($new_options as $new_option) {
264 $options[$new_option] =
$lng->txt(
"md_adv_confirm_definition_select_option_overwrite") .
': "' . $new_option .
'"';
267 $sum->addSubItem($sel);
274 $sel->setAlert(
$lng->txt(
"msg_input_is_required"));
279 $single =
new ilRadioOption(
$lng->txt(
"md_adv_confirm_definition_select_option_single"),
"sgl");
280 $details->addOption($single);
282 foreach ($items as $item) {
284 $sub_type = $item[1];
287 $item_id = $obj_id .
"_" . $sub_type .
"_" . $sub_id;
294 $class =
"ilObj" . $objDefinition->getClassName(
$type);
295 $class_path = $objDefinition->getLocation(
$type);
296 include_once $class_path .
"/class." . $class .
".php";
297 if (class_implements($class, ilAdvancedMetaDataSubItem)) {
298 $sub_title = $class::getAdvMDSubItemTitle($obj_id, $sub_type, $sub_id);
300 $title .=
' (' . $sub_title .
')';
306 $type_title .
' ' .
$title,
307 "conf[" . $this->
getFieldId() .
"][" . $old_option .
"][" . $item_id .
"]" 309 $sel->setRequired(
true);
311 "" =>
$lng->txt(
"please_select"),
312 self::REMOVE_ACTION_ID =>
$lng->txt(
"md_adv_confirm_definition_select_option_remove")
314 foreach ($new_options as $new_option) {
315 $options[$new_option] =
$lng->txt(
"md_adv_confirm_definition_select_option_overwrite") .
': "' . $new_option .
'"';
324 $sel->setAlert(
$lng->txt(
"msg_input_is_required"));
329 $single->addSubItem($sel);
344 if (is_array($this->confirmed_objects) && count($this->confirmed_objects) > 0) {
346 foreach ($this->confirmed_objects as $old_option => $item_ids) {
347 foreach ($item_ids as $item => $new_option) {
348 $item = explode(
"_", $item);
350 $sub_type = $item[1];
356 "obj_id" =>
array(
"integer", $obj_id),
357 "sub_type" =>
array(
"text", $sub_type),
358 "sub_id" =>
array(
"integer", $sub_id),
365 "obj_id" =>
array(
"integer", $obj_id),
366 "sub_type" =>
array(
"text", $sub_type),
367 "sub_id" =>
array(
"integer", $sub_id),
373 if ($sub_type ==
"wpg") {
375 include_once
"Modules/Wiki/classes/class.ilPCAMDPageList.php";
391 $a_writer->
xmlElement(
'FieldValue', null, $value);
397 $this->options[] = $a_value;
407 return $element->getSelection();
412 $this->
getADT()->setSelection($a_cdata);
424 $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)
addPropertiesToXML(ilXmlWriter $a_writer)
static _lookupTitle($a_id)
lookup object title
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.
foreach($_POST as $key=> $value) $res
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)
update($pash, $contents, Config $config)
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
getFieldId()
Get field_id.
getValueForXML(ilADT $element)
buildConfirmedObjects(ilPropertyFormGUI $a_form)
Process custom post values from definition form.