ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjectMetaDataGUI Class Reference

Class ilObjectMetaDataGUI. More...

+ Collaboration diagram for ilObjectMetaDataGUI:

Public Member Functions

 __construct (ilObject $a_object=null, $a_sub_type=null, $a_sub_id=null)
 Construct. More...
 
 executeCommand ()
 
 addMDObserver ($a_class, $a_method, $a_section)
 
 getTab ($a_base_class=null)
 
 getBlockHTML (array $a_cmds=null, $a_callback=null)
 
 getKeyValueList ()
 

Protected Member Functions

 getLOMType ()
 
 isAdvMDAvailable ()
 
 isLOMAvailable ()
 
 hasAdvancedMDSettings ()
 
 hasActiveRecords ()
 
 canEdit ()
 
 setSubTabs ($a_active)
 
 initEditForm ()
 
 edit (ilPropertyFormGUI $a_form=null)
 
 update ()
 

Protected Attributes

 $object
 
 $obj_id
 
 $obj_type
 
 $sub_type
 
 $sub_id
 
 $md_observers
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjectMetaDataGUI::__construct ( ilObject  $a_object = null,
  $a_sub_type = null,
  $a_sub_id = null 
)

Construct.

Parameters
ilObject$a_object
string$a_sub_type
Returns
self

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

References $lng.

29  {
30  global $lng;
31 
32  if($a_object)
33  {
34  $this->object = $a_object;
35  $this->obj_id = $a_object->getId();
36  $this->obj_type = $a_object->getType();
37  }
38  $this->sub_type = $a_sub_type;
39  $this->sub_id = $a_sub_id;
40 
41  if(!$this->sub_type)
42  {
43  $this->sub_type = "-";
44  }
45 
46  $lng->loadLanguageModule("meta");
47  }
getId()
get object id public
getType()
get object type public
global $lng
Definition: privfeed.php:17

Member Function Documentation

◆ addMDObserver()

ilObjectMetaDataGUI::addMDObserver (   $a_class,
  $a_method,
  $a_section 
)

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

References array.

Referenced by ilSCORM2004ChapterGUI\executeCommand(), ilSCORM2004ScoGUI\executeCommand(), ilStructureObjectGUI\executeCommand(), and ilObjMediaObjectGUI\executeCommand().

