ILIAS  release_7 Revision v7.30-3-g800a261c036
ilAdvancedMDRecordGUI Class Reference
+ Collaboration diagram for ilAdvancedMDRecordGUI:

Public Member Functions

 __construct ($a_mode, $a_obj_type='', $a_obj_id='', $a_sub_type='', $a_sub_id='')
 Constructor. More...
 
 setAdvMdRecordObject ($a_adv_ref_id, $a_adv_type, $a_adv_subtype="-")
 Set object, that defines the adv md records being used. More...
 
 getAdvMdRecordObject ()
 Get adv md record type. More...
 
 setRefId ($a_ref_id)
 Set ref_id for context. More...
 
 setPropertyForm ($form)
 set property form object More...
 
 setSearchValues ($a_values)
 Set values for search form. More...
 
 setInfoObject ($info)
 get info sections More...
 
 parse ()
 Get HTML. More...
 
 importEditFormPostValues ()
 Load edit form values from post. More...
 
 writeEditForm ($a_obj_id=null, $a_sub_id=null)
 Write edit form values to db. More...
 
 importSearchForm ()
 Load edit form values from post. More...
 
 setSearchFormValues (array $a_values)
 
 parseRecordSelection ($a_sec_head="")
 Parse property form in editor mode. More...
 
 saveSelection ()
 Save selection per object. More...
 
 setTableGUI ($a_val)
 Set table. More...
 
 getTableGUI ()
 Get table. More...
 
 setRowData ($a_val)
 Set row data. More...
 
 getRowData ()
 Get row data. More...
 
 importFilter ()
 Import filter (post) values. More...
 
 getFilterElements ($a_only_non_empty=true)
 Get SQL conditions for current filter value(s) More...
 

Data Fields

const MODE_EDITOR = 1
 
const MODE_SEARCH = 2
 
const MODE_INFO = 3
 
const MODE_APP_PRESENTATION = 8
 
const MODE_REC_SELECTION = 4
 
const MODE_FILTER = 5
 
const MODE_TABLE_HEAD = 6
 
const MODE_TABLE_CELLS = 7
 

Protected Member Functions

 parseEditor ()
 Parse property form in editor mode. More...
 
 parseDuration ($u_start, $u_end)
 parse hours and minutes from duration More...
 
 getActiveRecords ()
 

Protected Attributes

 $lng
 
 $editor_form
 
 $adv_ref_id = null
 
 $adv_type = null
 
 $adv_subtype = null
 
 $user
 

Private Member Functions

 parseSearch ()
 Parse search. More...
 
 parseInfoPage ()
 Presentation for info page. More...
 
 parseAppointmentPresentation ()
 Presentation for calendar agenda list. More...
 
 handleECSDefinitions ($a_definition)
 handle ecs definitions More...
 
 showECSStart ($def)
 Show special form for ecs start. More...
 
 parseFilter ()
 Parse property for filter (table) More...
 
 parseTableHead ()
 Parse property for table head. More...
 
 parseTableCells ()
 Parse table cells. More...
 

Private Attributes

 $mode
 
 $obj_type
 
 $sub_type
 
 $obj_id
 
 $ref_id = null
 
 $form
 
 $search_values = array()
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

@ilCtrl_Calls

Definition at line 14 of file class.ilAdvancedMDRecordGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDRecordGUI::__construct (   $a_mode,
  $a_obj_type = '',
  $a_obj_id = '',
  $a_sub_type = '',
  $a_sub_id = '' 
)

Constructor.

@access public

Parameters
intmode either MODE_EDITOR or MODE_SEARCH
intobj_type

Definition at line 70 of file class.ilAdvancedMDRecordGUI.php.

71 {
72 global $DIC;
73
74 $lng = $DIC['lng'];
75
76 $this->user = $DIC->user();
77 $this->lng = $lng;
78 $this->mode = $a_mode;
79 $this->obj_type = $a_obj_type;
80 $this->obj_id = $a_obj_id;
81 $this->sub_type = $a_sub_type;
82 $this->sub_id = $a_sub_id;
83
84 if ($a_obj_id) {
85 $refs = ilObject::_getAllReferences($a_obj_id);
86 $this->ref_id = end($refs);
87 }
88 }
user()
Definition: user.php:4
static _getAllReferences($a_id)
get all reference ids of object
global $DIC
Definition: goto.php:24

References $DIC, $lng, ilObject\_getAllReferences(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ getActiveRecords()

ilAdvancedMDRecordGUI::getActiveRecords ( )
protected

Definition at line 715 of file class.ilAdvancedMDRecordGUI.php.

716 {
717 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
720 }
getAdvMdRecordObject()
Get adv md record type.
static _getSelectedRecordsByObject($a_obj_type, $a_ref_id, $a_sub_type="")
Get selected records by object.

References $adv_ref_id, $adv_subtype, $adv_type, ilAdvancedMDRecord\_getSelectedRecordsByObject(), and getAdvMdRecordObject().

Referenced by parseEditor(), parseFilter(), parseSearch(), parseTableCells(), and parseTableHead().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdvMdRecordObject()

ilAdvancedMDRecordGUI::getAdvMdRecordObject ( )

Get adv md record type.

Returns
array adv type

Definition at line 108 of file class.ilAdvancedMDRecordGUI.php.

References $adv_ref_id, $adv_subtype, $adv_type, $obj_type, $ref_id, and $sub_type.

Referenced by getActiveRecords().

+ Here is the caller graph for this function:

◆ getFilterElements()

ilAdvancedMDRecordGUI::getFilterElements (   $a_only_non_empty = true)

Get SQL conditions for current filter value(s)

Returns
array

Definition at line 777 of file class.ilAdvancedMDRecordGUI.php.

778 {
779 if (!is_array($this->adt_search)) {
780 return;
781 }
782
783 $res = array();
784
785 foreach ($this->adt_search as $def_id => $element) {
786 if (!$element->isNull() ||
787 !(bool) $a_only_non_empty) {
788 $res[$def_id] = $element;
789 }
790 }
791 return $res;
792 }
foreach($_POST as $key=> $value) $res

References $res.

Referenced by ilTable2GUI\isAdvMDFilter().

+ Here is the caller graph for this function:

◆ getRowData()

ilAdvancedMDRecordGUI::getRowData ( )

Get row data.

Returns
array assoc array of row data (containing md record data)

Definition at line 710 of file class.ilAdvancedMDRecordGUI.php.

711 {
712 return $this->row_data;
713 }

Referenced by parseTableCells().

+ Here is the caller graph for this function:

◆ getTableGUI()

ilAdvancedMDRecordGUI::getTableGUI ( )

Get table.

Returns
object table gui class

Definition at line 690 of file class.ilAdvancedMDRecordGUI.php.

691 {
692 return $this->table_gui;
693 }

◆ handleECSDefinitions()

ilAdvancedMDRecordGUI::handleECSDefinitions (   $a_definition)
private

handle ecs definitions

@access private

Parameters
objectilAdvMDFieldDefinition
Returns

Definition at line 498 of file class.ilAdvancedMDRecordGUI.php.

499 {
500 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
501 include_once('./Services/WebServices/ECS/classes/class.ilECSServerSettings.php');
502
503 if (ilECSServerSettings::getInstance()->activeServerExists() or
504 ($this->obj_type != 'crs' and $this->obj_type != 'rcrs')
505 ) {
506 return false;
507 }
508 return false;
509 }
static getInstance()
Get singleton instance.

References ilECSServerSettings\getInstance().

Referenced by parseTableCells(), and parseTableHead().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importEditFormPostValues()

ilAdvancedMDRecordGUI::importEditFormPostValues ( )

Load edit form values from post.

Returns
bool

Definition at line 260 of file class.ilAdvancedMDRecordGUI.php.

261 {
262 // #13774
263 if (!is_array($this->editor_form)) {
264 return false;
265 }
266
267 $valid = true;
268
269 foreach ($this->editor_form as $item) {
270 $item["form"]->importFromPost();
271 if (!$item["form"]->validate()) {
272 $valid = false;
273 }
274 }
275
276 return $valid;
277 }
$valid

References $valid.

Referenced by ilObjSessionGUI\saveObject(), and ilObjSessionGUI\updateObject().

+ Here is the caller graph for this function:

◆ importFilter()

ilAdvancedMDRecordGUI::importFilter ( )

Import filter (post) values.

Definition at line 761 of file class.ilAdvancedMDRecordGUI.php.

762 {
763 if (!is_array($this->adt_search)) {
764 return;
765 }
766
767 foreach ($this->adt_search as $element) {
768 $element->importFromPost();
769 }
770 }

◆ importSearchForm()

ilAdvancedMDRecordGUI::importSearchForm ( )

Load edit form values from post.

Returns
array

Definition at line 373 of file class.ilAdvancedMDRecordGUI.php.

374 {
375 if (!sizeof($this->search_form)) {
376 return false;
377 }
378
379 $valid = true;
380 $res = array();
381
382 foreach ($this->search_form as $field_id => $item) {
383 $item["value"]->importFromPost();
384 if (!$item["value"]->validate()) {
385 $valid = false;
386 }
387 $value = $item["def"]->getSearchValueSerialized($item["value"]);
388 if ($value !== null) {
389 $res[$field_id] = $value;
390 }
391 }
392
393 if ($valid) {
394 return $res;
395 }
396 }

References $res, and $valid.

◆ parse()

ilAdvancedMDRecordGUI::parse ( )

Get HTML.

@access public

Parameters

Definition at line 170 of file class.ilAdvancedMDRecordGUI.php.

171 {
172 switch ($this->mode) {
174 return $this->parseEditor();
175
177 return $this->parseSearch();
178
179 case self::MODE_INFO:
180 return $this->parseInfoPage();
181
183 return $this->parseAppointmentPresentation();
184
186 return $this->parseRecordSelection();
187
189 return $this->parseFilter();
190
192 return $this->parseTableHead();
193
195 return $this->parseTableCells();
196
197 default:
198 die('Not implemented yet');
199 }
200 }
parseInfoPage()
Presentation for info page.
parseRecordSelection($a_sec_head="")
Parse property form in editor mode.
parseFilter()
Parse property for filter (table)
parseTableHead()
Parse property for table head.
parseAppointmentPresentation()
Presentation for calendar agenda list.
parseEditor()
Parse property form in editor mode.

References MODE_APP_PRESENTATION, MODE_EDITOR, MODE_FILTER, MODE_INFO, MODE_REC_SELECTION, MODE_SEARCH, MODE_TABLE_CELLS, MODE_TABLE_HEAD, parseAppointmentPresentation(), parseEditor(), parseFilter(), parseInfoPage(), parseRecordSelection(), parseSearch(), parseTableCells(), and parseTableHead().

+ Here is the call graph for this function:

◆ parseAppointmentPresentation()

ilAdvancedMDRecordGUI::parseAppointmentPresentation ( )
private

Presentation for calendar agenda list.

Returns
void

Definition at line 439 of file class.ilAdvancedMDRecordGUI.php.

440 {
442
443 $definitions = ilAdvancedMDFieldDefinition::getInstancesByObjType($this->obj_type);
444 $definitions = $sub->sortDefinitions($definitions);
445
446 $positions = array();
447 foreach ($definitions as $position => $value) {
448 $positions[$value->getFieldId()] = $position;
449 }
450
451 $array_elements = array();
452 foreach (ilAdvancedMDValues::getInstancesForObjectId($this->obj_id, $this->obj_type, $this->sub_type, $this->sub_id) as $record_id => $a_values) {
453 // this correctly binds group and definitions
454 $a_values->read();
455
456 $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record_id);
457
458 $defs = $a_values->getDefinitions();
459 foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
460 if (!$element->isNull()) {
461 $presentation_bridge = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
462 #21615
463 if (get_class($element) == 'ilADTLocation') {
464 $presentation_bridge->setSize("100%", "200px");
465 #22638
466 $presentation_value = $presentation_bridge->getHTML();
467 $presentation_value .= "<script>ilInitMaps();</script>";
468 } elseif (get_class($element) == 'ilADTExternalLink' || get_class($element) == 'ilADTInternalLink') {
469 #22638
470 $presentation_value = $presentation_bridge->getHTML();
471 } else {
472 $presentation_value = strip_tags($presentation_bridge->getHTML());
473 }
474 $array_elements[$positions[$element_id]] =
475 [
476 "title" => $field_translations->getTitleForLanguage($element_id, $this->user->getLanguage()),
477 "value" => $presentation_value
478 ];
479 }
480 }
481 }
482
483 // already sorted by record positions
484 return $array_elements;
485 }
static getInstance()
Get singleton.
static getInstancesByObjType($a_obj_type, $a_active_only=true)
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
static getInstancesForObjectId($a_obj_id, $a_obj_type=null, $a_sub_type="-", $a_sub_id=0)
Get instances for given object id.

References ilAdvancedMDSubstitution\_getInstanceByObjectType(), ilADTFactory\getInstance(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), ilAdvancedMDFieldDefinition\getInstancesByObjType(), ilAdvancedMDValues\getInstancesForObjectId(), and user().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseDuration()

ilAdvancedMDRecordGUI::parseDuration (   $u_start,
  $u_end 
)
protected

parse hours and minutes from duration

@access protected

Parameters

return

Definition at line 609 of file class.ilAdvancedMDRecordGUI.php.

610 {
611 if ($u_start >= $u_end) {
612 return array(0,0);
613 }
614 $diff = $u_end - $u_start;
615 $hours = (int) ($diff / (60 * 60));
616 $min = (int) (($diff % 3600) / 60);
617 return array($hours,$min);
618 }

Referenced by showECSStart().

+ Here is the caller graph for this function:

◆ parseEditor()

ilAdvancedMDRecordGUI::parseEditor ( )
protected

Parse property form in editor mode.

Definition at line 210 of file class.ilAdvancedMDRecordGUI.php.

211 {
212 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
213 $this->editor_form = array();
214
215 foreach ($this->getActiveRecords() as $record_obj) {
216 $record_id = $record_obj->getRecordId();
217
218 $values = new ilAdvancedMDValues($record_id, $this->obj_id, $this->sub_type, $this->sub_id);
219 $values->read();
220 $defs = $values->getDefinitions();
221
222 // empty record?
223 if (!sizeof($defs)) {
224 continue;
225 }
226
227 $translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($record_obj->getRecordId());
228 $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record_obj->getRecordId());
229
230 $adt_group_form = ilADTFactory::getInstance()->getFormBridgeForInstance($values->getADTGroup());
231 $adt_group_form->setForm($this->form);
232
233 $adt_group_form->setTitle($translations->getTitleForLanguage($this->user->getLanguage()));
234 $adt_group_form->setInfo($translations->getDescriptionForLanguage($this->user->getLanguage()));
235
236 foreach ($defs as $def) {
237 $element = $adt_group_form->getElement($def->getFieldId());
238 $element->setTitle($field_translations->getTitleForLanguage($def->getFieldId(), $this->user->getLanguage()));
239 $element->setInfo($field_translations->getDescriptionForLanguage($def->getFieldId(), $this->user->getLanguage()));
240
241 // definition may customize ADT form element
242 $def->prepareElementForEditor($element);
243
244 if ($values->isDisabled($def->getFieldId())) {
245 $element->setDisabled(true);
246 }
247 }
248
249 $adt_group_form->addToForm();
250
251 $this->editor_form[$record_id] = array("values" => $values, "form" => $adt_group_form);
252 }
253 }

