ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAdvancedMDRecordGUI Class Reference
+ Collaboration diagram for ilAdvancedMDRecordGUI:

Public Member Functions

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

Data Fields

const MODE_UNDEFINED = 0
 
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

 checkFilter ($record_id)
 Check filter. More...
 
 parseEditor ()
 Parse property form in editor mode. More...
 
 getActiveRecords ()
 

Protected Attributes

ilPropertyFormGUI $form = null
 
array $search_values = []
 
array $search_form = null
 
array $search_form_values = null
 
array $editor_form = []
 
ilInfoScreenGUI $info = null
 
int $adv_id = null
 
string $adv_type = null
 
string $adv_subtype = null
 
bool $in_repository = true
 
ilObjUser $user
 
ilLanguage $lng
 
GlobalHttpState $http
 
RefineryFactory $refinery
 
array $record_filter = null
 

Private Member Functions

 parseSearch ()
 Parse search. More...
 
 parseInfoPage ()
 Presentation for info page. More...
 
 parseAppointmentPresentationa ()
 Presentation for calendar agenda list. More...
 
 handleECSDefinitions ($a_definition)
 handle ecs definitions More...
 
 parseFilter ()
 Parse property for filter (table) More...
 
 parseTableHead ()
 Parse property for table head. More...
 
 parseTableCells ()
 Parse table cells. More...
 

Private Attributes

int $mode = self::MODE_UNDEFINED
 
string $obj_type = ''
 
string $sub_type = ''
 
int $sub_id = 0
 
int $obj_id = 0
 
int $ref_id = null
 
ilTable2GUI $table_gui = null
 
array $row_data = null
 
array $adt_search = null
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDRecordGUI::__construct ( int  $a_mode,
string  $a_obj_type = '',
int  $a_obj_id = 0,
string  $a_sub_type = '',
int  $a_sub_id = 0,
bool  $in_repository = true 
)

Constructor.

Parameters
int$a_modemode either MODE_EDITOR or MODE_SEARCH

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