94  {
95  $this->md_observers[] = array(
96  "class" => $a_class,
97  "method" => $a_method,
98  "section" => $a_section
99  );
100  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ canEdit()

ilObjectMetaDataGUI::canEdit ( )
protected

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

References hasActiveRecords().

Referenced by getTab(), and setSubTabs().

175  {
176  if($this->hasActiveRecords() &&
177  $this->obj_id)
178  {
179  if($this->sub_type == "-" ||
180  $this->sub_id)
181  {
182  return true;
183  }
184  }
185  return false;
186  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit()

ilObjectMetaDataGUI::edit ( ilPropertyFormGUI  $a_form = null)
protected

Definition at line 289 of file class.ilObjectMetaDataGUI.php.

References $tpl, and initEditForm().

Referenced by update().

290  {
291  global $tpl;
292 
293  if(!$a_form)
294  {
295  $a_form = $this->initEditForm();
296  }
297 
298  $tpl->setContent($a_form->getHTML());
299  }
global $tpl
Definition: ilias.php:8
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjectMetaDataGUI::executeCommand ( )

Definition at line 49 of file class.ilObjectMetaDataGUI.php.

References $cmd, $ilCtrl, getLOMType(), and setSubTabs().

50  {
51  global $ilCtrl;
52 
53  $next_class = $ilCtrl->getNextClass($this);
54  $cmd = $ilCtrl->getCmd("edit");
55 
56  switch($next_class)
57  {
58  case 'ilmdeditorgui':
59  $this->setSubTabs("lom");
60  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
61  $md_gui = new ilMDEditorGUI((int)$this->obj_id, (int)$this->sub_id, $this->getLOMType());
62  // custom observers?
63  if(is_array($this->md_observers))
64  {
65  foreach($this->md_observers as $observer)
66  {
67  $md_gui->addObserver($observer["class"], $observer["method"], $observer["section"]);
68  }
69  }
70  // "default" repository object observer
71  else if(!$this->sub_id &&
72  $this->object)
73  {
74  $md_gui->addObserver($this->object, 'MDUpdateListener', 'General');
75  }
76  $ilCtrl->forwardCommand($md_gui);
77  break;
78 
79  case 'iladvancedmdsettingsgui':
80  $this->setSubTabs("advmddef");
81  include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDSettingsGUI.php';
82  $advmdgui = new ilAdvancedMDSettingsGUI($this->obj_id, $this->obj_type, $this->sub_type);
83  $ilCtrl->forwardCommand($advmdgui);
84  break;
85 
86  default:
87  $this->setSubTabs("advmd");
88  $this->$cmd();
89  break;
90  }
91  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ getBlockHTML()

ilObjectMetaDataGUI::getBlockHTML ( array  $a_cmds = null,
  $a_callback = null 
)

Definition at line 332 of file class.ilObjectMetaDataGUI.php.

References $html, $lng, $obj_id, $sub_id, $sub_type, $url, and ilAdvancedMDRecord\_getSelectedRecordsByObject().

333  {
334  global $lng;
335 
336  $html = "";
337 
338  include_once "Services/Object/classes/class.ilObjectMetaDataBlockGUI.php";
339  include_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php";
340  include_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php";
341  foreach(ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type) as $record)
342  {
343  $block = new ilObjectMetaDataBlockGUI($record, $a_callback);
344  $block->setValues(new ilAdvancedMDValues($record->getRecordId(), $this->obj_id, $this->sub_type, $this->sub_id));
345  if($a_cmds)
346  {
347  foreach($a_cmds as $caption => $url)
348  {
349  $block->addBlockCommand($url, $lng->txt($caption), "_top");
350  }
351  }
352  $html.= $block->getHTML();
353  }
354 
355  return $html;
356  }
$url
Definition: shib_logout.php:72
static _getSelectedRecordsByObject($a_obj_type, $a_obj_id, $a_sub_type="")
Get selected records by object.
global $lng
Definition: privfeed.php:17
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ getKeyValueList()

ilObjectMetaDataGUI::getKeyValueList ( )

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

References $html, $obj_id, $sub_id, $sub_type, ilAdvancedMDRecord\_getSelectedRecordsByObject(), ilADTFactory\getInstance(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

365  {
366  $html = "";
367  $sep = "";
368 
371 
372  include_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php";
373  include_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php";
374  foreach(ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type) as $record)
375  {
376  $vals = new ilAdvancedMDValues($record->getRecordId(), $this->obj_id, $this->sub_type, $this->sub_id);
377 
378 
379  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
380  include_once('Services/ADT/classes/class.ilADTFactory.php');
381 
382  // this correctly binds group and definitions
383  $vals->read();
384 
385  $defs = $vals->getDefinitions();
386  foreach ($vals->getADTGroup()->getElements() as $element_id => $element)
387  {
388  if($element instanceof ilADTLocation)
389  {
390  continue;
391  }
392 
393  $html.= $sep.$defs[$element_id]->getTitle().": ";
394 
395  if($element->isNull())
396  {
397  $value = "-";
398  }
399  else
400  {
401  $value = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
402 
403  $value = $value->getHTML();
404  }
405  $html.= $value;
406  $sep = ",    ";
407  }
408 
409  }
410 
412 
413  return $html;
414  }
static setUseRelativeDates($a_status)
set use relative dates
static getInstance()
Get singleton.
static useRelativeDates()
check if relative dates are used
static _getSelectedRecordsByObject($a_obj_type, $a_obj_id, $a_sub_type="")
Get selected records by object.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ getLOMType()

ilObjectMetaDataGUI::getLOMType ( )
protected

Definition at line 102 of file class.ilObjectMetaDataGUI.php.

References $obj_type, and $sub_type.

Referenced by executeCommand(), and isLOMAvailable().

103  {
104  if($this->sub_type != "-" &&
105  $this->sub_id)
106  {
107  return $this->sub_type;
108  }
109  else
110  {
111  return $this->obj_type;
112  }
113  }
+ Here is the caller graph for this function:

◆ getTab()

ilObjectMetaDataGUI::getTab (   $a_base_class = null)

Definition at line 188 of file class.ilObjectMetaDataGUI.php.

References $ilCtrl, $path, array, canEdit(), hasAdvancedMDSettings(), isAdvMDAvailable(), and isLOMAvailable().

Referenced by ilGlossaryTermGUI\getTabs(), ilObjMediaObjectGUI\getTabs(), ilSCORM2004ChapterGUI\setTabs(), ilSCORM2004ScoGUI\setTabs(), and ilStructureObjectGUI\setTabs().

189  {
190  global $ilCtrl;
191 
192  if(!$a_base_class)
193  {
194  $path = array();
195  }
196  else
197  {
198  $path = array($a_base_class);
199  }
200  $path[] = "ilobjectmetadatagui";
201 
202  $link = null;
203  if($this->isLOMAvailable())
204  {
205  $path[] = "ilmdeditorgui";
206  $link = $ilCtrl->getLinkTargetByClass($path, "listSection");
207  }
208  else if($this->isAdvMDAvailable())
209  {
210  if($this->canEdit())
211  {
212  $link = $ilCtrl->getLinkTarget($this, "edit");
213  }
214  else if($this->hasAdvancedMDSettings())
215  {
216  $path[] = "iladvancedmdsettingsgui";
217  $link = $ilCtrl->getLinkTargetByClass($path, "showRecords");
218  }
219  }
220  return $link;
221  }
$path
Definition: aliased.php:25
global $ilCtrl
Definition: ilias.php:18
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:

◆ hasActiveRecords()

ilObjectMetaDataGUI::hasActiveRecords ( )
protected

Definition at line 168 of file class.ilObjectMetaDataGUI.php.

References ilAdvancedMDRecord\_getSelectedRecordsByObject().

Referenced by canEdit().

169  {
170  include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
171  return (bool)sizeof(ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type));
172  }
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:

◆ hasAdvancedMDSettings()

ilObjectMetaDataGUI::hasAdvancedMDSettings ( )
protected

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

References ilContainer\_lookupContainerSetting(), and ilObjectServiceSettingsGUI\CUSTOM_METADATA.

Referenced by getTab(), and setSubTabs().

153  {
154  if($this->sub_id)
155  {
156  return false;
157  }
158 
159  include_once 'Services/Container/classes/class.ilContainer.php';
160  include_once 'Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
161 
163  $this->obj_id,
165  false);
166  }
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initEditForm()

ilObjectMetaDataGUI::initEditForm ( )
protected

Definition at line 264 of file class.ilObjectMetaDataGUI.php.

References $ilCtrl, $lng, and ilAdvancedMDRecordGUI\MODE_EDITOR.

Referenced by edit(), and update().

265  {
266  global $ilCtrl, $lng;
267 
268  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
269  $form = new ilPropertyFormGUI();
270  $form->setFormAction($ilCtrl->getFormAction($this, "update"));
271  $form->setTitle($lng->txt("meta_tab_advmd"));
272 
273  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
274  $this->record_gui = new ilAdvancedMDRecordGUI(
276  $this->obj_type,
277  $this->obj_id,
278  $this->sub_type,
279  $this->sub_id
280  );
281  $this->record_gui->setPropertyForm($form);
282  $this->record_gui->parse();
283 
284  $form->addCommandButton("update", $lng->txt("save"));
285 
286  return $form;
287  }
This class represents a property form user interface.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ isAdvMDAvailable()

ilObjectMetaDataGUI::isAdvMDAvailable ( )
protected

Definition at line 115 of file class.ilObjectMetaDataGUI.php.

References ilAdvancedMDRecord\_getAssignableObjectTypes().

Referenced by getTab(), and setSubTabs().

116  {
117  include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
118  foreach(ilAdvancedMDRecord::_getAssignableObjectTypes(false) as $item)
119  {
120  if($item["obj_type"] == $this->obj_type)
121  {
122  return ((!$item["sub_type"] && $this->sub_type == "-") ||
123  ($item["sub_type"] == $this->sub_type));
124  }
125  }
126  return false;
127  }
static _getAssignableObjectTypes($a_include_text=false)
Get assignable object type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLOMAvailable()

ilObjectMetaDataGUI::isLOMAvailable ( )
protected

Definition at line 129 of file class.ilObjectMetaDataGUI.php.

References array, and getLOMType().

Referenced by getTab(), and setSubTabs().

130  {
131  $type = $this->getLOMType();
132  if($type == $this->sub_type)
133  {
134  $type = $this->obj_type.":".$type;
135  }
136 
137  return (($this->obj_id || !$this->obj_type) &&
138  in_array($type, array(
139  "crs",
140  "file",
141  "glo", "glo:gdf",
142  "svy", "spl",
143  "tst", "qpl",
144  ":mob",
145  "webr",
146  "htlm",
147  "lm", "lm:st", "lm:pg",
148  "sahs", "sahs:sco", "sahs:page"
149  )));
150  }
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:

◆ setSubTabs()

ilObjectMetaDataGUI::setSubTabs (   $a_active)
protected

Definition at line 223 of file class.ilObjectMetaDataGUI.php.

References $ilCtrl, $lng, canEdit(), hasAdvancedMDSettings(), isAdvMDAvailable(), and isLOMAvailable().

Referenced by executeCommand().

224  {
225  global $ilTabs, $lng, $ilCtrl;
226 
227  if($this->isLOMAvailable())
228  {
229  $ilTabs->addSubTab("lom",
230  $lng->txt("meta_tab_lom"),
231  $ilCtrl->getLinkTargetByClass("ilmdeditorgui", "listSection")
232  );
233  }
234 
235  if($this->isAdvMDAvailable())
236  {
237  if($this->canEdit())
238  {
239  $ilTabs->addSubTab("advmd",
240  $lng->txt("meta_tab_advmd"),
241  $ilCtrl->getLinkTarget($this, "edit"));
242  }
243 
244  if($this->hasAdvancedMDSettings())
245  {
246  $ilTabs->addSubTab("advmddef",
247  $lng->txt("meta_tab_advmd_def"),
248  $ilCtrl->getLinkTargetByClass("iladvancedmdsettingsgui", "showRecords"));
249 
250  $ilTabs->addSubTab("md_adv_file_list",
251  $lng->txt("md_adv_file_list"),
252  $ilCtrl->getLinkTargetByClass("iladvancedmdsettingsgui", "showFiles"));
253  }
254  }
255 
256  $ilTabs->activateSubTab($a_active);
257  }
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilObjectMetaDataGUI::update ( )
protected

Definition at line 301 of file class.ilObjectMetaDataGUI.php.

References $ilCtrl, $lng, edit(), initEditForm(), and ilUtil\sendSuccess().

302  {
303  global $lng, $ilCtrl;
304 
305  $form = $this->initEditForm();
306  if($form->checkInput() &&
307  $this->record_gui->importEditFormPostValues())
308  {
309  $this->record_gui->writeEditForm();
310 
311  // Update ECS content
312  if($this->obj_type == "crs")
313  {
314  include_once "Modules/Course/classes/class.ilECSCourseSettings.php";
315  $ecs = new ilECSCourseSettings($this->object);
316  $ecs->handleContentUpdate();
317  }
318 
319  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
320  $ilCtrl->redirect($this, "edit");
321  }
322 
323  $form->setValuesByPost();
324  $this->edit($form);
325  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
edit(ilPropertyFormGUI $a_form=null)
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
Class ilECSCourseSettings.
+ Here is the call graph for this function:

Field Documentation

◆ $md_observers

ilObjectMetaDataGUI::$md_observers
protected

Definition at line 19 of file class.ilObjectMetaDataGUI.php.

◆ $obj_id

ilObjectMetaDataGUI::$obj_id
protected

Definition at line 15 of file class.ilObjectMetaDataGUI.php.

Referenced by getBlockHTML(), and getKeyValueList().

◆ $obj_type

ilObjectMetaDataGUI::$obj_type
protected

Definition at line 16 of file class.ilObjectMetaDataGUI.php.

Referenced by getLOMType().

◆ $object

ilObjectMetaDataGUI::$object
protected

Definition at line 14 of file class.ilObjectMetaDataGUI.php.

◆ $sub_id

ilObjectMetaDataGUI::$sub_id
protected

Definition at line 18 of file class.ilObjectMetaDataGUI.php.

Referenced by getBlockHTML(), and getKeyValueList().

◆ $sub_type

ilObjectMetaDataGUI::$sub_type
protected

Definition at line 17 of file class.ilObjectMetaDataGUI.php.

Referenced by getBlockHTML(), getKeyValueList(), and getLOMType().


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