ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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$

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.

public

Parameters
intmode either MODE_EDITOR or MODE_SEARCH
intobj_type

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

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

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
+ Here is the call graph for this function:

Member Function Documentation

◆ getActiveRecords()

ilAdvancedMDRecordGUI::getActiveRecords ( )
protected

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

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

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

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

References $res.

Referenced by ilTable2GUI\isAdvMDFilter().

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
+ 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.

Referenced by parseTableCells().

711  {
712  return $this->row_data;
713  }
+ 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

private

Parameters
objectilAdvMDFieldDefinition
Returns

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

References ilECSServerSettings\getInstance().

Referenced by parseTableCells(), and parseTableHead().

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.
+ 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.

References $valid.

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

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
+ 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.

References $res, and $valid.

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  }
$valid
foreach($_POST as $key=> $value) $res

◆ parse()

ilAdvancedMDRecordGUI::parse ( )

Get HTML.

public

Parameters

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

References parseAppointmentPresentation(), parseEditor(), parseFilter(), parseInfoPage(), parseRecordSelection(), parseSearch(), parseTableCells(), and parseTableHead().

171  {
172  switch ($this->mode) {
173  case self::MODE_EDITOR:
174  return $this->parseEditor();
175 
176  case self::MODE_SEARCH:
177  return $this->parseSearch();
178 
179  case self::MODE_INFO:
180  return $this->parseInfoPage();
181 
182  case self::MODE_APP_PRESENTATION:
183  return $this->parseAppointmentPresentation();
184 
185  case self::MODE_REC_SELECTION:
186  return $this->parseRecordSelection();
187 
188  case self::MODE_FILTER:
189  return $this->parseFilter();
190 
191  case self::MODE_TABLE_HEAD:
192  return $this->parseTableHead();
193 
194  case self::MODE_TABLE_CELLS:
195  return $this->parseTableCells();
196 
197  default:
198  die('Not implemented yet');
199  }
200  }
parseTableCells()
Parse table cells.
parseRecordSelection($a_sec_head="")
Parse property form in editor mode.
parseTableHead()
Parse property for table head.
parseFilter()
Parse property for filter (table)
parseAppointmentPresentation()
Presentation for calendar agenda list.
parseEditor()
Parse property form in editor mode.
parseInfoPage()
Presentation for info page.
+ 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.

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

Referenced by parse().

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 getInstancesForObjectId($a_obj_id, $a_obj_type=null, $a_sub_type="-", $a_sub_id=0)
Get instances for given object id.
static getInstance()
Get singleton.
user()
Definition: user.php:4
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
static getInstancesByObjType($a_obj_type, $a_active_only=true)
+ 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

protected

Parameters

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

Referenced by showECSStart().

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  }
+ 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.

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

Referenced by parse().

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  }
static getInstance()
Get singleton.
user()
Definition: user.php:4
+ 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)

private

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

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

Referenced by parse().

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 getInstance()
Get singleton.
user()
Definition: user.php:4
static getInstancesByRecordId($a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
+ 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.

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

Referenced by parse().

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  }
static getInstancesForObjectId($a_obj_id, $a_obj_type=null, $a_sub_type="-", $a_sub_id=0)
Get instances for given object id.
static getInstance()
Get singleton.
user()
Definition: user.php:4
info()
Definition: info.php:2
+ 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.

private

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

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

Referenced by parse().

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  }
This class represents a section header in a property form.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
$section
Definition: Utf8Test.php:83
global $DIC
Definition: goto.php:24
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="", $a_only_optional=false)
Get activated records by object type.
$ilUser
Definition: imgupload.php:18
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
+ 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.

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

Referenced by parse().

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  }
This class represents a section header in a property form.
static getInstance()
Get singleton.
user()
Definition: user.php:4
$section
Definition: Utf8Test.php:83
static getInstancesByRecordId($a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
+ 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.

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

Referenced by parse().

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  }
$data
Definition: storeScorm.php:23
handleECSDefinitions($a_definition)
handle ecs definitions
foreach($_POST as $key=> $value) $res
ADT presentation bridge base class.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
+ 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.

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

Referenced by parse().

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  }
handleECSDefinitions($a_definition)
handle ecs definitions
user()
Definition: user.php:4
static getInstancesByRecordId($a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSelection()

ilAdvancedMDRecordGUI::saveSelection ( )

Save selection per object.

Parameters

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

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

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  }
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.
$_POST["username"]
+ 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

public

Parameters
objectinstance of ilInfoScreenGUI

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

References info().

Referenced by ilObjIndividualAssessmentGUI\buildInfoScreen(), ilObjOrgUnitGUI\executeCommand(), ilObjStudyProgrammeGUI\fillInfoScreen(), ilObjExerciseGUI\getService(), ilRemoteObjectBaseGUI\infoScreen(), ilObjCourseGUI\infoScreen(), ilObjCategoryGUI\infoScreen(), ilObjSessionGUI\infoScreen(), and ilObjGroupGUI\infoScreen().

159  {
160  $this->info = $info;
161  }
info()
Definition: info.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPropertyForm()

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

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.

Referenced by ilMediaPoolTableGUI\__construct(), ilPresentationListTableGUI\__construct(), and ilMediaPoolTableGUI\fillRow().

681  {
682  $this->table_gui = $a_val;
683  }
+ Here is the caller graph for this function:

◆ showECSStart()

ilAdvancedMDRecordGUI::showECSStart (   $def)
private

Show special form for ecs start.

private

Parameters
objectilAdvMDFieldDefinition

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

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

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  }
parseDuration($u_start, $u_end)
parse hours and minutes from duration
This class represents a duration (typical hh:mm:ss) property in a property form.
setHours($a_hours)
Set Hours.
const IL_CAL_UNIX
This class represents a date/time property in a property form.
global $DIC
Definition: goto.php:24
static getInstance($a_field_id, $a_type=null, string $language='')
Get definition instance by type.
$ilUser
Definition: imgupload.php:18
static _getInstance()
Get Singleton instance.
setShowTime($a_showtime)
Set Show Time Information.
+ 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.

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

◆ MODE_TABLE_HEAD

const ilAdvancedMDRecordGUI::MODE_TABLE_HEAD = 6

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

Referenced by ilMediaPoolTableGUI\__construct().


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