ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
 

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 65 of file class.ilAdvancedMDRecordGUI.php.

66 {
67 global $DIC;
68
69 $lng = $DIC['lng'];
70
71 $this->lng = $lng;
72 $this->mode = $a_mode;
73 $this->obj_type = $a_obj_type;
74 $this->obj_id = $a_obj_id;
75 $this->sub_type = $a_sub_type;
76 $this->sub_id = $a_sub_id;
77
78 if ($a_obj_id) {
79 $refs = ilObject::_getAllReferences($a_obj_id);
80 $this->ref_id = end($refs);
81 }
82 }
static _getAllReferences($a_id)
get all reference ids of object
$DIC
Definition: xapitoken.php:46

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getActiveRecords()

ilAdvancedMDRecordGUI::getActiveRecords ( )
protected

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

702 {
703 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
706 }
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 102 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 766 of file class.ilAdvancedMDRecordGUI.php.

767 {
768 if (!is_array($this->adt_search)) {
769 return;
770 }
771
772 $res = array();
773
774 foreach ($this->adt_search as $def_id => $element) {
775 if (!$element->isNull() ||
776 !(bool) $a_only_non_empty) {
777 $res[$def_id] = $element;
778 }
779 }
780
781 return $res;
782 }
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 696 of file class.ilAdvancedMDRecordGUI.php.

697 {
698 return $this->row_data;
699 }

Referenced by parseTableCells().

+ Here is the caller graph for this function:

◆ getTableGUI()

ilAdvancedMDRecordGUI::getTableGUI ( )

Get table.

Returns
object table gui class

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

677 {
678 return $this->table_gui;
679 }

◆ handleECSDefinitions()

ilAdvancedMDRecordGUI::handleECSDefinitions (   $a_definition)
private

handle ecs definitions

@access private

Parameters
objectilAdvMDFieldDefinition
Returns

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

485 {
486 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
487 include_once('./Services/WebServices/ECS/classes/class.ilECSServerSettings.php');
488
489 if (ilECSServerSettings::getInstance()->activeServerExists() or
490 ($this->obj_type != 'crs' and $this->obj_type != 'rcrs')
491 ) {
492 return false;
493 }
494 return false;
495 }
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 257 of file class.ilAdvancedMDRecordGUI.php.

258 {
259 // #13774
260 if (!is_array($this->editor_form)) {
261 return false;
262 }
263
264 $valid = true;
265
266 foreach ($this->editor_form as $item) {
267 $item["form"]->importFromPost();
268 if (!$item["form"]->validate()) {
269 $valid = false;
270 }
271 }
272
273 return $valid;
274 }
$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 750 of file class.ilAdvancedMDRecordGUI.php.

751 {
752 if (!is_array($this->adt_search)) {
753 return;
754 }
755
756 foreach ($this->adt_search as $element) {
757 $element->importFromPost();
758 }
759 }

◆ importSearchForm()

ilAdvancedMDRecordGUI::importSearchForm ( )

Load edit form values from post.

Returns
array

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

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

References $res, and $valid.

◆ parse()

ilAdvancedMDRecordGUI::parse ( )

Get HTML.

@access public

Parameters

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

165 {
166 switch ($this->mode) {
168 return $this->parseEditor();
169
171 return $this->parseSearch();
172
173 case self::MODE_INFO:
174 return $this->parseInfoPage();
175
177 return $this->parseAppointmentPresentation();
178
180 return $this->parseRecordSelection();
181
183 return $this->parseFilter();
184
186 return $this->parseTableHead();
187
189 return $this->parseTableCells();
190
191 default:
192 die('Not implemented yet');
193 }
194 }
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 429 of file class.ilAdvancedMDRecordGUI.php.