References $DIC, $in_repository, ilObject\_getAllReferences(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

99  {
100  global $DIC;
101 
102  $this->user = $DIC->user();
103  $this->lng = $DIC->language();
104  $this->mode = $a_mode;
105  $this->obj_type = $a_obj_type;
106  $this->obj_id = $a_obj_id;
107  $this->sub_type = $a_sub_type;
108  $this->sub_id = $a_sub_id;
109 
110  $this->in_repository = $in_repository;
111  if ($a_obj_id && $this->in_repository) {
112  $refs = ilObject::_getAllReferences($a_obj_id);
113  $this->ref_id = end($refs);
114  }
115 
116  $this->refinery = $DIC->refinery();
117  $this->http = $DIC->http();
118  }
static _getAllReferences(int $id)
get all reference ids for object ID
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ checkFilter()

ilAdvancedMDRecordGUI::checkFilter (   $record_id)
protected

Check filter.

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

Referenced by parseEditor().

191  : bool
192  {
193  return !(is_array($this->record_filter) && !in_array($record_id, $this->record_filter));
194  }
+ Here is the caller graph for this function:

◆ getActiveRecords()

ilAdvancedMDRecordGUI::getActiveRecords ( )
protected
Returns
ilAdvancedMDRecord[]

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

References ilAdvancedMDRecord\_getSelectedRecordsByObject(), and getAdvMdRecordObject().

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

625  : array
626  {
629  }
static _getSelectedRecordsByObject(string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)
getAdvMdRecordObject()
Get adv md record parameters.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdvMdRecordObject()

ilAdvancedMDRecordGUI::getAdvMdRecordObject ( )

Get adv md record parameters.

Returns
array adv type

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

References $adv_id, $adv_subtype, $adv_type, $obj_id, $obj_type, $ref_id, $sub_type, and null.

Referenced by getActiveRecords().

136  : array
137  {
138  if ($this->adv_type == null) {
139  if ($this->in_repository) {
141  } else {
143  }
144  }
146  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getFilterElements()

ilAdvancedMDRecordGUI::getFilterElements ( bool  $a_only_non_empty = true)

Get SQL conditions for current filter value(s)

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

References $res.

Referenced by ilTable2GUI\isAdvMDFilter().

684  : array
685  {
686  if (!is_array($this->adt_search)) {
687  return [];
688  }
689 
690  $res = [];
691  foreach ($this->adt_search as $def_id => $element) {
692  if (!$element->isNull() ||
693  !$a_only_non_empty) {
694  $res[$def_id] = $element;
695  }
696  }
697  return $res;
698  }
$res
Definition: ltiservices.php:66
+ 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 617 of file class.ilAdvancedMDRecordGUI.php.

References $row_data.

Referenced by parseTableCells().

617  : ?array
618  {
619  return $this->row_data;
620  }
+ Here is the caller graph for this function:

◆ getTableGUI()

ilAdvancedMDRecordGUI::getTableGUI ( )

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

References $table_gui.

599  : ?ilTable2GUI
600  {
601  return $this->table_gui;
602  }

◆ handleECSDefinitions()

ilAdvancedMDRecordGUI::handleECSDefinitions (   $a_definition)
private

handle ecs definitions

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

References ilECSServerSettings\getInstance().

Referenced by parseTableCells(), and parseTableHead().

531  : bool
532  {
533  if (ilECSServerSettings::getInstance()->activeServerExists() or
534  ($this->obj_type != 'crs' and $this->obj_type != 'rcrs')
535  ) {
536  return false;
537  }
538  return false;
539  }
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.

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

References $valid.

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

297  : bool
298  {
299  $valid = true;
300  foreach ($this->editor_form as $item) {
301  $item["form"]->importFromPost();
302  if (!$item["form"]->validate()) {
303  $valid = false;
304  }
305  }
306 
307  return $valid;
308  }
$valid
+ Here is the caller graph for this function:

◆ importFilter()

ilAdvancedMDRecordGUI::importFilter ( )

Import filter (post) values.

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

670  : void
671  {
672  if (!is_array($this->adt_search)) {
673  return;
674  }
675 
676  foreach ($this->adt_search as $element) {
677  $element->importFromPost();
678  }
679  }

◆ importSearchForm()

ilAdvancedMDRecordGUI::importSearchForm ( )

Load edit form values from post.

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

References $res, $valid, and null.

398  : ?array
399  {
400  if (!is_array($this->search_form)) {
401  return null;
402  }
403 
404  $valid = true;
405  $res = array();
406  foreach ($this->search_form as $field_id => $item) {
407  $item["value"]->importFromPost();
408  if (!$item["value"]->validate()) {
409  $valid = false;
410  }
411  $value = $item["def"]->getSearchValueSerialized($item["value"]);
412  if ($value !== null) {
413  $res[$field_id] = $value;
414  }
415  }
416 
417  if ($valid) {
418  return $res;
419  }
420  return null;
421  }
$res
Definition: ltiservices.php:66
$valid
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ parse()

ilAdvancedMDRecordGUI::parse ( )

Get HTML.

Exceptions
InvalidArgumentExceptionPhpVoidFunctionResultUsedInspection
Todo:
return type depends on mode MODE_APP_PRESENTATION => array MODE_TABLE_CELLS => string all other void refactor this type parsing.

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

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

Referenced by ilObjCourseGUI\infoScreen(), and ilObjCategoryGUI\infoScreen().

207  {
208  switch ($this->mode) {
209  case self::MODE_EDITOR:
210  return $this->parseEditor();
211 
212  case self::MODE_SEARCH:
213  return $this->parseSearch();
214 
215  case self::MODE_INFO:
216  return $this->parseInfoPage();
217 
218  case self::MODE_APP_PRESENTATION:
219  return $this->parseAppointmentPresentationa();
220 
221  case self::MODE_REC_SELECTION:
222  return $this->parseRecordSelection();
223 
224  case self::MODE_FILTER:
225  return $this->parseFilter();
226 
227  case self::MODE_TABLE_HEAD:
228  return $this->parseTableHead();
229 
230  case self::MODE_TABLE_CELLS:
231  return $this->parseTableCells();
232 
233  default:
234  throw new InvalidArgumentException('Missing or wrong ADV mode given: ' . $this->mode);
235  }
236  }
parseTableCells()
Parse table cells.
parseTableHead()
Parse property for table head.
parseAppointmentPresentationa()
Presentation for calendar agenda list.
parseRecordSelection(string $a_sec_head="")
Parse property form in editor mode.
parseFilter()
Parse property for filter (table)
parseEditor()
Parse property form in editor mode.
parseInfoPage()
Presentation for info page.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseAppointmentPresentationa()

ilAdvancedMDRecordGUI::parseAppointmentPresentationa ( )
private

Presentation for calendar agenda list.

TODO replace this by presentation_bridge->getHTML() when maps work in modals (36490). Note that at that point formatting of maps in appointment lists has to be improved.

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

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

Referenced by parse().

470  : array
471  {
473 
474  $definitions = ilAdvancedMDFieldDefinition::getInstancesByObjType($this->obj_type);
475  $definitions = $sub->sortDefinitions($definitions);
476 
477  $positions = array();
478  foreach ($definitions as $position => $value) {
479  $positions[$value->getFieldId()] = $position;
480  }
481 
482  $array_elements = array();
484  $this->obj_id,
485  $this->obj_type,
486  $this->sub_type,
487  $this->sub_id
488  ) as $record_id => $a_values) {
489  // this correctly binds group and definitions
490  $a_values->read();
491 
492  $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record_id);
493 
494  $defs = $a_values->getDefinitions();
495  foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
496  if (!$element->isNull()) {
497  $presentation_bridge = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
498  #21615
499  if (get_class($element) == 'ilADTLocation') {
505  $presentation_value = $presentation_bridge->getSortable();
506  } elseif (get_class($element) == 'ilADTExternalLink' || get_class($element) == 'ilADTInternalLink') {
507  #22638
508  $presentation_value = $presentation_bridge->getHTML();
509  } else {
510  $presentation_value = strip_tags($presentation_bridge->getHTML());
511  }
512  $array_elements[$positions[$element_id]] =
513  [
514  "title" => $field_translations->getTitleForLanguage(
515  $element_id,
516  $this->user->getLanguage()
517  ),
518  "value" => $presentation_value
519  ];
520  }
521  }
522  }
523 
524  // already sorted by record positions
525  return $array_elements;
526  }
static getInstancesForObjectId(int $a_obj_id, ?string $a_obj_type=null, string $a_sub_type="-", int $a_sub_id=0)
static getInstancesByObjType($a_obj_type, $a_active_only=true)
static _getInstanceByObjectType(string $a_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseEditor()

ilAdvancedMDRecordGUI::parseEditor ( )
protected

Parse property form in editor mode.

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

References checkFilter(), ILIAS\Repository\form(), getActiveRecords(), ilADTFactory\getInstance(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), and ILIAS\Repository\user().

Referenced by parse().

241  : void
242  {
243  $this->editor_form = array();
244  foreach ($this->getActiveRecords() as $record_obj) {
245  $record_id = $record_obj->getRecordId();
246 
247  $values = new ilAdvancedMDValues($record_id, $this->obj_id, $this->sub_type, $this->sub_id);
248  $values->read();
249  $defs = $values->getDefinitions();
250 
251  // empty record?
252  if (!sizeof($defs)) {
253  continue;
254  }
255 
256  if (!$this->checkFilter($record_id)) {
257  continue;
258  }
259 
260  $translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($record_obj->getRecordId());
261  $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record_obj->getRecordId());
262 
263  $adt_group_form = ilADTFactory::getInstance()->getFormBridgeForInstance($values->getADTGroup());
264  $adt_group_form->setForm($this->form);
265 
266  $adt_group_form->setTitle($translations->getTitleForLanguage($this->user->getLanguage()));
267  $adt_group_form->setInfo($translations->getDescriptionForLanguage($this->user->getLanguage()));
268 
269  foreach ($defs as $def) {
270  $element = $adt_group_form->getElement((string) $def->getFieldId());
271  $element->setTitle($field_translations->getTitleForLanguage(
272  $def->getFieldId(),
273  $this->user->getLanguage()
274  ));
275  $element->setInfo($field_translations->getDescriptionForLanguage(
276  $def->getFieldId(),
277  $this->user->getLanguage()
278  ));
279 
280  // definition may customize ADT form element
281  $def->prepareElementForEditor($element);
282 
283  if ($values->isDisabled((string) $def->getFieldId())) {
284  $element->setDisabled(true);
285  }
286  }
287 
288  $adt_group_form->addToForm();
289 
290  $this->editor_form[$record_id] = array("values" => $values, "form" => $adt_group_form);
291  }
292  }
checkFilter($record_id)
Check filter.
form( $class_path, string $cmd, string $submit_caption="")
+ 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)

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

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

Referenced by parse().

634  : void
635  {
636  $this->adt_search = array();
637 
638  foreach ($this->getActiveRecords() as $record_obj) {
639  $record_id = $record_obj->getRecordId();
640 
641  $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record_id);
642 
644  foreach ($defs as $def) {
645  // some input GUIs do NOT support filter rendering yet
646  if (!$def->isFilterSupported()) {
647  continue;
648  }
649 
650  $this->adt_search[$def->getFieldId()] = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance(
651  $def->getADTDefinition(),
652  true,
653  false
654  );
655  $this->adt_search[$def->getFieldId()]->setTableGUI($this->table_gui);
656  $this->adt_search[$def->getFieldId()]->setTitle(
657  $field_translations->getTitleForLanguage($def->getFieldId(), $this->user->getLanguage())
658  );
659  $this->adt_search[$def->getFieldId()]->setElementId('md_' . $def->getFieldId());
660 
661  $this->adt_search[$def->getFieldId()]->loadFilter();
662  $this->adt_search[$def->getFieldId()]->addToFilterForm();
663  }
664  }
665  }
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 432 of file class.ilAdvancedMDRecordGUI.php.

References ilADTFactory\getInstance(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), ilAdvancedMDValues\getInstancesForObjectId(), ILIAS\UI\examples\MessageBox\Info\info(), and ILIAS\Repository\user().

Referenced by parse().

432  : void
433  {
435  $this->obj_id,
436  $this->obj_type,
437  $this->sub_type,
438  $this->sub_id
439  ) as $record_id => $a_values) {
440  // this correctly binds group and definitions
441  $a_values->read();
442 
443  $record_translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($record_id);
444  $this->info->addSection($record_translations->getTitleForLanguage($this->user->getLanguage()));
445 
446  $defs = $a_values->getDefinitions();
447  foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
448  if (!$element->isNull()) {
449  $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record_id);
450  $title = $field_translations->getTitleForLanguage($element_id, $this->user->getLanguage());
451 
452  $presentation_bridge = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
453 
454  if ($element instanceof ilADTLocation) {
455  $presentation_bridge->setSize('500px', '300px');
456  }
457 
458  $this->info->addProperty(
459  $title,
460  $presentation_bridge->getHTML()
461  );
462  }
463  }
464  }
465  }
static getInstancesForObjectId(int $a_obj_id, ?string $a_obj_type=null, string $a_sub_type="-", int $a_sub_id=0)
info()
description: > Example for rendering a info message box.
Definition: info.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseRecordSelection()

ilAdvancedMDRecordGUI::parseRecordSelection ( string  $a_sec_head = "")

Parse property form in editor mode.

Todo:
the parameter is never filled.

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

References ilAdvancedMDRecord\_getActivatedRecordsByObjectType(), ILIAS\Repository\form(), ilAdvancedMDRecord\getObjRecSelection(), and ILIAS\Repository\lng().

Referenced by parse().

545  : void
546  {
547  $first = true;
549  $this->obj_type,
550  $this->sub_type
551  ) as $record_obj) {
552  $selected = ilAdvancedMDRecord::getObjRecSelection($this->obj_id, $this->sub_type);
553  if ($first) {
554  $first = false;
555  $section = new ilFormSectionHeaderGUI();
556  $sec_tit = ($a_sec_head == "")
557  ? $this->lng->txt("meta_adv_records")
558  : $a_sec_head;
559  $section->setTitle($sec_tit);
560  $this->form->addItem($section);
561  }
562 
563  // checkbox for each active record
564  $cb = new ilCheckboxInputGUI($record_obj->getTitle(), "amet_use_rec[]");
565  $cb->setInfo($record_obj->getDescription());
566  $cb->setValue((string) $record_obj->getRecordId());
567  if (in_array((string) $record_obj->getRecordId(), $selected)) {
568  $cb->setChecked(true);
569  }
570  $this->form->addItem($cb);
571  }
572  }
static _getActivatedRecordsByObjectType(string $a_obj_type, string $a_sub_type="", bool $a_only_optional=false)
Get activated records by object type.
static getObjRecSelection(int $a_obj_id, string $a_sub_type="")
Get repository object record selection.
form( $class_path, string $cmd, string $submit_caption="")
+ 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 342 of file class.ilAdvancedMDRecordGUI.php.

References ILIAS\Repository\form(), getActiveRecords(), ilADTFactory\getInstance(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

Referenced by parse().

342  : void
343  {
344  // this is NOT used for the global search, see ilLuceneAdvancedSearchFields::getFormElement()
345  // (so searchable flag is NOT relevant)
346  //
347  // current usage: wiki page element "[amd] page list"
348 
349  $this->lng->loadLanguageModule('search');
350 
351  $this->search_form = array();
352  foreach ($this->getActiveRecords() as $record) {
353  $fields = ilAdvancedMDFieldDefinition::getInstancesByRecordId($record->getRecordId(), true);
354 
355  // empty record?
356  if (!sizeof($fields)) {
357  continue;
358  }
359 
360  $record_translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($record->getRecordId());
361  $section = new ilFormSectionHeaderGUI();
362  $section->setTitle($record_translations->getTitleForLanguage($this->user->getLanguage()));
363  $section->setInfo($record_translations->getDescriptionForLanguage($this->user->getLanguage()));
364  $this->form->addItem($section);
365 
366  foreach ($fields as $field) {
367  $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record->getRecordId());
368 
369  $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance(
370  $field->getADTDefinition(),
371  true,
372  false
373  );
374  $field_form->setForm($this->form);
375  $field_form->setElementId("advmd[" . $field->getFieldId() . "]");
376  $field_form->setTitle($field_translations->getTitleForLanguage(
377  $field->getFieldId(),
378  $this->user->getLanguage()
379  ));
380 
381  if (is_array($this->search_form_values) &&
382  isset($this->search_form_values[$field->getFieldId()])) {
383  $field->setSearchValueSerialized($field_form, $this->search_form_values[$field->getFieldId()]);
384  }
385 
386  $field->prepareElementForSearch($field_form);
387 
388  $field_form->addToForm();
389 
390  $this->search_form[$field->getFieldId()] = array("def" => $field, "value" => $field_form);
391  }
392  }
393  }
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
form( $class_path, string $cmd, string $submit_caption="")
+ 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 727 of file class.ilAdvancedMDRecordGUI.php.

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

Referenced by parse().

727  : string
728  {
729  $data = $this->getRowData();
730  $html = "";
731 
732  foreach ($this->getActiveRecords() as $record_obj) {
733  $record_id = $record_obj->getRecordId();
734 
736  foreach ($defs as $def) {
737  if ($this->handleECSDefinitions($def)) {
738  continue;
739  }
740 
741  $res = '';
742  $res_raw = $data['md_' . $def->getFieldId()] ?? null;
743  $res_presentation = $data['md_' . $def->getFieldId() . '_presentation'] ?? null;
744  if ($res_raw) {
745  $res = $res_raw;
746  }
747  if (
748  $res_presentation instanceof ilADTPresentationBridge &&
749  !($res_presentation instanceof ilADTLocationPresentationBridge)
750  ) {
751  $res = $res_presentation->getHTML();
752  }
753 
754  $html .= "<td class='std'>" . $res . "</td>";
755  }
756  }
757  return $html;
758  }
$res
Definition: ltiservices.php:66
handleECSDefinitions($a_definition)
handle ecs definitions
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ADT presentation bridge base class.
+ 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 703 of file class.ilAdvancedMDRecordGUI.php.

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

Referenced by parse().

703  : void
704  {
705  foreach ($this->getActiveRecords() as $record_obj) {
706  $record_id = $record_obj->getRecordId();
707 
708  $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record_id);
709 
711  foreach ($defs as $def) {
712  if ($this->handleECSDefinitions($def)) {
713  continue;
714  }
715 
716  $this->table_gui->addColumn(
717  $field_translations->getTitleForLanguage($def->getFieldId(), $this->user->getLanguage()),
718  'md_' . $def->getFieldId()
719  );
720  }
721  }
722  }
handleECSDefinitions($a_definition)
handle ecs definitions
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.

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

References ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), and ilAdvancedMDRecord\saveObjRecSelection().

577  : void
578  {
579  $post_amet_use_rec = [];
580  if ($this->http->wrapper()->post()->has('amet_use_rec')) {
581  $post_amet_use_rec = $this->http->wrapper()->post()->retrieve(
582  'amet_use_rec',
583  $this->refinery->kindlyTo()->dictOf(
584  $this->refinery->kindlyTo()->int()
585  )
586  );
587  }
588  ilAdvancedMDRecord::saveObjRecSelection($this->obj_id, $this->sub_type, $post_amet_use_rec);
589  }
static http()
Fetches the global http state from ILIAS.
static saveObjRecSelection(int $a_obj_id, string $a_sub_type="", ?array $a_records=null, bool $a_delete_before=true)
Save repository object record selection.
+ Here is the call graph for this function:

◆ setAdvMdRecordObject()

ilAdvancedMDRecordGUI::setAdvMdRecordObject ( int  $a_adv_id,
string  $a_adv_type,
string  $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
int$a_adv_idref id, if $in_repository is true, otherwise object id

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

125  : void
126  {
127  $this->adv_id = $a_adv_id;
128  $this->adv_type = $a_adv_type;
129  $this->adv_subtype = $a_adv_subtype;
130  }

◆ setInfoObject()

ilAdvancedMDRecordGUI::setInfoObject ( ilInfoScreenGUI  $info)

get info sections

Todo:
use another required parameter injection for modes

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

References $info, and ILIAS\UI\examples\MessageBox\Info\info().

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

174  : void
175  {
176  $this->info = $info;
177  }
info()
description: > Example for rendering a info message box.
Definition: info.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPropertyForm()

ilAdvancedMDRecordGUI::setPropertyForm ( ilPropertyFormGUI  $form)

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

References $form, and ILIAS\Repository\form().

Referenced by ilGlossaryTermGUI\getEditTermForm(), ilWikiPageGUI\initAdvancedMetaDataForm(), ilRemoteObjectBaseGUI\initEditForm(), ilObjCategoryGUI\initExtendedSettings(), ilObjSessionGUI\initForm(), and ilObjCourseGUI\initInfoEditor().

157  : void
158  {
159  $this->form = $form;
160  }
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRecordFilter()

ilAdvancedMDRecordGUI::setRecordFilter ( ?array  $filter = null)

Set advanced record filter.

Parameters
?int[]$filter

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

183  : void
184  {
185  $this->record_filter = $filter;
186  }

◆ setRefId()

ilAdvancedMDRecordGUI::setRefId ( int  $a_ref_id)

Set ref_id for context.

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

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

152  : void
153  {
154  $this->ref_id = $a_ref_id;
155  }

◆ setRowData()

ilAdvancedMDRecordGUI::setRowData ( array  $a_val)

Set row data.

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

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

608  : void
609  {
610  $this->row_data = $a_val;
611  }

◆ setSearchFormValues()

ilAdvancedMDRecordGUI::setSearchFormValues ( array  $a_values)

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

423  : void
424  {
425  $this->search_form_values = $a_values;
426  }

◆ setSearchValues()

ilAdvancedMDRecordGUI::setSearchValues ( array  $a_values)

Set values for search form.

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

165  : void
166  {
167  $this->search_values = $a_values;
168  }

◆ setTableGUI()

ilAdvancedMDRecordGUI::setTableGUI ( ilTable2GUI  $a_val)

Set table for self::MODE_TABLE_FILTER.

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

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

594  : void
595  {
596  $this->table_gui = $a_val;
597  }
+ Here is the caller graph for this function:

◆ writeEditForm()

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

Write edit form values to db.

Todo:
throw exception in case of missing parameters

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

314  : bool
315  {
316  if (!count($this->editor_form)) {
317  return false;
318  }
319 
320  // switch ids?
321  if ($a_obj_id) {
322  $this->obj_id = $a_obj_id;
323  }
324  if ($a_sub_id) {
325  $this->sub_id = $a_sub_id;
326  }
327 
328  foreach ($this->editor_form as $item) {
329  if ($a_obj_id || $a_sub_id) {
330  // switch active record to updated primary keys, e.g. after creation
331  $item["values"]->setActiveRecordPrimary($this->obj_id, $this->sub_type, $this->sub_id);
332  }
333 
334  $item["values"]->write();
335  }
336  return true;
337  }

Field Documentation

◆ $adt_search

array ilAdvancedMDRecordGUI::$adt_search = null
private

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

◆ $adv_id

int ilAdvancedMDRecordGUI::$adv_id = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $adv_subtype

string ilAdvancedMDRecordGUI::$adv_subtype = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $adv_type

string ilAdvancedMDRecordGUI::$adv_type = null
protected

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

Referenced by getAdvMdRecordObject().

◆ $editor_form

array ilAdvancedMDRecordGUI::$editor_form = []
protected

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

◆ $form

ilPropertyFormGUI ilAdvancedMDRecordGUI::$form = null
protected

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

Referenced by setPropertyForm().

◆ $http

GlobalHttpState ilAdvancedMDRecordGUI::$http
protected

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

◆ $in_repository

bool ilAdvancedMDRecordGUI::$in_repository = true
protected

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

Referenced by __construct().

◆ $info

ilInfoScreenGUI ilAdvancedMDRecordGUI::$info = null
protected

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

Referenced by setInfoObject().

◆ $lng

ilLanguage ilAdvancedMDRecordGUI::$lng
protected

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

◆ $mode

int ilAdvancedMDRecordGUI::$mode = self::MODE_UNDEFINED
private

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

◆ $obj_id

int ilAdvancedMDRecordGUI::$obj_id = 0
private

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

Referenced by getAdvMdRecordObject().

◆ $obj_type

string ilAdvancedMDRecordGUI::$obj_type = ''
private

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

Referenced by getAdvMdRecordObject().

◆ $record_filter

array ilAdvancedMDRecordGUI::$record_filter = null
protected

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

◆ $ref_id

int ilAdvancedMDRecordGUI::$ref_id = null
private

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

Referenced by getAdvMdRecordObject().

◆ $refinery

RefineryFactory ilAdvancedMDRecordGUI::$refinery
protected

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

◆ $row_data

array ilAdvancedMDRecordGUI::$row_data = null
private

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

Referenced by getRowData().

◆ $search_form

array ilAdvancedMDRecordGUI::$search_form = null
protected

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

◆ $search_form_values

array ilAdvancedMDRecordGUI::$search_form_values = null
protected

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

◆ $search_values

array ilAdvancedMDRecordGUI::$search_values = []
protected

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

◆ $sub_id

int ilAdvancedMDRecordGUI::$sub_id = 0
private

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

◆ $sub_type

string ilAdvancedMDRecordGUI::$sub_type = ''
private

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

Referenced by getAdvMdRecordObject().

◆ $table_gui

ilTable2GUI ilAdvancedMDRecordGUI::$table_gui = null
private

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

Referenced by getTableGUI().

◆ $user

ilObjUser ilAdvancedMDRecordGUI::$user
protected

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

◆ MODE_APP_PRESENTATION

const ilAdvancedMDRecordGUI::MODE_APP_PRESENTATION = 8

◆ MODE_EDITOR

◆ MODE_FILTER

const ilAdvancedMDRecordGUI::MODE_FILTER = 5

◆ MODE_INFO

◆ MODE_REC_SELECTION

◆ MODE_SEARCH

const ilAdvancedMDRecordGUI::MODE_SEARCH = 2

◆ MODE_TABLE_CELLS

const ilAdvancedMDRecordGUI::MODE_TABLE_CELLS = 7

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

Referenced by ilMediaPoolTableGUI\fillRow().

◆ MODE_TABLE_HEAD

const ilAdvancedMDRecordGUI::MODE_TABLE_HEAD = 6

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

Referenced by ilMediaPoolTableGUI\__construct().

◆ MODE_UNDEFINED

const ilAdvancedMDRecordGUI::MODE_UNDEFINED = 0

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


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