References getActiveRecords(), ilADTFactory\getInstance(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), and ilAdvancedMDRecordTranslations\getInstanceByRecordId().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseFilter()

ilAdvancedMDRecordGUI::parseFilter ( )
private

Parse property for filter (table)

@access private

Definition at line 728 of file class.ilAdvancedMDRecordGUI.php.

729 {
730 $this->adt_search = array();
731
732 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
733 foreach ($this->getActiveRecords() as $record_obj) {
734 $record_id = $record_obj->getRecordId();
735
736 $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record_id);
737
739 foreach ($defs as $def) {
740 // some input GUIs do NOT support filter rendering yet
741 if (!$def->isFilterSupported()) {
742 continue;
743 }
744
745 $this->adt_search[$def->getFieldId()] = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($def->getADTDefinition(), true, false);
746 $this->adt_search[$def->getFieldId()]->setTableGUI($this->table_gui);
747 $this->adt_search[$def->getFieldId()]->setTitle(
748 $field_translations->getTitleForLanguage($def->getFieldId(), $this->user->getLanguage())
749 );
750 $this->adt_search[$def->getFieldId()]->setElementId('md_' . $def->getFieldId());
751
752 $this->adt_search[$def->getFieldId()]->loadFilter();
753 $this->adt_search[$def->getFieldId()]->addToForm();
754 }
755 }
756 }
static getInstancesByRecordId($a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.

References getActiveRecords(), ilADTFactory\getInstance(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseInfoPage()

ilAdvancedMDRecordGUI::parseInfoPage ( )
private

Presentation for info page.

Returns
void

Definition at line 407 of file class.ilAdvancedMDRecordGUI.php.

408 {
409 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
410 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
411 include_once('Services/ADT/classes/class.ilADTFactory.php');
412
413 foreach (ilAdvancedMDValues::getInstancesForObjectId($this->obj_id, $this->obj_type, $this->sub_type, $this->sub_id) as $record_id => $a_values) {
414 // this correctly binds group and definitions
415 $a_values->read();
416
417 $record_translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($record_id);
418 $this->info->addSection($record_translations->getTitleForLanguage($this->user->getLanguage()));
419
420 $defs = $a_values->getDefinitions();
421 foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
422 if (!$element->isNull()) {
423 $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record_id);
424 $title = $field_translations->getTitleForLanguage($element_id, $this->user->getLanguage());
425
426 $this->info->addProperty(
427 $title,
428 ilADTFactory::getInstance()->getPresentationBridgeForInstance($element)->getHTML()
429 );
430 }
431 }
432 }
433 }
info()
Definition: info.php:2