430 {
432
433 $definitions = ilAdvancedMDFieldDefinition::getInstancesByObjType($this->obj_type);
434 $definitions = $sub->sortDefinitions($definitions);
435
436 $positions = array();
437 foreach ($definitions as $position => $value) {
438 $positions[$value->getFieldId()] = $position;
439 }
440
441 $array_elements = array();
442 foreach (ilAdvancedMDValues::getInstancesForObjectId($this->obj_id, $this->obj_type, $this->sub_type, $this->sub_id) as $record_id => $a_values) {
443 // this correctly binds group and definitions
444 $a_values->read();
445
446 $defs = $a_values->getDefinitions();
447 foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
448 if (!$element->isNull()) {
449 $presentation_bridge = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
450 #21615
451 if (get_class($element) == 'ilADTLocation') {
452 $presentation_bridge->setSize("100%", "200px");
453 #22638
454 $presentation_value = $presentation_bridge->getHTML();
455 $presentation_value .= "<script>ilInitMaps();</script>";
456 } else {
457 #22638
458 $presentation_value = strip_tags($presentation_bridge->getHTML());
459 }
460 $array_elements[$positions[$element_id]] =
461 [
462 "title" => $defs[$element_id]->getTitle(),
463 "value" => $presentation_value
464 ];
465 }
466 }
467 }
468
469 // already sorted by record positions
470 return $array_elements;
471 }
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(), ilAdvancedMDFieldDefinition\getInstancesByObjType(), and ilAdvancedMDValues\getInstancesForObjectId().

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 595 of file class.ilAdvancedMDRecordGUI.php.

596 {
597 if ($u_start >= $u_end) {
598 return array(0,0);
599 }
600 $diff = $u_end - $u_start;
601 $hours = (int) ($diff / (60 * 60));
602 $min = (int) (($diff % 3600) / 60);
603 return array($hours,$min);
604 }

Referenced by showECSStart().

+ Here is the caller graph for this function:

◆ parseEditor()

ilAdvancedMDRecordGUI::parseEditor ( )
protected

Parse property form in editor mode.

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

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

References getActiveRecords(), and ilADTFactory\getInstance().

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 714 of file class.ilAdvancedMDRecordGUI.php.

715 {
716 $this->adt_search = array();
717
718 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
719 foreach ($this->getActiveRecords() as $record_obj) {
720 $record_id = $record_obj->getRecordId();
721
723 foreach ($defs as $def) {
724 // some input GUIs do NOT support filter rendering yet
725 if (!$def->isFilterSupported()) {
726 continue;
727 }
728
729 /* :TODO:
730 if($this->handleECSDefinitions($def))
731 {
732 continue;
733 }
734 */
735
736 $this->adt_search[$def->getFieldId()] = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($def->getADTDefinition(), true, false);
737 $this->adt_search[$def->getFieldId()]->setTableGUI($this->table_gui);
738 $this->adt_search[$def->getFieldId()]->setTitle($def->getTitle());
739 $this->adt_search[$def->getFieldId()]->setElementId('md_' . $def->getFieldId());
740
741 $this->adt_search[$def->getFieldId()]->loadFilter();
742 $this->adt_search[$def->getFieldId()]->addToForm();
743 }
744 }
745 }
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.

References getActiveRecords(), ilADTFactory\getInstance(), 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 401 of file class.ilAdvancedMDRecordGUI.php.

402 {
403 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
404 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
405 include_once('Services/ADT/classes/class.ilADTFactory.php');
406
407 foreach (ilAdvancedMDValues::getInstancesForObjectId($this->obj_id, $this->obj_type, $this->sub_type, $this->sub_id) as $record_id => $a_values) {
408 // this correctly binds group and definitions
409 $a_values->read();
410
411 $this->info->addSection(ilAdvancedMDRecord::_lookupTitle($record_id));
412
413 $defs = $a_values->getDefinitions();
414 foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
415 if (!$element->isNull()) {
416 $this->info->addProperty(
417 $defs[$element_id]->getTitle(),
418 ilADTFactory::getInstance()->getPresentationBridgeForInstance($element)->getHTML()
419 );
420 }
421 }
422 }
423 }
static _lookupTitle($a_record_id)
Lookup title.
info()
Definition: info.php:2

References ilAdvancedMDRecord\_lookupTitle(), ilADTFactory\getInstance(), ilAdvancedMDValues\getInstancesForObjectId(), and info().

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 617 of file class.ilAdvancedMDRecordGUI.php.

618 {
619 global $DIC;
620
621 $ilUser = $DIC['ilUser'];
622
623 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
624 $first = true;
625 foreach (ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type, $this->sub_type) as $record_obj) {
626 $selected = ilAdvancedMDRecord::getObjRecSelection($this->obj_id, $this->sub_type);
627 if ($first) {
628 $first = false;
630 $sec_tit = ($a_sec_head == "")
631 ? $this->lng->txt("meta_adv_records")
632 : $a_sec_head;
633 $section->setTitle($sec_tit);
634 $this->form->addItem($section);
635 }
636
637 // checkbox for each active record
638 $cb = new ilCheckboxInputGUI($record_obj->getTitle(), "amet_use_rec[]");
639 $cb->setInfo($record_obj->getDescription());
640 $cb->setValue($record_obj->getRecordId());
641 if (in_array($record_obj->getRecordId(), $selected)) {
642 $cb->setChecked(true);
643 }
644 $this->form->addItem($cb);
645 }
646 }
$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 317 of file class.ilAdvancedMDRecordGUI.php.

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

References $section, getActiveRecords(), ilADTFactory\getInstance(), 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 812 of file class.ilAdvancedMDRecordGUI.php.

813 {
814 $data = $this->getRowData();
815 $html = "";
816
817 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
818 foreach ($this->getActiveRecords() as $record_obj) {
819 $record_id = $record_obj->getRecordId();
820
822 foreach ($defs as $def) {
823 if ($this->handleECSDefinitions($def)) {
824 continue;
825 }
826
827 $html .= "<td class='std'>" . $data['md_' . $def->getFieldId()] . "</td>";
828 }
829 }
830 return $html;
831 }
handleECSDefinitions($a_definition)
handle ecs definitions
$data
Definition: storeScorm.php:23

References $data, 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 792 of file class.ilAdvancedMDRecordGUI.php.

793 {
794 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
795 foreach ($this->getActiveRecords() as $record_obj) {
796 $record_id = $record_obj->getRecordId();
797
799 foreach ($defs as $def) {
800 if ($this->handleECSDefinitions($def)) {
801 continue;
802 }
803
804 $this->table_gui->addColumn($def->getTitle(), 'md_' . $def->getFieldId());
805 }
806 }
807 }

References getActiveRecords(), 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 654 of file class.ilAdvancedMDRecordGUI.php.

655 {
656 $sel = ilUtil::stripSlashesArray($_POST["amet_use_rec"]);
657 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
658 ilAdvancedMDRecord::saveObjRecSelection($this->obj_id, $this->sub_type, $sel);
659 }
$_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 90 of file class.ilAdvancedMDRecordGUI.php.

91 {
92 $this->adv_ref_id = $a_adv_ref_id;
93 $this->adv_type = $a_adv_type;
94 $this->adv_subtype = $a_adv_subtype;
95 }

◆ setInfoObject()

ilAdvancedMDRecordGUI::setInfoObject (   $info)

get info sections

@access public

Parameters
objectinstance of ilInfoScreenGUI

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

153 {
154 $this->info = $info;
155 }

References info().

+ Here is the call graph for this function:

◆ setPropertyForm()

ilAdvancedMDRecordGUI::setPropertyForm (   $form)

set property form object

@access public

Parameters

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

129 {
130 $this->form = $form;
131 }

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 116 of file class.ilAdvancedMDRecordGUI.php.

117 {
118 $this->ref_id = $a_ref_id;
119 }

◆ setRowData()

ilAdvancedMDRecordGUI::setRowData (   $a_val)

Set row data.

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

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

687 {
688 $this->row_data = $a_val;
689 }

◆ setSearchFormValues()

ilAdvancedMDRecordGUI::setSearchFormValues ( array  $a_values)

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

393 {
394 $this->search_form_values = $a_values;
395 }

◆ setSearchValues()

ilAdvancedMDRecordGUI::setSearchValues (   $a_values)

Set values for search form.

@access public

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

140 {
141 $this->search_values = $a_values;
142 }

◆ setTableGUI()

ilAdvancedMDRecordGUI::setTableGUI (   $a_val)

Set table.

Parameters
object$a_valtable gui class

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

667 {
668 $this->table_gui = $a_val;
669 }

◆ showECSStart()

ilAdvancedMDRecordGUI::showECSStart (   $def)
private

Show special form for ecs start.

@access private

Parameters
objectilAdvMDFieldDefinition

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

504 {
505 global $DIC;
506
507 $ilUser = $DIC['ilUser'];
508
509 $this->lng->loadLanguageModule('ecs');
510
511 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
512 $value_start = ilAdvancedMDValue::_getInstance($this->obj_id, $def->getFieldId());
513
514 $unixtime = $value_start->getValue() ? $value_start->getValue() : mktime(8, 0, 0, date('m'), date('d'), date('Y'));
515
516 $time = new ilDateTimeInputGUI($this->lng->txt('ecs_event_appointment'), 'md[' . $def->getFieldId() . ']');
517 $time->setShowTime(true);
518 $time->setDate(new ilDateTime($unixtime, IL_CAL_UNIX));
519 /*
520 $time->enableDateActivation($this->lng->txt('enabled'),
521 'md_activated['.$def->getFieldId().']',
522 $value_start->getValue() ? true : false);
523 */
524 $time->setDisabled($value_start->isDisabled());
525
527 if ($field_id = $mapping->getMappingByECSName(0, 'end')) {
528 $value_end = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
529
530 list($hours, $minutes) = $this->parseDuration($value_start->getValue(), $value_end->getValue());
531
532 $duration = new ilDurationInputGUI($this->lng->txt('ecs_duration'), 'ecs_duration');
533 $duration->setHours($hours);
534 $duration->setMinutes($minutes);
535 #$duration->setInfo($this->lng->txt('ecs_duration_info'));
536 $duration->setShowHours(true);
537 $duration->setShowMinutes(true);
538 $time->addSubItem($duration);
539 }
540
541 if ($field_id = $mapping->getMappingByECSName(0, 'cycle')) {
542 $value = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
543 $cycle_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
544 switch ($cycle_def->getFieldType()) {
546 $text = new ilTextInputGUI($cycle_def->getTitle(), 'md[' . $cycle_def->getFieldId() . ']');
547 $text->setValue($value->getValue());
548 $text->setSize(20);
549 $text->setMaxLength(512);
550 $text->setDisabled($value->isDisabled());
551 $time->addSubItem($text);
552 break;
553
555 $select = new ilSelectInputGUI($cycle_def->getTitle(), 'md[' . $cycle_def->getFieldId() . ']');
556 $select->setOptions($cycle_def->getFieldValuesForSelect());
557 $select->setValue($value->getValue());
558 $select->setDisabled($value->isDisabled());
559 $time->addSubItem($select);
560 break;
561 }
562 }
563 if ($field_id = $mapping->getMappingByECSName(0, 'room')) {
564 $value = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
565 $room_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
566 switch ($room_def->getFieldType()) {
568 $text = new ilTextInputGUI($room_def->getTitle(), 'md[' . $room_def->getFieldId() . ']');
569 $text->setValue($value->getValue());
570 $text->setSize(20);
571 $text->setMaxLength(512);
572 $text->setDisabled($value->isDisabled());
573 $time->addSubItem($text);
574 break;
575
577 $select = new ilSelectInputGUI($room_def->getTitle(), 'md[' . $room_def->getFieldId() . ']');
578 $select->setOptions($cycle_def->getFieldValuesForSelect());
579 $select->setValue($value->getValue());
580 $select->setDisabled($value->isDisabled());
581 $time->addSubItem($select);
582 break;
583 }
584 }
585 $this->form->addItem($time);
586 }
const IL_CAL_UNIX
static getInstance($a_field_id, $a_type=null)
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 283 of file class.ilAdvancedMDRecordGUI.php.

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

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().

◆ 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: