ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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...
 
 setPropertyForm ($form)
 set property form object More...
 
 setSearchValues ($a_values)
 Set values for search form. More...
 
 setInfoObject ($info)
 get info sections More...
 
 setSelectedOnly ($a_val)
 Set selected only flag. More...
 
 getSelectedOnly ()
 Get selected only flag. More...
 
 parse ()
 Get HTML. More...
 
 importEditFormPostValues ()
 Load edit form values from post. More...
 
 writeEditForm ()
 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 ()
 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_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...
 

Protected Attributes

 $lng
 
 $editor_form
 

Private Member Functions

 parseSearch ()
 Parse search. More...
 
 parseInfoPage ()
 
 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
 
 $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 46 of file class.ilAdvancedMDRecordGUI.php.

References $lng.

47  {
48  global $lng;
49 
50  $this->lng = $lng;
51  $this->mode = $a_mode;
52  $this->obj_type = $a_obj_type;
53  $this->obj_id = $a_obj_id;
54  $this->sub_type = $a_sub_type;
55  $this->sub_id = $a_sub_id;
56  }

Member Function Documentation

◆ getFilterElements()

ilAdvancedMDRecordGUI::getFilterElements ( )

Get SQL conditions for current filter value(s)

Returns
array

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

References $res.

722  {
723  if(!is_array($this->adt_search))
724  {
725  return;
726  }
727 
728  $res = array();
729 
730  foreach($this->adt_search as $def_id => $element)
731  {
732  if(!$element->isNull())
733  {
734  $res[$def_id] = $element;
735  }
736  }
737 
738  return $res;
739  }

◆ getRowData()

ilAdvancedMDRecordGUI::getRowData ( )

Get row data.

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

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

Referenced by parseTableCells().

639  {
640  return $this->row_data;
641  }
+ Here is the caller graph for this function:

◆ getSelectedOnly()

ilAdvancedMDRecordGUI::getSelectedOnly ( )

Get selected only flag.

Returns
boolean retrieve only records, that are selected by the object

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

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

110  {
111  return $this->selected_only;
112  }
+ Here is the caller graph for this function:

◆ getTableGUI()

ilAdvancedMDRecordGUI::getTableGUI ( )

Get table.

Returns
object table gui class

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

619  {
620  return $this->table_gui;
621  }

◆ handleECSDefinitions()

ilAdvancedMDRecordGUI::handleECSDefinitions (   $a_definition)
private

handle ecs definitions

private

Parameters
objectilAdvMDFieldDefinition
Returns

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

References ilECSServerSettings\getInstance().

Referenced by parseTableCells(), and parseTableHead().

402  {
403  include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
404  include_once('./Services/WebServices/ECS/classes/class.ilECSServerSettings.php');
405 
406  if(ilECSServerSettings::getInstance()->activeServerExists() or
407  ($this->obj_type != 'crs' and $this->obj_type != 'rcrs')
408  )
409  {
410  return false;
411  }
412  return false;
413  /*
414  $mapping = ilECSDataMappingSettings::_getInstance();
415 
416  if($mapping->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'begin') == $a_definition->getFieldId())
417  {
418  $this->showECSStart($a_definition);
419  return true;
420  }
421  if($mapping->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'end') == $a_definition->getFieldId())
422  {
423  return true;
424  }
425  if($mapping->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'cycle') == $a_definition->getFieldId())
426  {
427  return true;
428  }
429  if($mapping->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'room') == $a_definition->getFieldId())
430  {
431  return true;
432  }
433  */
434  }
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 219 of file class.ilAdvancedMDRecordGUI.php.

References $valid.

220  {
221  // #13774
222  if(!is_array($this->editor_form))
223  {
224  return false;
225  }
226 
227  $valid = true;
228 
229  foreach($this->editor_form as $item)
230  {
231  $item["form"]->importFromPost();
232  if(!$item["form"]->validate())
233  {
234  $valid = false;
235  }
236  }
237 
238  return $valid;
239  }
$valid

◆ importFilter()

ilAdvancedMDRecordGUI::importFilter ( )

Import filter (post) values.

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

704  {
705  if(!is_array($this->adt_search))
706  {
707  return;
708  }
709 
710  foreach($this->adt_search as $element)
711  {
712  $element->importFromPost();
713  }
714  }

◆ importSearchForm()

ilAdvancedMDRecordGUI::importSearchForm ( )

Load edit form values from post.

Returns
array

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

References $res, and $valid.

325  {
326  if(!sizeof($this->search_form))
327  {
328  return false;
329  }
330 
331  $valid = true;
332  $res = array();
333 
334  foreach($this->search_form as $field_id => $item)
335  {
336  $item["value"]->importFromPost();
337  if(!$item["value"]->validate())
338  {
339  $valid = false;
340  }
341  $value = $item["def"]->getSearchValueSerialized($item["value"]);
342  if($value !== null)
343  {
344  $res[$field_id] = $value;
345  }
346  }
347 
348  if($valid)
349  {
350  return $res;
351  }
352  }
$valid

◆ parse()

ilAdvancedMDRecordGUI::parse ( )

Get HTML.

public

Parameters

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

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

122  {
123  switch($this->mode)
124  {
125  case self::MODE_EDITOR:
126  return $this->parseEditor();
127 
128  case self::MODE_SEARCH:
129  return $this->parseSearch();
130 
131  case self::MODE_INFO:
132  return $this->parseInfoPage();
133 
134  case self::MODE_REC_SELECTION:
135  return $this->parseRecordSelection();
136 
137  case self::MODE_FILTER:
138  return $this->parseFilter();
139 
140  case self::MODE_TABLE_HEAD:
141  return $this->parseTableHead();
142 
143  case self::MODE_TABLE_CELLS:
144  return $this->parseTableCells();
145 
146  default:
147  die('Not implemented yet');
148  }
149  }
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)
parseEditor()
Parse property form in editor mode.
+ Here is the call graph for this function:

◆ parseDuration()

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

parse hours and minutes from duration

protected

Parameters

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

Referenced by showECSStart().

536  {
537  if($u_start >= $u_end)
538  {
539  return array(0,0);
540  }
541  $diff = $u_end - $u_start;
542  $hours = (int) ($diff / (60 * 60));
543  $min = (int) (($diff % 3600) / 60);
544  return array($hours,$min);
545  }
+ Here is the caller graph for this function:

◆ parseEditor()

ilAdvancedMDRecordGUI::parseEditor ( )
protected

Parse property form in editor mode.

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

References ilAdvancedMDRecord\_getActivatedRecordsByObjectType(), ilAdvancedMDRecord\_getSelectedRecordsByObject(), ilADTFactory\getInstance(), and getSelectedOnly().

Referenced by parse().

160  {
161  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
162  if ($this->getSelectedOnly())
163  {
164  $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type);
165  }
166  else
167  {
168  $recs = ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type, $this->sub_type);
169  }
170 
171  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
172  $this->editor_form = array();
173 
174  foreach($recs as $record_obj)
175  {
176  /* :TODO:
177  if($this->handleECSDefinitions($def))
178  {
179  continue;
180  }
181  */
182 
183  $record_id = $record_obj->getRecordId();
184 
185  $values = new ilAdvancedMDValues($record_id, $this->obj_id, $this->sub_type, $this->sub_id);
186  $values->read();
187 
188  $adt_group_form = ilADTFactory::getInstance()->getFormBridgeForInstance($values->getADTGroup());
189  $adt_group_form->setForm($this->form);
190  $adt_group_form->setTitle($record_obj->getTitle());
191  $adt_group_form->setInfo($record_obj->getDescription());
192 
193  foreach($values->getDefinitions() as $def)
194  {
195  $element = $adt_group_form->getElement($def->getFieldId());
196  $element->setTitle($def->getTitle());
197  $element->setInfo($def->getDescription());
198 
199  // definition may customize ADT form element
200  $def->prepareElementForEditor($element);
201 
202  if($values->isDisabled($def->getFieldId()))
203  {
204  $element->setDisabled(true);
205  }
206  }
207 
208  $adt_group_form->addToForm();
209 
210  $this->editor_form[$record_id] = array("values"=>$values, "form"=>$adt_group_form);
211  }
212  }
static getInstance()
Get singleton.
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="")
Get activated records by object type.
getSelectedOnly()
Get selected only flag.
static _getSelectedRecordsByObject($a_obj_type, $a_obj_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:

◆ parseFilter()

ilAdvancedMDRecordGUI::parseFilter ( )
private

Parse property for filter (table)

private

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

References ilAdvancedMDRecord\_getActivatedRecordsByObjectType(), ilAdvancedMDRecord\_getSelectedRecordsByObject(), ilADTFactory\getInstance(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), getSelectedOnly(), ilAdvancedMDFieldDefinition\TYPE_DATE, ilAdvancedMDFieldDefinition\TYPE_DATETIME, ilAdvancedMDFieldDefinition\TYPE_SELECT, ilAdvancedMDFieldDefinition\TYPE_SELECT_MULTI, and ilAdvancedMDFieldDefinition\TYPE_TEXT.

Referenced by parse().

650  {
651  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
652  if ($this->getSelectedOnly())
653  {
654  $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type);
655  }
656  else
657  {
658  $recs = ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type, $this->sub_type);
659  }
660 
661  $this->adt_search = array();
662 
663  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
664  foreach($recs as $record_obj)
665  {
666  $record_id = $record_obj->getRecordId();
667 
669  foreach($defs as $def)
670  {
671  // :TODO: not all types supported yet
672  if(!in_array($def->getType(), array(
678  {
679  continue;
680  }
681 
682  /* :TODO:
683  if($this->handleECSDefinitions($def))
684  {
685  continue;
686  }
687  */
688 
689  $this->adt_search[$def->getFieldId()] = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($def->getADTDefinition(), true, false);
690  $this->adt_search[$def->getFieldId()]->setTableGUI($this->table_gui);
691  $this->adt_search[$def->getFieldId()]->setTitle($def->getTitle());
692  $this->adt_search[$def->getFieldId()]->setElementId('md_'.$def->getFieldId());
693 
694  $this->adt_search[$def->getFieldId()]->loadFilter();
695  $this->adt_search[$def->getFieldId()]->addToForm();
696  }
697  }
698  }
static getInstance()
Get singleton.
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="")
Get activated records by object type.
getSelectedOnly()
Get selected only flag.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
static _getSelectedRecordsByObject($a_obj_type, $a_obj_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:

◆ parseInfoPage()

ilAdvancedMDRecordGUI::parseInfoPage ( )
private

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

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

Referenced by parse().

365  {
366  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
367  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
368  include_once('Services/ADT/classes/class.ilADTFactory.php');
369 
370  foreach(ilAdvancedMDValues::getInstancesForObjectId($this->obj_id, $this->obj_type) as $record_id => $a_values)
371  {
372  // this correctly binds group and definitions
373  $a_values->read();
374 
375  $this->info->addSection(ilAdvancedMDRecord::_lookupTitle($record_id));
376 
377  $defs = $a_values->getDefinitions();
378  foreach($a_values->getADTGroup()->getElements() as $element_id => $element)
379  {
380  if(!$element->isNull())
381  {
382  $this->info->addProperty($defs[$element_id]->getTitle(),
383  ilADTFactory::getInstance()->getPresentationBridgeForInstance($element)->getHTML());
384  }
385  }
386  }
387  }
static getInstance()
Get singleton.
static _lookupTitle($a_record_id)
Lookup title.
static getInstancesForObjectId($a_obj_id, $a_obj_type=null)
Get instances for given object id.
+ 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 558 of file class.ilAdvancedMDRecordGUI.php.

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

Referenced by parse().

559  {
560  global $ilUser;
561 
562  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
563  $first = true;
564  foreach(ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type, $this->sub_type) as $record_obj)
565  {
566  $selected = ilAdvancedMDRecord::getObjRecSelection($this->obj_id, $this->sub_type);
567  if ($first)
568  {
569  $first = false;
571  $sec_tit = ($a_sec_head == "")
572  ? $this->lng->txt("meta_adv_records")
573  : $a_sec_head;
574  $section->setTitle($sec_tit);
575  $this->form->addItem($section);
576  }
577 
578  // checkbox for each active record
579  $cb = new ilCheckboxInputGUI($record_obj->getTitle(), "amet_use_rec[]");
580  $cb->setInfo($record_obj->getDescription());
581  $cb->setValue($record_obj->getRecordId());
582  if (in_array($record_obj->getRecordId(), $selected))
583  {
584  $cb->setChecked(true);
585  }
586  $this->form->addItem($cb);
587  }
588  }
This class represents a section header in a property form.
This class represents a checkbox property in a property form.
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="")
Get activated records by object type.
setInfo($a_info)
Set Information Text.
$section
Definition: Utf8Test.php:84
global $ilUser
Definition: imgupload.php:15
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 269 of file class.ilAdvancedMDRecordGUI.php.

References $section, ilAdvancedMDRecord\_getActivatedRecordsByObjectType(), ilAdvancedMDRecord\_getSelectedRecordsByObject(), ilADTFactory\getInstance(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), and getSelectedOnly().

Referenced by parse().

270  {
271  // this is NOT used for the global search, see ilLuceneAdvancedSearchFields::getFormElement()
272  // (so searchable flag is NOT relevant)
273  //
274  // current usage: wiki page element "[amd] page list"
275 
276  $this->lng->loadLanguageModule('search');
277 
278  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
279  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
280  if ($this->getSelectedOnly())
281  {
282  $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type);
283  }
284  else
285  {
286  $recs = ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type, $this->sub_type);
287  }
288 
289  $this->search_form = array();
290  foreach($recs as $record)
291  {
293  $section->setTitle($record->getTitle());
294  $section->setInfo($record->getDescription());
295  $this->form->addItem($section);
296 
297  foreach(ilAdvancedMDFieldDefinition::getInstancesByRecordId($record->getRecordId(), true) as $field)
298  {
299  $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), true, false);
300  $field_form->setForm($this->form);
301  $field_form->setElementId("advmd[".$field->getFieldId()."]");
302  $field_form->setTitle($field->getTitle());
303 
304  if(is_array($this->search_form_values) &&
305  isset($this->search_form_values[$field->getFieldId()]))
306  {
307  $field->setSearchValueSerialized($field_form, $this->search_form_values[$field->getFieldId()]);
308  }
309 
310  $field->prepareElementForSearch($field_form);
311 
312  $field_form->addToForm();
313 
314  $this->search_form[$field->getFieldId()] = array("def"=>$field, "value"=>$field_form);
315  }
316  }
317  }
This class represents a section header in a property form.
static getInstance()
Get singleton.
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="")
Get activated records by object type.
getSelectedOnly()
Get selected only flag.
$section
Definition: Utf8Test.php:84
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
static _getSelectedRecordsByObject($a_obj_type, $a_obj_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:

◆ parseTableCells()

ilAdvancedMDRecordGUI::parseTableCells ( )
private

Parse table cells.

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

References $data, $ilUser, ilAdvancedMDRecord\_getActivatedRecordsByObjectType(), ilAdvancedMDRecord\_getSelectedRecordsByObject(), getRowData(), getSelectedOnly(), and handleECSDefinitions().

Referenced by parse().

781  {
782  global $ilUser;
783 
784  $data = $this->getRowData();
785 
786  $html = "";
787 
788  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
789  if ($this->getSelectedOnly())
790  {
791  $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type);
792  }
793  else
794  {
795  $recs = ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type, $this->sub_type);
796  }
797  foreach($recs as $record_obj)
798  {
799  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
800  foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def)
801  {
802  if($this->handleECSDefinitions($def))
803  {
804  continue;
805  }
806 
807  $html.= "<td class='std'>".$data['md_'.$def->getFieldId()]."</td>";
808  }
809  }
810  return $html;
811  }
handleECSDefinitions($a_definition)
handle ecs definitions
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="")
Get activated records by object type.
getSelectedOnly()
Get selected only flag.
static _getSelectedRecordsByObject($a_obj_type, $a_obj_id, $a_sub_type="")
Get selected records by object.
global $ilUser
Definition: imgupload.php:15
+ 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 749 of file class.ilAdvancedMDRecordGUI.php.

References $ilUser, ilAdvancedMDRecord\_getActivatedRecordsByObjectType(), ilAdvancedMDRecord\_getSelectedRecordsByObject(), getSelectedOnly(), and handleECSDefinitions().

Referenced by parse().

750  {
751  global $ilUser;
752 
753  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
754  if ($this->getSelectedOnly())
755  {
756  $recs = ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type);
757  }
758  else
759  {
760  $recs = ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type, $this->sub_type);
761  }
762  foreach($recs as $record_obj)
763  {
764  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
765  foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def)
766  {
767  if($this->handleECSDefinitions($def))
768  {
769  continue;
770  }
771 
772  $this->table_gui->addColumn($def->getTitle(),'md_'.$def->getFieldId());
773  }
774  }
775  }
handleECSDefinitions($a_definition)
handle ecs definitions
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="")
Get activated records by object type.
getSelectedOnly()
Get selected only flag.
static _getSelectedRecordsByObject($a_obj_type, $a_obj_id, $a_sub_type="")
Get selected records by object.
global $ilUser
Definition: imgupload.php:15
+ 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 596 of file class.ilAdvancedMDRecordGUI.php.

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

Referenced by ilObjGlossaryGUI\saveProperties(), and ilObjWikiGUI\saveSettingsObject().

597  {
598  $sel = ilUtil::stripSlashesArray($_POST["amet_use_rec"]);
599  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
600  ilAdvancedMDRecord::saveObjRecSelection($this->obj_id, $this->sub_type, $sel);
601  }
$_POST['username']
Definition: cron.php:12
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setInfoObject()

ilAdvancedMDRecordGUI::setInfoObject (   $info)

get info sections

public

Parameters
objectinstance of ilInfoScreenGUI

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

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

90  {
91  $this->info = $info;
92  }
+ Here is the caller graph for this function:

◆ setPropertyForm()

◆ setRowData()

ilAdvancedMDRecordGUI::setRowData (   $a_val)

Set row data.

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

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

629  {
630  $this->row_data = $a_val;
631  }

◆ setSearchFormValues()

ilAdvancedMDRecordGUI::setSearchFormValues ( array  $a_values)

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

355  {
356  $this->search_form_values = $a_values;
357  }

◆ setSearchValues()

ilAdvancedMDRecordGUI::setSearchValues (   $a_values)

Set values for search form.

public

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

77  {
78  $this->search_values = $a_values;
79  }

◆ setSelectedOnly()

ilAdvancedMDRecordGUI::setSelectedOnly (   $a_val)

Set selected only flag.

Parameters
boolean$a_valretrieve only records, that are selected by the object

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

Referenced by ilPresentationListTableGUI\__construct().

100  {
101  $this->selected_only = $a_val;
102  }
+ Here is the caller graph for this function:

◆ setTableGUI()

ilAdvancedMDRecordGUI::setTableGUI (   $a_val)

Set table.

Parameters
object$a_valtable gui class

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

609  {
610  $this->table_gui = $a_val;
611  }

◆ showECSStart()

ilAdvancedMDRecordGUI::showECSStart (   $def)
private

Show special form for ecs start.

private

Parameters
objectilAdvMDFieldDefinition

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

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

443  {
444  global $ilUser;
445 
446  $this->lng->loadLanguageModule('ecs');
447 
448  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
449  $value_start = ilAdvancedMDValue::_getInstance($this->obj_id,$def->getFieldId());
450 
451  $unixtime = $value_start->getValue() ? $value_start->getValue() : mktime(8,0,0,date('m'),date('d'),date('Y'));
452 
453  $time = new ilDateTimeInputGUI($this->lng->txt('ecs_event_appointment'),'md['.$def->getFieldId().']');
454  $time->setShowTime(true);
455  $time->setDate(new ilDateTime($unixtime,IL_CAL_UNIX));
456  $time->enableDateActivation($this->lng->txt('enabled'),
457  'md_activated['.$def->getFieldId().']',
458  $value_start->getValue() ? true : false);
459  $time->setDisabled($value_start->isDisabled());
460 
462  if($field_id = $mapping->getMappingByECSName(0,'end'))
463  {
464  $value_end = ilAdvancedMDValue::_getInstance($this->obj_id,$field_id);
465 
466  list($hours,$minutes) = $this->parseDuration($value_start->getValue(),$value_end->getValue());
467 
468  $duration = new ilDurationInputGUI($this->lng->txt('ecs_duration'),'ecs_duration');
469  $duration->setHours($hours);
470  $duration->setMinutes($minutes);
471  #$duration->setInfo($this->lng->txt('ecs_duration_info'));
472  $duration->setShowHours(true);
473  $duration->setShowMinutes(true);
474  $time->addSubItem($duration);
475  }
476 
477  if($field_id = $mapping->getMappingByECSName(0,'cycle'))
478  {
479  $value = ilAdvancedMDValue::_getInstance($this->obj_id,$field_id);
480  $cycle_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
481  switch($cycle_def->getFieldType())
482  {
484  $text = new ilTextInputGUI($cycle_def->getTitle(),'md['.$cycle_def->getFieldId().']');
485  $text->setValue($value->getValue());
486  $text->setSize(20);
487  $text->setMaxLength(512);
488  $text->setDisabled($value->isDisabled());
489  $time->addSubItem($text);
490  break;
491 
493  $select = new ilSelectInputGUI($cycle_def->getTitle(),'md['.$cycle_def->getFieldId().']');
494  $select->setOptions($cycle_def->getFieldValuesForSelect());
495  $select->setValue($value->getValue());
496  $select->setDisabled($value->isDisabled());
497  $time->addSubItem($select);
498  break;
499  }
500  }
501  if($field_id = $mapping->getMappingByECSName(0,'room'))
502  {
503  $value = ilAdvancedMDValue::_getInstance($this->obj_id,$field_id);
504  $room_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
505  switch($room_def->getFieldType())
506  {
508  $text = new ilTextInputGUI($room_def->getTitle(),'md['.$room_def->getFieldId().']');
509  $text->setValue($value->getValue());
510  $text->setSize(20);
511  $text->setMaxLength(512);
512  $text->setDisabled($value->isDisabled());
513  $time->addSubItem($text);
514  break;
515 
517  $select = new ilSelectInputGUI($room_def->getTitle(),'md['.$room_def->getFieldId().']');
518  $select->setOptions($cycle_def->getFieldValuesForSelect());
519  $select->setValue($value->getValue());
520  $select->setDisabled($value->isDisabled());
521  $time->addSubItem($select);
522  break;
523  }
524  }
525  $this->form->addItem($time);
526  }
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.
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
This class represents a text property in a property form.
Date and time handling
global $ilUser
Definition: imgupload.php:15
static _getInstance()
Get Singleton instance.
+ Here is the call graph for this function:

◆ writeEditForm()

ilAdvancedMDRecordGUI::writeEditForm ( )

Write edit form values to db.

Returns
bool

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

Referenced by ilGlossaryTermGUI\updateTerm().

247  {
248  if(!sizeof($this->editor_form))
249  {
250  return false;
251  }
252 
253  foreach($this->editor_form as $item)
254  {
255  $item["values"]->write();
256  }
257 
258  return true;
259  }
+ Here is the caller graph for this function:

Field Documentation

◆ $editor_form

ilAdvancedMDRecordGUI::$editor_form
protected

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

◆ $form

ilAdvancedMDRecordGUI::$form
private

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

Referenced by setPropertyForm().

◆ $lng

ilAdvancedMDRecordGUI::$lng
protected

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

Referenced by __construct().

◆ $mode

ilAdvancedMDRecordGUI::$mode
private

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

◆ $obj_id

ilAdvancedMDRecordGUI::$obj_id
private

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

◆ $obj_type

ilAdvancedMDRecordGUI::$obj_type
private

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

◆ $search_values

ilAdvancedMDRecordGUI::$search_values = array()
private

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

◆ $sub_type

ilAdvancedMDRecordGUI::$sub_type
private

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

◆ MODE_EDITOR

◆ MODE_FILTER

const ilAdvancedMDRecordGUI::MODE_FILTER = 5

◆ MODE_INFO

const ilAdvancedMDRecordGUI::MODE_INFO = 3

◆ MODE_REC_SELECTION

◆ MODE_SEARCH

const ilAdvancedMDRecordGUI::MODE_SEARCH = 2

◆ MODE_TABLE_CELLS

const ilAdvancedMDRecordGUI::MODE_TABLE_CELLS = 7

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

◆ MODE_TABLE_HEAD

const ilAdvancedMDRecordGUI::MODE_TABLE_HEAD = 6

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


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