References ilADTFactory\getInstance(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), ilAdvancedMDValues\getInstancesForObjectId(), info(), and user().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseRecordSelection()

ilAdvancedMDRecordGUI::parseRecordSelection (   $a_sec_head = "")

Parse property form in editor mode.

@access private

Definition at line 631 of file class.ilAdvancedMDRecordGUI.php.

632 {
633 global $DIC;
634
635 $ilUser = $DIC['ilUser'];
636
637 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
638 $first = true;
639 foreach (ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type, $this->sub_type) as $record_obj) {
640 $selected = ilAdvancedMDRecord::getObjRecSelection($this->obj_id, $this->sub_type);
641 if ($first) {
642 $first = false;
644 $sec_tit = ($a_sec_head == "")
645 ? $this->lng->txt("meta_adv_records")
646 : $a_sec_head;
647 $section->setTitle($sec_tit);
648 $this->form->addItem($section);
649 }
650
651 // checkbox for each active record
652 $cb = new ilCheckboxInputGUI($record_obj->getTitle(), "amet_use_rec[]");
653 $cb->setInfo($record_obj->getDescription());
654 $cb->setValue($record_obj->getRecordId());
655 if (in_array($record_obj->getRecordId(), $selected)) {
656 $cb->setChecked(true);
657 }
658 $this->form->addItem($cb);
659 }
660 }
$section
Definition: Utf8Test.php:83
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="", $a_only_optional=false)
Get activated records by object type.
This class represents a checkbox property in a property form.
This class represents a section header in a property form.
$ilUser
Definition: imgupload.php:18

References $DIC, $ilUser, $section, ilAdvancedMDRecord\_getActivatedRecordsByObjectType(), and ilAdvancedMDRecord\getObjRecSelection().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseSearch()

ilAdvancedMDRecordGUI::parseSearch ( )
private

Parse search.

Definition at line 320 of file class.ilAdvancedMDRecordGUI.php.

321 {
322 // this is NOT used for the global search, see ilLuceneAdvancedSearchFields::getFormElement()
323 // (so searchable flag is NOT relevant)
324 //
325 // current usage: wiki page element "[amd] page list"
326
327 $this->lng->loadLanguageModule('search');
328
329 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
330
331 $this->search_form = array();
332 foreach ($this->getActiveRecords() as $record) {
333 $fields = ilAdvancedMDFieldDefinition::getInstancesByRecordId($record->getRecordId(), true);
334
335 // empty record?
336 if (!sizeof($fields)) {
337 continue;
338 }
339
340 $record_translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($record->getRecordId());
342 $section->setTitle($record_translations->getTitleForLanguage($this->user->getLanguage()));
343 $section->setInfo($record_translations->getDescriptionForLanguage($this->user->getLanguage()));
344 $this->form->addItem($section);
345
346 foreach ($fields as $field) {
347 $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record->getRecordId());
348
349 $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), true, false);
350 $field_form->setForm($this->form);
351 $field_form->setElementId("advmd[" . $field->getFieldId() . "]");
352 $field_form->setTitle($field_translations->getTitleForLanguage($field->getFieldId(), $this->user->getLanguage()));
353
354 if (is_array($this->search_form_values) &&
355 isset($this->search_form_values[$field->getFieldId()])) {
356 $field->setSearchValueSerialized($field_form, $this->search_form_values[$field->getFieldId()]);
357 }
358
359 $field->prepareElementForSearch($field_form);
360
361 $field_form->addToForm();
362
363 $this->search_form[$field->getFieldId()] = array("def" => $field, "value" => $field_form);
364 }
365 }
366 }

References $section, getActiveRecords(), ilADTFactory\getInstance(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseTableCells()

ilAdvancedMDRecordGUI::parseTableCells ( )
private

Parse table cells.

Definition at line 827 of file class.ilAdvancedMDRecordGUI.php.

828 {
829 $data = $this->getRowData();
830 $html = "";
831
832 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
833 foreach ($this->getActiveRecords() as $record_obj) {
834 $record_id = $record_obj->getRecordId();
835
837 foreach ($defs as $def) {
838 if ($this->handleECSDefinitions($def)) {
839 continue;
840 }
841
842 $res = '';
843 $res_raw = $data['md_' . $def->getFieldId()] ?? null;
844 $res_presentation = $data['md_' . $def->getFieldId() . '_presentation'] ?? null;
845 if ($res_raw) {
846 $res = $res_raw;
847 }
848 if (
849 $res_presentation instanceof ilADTPresentationBridge &&
850 !($res_presentation instanceof ilADTLocationPresentationBridge)
851 ) {
852 $res = $res_presentation->getHTML();
853 }
854
855 $html .= "<td class='std'>" . $res . "</td>";
856 }
857 }
858 return $html;
859 }
ADT presentation bridge base class.
handleECSDefinitions($a_definition)
handle ecs definitions
$data
Definition: storeScorm.php:23

References $data, $res, getActiveRecords(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), getRowData(), and handleECSDefinitions().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseTableHead()

ilAdvancedMDRecordGUI::parseTableHead ( )
private

Parse property for table head.

Definition at line 802 of file class.ilAdvancedMDRecordGUI.php.

803 {
804 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
805 foreach ($this->getActiveRecords() as $record_obj) {
806 $record_id = $record_obj->getRecordId();
807
808 $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record_id);
809
811 foreach ($defs as $def) {
812 if ($this->handleECSDefinitions($def)) {
813 continue;
814 }
815
816 $this->table_gui->addColumn(
817 $field_translations->getTitleForLanguage($def->getFieldId(), $this->user->getLanguage()),
818 'md_' . $def->getFieldId()
819 );
820 }
821 }
822 }

References getActiveRecords(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), and handleECSDefinitions().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSelection()

ilAdvancedMDRecordGUI::saveSelection ( )

Save selection per object.

Parameters

return

Definition at line 668 of file class.ilAdvancedMDRecordGUI.php.

669 {
670 $sel = ilUtil::stripSlashesArray($_POST["amet_use_rec"]);
671 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
672 ilAdvancedMDRecord::saveObjRecSelection($this->obj_id, $this->sub_type, $sel);
673 }
$_POST["username"]
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.

References $_POST, ilAdvancedMDRecord\saveObjRecSelection(), and ilUtil\stripSlashesArray().

+ Here is the call graph for this function:

◆ setAdvMdRecordObject()

ilAdvancedMDRecordGUI::setAdvMdRecordObject (   $a_adv_ref_id,
  $a_adv_type,
  $a_adv_subtype = "-" 
)

Set object, that defines the adv md records being used.

Default is $this->object, but the context may set another object (e.g. media pool for media objects)

Parameters
string$a_valadv type

Definition at line 96 of file class.ilAdvancedMDRecordGUI.php.

97 {
98 $this->adv_ref_id = $a_adv_ref_id;
99 $this->adv_type = $a_adv_type;
100 $this->adv_subtype = $a_adv_subtype;
101 }

◆ setInfoObject()

ilAdvancedMDRecordGUI::setInfoObject (   $info)

get info sections

@access public

Parameters
objectinstance of ilInfoScreenGUI

Definition at line 158 of file class.ilAdvancedMDRecordGUI.php.

159 {
160 $this->info = $info;
161 }

References info().

+ Here is the call graph for this function:

◆ setPropertyForm()

ilAdvancedMDRecordGUI::setPropertyForm (   $form)

set property form object

@access public

Parameters

Definition at line 134 of file class.ilAdvancedMDRecordGUI.php.

135 {
136 $this->form = $form;
137 }

References $form.

◆ setRefId()

ilAdvancedMDRecordGUI::setRefId (   $a_ref_id)

Set ref_id for context.

In case of object creations this is the reference id of the parent container.

Parameters
intref_id

Definition at line 122 of file class.ilAdvancedMDRecordGUI.php.

123 {
124 $this->ref_id = $a_ref_id;
125 }

◆ setRowData()

ilAdvancedMDRecordGUI::setRowData (   $a_val)

Set row data.

Parameters
array$a_valassoc array of row data (containing md record data)

Definition at line 700 of file class.ilAdvancedMDRecordGUI.php.

701 {
702 $this->row_data = $a_val;
703 }

◆ setSearchFormValues()

ilAdvancedMDRecordGUI::setSearchFormValues ( array  $a_values)

Definition at line 398 of file class.ilAdvancedMDRecordGUI.php.

399 {
400 $this->search_form_values = $a_values;
401 }

◆ setSearchValues()

ilAdvancedMDRecordGUI::setSearchValues (   $a_values)

Set values for search form.

@access public

Definition at line 145 of file class.ilAdvancedMDRecordGUI.php.

146 {
147 $this->search_values = $a_values;
148 }

◆ setTableGUI()

ilAdvancedMDRecordGUI::setTableGUI (   $a_val)

Set table.

Parameters
object$a_valtable gui class

Definition at line 680 of file class.ilAdvancedMDRecordGUI.php.

681 {
682 $this->table_gui = $a_val;
683 }

◆ showECSStart()

ilAdvancedMDRecordGUI::showECSStart (   $def)
private

Show special form for ecs start.

@access private

Parameters
objectilAdvMDFieldDefinition

Definition at line 517 of file class.ilAdvancedMDRecordGUI.php.

518 {
519 global $DIC;
520
521 $ilUser = $DIC['ilUser'];
522
523 $this->lng->loadLanguageModule('ecs');
524
525 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
526 $value_start = ilAdvancedMDValue::_getInstance($this->obj_id, $def->getFieldId());
527
528 $unixtime = $value_start->getValue() ? $value_start->getValue() : mktime(8, 0, 0, date('m'), date('d'), date('Y'));
529
530 $time = new ilDateTimeInputGUI($this->lng->txt('ecs_event_appointment'), 'md[' . $def->getFieldId() . ']');
531 $time->setShowTime(true);
532 $time->setDate(new ilDateTime($unixtime, IL_CAL_UNIX));
533 /*
534 $time->enableDateActivation($this->lng->txt('enabled'),
535 'md_activated['.$def->getFieldId().']',
536 $value_start->getValue() ? true : false);
537 */
538 $time->setDisabled($value_start->isDisabled());
539
541 if ($field_id = $mapping->getMappingByECSName(0, 'end')) {
542 $value_end = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
543
544 list($hours, $minutes) = $this->parseDuration($value_start->getValue(), $value_end->getValue());
545
546 $duration = new ilDurationInputGUI($this->lng->txt('ecs_duration'), 'ecs_duration');
547 $duration->setHours($hours);
548 $duration->setMinutes($minutes);
549 #$duration->setInfo($this->lng->txt('ecs_duration_info'));
550 $duration->setShowHours(true);
551 $duration->setShowMinutes(true);
552 $time->addSubItem($duration);
553 }
554
555 if ($field_id = $mapping->getMappingByECSName(0, 'cycle')) {
556 $value = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
557 $cycle_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
558 switch ($cycle_def->getFieldType()) {
560 $text = new ilTextInputGUI($cycle_def->getTitle(), 'md[' . $cycle_def->getFieldId() . ']');
561 $text->setValue($value->getValue());
562 $text->setSize(20);
563 $text->setMaxLength(512);
564 $text->setDisabled($value->isDisabled());
565 $time->addSubItem($text);
566 break;
567
569 $select = new ilSelectInputGUI($cycle_def->getTitle(), 'md[' . $cycle_def->getFieldId() . ']');
570 $select->setOptions($cycle_def->getFieldValuesForSelect());
571 $select->setValue($value->getValue());
572 $select->setDisabled($value->isDisabled());
573 $time->addSubItem($select);
574 break;
575 }
576 }
577 if ($field_id = $mapping->getMappingByECSName(0, 'room')) {
578 $value = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
579 $room_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
580 switch ($room_def->getFieldType()) {
582 $text = new ilTextInputGUI($room_def->getTitle(), 'md[' . $room_def->getFieldId() . ']');
583 $text->setValue($value->getValue());
584 $text->setSize(20);
585 $text->setMaxLength(512);
586 $text->setDisabled($value->isDisabled());
587 $time->addSubItem($text);
588 break;
589
591 $select = new ilSelectInputGUI($room_def->getTitle(), 'md[' . $room_def->getFieldId() . ']');
592 $select->setOptions($cycle_def->getFieldValuesForSelect());
593 $select->setValue($value->getValue());
594 $select->setDisabled($value->isDisabled());
595 $time->addSubItem($select);
596 break;
597 }
598 }
599 $this->form->addItem($time);
600 }
const IL_CAL_UNIX
static getInstance($a_field_id, $a_type=null, string $language='')
Get definition instance by type.
parseDuration($u_start, $u_end)
parse hours and minutes from duration
This class represents a date/time property in a property form.
@classDescription Date and time handling
This class represents a duration (typical hh:mm:ss) property in a property form.
static _getInstance()
Get Singleton instance.
This class represents a selection list property in a property form.
This class represents a text property in a property form.

References $DIC, $ilUser, ilECSDataMappingSettings\_getInstance(), ilAdvancedMDFieldDefinition\getInstance(), IL_CAL_UNIX, parseDuration(), ilAdvancedMDFieldDefinition\TYPE_SELECT, and ilAdvancedMDFieldDefinition\TYPE_TEXT.

+ Here is the call graph for this function:

◆ writeEditForm()

ilAdvancedMDRecordGUI::writeEditForm (   $a_obj_id = null,
  $a_sub_id = null 
)

Write edit form values to db.

Parameters
int$a_obj_id
int$a_sub_id
Returns
bool

Definition at line 286 of file class.ilAdvancedMDRecordGUI.php.

287 {
288 if (!sizeof($this->editor_form)) {
289 return false;
290 }
291
292 // switch ids?
293 if ($a_obj_id) {
294 $this->obj_id = $a_obj_id;
295 }
296 if ($a_sub_id) {
297 $this->sub_id = $a_sub_id;
298 }
299
300 foreach ($this->editor_form as $item) {
301 if ($a_obj_id || $a_sub_id) {
302 // switch active record to updated primary keys, e.g. after creation
303 $item["values"]->setActiveRecordPrimary($this->obj_id, $this->sub_type, $this->sub_id);
304 }
305
306 $item["values"]->write();
307 }
308
309 return true;
310 }

Field Documentation

◆ $adv_ref_id

ilAdvancedMDRecordGUI::$adv_ref_id = null
protected

Definition at line 46 of file class.ilAdvancedMDRecordGUI.php.

Referenced by getActiveRecords(), and getAdvMdRecordObject().

◆ $adv_subtype

ilAdvancedMDRecordGUI::$adv_subtype = null
protected

Definition at line 54 of file class.ilAdvancedMDRecordGUI.php.

Referenced by getActiveRecords(), and getAdvMdRecordObject().

◆ $adv_type

ilAdvancedMDRecordGUI::$adv_type = null
protected

Definition at line 50 of file class.ilAdvancedMDRecordGUI.php.

Referenced by getActiveRecords(), and getAdvMdRecordObject().

◆ $editor_form

ilAdvancedMDRecordGUI::$editor_form
protected

Definition at line 38 of file class.ilAdvancedMDRecordGUI.php.

◆ $form

ilAdvancedMDRecordGUI::$form
private

Definition at line 35 of file class.ilAdvancedMDRecordGUI.php.

Referenced by setPropertyForm().

◆ $lng

ilAdvancedMDRecordGUI::$lng
protected

Definition at line 27 of file class.ilAdvancedMDRecordGUI.php.

Referenced by __construct().

◆ $mode

ilAdvancedMDRecordGUI::$mode
private

Definition at line 29 of file class.ilAdvancedMDRecordGUI.php.

◆ $obj_id

ilAdvancedMDRecordGUI::$obj_id
private

Definition at line 32 of file class.ilAdvancedMDRecordGUI.php.

◆ $obj_type

ilAdvancedMDRecordGUI::$obj_type
private

Definition at line 30 of file class.ilAdvancedMDRecordGUI.php.

Referenced by getAdvMdRecordObject().

◆ $ref_id

ilAdvancedMDRecordGUI::$ref_id = null
private

Definition at line 33 of file class.ilAdvancedMDRecordGUI.php.

Referenced by getAdvMdRecordObject().

◆ $search_values

ilAdvancedMDRecordGUI::$search_values = array()
private

Definition at line 36 of file class.ilAdvancedMDRecordGUI.php.

◆ $sub_type

ilAdvancedMDRecordGUI::$sub_type
private

Definition at line 31 of file class.ilAdvancedMDRecordGUI.php.

Referenced by getAdvMdRecordObject().

◆ $user

ilAdvancedMDRecordGUI::$user
protected

Definition at line 59 of file class.ilAdvancedMDRecordGUI.php.

◆ MODE_APP_PRESENTATION

const ilAdvancedMDRecordGUI::MODE_APP_PRESENTATION = 8

◆ MODE_EDITOR

◆ MODE_FILTER

◆ MODE_INFO

◆ MODE_REC_SELECTION

const ilAdvancedMDRecordGUI::MODE_REC_SELECTION = 4

Definition at line 22 of file class.ilAdvancedMDRecordGUI.php.

Referenced by parse().

◆ MODE_SEARCH

const ilAdvancedMDRecordGUI::MODE_SEARCH = 2

◆ MODE_TABLE_CELLS

const ilAdvancedMDRecordGUI::MODE_TABLE_CELLS = 7

Definition at line 25 of file class.ilAdvancedMDRecordGUI.php.

Referenced by ilMediaPoolTableGUI\fillRow(), and parse().

◆ MODE_TABLE_HEAD

const ilAdvancedMDRecordGUI::MODE_TABLE_HEAD = 6

Definition at line 24 of file class.ilAdvancedMDRecordGUI.php.

Referenced by ilMediaPoolTableGUI\__construct(), and parse().


The documentation for this class was generated from the following file: