ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 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
 

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

References $lng, and ilObject\_getAllReferences().

49  {
50  global $lng;
51 
52  $this->lng = $lng;
53  $this->mode = $a_mode;
54  $this->obj_type = $a_obj_type;
55  $this->obj_id = $a_obj_id;
56  $this->sub_type = $a_sub_type;
57  $this->sub_id = $a_sub_id;
58 
59  if ($a_obj_id) {
60  $refs = ilObject::_getAllReferences($a_obj_id);
61  $this->ref_id = end($refs);
62  }
63  }
static _getAllReferences($a_id)
get all reference ids of object
+ Here is the call graph for this function:

Member Function Documentation

◆ getActiveRecords()

ilAdvancedMDRecordGUI::getActiveRecords ( )
protected

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

References ilAdvancedMDRecord\_getSelectedRecordsByObject().

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

652  {
653  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
654  return ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->ref_id, $this->sub_type);
655  }
static _getSelectedRecordsByObject($a_obj_type, $a_ref_id, $a_sub_type="")
Get selected records by object.
+ Here is the call graph for this function:
+ 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 715 of file class.ilAdvancedMDRecordGUI.php.

References $res, and array.

Referenced by ilTable2GUI\isAdvMDFilter().

716  {
717  if (!is_array($this->adt_search)) {
718  return;
719  }
720 
721  $res = array();
722 
723  foreach ($this->adt_search as $def_id => $element) {
724  if (!$element->isNull() ||
725  !(bool) $a_only_non_empty) {
726  $res[$def_id] = $element;
727  }
728  }
729 
730  return $res;
731  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ 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 646 of file class.ilAdvancedMDRecordGUI.php.

Referenced by parseTableCells().

647  {
648  return $this->row_data;
649  }
+ Here is the caller graph for this function:

◆ getTableGUI()

ilAdvancedMDRecordGUI::getTableGUI ( )

Get table.

Returns
object table gui class

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

627  {
628  return $this->table_gui;
629  }

◆ handleECSDefinitions()

ilAdvancedMDRecordGUI::handleECSDefinitions (   $a_definition)
private

handle ecs definitions

private

Parameters
objectilAdvMDFieldDefinition
Returns

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

References ilECSServerSettings\getInstance().

Referenced by parseTableCells(), and parseTableHead().

439  {
440  include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
441  include_once('./Services/WebServices/ECS/classes/class.ilECSServerSettings.php');
442 
443  if (ilECSServerSettings::getInstance()->activeServerExists() or
444  ($this->obj_type != 'crs' and $this->obj_type != 'rcrs')
445  ) {
446  return false;
447  }
448  return false;
449  }
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 211 of file class.ilAdvancedMDRecordGUI.php.

References $valid.

212  {
213  // #13774
214  if (!is_array($this->editor_form)) {
215  return false;
216  }
217 
218  $valid = true;
219 
220  foreach ($this->editor_form as $item) {
221  $item["form"]->importFromPost();
222  if (!$item["form"]->validate()) {
223  $valid = false;
224  }
225  }
226 
227  return $valid;
228  }
$valid

◆ importFilter()

ilAdvancedMDRecordGUI::importFilter ( )

Import filter (post) values.

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

700  {
701  if (!is_array($this->adt_search)) {
702  return;
703  }
704 
705  foreach ($this->adt_search as $element) {
706  $element->importFromPost();
707  }
708  }

◆ importSearchForm()

ilAdvancedMDRecordGUI::importSearchForm ( )

Load edit form values from post.

Returns
array

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

References $res, $valid, and array.

322  {
323  if (!sizeof($this->search_form)) {
324  return false;
325  }
326 
327  $valid = true;
328  $res = array();
329 
330  foreach ($this->search_form as $field_id => $item) {
331  $item["value"]->importFromPost();
332  if (!$item["value"]->validate()) {
333  $valid = false;
334  }
335  $value = $item["def"]->getSearchValueSerialized($item["value"]);
336  if ($value !== null) {
337  $res[$field_id] = $value;
338  }
339  }
340 
341  if ($valid) {
342  return $res;
343  }
344  }
$valid
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.

◆ parse()

ilAdvancedMDRecordGUI::parse ( )

Get HTML.

public

Parameters

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

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

119  {
120  switch ($this->mode) {
121  case self::MODE_EDITOR:
122  return $this->parseEditor();
123 
124  case self::MODE_SEARCH:
125  return $this->parseSearch();
126 
127  case self::MODE_INFO:
128  return $this->parseInfoPage();
129 
130  case self::MODE_APP_PRESENTATION:
131  return $this->parseAppointmentPresentation();
132 
133  case self::MODE_REC_SELECTION:
134  return $this->parseRecordSelection();
135 
136  case self::MODE_FILTER:
137  return $this->parseFilter();
138 
139  case self::MODE_TABLE_HEAD:
140  return $this->parseTableHead();
141 
142  case self::MODE_TABLE_CELLS:
143  return $this->parseTableCells();
144 
145  default:
146  die('Not implemented yet');
147  }
148  }
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 383 of file class.ilAdvancedMDRecordGUI.php.

References ilAdvancedMDSubstitution\_getInstanceByObjectType(), array, ilADTFactory\getInstance(), ilAdvancedMDFieldDefinition\getInstancesByObjType(), and ilAdvancedMDValues\getInstancesForObjectId().

Referenced by parse().

384  {
386 
387  $definitions = ilAdvancedMDFieldDefinition::getInstancesByObjType($this->obj_type);
388  $definitions = $sub->sortDefinitions($definitions);
389 
390  $positions = array();
391  foreach ($definitions as $position => $value) {
392  $positions[$value->getFieldId()] = $position;
393  }
394 
395  $array_elements = array();
396  foreach (ilAdvancedMDValues::getInstancesForObjectId($this->obj_id, $this->obj_type, $this->sub_type, $this->sub_id) as $record_id => $a_values) {
397  // this correctly binds group and definitions
398  $a_values->read();
399 
400  $defs = $a_values->getDefinitions();
401  foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
402  if (!$element->isNull()) {
403  $presentation_bridge = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
404  #21615
405  if (get_class($element) == 'ilADTLocation') {
406  $presentation_bridge->setSize("100%", "200px");
407  #22638
408  $presentation_value = $presentation_bridge->getHTML();
409  $presentation_value .= "<script>ilInitMaps();</script>";
410  } else {
411  #22638
412  $presentation_value = strip_tags($presentation_bridge->getHTML());
413  }
414  $array_elements[$positions[$element_id]] =
415  [
416  "title" => $defs[$element_id]->getTitle(),
417  "value" => $presentation_value
418  ];
419  }
420  }
421  }
422 
423  ksort($array_elements);
424  return $array_elements;
425  }
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.
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
static getInstancesByObjType($a_obj_type, $a_active_only=true)
Create styles array
The data for the language used.
+ 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 547 of file class.ilAdvancedMDRecordGUI.php.

References array.

Referenced by showECSStart().

548  {
549  if ($u_start >= $u_end) {
550  return array(0,0);
551  }
552  $diff = $u_end - $u_start;
553  $hours = (int) ($diff / (60 * 60));
554  $min = (int) (($diff % 3600) / 60);
555  return array($hours,$min);
556  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ parseEditor()

ilAdvancedMDRecordGUI::parseEditor ( )
protected

Parse property form in editor mode.

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

References $def, array, getActiveRecords(), and ilADTFactory\getInstance().

Referenced by parse().

159  {
160  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
161  $this->editor_form = array();
162 
163  foreach ($this->getActiveRecords() as $record_obj) {
164  /* :TODO:
165  if($this->handleECSDefinitions($def))
166  {
167  continue;
168  }
169  */
170 
171  $record_id = $record_obj->getRecordId();
172 
173  $values = new ilAdvancedMDValues($record_id, $this->obj_id, $this->sub_type, $this->sub_id);
174  $values->read();
175  $defs = $values->getDefinitions();
176 
177  // empty record?
178  if (!sizeof($defs)) {
179  continue;
180  }
181 
182  $adt_group_form = ilADTFactory::getInstance()->getFormBridgeForInstance($values->getADTGroup());
183  $adt_group_form->setForm($this->form);
184  $adt_group_form->setTitle($record_obj->getTitle());
185  $adt_group_form->setInfo($record_obj->getDescription());
186 
187  foreach ($defs as $def) {
188  $element = $adt_group_form->getElement($def->getFieldId());
189  $element->setTitle($def->getTitle());
190  $element->setInfo($def->getDescription());
191 
192  // definition may customize ADT form element
193  $def->prepareElementForEditor($element);
194 
195  if ($values->isDisabled($def->getFieldId())) {
196  $element->setDisabled(true);
197  }
198  }
199 
200  $adt_group_form->addToForm();
201 
202  $this->editor_form[$record_id] = array("values"=>$values, "form"=>$adt_group_form);
203  }
204  }
static getInstance()
Get singleton.
Create styles array
The data for the language used.
$def
Definition: croninfo.php:21
+ 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 663 of file class.ilAdvancedMDRecordGUI.php.

References $def, array, getActiveRecords(), ilADTFactory\getInstance(), and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by parse().

664  {
665  $this->adt_search = array();
666 
667  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
668  foreach ($this->getActiveRecords() as $record_obj) {
669  $record_id = $record_obj->getRecordId();
670 
672  foreach ($defs as $def) {
673  // some input GUIs do NOT support filter rendering yet
674  if (!$def->isFilterSupported()) {
675  continue;
676  }
677 
678  /* :TODO:
679  if($this->handleECSDefinitions($def))
680  {
681  continue;
682  }
683  */
684 
685  $this->adt_search[$def->getFieldId()] = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($def->getADTDefinition(), true, false);
686  $this->adt_search[$def->getFieldId()]->setTableGUI($this->table_gui);
687  $this->adt_search[$def->getFieldId()]->setTitle($def->getTitle());
688  $this->adt_search[$def->getFieldId()]->setElementId('md_' . $def->getFieldId());
689 
690  $this->adt_search[$def->getFieldId()]->loadFilter();
691  $this->adt_search[$def->getFieldId()]->addToForm();
692  }
693  }
694  }
static getInstance()
Get singleton.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
Create styles array
The data for the language used.
$def
Definition: croninfo.php:21
+ 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 355 of file class.ilAdvancedMDRecordGUI.php.

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

Referenced by parse().

356  {
357  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
358  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
359  include_once('Services/ADT/classes/class.ilADTFactory.php');
360 
361  foreach (ilAdvancedMDValues::getInstancesForObjectId($this->obj_id, $this->obj_type, $this->sub_type, $this->sub_id) as $record_id => $a_values) {
362  // this correctly binds group and definitions
363  $a_values->read();
364 
365  $this->info->addSection(ilAdvancedMDRecord::_lookupTitle($record_id));
366 
367  $defs = $a_values->getDefinitions();
368  foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
369  if (!$element->isNull()) {
370  $this->info->addProperty(
371  $defs[$element_id]->getTitle(),
372  ilADTFactory::getInstance()->getPresentationBridgeForInstance($element)->getHTML()
373  );
374  }
375  }
376  }
377  }
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.
static _lookupTitle($a_record_id)
Lookup title.
+ 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 569 of file class.ilAdvancedMDRecordGUI.php.

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

Referenced by parse().

570  {
571  global $ilUser;
572 
573  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
574  $first = true;
575  foreach (ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type, $this->sub_type) as $record_obj) {
576  $selected = ilAdvancedMDRecord::getObjRecSelection($this->obj_id, $this->sub_type);
577  if ($first) {
578  $first = false;
580  $sec_tit = ($a_sec_head == "")
581  ? $this->lng->txt("meta_adv_records")
582  : $a_sec_head;
583  $section->setTitle($sec_tit);
584  $this->form->addItem($section);
585  }
586 
587  // checkbox for each active record
588  $cb = new ilCheckboxInputGUI($record_obj->getTitle(), "amet_use_rec[]");
589  $cb->setInfo($record_obj->getDescription());
590  $cb->setValue($record_obj->getRecordId());
591  if (in_array($record_obj->getRecordId(), $selected)) {
592  $cb->setChecked(true);
593  }
594  $this->form->addItem($cb);
595  }
596  }
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
$ilUser
Definition: imgupload.php:18
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="", $a_only_optional=false)
Get activated records by object type.
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 271 of file class.ilAdvancedMDRecordGUI.php.

References $section, array, getActiveRecords(), ilADTFactory\getInstance(), and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by parse().

272  {
273  // this is NOT used for the global search, see ilLuceneAdvancedSearchFields::getFormElement()
274  // (so searchable flag is NOT relevant)
275  //
276  // current usage: wiki page element "[amd] page list"
277 
278  $this->lng->loadLanguageModule('search');
279 
280  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
281 
282  $this->search_form = array();
283  foreach ($this->getActiveRecords() as $record) {
284  $fields = ilAdvancedMDFieldDefinition::getInstancesByRecordId($record->getRecordId(), true);
285 
286  // empty record?
287  if (!sizeof($fields)) {
288  continue;
289  }
290 
292  $section->setTitle($record->getTitle());
293  $section->setInfo($record->getDescription());
294  $this->form->addItem($section);
295 
296  foreach ($fields as $field) {
297  $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), true, false);
298  $field_form->setForm($this->form);
299  $field_form->setElementId("advmd[" . $field->getFieldId() . "]");
300  $field_form->setTitle($field->getTitle());
301 
302  if (is_array($this->search_form_values) &&
303  isset($this->search_form_values[$field->getFieldId()])) {
304  $field->setSearchValueSerialized($field_form, $this->search_form_values[$field->getFieldId()]);
305  }
306 
307  $field->prepareElementForSearch($field_form);
308 
309  $field_form->addToForm();
310 
311  $this->search_form[$field->getFieldId()] = array("def"=>$field, "value"=>$field_form);
312  }
313  }
314  }
This class represents a section header in a property form.
static getInstance()
Get singleton.
$section
Definition: Utf8Test.php:83
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
Create styles array
The data for the language used.
+ 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 758 of file class.ilAdvancedMDRecordGUI.php.

References $data, $def, $html, getActiveRecords(), getRowData(), and handleECSDefinitions().

Referenced by parse().

759  {
760  $data = $this->getRowData();
761 
762  $html = "";
763 
764  foreach ($this->getActiveRecords() as $record_obj) {
765  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
766  foreach (ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def) {
767  if ($this->handleECSDefinitions($def)) {
768  continue;
769  }
770 
771  $html.= "<td class='std'>" . $data['md_' . $def->getFieldId()] . "</td>";
772  }
773  }
774  return $html;
775  }
handleECSDefinitions($a_definition)
handle ecs definitions
$def
Definition: croninfo.php:21
$html
Definition: example_001.php:87
+ 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 741 of file class.ilAdvancedMDRecordGUI.php.

References $def, getActiveRecords(), and handleECSDefinitions().

Referenced by parse().

742  {
743  foreach ($this->getActiveRecords() as $record_obj) {
744  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
745  foreach (ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def) {
746  if ($this->handleECSDefinitions($def)) {
747  continue;
748  }
749 
750  $this->table_gui->addColumn($def->getTitle(), 'md_' . $def->getFieldId());
751  }
752  }
753  }
handleECSDefinitions($a_definition)
handle ecs definitions
$def
Definition: croninfo.php:21
+ 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 604 of file class.ilAdvancedMDRecordGUI.php.

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

605  {
606  $sel = ilUtil::stripSlashesArray($_POST["amet_use_rec"]);
607  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
608  ilAdvancedMDRecord::saveObjRecSelection($this->obj_id, $this->sub_type, $sel);
609  }
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:

◆ setInfoObject()

ilAdvancedMDRecordGUI::setInfoObject (   $info)

get info sections

public

Parameters
objectinstance of ilInfoScreenGUI

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

References $info.

Referenced by ilObjOrgUnitGUI\executeCommand(), ilObjStudyProgrammeGUI\fillInfoScreen(), ilRemoteObjectBaseGUI\infoScreen(), ilObjCourseGUI\infoScreen(), ilObjSessionGUI\infoScreen(), and ilObjCategoryGUI\infoScreen().

107  {
108  $this->info = $info;
109  }
$info
Definition: index.php:5
+ 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 70 of file class.ilAdvancedMDRecordGUI.php.

71  {
72  $this->ref_id = $a_ref_id;
73  }

◆ setRowData()

ilAdvancedMDRecordGUI::setRowData (   $a_val)

Set row data.

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

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

637  {
638  $this->row_data = $a_val;
639  }

◆ setSearchFormValues()

ilAdvancedMDRecordGUI::setSearchFormValues ( array  $a_values)

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

347  {
348  $this->search_form_values = $a_values;
349  }

◆ setSearchValues()

ilAdvancedMDRecordGUI::setSearchValues (   $a_values)

Set values for search form.

public

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

94  {
95  $this->search_values = $a_values;
96  }

◆ setTableGUI()

ilAdvancedMDRecordGUI::setTableGUI (   $a_val)

Set table.

Parameters
object$a_valtable gui class

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

Referenced by ilPresentationListTableGUI\__construct().

617  {
618  $this->table_gui = $a_val;
619  }
+ 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 457 of file class.ilAdvancedMDRecordGUI.php.

References $def, $ilUser, $text, $time, ilECSDataMappingSettings\_getInstance(), date, ilAdvancedMDFieldDefinition\getInstance(), IL_CAL_UNIX, parseDuration(), ilDurationInputGUI\setHours(), ilSelectInputGUI\setOptions(), ilAdvancedMDFieldDefinition\TYPE_SELECT, and ilAdvancedMDFieldDefinition\TYPE_TEXT.

458  {
459  global $ilUser;
460 
461  $this->lng->loadLanguageModule('ecs');
462 
463  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
464  $value_start = ilAdvancedMDValue::_getInstance($this->obj_id, $def->getFieldId());
465 
466  $unixtime = $value_start->getValue() ? $value_start->getValue() : mktime(8, 0, 0, date('m'), date('d'), date('Y'));
467 
468  $time = new ilDateTimeInputGUI($this->lng->txt('ecs_event_appointment'), 'md[' . $def->getFieldId() . ']');
469  $time->setShowTime(true);
470  $time->setDate(new ilDateTime($unixtime, IL_CAL_UNIX));
471  /*
472  $time->enableDateActivation($this->lng->txt('enabled'),
473  'md_activated['.$def->getFieldId().']',
474  $value_start->getValue() ? true : false);
475  */
476  $time->setDisabled($value_start->isDisabled());
477 
479  if ($field_id = $mapping->getMappingByECSName(0, 'end')) {
480  $value_end = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
481 
482  list($hours, $minutes) = $this->parseDuration($value_start->getValue(), $value_end->getValue());
483 
484  $duration = new ilDurationInputGUI($this->lng->txt('ecs_duration'), 'ecs_duration');
485  $duration->setHours($hours);
486  $duration->setMinutes($minutes);
487  #$duration->setInfo($this->lng->txt('ecs_duration_info'));
488  $duration->setShowHours(true);
489  $duration->setShowMinutes(true);
490  $time->addSubItem($duration);
491  }
492 
493  if ($field_id = $mapping->getMappingByECSName(0, 'cycle')) {
494  $value = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
495  $cycle_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
496  switch ($cycle_def->getFieldType()) {
498  $text = new ilTextInputGUI($cycle_def->getTitle(), 'md[' . $cycle_def->getFieldId() . ']');
499  $text->setValue($value->getValue());
500  $text->setSize(20);
501  $text->setMaxLength(512);
502  $text->setDisabled($value->isDisabled());
503  $time->addSubItem($text);
504  break;
505 
507  $select = new ilSelectInputGUI($cycle_def->getTitle(), 'md[' . $cycle_def->getFieldId() . ']');
508  $select->setOptions($cycle_def->getFieldValuesForSelect());
509  $select->setValue($value->getValue());
510  $select->setDisabled($value->isDisabled());
511  $time->addSubItem($select);
512  break;
513  }
514  }
515  if ($field_id = $mapping->getMappingByECSName(0, 'room')) {
516  $value = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
517  $room_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
518  switch ($room_def->getFieldType()) {
520  $text = new ilTextInputGUI($room_def->getTitle(), 'md[' . $room_def->getFieldId() . ']');
521  $text->setValue($value->getValue());
522  $text->setSize(20);
523  $text->setMaxLength(512);
524  $text->setDisabled($value->isDisabled());
525  $time->addSubItem($text);
526  break;
527 
529  $select = new ilSelectInputGUI($room_def->getTitle(), 'md[' . $room_def->getFieldId() . ']');
530  $select->setOptions($cycle_def->getFieldValuesForSelect());
531  $select->setValue($value->getValue());
532  $select->setDisabled($value->isDisabled());
533  $time->addSubItem($select);
534  break;
535  }
536  }
537  $this->form->addItem($time);
538  }
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.
This class represents a selection list 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.
$time
Definition: cron.php:21
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$text
Definition: errorreport.php:18
This class represents a text property in a property form.
Date and time handling
$ilUser
Definition: imgupload.php:18
setOptions($a_options)
Set Options.
$def
Definition: croninfo.php:21
static _getInstance()
Get Singleton instance.
+ 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 237 of file class.ilAdvancedMDRecordGUI.php.

238  {
239  if (!sizeof($this->editor_form)) {
240  return false;
241  }
242 
243  // switch ids?
244  if ($a_obj_id) {
245  $this->obj_id = $a_obj_id;
246  }
247  if ($a_sub_id) {
248  $this->sub_id = $a_sub_id;
249  }
250 
251  foreach ($this->editor_form as $item) {
252  if ($a_obj_id || $a_sub_id) {
253  // switch active record to updated primary keys, e.g. after creation
254  $item["values"]->setActiveRecordPrimary($this->obj_id, $this->sub_type, $this->sub_id);
255  }
256 
257  $item["values"]->write();
258  }
259 
260  return true;
261  }

Field Documentation

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

◆ $ref_id

ilAdvancedMDRecordGUI::$ref_id = null
private

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

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

◆ MODE_APP_PRESENTATION

const ilAdvancedMDRecordGUI::MODE_APP_PRESENTATION = 8

◆ MODE_EDITOR

◆ MODE_FILTER

const ilAdvancedMDRecordGUI::MODE_FILTER = 5

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

◆ MODE_TABLE_HEAD

const ilAdvancedMDRecordGUI::MODE_TABLE_HEAD = 6

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


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