ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMDEditorGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 // @FIXME
5 define('IL_TLT_MAX_HOURS', 99);
6 
7 
18 {
19  public $ctrl = null;
20  public $lng = null;
21  public $tpl = null;
22  public $md_obj = null;
23 
24  public $observers = array();
25 
26  public $rbac_id = null;
27  public $obj_id = null;
28  public $obj_type = null;
29 
30  public function __construct($a_rbac_id, $a_obj_id, $a_obj_type)
31  {
32  global $DIC;
33 
34  $this->lng = $DIC->language();
35  $this->tpl = $DIC['tpl'];
36  $this->tabs_gui = $DIC->tabs();
37  $this->ctrl = $DIC->ctrl();
38 
39  $this->ui_factory = $DIC->ui()->factory();
40  $this->ui_renderer = $DIC->ui()->renderer();
41 
42  $this->md_obj = new ilMD($a_rbac_id, $a_obj_id, $a_obj_type);
43 
44  $this->lng->loadLanguageModule('meta');
45 
46  include_once('Services/MetaData/classes/class.ilMDSettings.php');
47  $this->md_settings = ilMDSettings::_getInstance();
48  }
49 
50  public function executeCommand()
51  {
52  global $DIC;
53 
54  $rbacsystem = $DIC['rbacsystem'];
55 
56  $next_class = $this->ctrl->getNextClass($this);
57 
58  $cmd = $this->ctrl->getCmd();
59  switch ($next_class) {
60  case 'ilformpropertydispatchgui':
61  // see ilTaxMDGUI / ilTaxSelectInputGUI
62  include_once './Services/Form/classes/class.ilFormPropertyDispatchGUI.php';
63  $form_prop_dispatch = new ilFormPropertyDispatchGUI();
64  $this->initFilter();
65  $item = $this->getFilterItemByPostVar($_GET["postvar"]);
66  $form_prop_dispatch->setItem($item);
67  return $this->ctrl->forwardCommand($form_prop_dispatch);
68 
69  default:
70  if (!$cmd) {
71  $cmd = "listSection";
72  }
73  $this->$cmd();
74  break;
75  }
76  return true;
77  }
78 
79 
80  public function debug()
81  {
82  include_once 'Services/MetaData/classes/class.ilMD2XML.php';
83 
84 
85  $xml_writer = new ilMD2XML($this->md_obj->getRBACId(), $this->md_obj->getObjId(), $this->md_obj->getObjType());
86  $xml_writer->startExport();
87 
88  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
89 
90  $this->__setTabs('meta_general');
91 
92  $this->tpl->setVariable("MD_CONTENT", htmlentities($xml_writer->getXML()));
93 
94  return true;
95  }
96 
100  public function listQuickEdit_scorm()
101  {
102  global $DIC;
103 
104  $lng = $DIC['lng'];
105  if (!is_object($this->md_section = $this->md_obj->getGeneral())) {
106  $this->md_section = $this->md_obj->addGeneral();
107  $this->md_section->save();
108  }
109 
110  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
111 
112  $this->__setTabs('meta_quickedit');
113 
114  $this->tpl->addBlockFile('MD_CONTENT', 'md_content', 'tpl.md_quick_edit_scorm.html', 'Services/MetaData');
115 
116  $this->ctrl->setReturn($this, 'listGeneral');
117  $this->ctrl->setParameter($this, 'section', 'meta_general');
118  $this->tpl->setVariable("EDIT_ACTION", $this->ctrl->getFormAction($this));
119 
120  $this->tpl->setVariable("TXT_QUICK_EDIT", $this->lng->txt("meta_quickedit"));
121  $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("meta_language"));
122  $this->tpl->setVariable("TXT_KEYWORD", $this->lng->txt("meta_keyword"));
123  $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("meta_description"));
124  $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
125 
126  // Language
127  $first = true;
128  foreach ($ids = $this->md_section->getLanguageIds() as $id) {
129  $md_lan = $this->md_section->getLanguage($id);
130 
131  if ($first) {
132  $this->tpl->setCurrentBlock("language_head");
133  $this->tpl->setVariable("ROWSPAN_LANG", count($ids));
134  $this->tpl->setVariable("LANGUAGE_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
135  $this->tpl->parseCurrentBlock();
136  $first = false;
137  }
138 
139  if (count($ids) > 1) {
140  $this->ctrl->setParameter($this, 'meta_index', $id);
141  $this->ctrl->setParameter($this, 'meta_path', 'meta_language');
142 
143  $this->tpl->setCurrentBlock("language_delete");
144  $this->tpl->setVariable("LANGUAGE_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
145  $this->tpl->setVariable("LANGUAGE_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
146  $this->tpl->parseCurrentBlock();
147  }
148  $this->tpl->setCurrentBlock("language_loop");
149  $this->tpl->setVariable("LANGUAGE_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect(
150  'gen_language[' . $id . '][language]',
151  $md_lan->getLanguageCode()
152  ));
153  $this->tpl->parseCurrentBlock();
154  }
155 
156  if ($first) {
157  $this->tpl->setCurrentBlock("language_head");
158  $this->tpl->setVariable("ROWSPAN_LANG", 1);
159  $this->tpl->setVariable("LANGUAGE_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
160  $this->tpl->parseCurrentBlock();
161  $this->tpl->setCurrentBlock("language_loop");
162  $this->tpl->setVariable("LANGUAGE_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect(
163  'gen_language[][language]',
164  ""
165  ));
166  $this->tpl->parseCurrentBlock();
167  }
168 
169  // TITLE
170  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
171  $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($this->md_section->getTitle()));
172  $this->tpl->setVariable("VAL_TITLE_LANGUAGE", $this->__showLanguageSelect(
173  'gen_title_language',
174  $this->md_section->getTitleLanguageCode()
175  ));
176 
177  // DESCRIPTION
178  foreach ($ids = $this->md_section->getDescriptionIds() as $id) {
179  $md_des = $this->md_section->getDescription($id);
180 
181  if (count($ids) > 1) {
182  $this->ctrl->setParameter($this, 'meta_index', $id);
183  $this->ctrl->setParameter($this, 'meta_path', 'meta_description');
184 
185  $this->tpl->setCurrentBlock("description_delete");
186  $this->tpl->setVariable("DESCRIPTION_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
187  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
188  $this->tpl->parseCurrentBlock();
189  }
190 
191  $this->tpl->setCurrentBlock("description_loop");
192  $this->tpl->setVariable("DESCRIPTION_LOOP_NO", $id);
193  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DESCRIPTION", $this->lng->txt("meta_description"));
194  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
195  $this->tpl->setVariable("DESCRIPTION_LOOP_VAL", ilUtil::prepareFormOutput($md_des->getDescription()));
196  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
197  $this->tpl->setVariable("DESCRIPTION_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect(
198  "gen_description[" . $id . '][language]',
199  $md_des->getDescriptionLanguageCode()
200  ));
201  $this->tpl->parseCurrentBlock();
202  }
203 
204  // KEYWORD
205  $first = true;
206  $keywords = array();
207  foreach ($ids = $this->md_section->getKeywordIds() as $id) {
208  $md_key = $this->md_section->getKeyword($id);
209  $keywords[$md_key->getKeywordLanguageCode()][]
210  = $md_key->getKeyword();
211  }
212 
213  foreach ($keywords as $lang => $keyword_set) {
214  if ($first) {
215  $this->tpl->setCurrentBlock("keyword_head");
216  $this->tpl->setVariable("ROWSPAN_KEYWORD", count($keywords));
217  $this->tpl->setVariable("TXT_COMMA_SEP2", $this->lng->txt('comma_separated'));
218  $this->tpl->setVariable("KEYWORD_LOOP_TXT_KEYWORD", $this->lng->txt("keywords"));
219  $this->tpl->parseCurrentBlock();
220  $first = false;
221  }
222 
223  $this->tpl->setCurrentBlock("keyword_loop");
224  $this->tpl->setVariable("KEYWORD_LOOP_VAL", ilUtil::prepareFormOutput(
225  implode(", ", $keyword_set)
226  ));
227  $this->tpl->setVariable("LANG", $lang);
228  $this->tpl->setVariable("KEYWORD_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect(
229  "keyword[language][$lang]",
230  $lang
231  ));
232  $this->tpl->parseCurrentBlock();
233  }
234 
235  if (count($keywords) == 0) {
236  $this->tpl->setCurrentBlock("keyword_head");
237  $this->tpl->setVariable("ROWSPAN_KEYWORD", 1);
238  $this->tpl->setVariable("TXT_COMMA_SEP2", $this->lng->txt('comma_separated'));
239  $this->tpl->setVariable("KEYWORD_LOOP_TXT_KEYWORD", $this->lng->txt("keywords"));
240  $this->tpl->parseCurrentBlock();
241  $this->tpl->setCurrentBlock("keyword_loop");
242  $this->tpl->setVariable("KEYWORD_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect(
243  "keyword[language][$lang]",
244  $lang
245  ));
246  }
247 
248  // Lifecycle...
249  // experts
250  $this->tpl->setVariable("TXT_EXPERTS", $lng->txt('meta_subjectmatterexpert'));
251  $this->tpl->setVariable("TXT_COMMA_SEP", $this->lng->txt('comma_separated'));
252  $this->tpl->setVariable("TXT_SCOPROP_EXPERT", $this->lng->txt('sco_propagate'));
253  if (is_object($this->md_section = $this->md_obj->getLifecycle())) {
254  $sep = $ent_str = "";
255  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
256  $md_con = $this->md_section->getContribute($con_id);
257  if ($md_con->getRole() == "SubjectMatterExpert") {
258  foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
259  $md_ent = $md_con->getEntity($ent_id);
260  $ent_str = $ent_str . $sep . $md_ent->getEntity();
261  $sep = ", ";
262  }
263  }
264  }
265  $this->tpl->setVariable("EXPERTS_VAL", ilUtil::prepareFormOutput($ent_str));
266  }
267  // InstructionalDesigner
268  $this->tpl->setVariable("TXT_DESIGNERS", $lng->txt('meta_instructionaldesigner'));
269  $this->tpl->setVariable("TXT_SCOPROP_DESIGNERS", $this->lng->txt('sco_propagate'));
270  if (is_object($this->md_section = $this->md_obj->getLifecycle())) {
271  $sep = $ent_str = "";
272  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
273  $md_con = $this->md_section->getContribute($con_id);
274  if ($md_con->getRole() == "InstructionalDesigner") {
275  foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
276  $md_ent = $md_con->getEntity($ent_id);
277  $ent_str = $ent_str . $sep . $md_ent->getEntity();
278  $sep = ", ";
279  }
280  }
281  }
282  $this->tpl->setVariable("DESIGNERS_VAL", ilUtil::prepareFormOutput($ent_str));
283  }
284  // Point of Contact
285  $this->tpl->setVariable("TXT_POC", $lng->txt('meta_pointofcontact'));
286  $this->tpl->setVariable("TXT_SCOPROP_POC", $this->lng->txt('sco_propagate'));
287  if (is_object($this->md_section = $this->md_obj->getLifecycle())) {
288  $sep = $ent_str = "";
289  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
290  $md_con = $this->md_section->getContribute($con_id);
291  if ($md_con->getRole() == "PointOfContact") {
292  foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
293  $md_ent = $md_con->getEntity($ent_id);
294  $ent_str = $ent_str . $sep . $md_ent->getEntity();
295  $sep = ", ";
296  }
297  }
298  }
299  $this->tpl->setVariable("POC_VAL", ilUtil::prepareFormOutput($ent_str));
300  }
301 
302  $this->tpl->setVariable("TXT_STATUS", $this->lng->txt('meta_status'));
303  if (!is_object($this->md_section = $this->md_obj->getLifecycle())) {
304  $this->md_section = $this->md_obj->addLifecycle();
305  $this->md_section->save();
306  }
307  if (is_object($this->md_section = $this->md_obj->getLifecycle())) {
308  $this->tpl->setVariable("SEL_STATUS", ilMDUtilSelect::_getStatusSelect(
309  $this->md_section->getStatus(),
310  "lif_status",
311  array(0 => $this->lng->txt('meta_please_select'))
312  ));
313  }
314 
315  // Rights...
316  // Copyright
317  // smeyer 2018-09-14 not supported
318 
319  $tlt = array(0,0,0,0,0);
320  $valid = true;
321  if (is_object($this->md_section = $this->md_obj->getEducational())) {
322  include_once 'Services/MetaData/classes/class.ilMDUtils.php';
323 
324  if (!$tlt = ilMDUtils::_LOMDurationToArray($this->md_section->getTypicalLearningTime())) {
325  if (strlen($this->md_section->getTypicalLearningTime())) {
326  $tlt = array(0,0,0,0,0);
327  $valid = false;
328  }
329  }
330  }
331  $this->tpl->setVariable("TXT_MONTH", $this->lng->txt('md_months'));
332  $this->tpl->setVariable("SEL_MONTHS", $this->__buildMonthsSelect($tlt[0]));
333  $this->tpl->setVariable("SEL_DAYS", $this->__buildDaysSelect($tlt[1]));
334 
335  $this->tpl->setVariable("TXT_DAYS", $this->lng->txt('md_days'));
336  $this->tpl->setVariable("TXT_TIME", $this->lng->txt('md_time'));
337 
338  $this->tpl->setVariable("TXT_TYPICAL_LEARN_TIME", $this->lng->txt('meta_typical_learning_time'));
339  $this->tpl->setVariable("SEL_TLT", ilUtil::makeTimeSelect(
340  'tlt',
341  $tlt[4] ? false : true,
342  $tlt[2],
343  $tlt[3],
344  $tlt[4],
345  false
346  ));
347  $this->tpl->setVariable("TLT_HINT", $tlt[4] ? '(hh:mm:ss)' : '(hh:mm)');
348 
349  if (!$valid) {
350  $this->tpl->setCurrentBlock("tlt_not_valid");
351  $this->tpl->setVariable("TXT_CURRENT_VAL", $this->lng->txt('meta_current_value'));
352  $this->tpl->setVariable("TLT", $this->md_section->getTypicalLearningTime());
353  $this->tpl->setVariable("INFO_TLT_NOT_VALID", $this->lng->txt('meta_info_tlt_not_valid'));
354  $this->tpl->parseCurrentBlock();
355  }
356 
357 
358  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt('save'));
359  }
360 
361  public function listQuickEdit()
362  {
363  global $DIC;
364 
365  $tpl = $DIC['tpl'];
366 
367  if (!is_object($this->md_section = $this->md_obj->getGeneral())) {
368  $this->md_section = $this->md_obj->addGeneral();
369  $this->md_section->save();
370  }
371 
372  $this->__setTabs('meta_quickedit');
373 
374 
375  $interruptive_modal = $this->getChangeCopyrightModal();
376  $interruptive_signal = '';
377  $modal_content = '';
378  if ($interruptive_modal != null) {
379  $interruptive_signal = $interruptive_modal->getShowSignal();
380  $modal_content = $this->ui_renderer->render($interruptive_modal);
381  }
382  $form = $this->initQuickEditForm($interruptive_signal);
383 
384  $tpl->setContent(
385  $modal_content . $form->getHTML()
386  );
387  }
388 
392  public function initQuickEditForm($a_signal_id)
393  {
394  global $DIC;
395 
396  $lng = $DIC['lng'];
397  $ilCtrl = $DIC['ilCtrl'];
398  $tree = $DIC['tree'];
399 
400  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
401  $this->form = new ilPropertyFormGUI();
402  $this->form->setId('ilquickeditform');
403  $this->form->setShowTopButtons(false);
404 
405  // title
406  $ti = new ilTextInputGUI($this->lng->txt("title"), "gen_title");
407  $ti->setMaxLength(200);
408  $ti->setSize(50);
409  if ($this->md_obj->getObjType() != 'sess') {
410  $ti->setRequired(true);
411  }
412  $ti->setValue($this->md_section->getTitle());
413  $this->form->addItem($ti);
414 
415  // description(s)
416  foreach ($ids = $this->md_section->getDescriptionIds() as $id) {
417  $md_des = $this->md_section->getDescription($id);
418 
419  $ta = new ilTextAreaInputGUI($this->lng->txt("meta_description"), "gen_description[" . $id . "][description]");
420  $ta->setCols(50);
421  $ta->setRows(4);
422  $ta->setValue($md_des->getDescription());
423  if (count($ids) > 1) {
424  $ta->setInfo($this->lng->txt("meta_l_" . $md_des->getDescriptionLanguageCode()));
425  }
426 
427  $this->form->addItem($ta);
428  }
429 
430  // language(s)
431  $first = "";
433  foreach ($ids = $this->md_section->getLanguageIds() as $id) {
434  $md_lan = $this->md_section->getLanguage($id);
435  $first_lang = $md_lan->getLanguageCode();
436  $si = new ilSelectInputGUI($this->lng->txt("meta_language"), "gen_language[" . $id . "][language]");
437  $si->setOptions($options);
438  $si->setValue($md_lan->getLanguageCode());
439  $this->form->addItem($si);
440  $first = false;
441  }
442  if ($first) {
443  $si = new ilSelectInputGUI($this->lng->txt("meta_language"), "gen_language[][language]");
444  $si->setOptions($options);
445  $this->form->addItem($si);
446  }
447 
448  // keyword(s)
449  $first = true;
450  $keywords = array();
451  foreach ($ids = $this->md_section->getKeywordIds() as $id) {
452  $md_key = $this->md_section->getKeyword($id);
453  if (trim($md_key->getKeyword()) != "") {
454  $keywords[$md_key->getKeywordLanguageCode()][]
455  = $md_key->getKeyword();
456  }
457  }
458  foreach ($keywords as $lang => $keyword_set) {
459  $kw = new ilTextInputGUI(
460  $this->lng->txt("keywords"),
461  "keywords[value][" . $lang . "]"
462  );
463  $kw->setDataSource($this->ctrl->getLinkTarget($this, "keywordAutocomplete", "", true));
464  $kw->setMaxLength(200);
465  $kw->setSize(50);
466  $kw->setMulti(true);
467  if (count($keywords) > 1) {
468  $kw->setInfo($this->lng->txt("meta_l_" . $lang));
469  }
470  $this->form->addItem($kw);
471  asort($keyword_set);
472  $kw->setValue($keyword_set);
473  }
474  if (count($keywords) == 0) {
475  $kw = new ilTextInputGUI(
476  $this->lng->txt("keywords"),
477  "keywords[value][" . $first_lang . "]"
478  );
479  $kw->setDataSource($this->ctrl->getLinkTarget($this, "keywordAutocomplete", "", true));
480  $kw->setMaxLength(200);
481  $kw->setSize(50);
482  $kw->setMulti(true);
483  $this->form->addItem($kw);
484  }
485 
486  // Lifecycle...
487  // Authors
488  $ta = new ilTextAreaInputGUI(
489  $this->lng->txt('authors') . "<br />" .
490  "(" . sprintf($this->lng->txt('md_separated_by'), $this->md_settings->getDelimiter()) . ")",
491  "life_authors"
492  );
493  $ta->setCols(50);
494  $ta->setRows(2);
495  if (is_object($this->md_section = $this->md_obj->getLifecycle())) {
496  $sep = $ent_str = "";
497  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
498  $md_con = $this->md_section->getContribute($con_id);
499  if ($md_con->getRole() == "Author") {
500  foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
501  $md_ent = $md_con->getEntity($ent_id);
502  $ent_str = $ent_str . $sep . $md_ent->getEntity();
503  $sep = $this->md_settings->getDelimiter() . " ";
504  }
505  }
506  }
507  $ta->setValue($ent_str);
508  }
509  $this->form->addItem($ta);
510 
511  // copyright
512  $this->listQuickEditCopyright($this->form);
513 
514 
515  // typical learning time
516  include_once("./Services/MetaData/classes/class.ilTypicalLearningTimeInputGUI.php");
517  $tlt = new ilTypicalLearningTimeInputGUI($this->lng->txt("meta_typical_learning_time"), "tlt");
518  $edu = $this->md_obj->getEducational();
519  if (is_object($edu)) {
520  $tlt->setValueByLOMDuration($edu->getTypicalLearningTime());
521  }
522  $this->form->addItem($tlt);
523 
524  $this->form->addCommandButton("updateQuickEdit", $lng->txt("save"), 'button_ilquickeditform');
525  $this->form->setTitle($this->lng->txt("meta_quickedit"));
526  $this->form->setFormAction($ilCtrl->getFormAction($this));
527 
528 
529  if (ilMDSettings::_getInstance()->isCopyrightSelectionActive()) {
530  $DIC->ui()->mainTemplate()->addJavaScript(
531  'Services/MetaData/js/ilMetaCopyrightListener.js'
532  );
533  $DIC->ui()->mainTemplate()->addOnLoadCode(
534  'il.MetaDataCopyrightListener.init("' .
535  $a_signal_id . '","copyright","form_ilquickeditform","button_ilquickeditform");'
536  );
537  }
538 
539 
540 
541  return $this->form;
542  }
543 
549  {
550  $md_settings = ilMDSettings::_getInstance();
551  $oer_settings = ilOerHarvesterSettings::getInstance();
552 
555  $this->md_obj->getRBACId(),
556  $this->md_obj->getObjId()
557  );
558 
559  //current id can be 0 for non predefined copyright.
560  //Todo add new DB column with copyright id instead of parse descriptions to get entry ID.
561  if ($description) {
563  } else {
565  }
566 
567  if (
568  !$this->md_settings->isCopyrightSelectionActive() ||
569  !count($cp_entries)
570  ) {
571  return true;
572  }
573 
574  $copyright = new ilRadioGroupInputGUI($this->lng->txt('meta_copyright'), 'copyright');
575  $copyright->setValue($current_id);
576 
577 
578  foreach ($cp_entries as $copyright_entry) {
579  $radio_entry = new ilRadioOption(
580  $copyright_entry->getTitle(),
581  $copyright_entry->getEntryId(),
582  $copyright_entry->getDescription()
583  );
584 
585  if ($copyright_entry->getOutdated()) {
586  $radio_entry->setTitle("(" . $this->lng->txt('meta_copyright_outdated') . ") " . $radio_entry->getTitle());
587  $radio_entry->setDisabled(true);
588  }
589 
590  if (
591  $oer_settings->supportsHarvesting($this->md_obj->getObjType()) &&
592  $oer_settings->isActiveCopyrightTemplate($copyright_entry->getEntryId())
593  ) {
594  // block harvesting
595  $blocked = new ilCheckboxInputGUI(
596  $this->lng->txt('meta_oer_blocked'),
597  'copyright_oer_blocked_' . $copyright_entry->getEntryId()
598  );
599  $blocked->setInfo($this->lng->txt('meta_oer_blocked_info'));
600  $blocked->setValue(1);
601  $status = new ilOerHarvesterObjectStatus($this->md_obj->getRBACId());
602  if ($status->isBlocked()) {
603  $blocked->setChecked(true);
604  }
605  $radio_entry->addSubItem($blocked);
606  }
607 
608 
609  $copyright->addOption($radio_entry);
610  }
611 
612  // add own selection
613  $own_selection = new ilRadioOption(
614  $this->lng->txt('meta_cp_own'),
615  'copyright_text'
616  );
617  $own_selection->setValue(0);
618 
619  // copyright text
620  $own_copyright = new ilTextAreaInputGUI(
621  '',
622  'copyright_text'
623  );
624  if ($current_id == 0) {
625  $own_copyright->setValue($description);
626  }
627  $own_selection->addSubItem($own_copyright);
628  $copyright->addOption($own_selection);
629  $form->addItem($copyright);
630  }
631 
638  public function keywordAutocomplete()
639  {
640  include_once("./Services/MetaData/classes/class.ilMDKeyword.php");
642  ilUtil::stripSlashes($_GET["term"]),
643  $this->md_obj->getObjType(),
644  $this->md_obj->getRBACId()
645  );
646 
647  $result = array();
648  $cnt = 0;
649  foreach ($res as $r) {
650  if ($cnt++ > 19) {
651  continue;
652  }
653  $entry = new stdClass();
654  $entry->value = $r;
655  $entry->label = $r;
656  $result[] = $entry;
657  }
658 
659  include_once './Services/JSON/classes/class.ilJsonUtil.php';
660  echo ilJsonUtil::encode($result);
661  exit;
662  }
663 
664 
668  public function updateQuickEdit()
669  {
670  ilLoggerFactory::getLogger('root')->dump($_REQUEST);
671 
672 
673  if (!trim($_POST['gen_title'])) {
674  if ($this->md_obj->getObjType() != 'sess') {
675  ilUtil::sendFailure($this->lng->txt('title_required'));
676  $this->listQuickEdit();
677  return false;
678  }
679  }
680 
681  // General values
682  $this->md_section = $this->md_obj->getGeneral();
683  $this->md_section->setTitle(ilUtil::stripSlashes($_POST['gen_title']));
684  // $this->md_section->setTitleLanguage(new ilMDLanguageItem($_POST['gen_title_language']));
685  $this->md_section->update();
686 
687  // Language
688  if (is_array($_POST['gen_language'])) {
689  foreach ($_POST['gen_language'] as $id => $data) {
690  if ($id > 0) {
691  $md_lan = $this->md_section->getLanguage($id);
692  $md_lan->setLanguage(new ilMDLanguageItem($data['language']));
693  $md_lan->update();
694  } else {
695  $md_lan = $this->md_section->addLanguage();
696  $md_lan->setLanguage(new ilMDLanguageItem($data['language']));
697  $md_lan->save();
698  }
699  }
700  }
701  // Description
702  if (is_array($_POST['gen_description'])) {
703  foreach ($_POST['gen_description'] as $id => $data) {
704  $md_des = $this->md_section->getDescription($id);
705  $md_des->setDescription(ilUtil::stripSlashes($data['description']));
706  // $md_des->setDescriptionLanguage(new ilMDLanguageItem($data['language']));
707  $md_des->update();
708  }
709  }
710 
711  // Keyword
712  if (is_array($_POST["keywords"]["value"])) {
713  include_once("./Services/MetaData/classes/class.ilMDKeyword.php");
714  ilMDKeyword::updateKeywords($this->md_section, $_POST["keywords"]["value"]);
715  }
716  $this->callListeners('General');
717 
718  // Copyright
719  if ($_POST['copyright'] || $_POST['copyright_text']) {
720  if (!is_object($this->md_section = $this->md_obj->getRights())) {
721  $this->md_section = $this->md_obj->addRights();
722  $this->md_section->save();
723  }
724  if ($_POST['copyright'] > 0) {
725  $this->md_section->setCopyrightAndOtherRestrictions("Yes");
726  $this->md_section->setDescription('il_copyright_entry__' . IL_INST_ID . '__' . (int) $_POST['copyright']);
727  } else {
728  $this->md_section->setCopyrightAndOtherRestrictions("Yes");
729  $this->md_section->setDescription(ilUtil::stripSlashes($_POST['copyright_text']));
730  }
731  $this->md_section->update();
732 
733  // update oer status
734 
735  $oer_settings = ilOerHarvesterSettings::getInstance();
736  if ($oer_settings->supportsHarvesting($this->md_obj->getObjType())) {
737  $chosen_copyright = (int) $_POST['copyright'];
738 
739  $status = new ilOerHarvesterObjectStatus($this->md_obj->getRBACId());
740  $status->setBlocked((int) $_POST['copyright_oer_blocked_' . $chosen_copyright] ? true : false);
741  $status->save();
742  }
743  } else {
744  if (is_object($this->md_section = $this->md_obj->getRights())) {
745  $this->md_section->setCopyrightAndOtherRestrictions("No");
746  $this->md_section->setDescription("");
747  $this->md_section->update();
748  }
749  }
750  $this->callListeners('Rights');
751 
752  //Educational...
753  // Typical Learning Time
754  if ($_POST['tlt']['mo'] or $_POST['tlt']['d'] or
755  $_POST["tlt"]['h'] or $_POST['tlt']['m'] or $_POST['tlt']['s']) {
756  if (!is_object($this->md_section = $this->md_obj->getEducational())) {
757  $this->md_section = $this->md_obj->addEducational();
758  $this->md_section->save();
759  }
760  $this->md_section->setPhysicalTypicalLearningTime(
761  (int) $_POST['tlt']['mo'],
762  (int) $_POST['tlt']['d'],
763  (int) $_POST['tlt']['h'],
764  (int) $_POST['tlt']['m'],
765  (int) $_POST['tlt']['s']
766  );
767  $this->md_section->update();
768  } else {
769  if (is_object($this->md_section = $this->md_obj->getEducational())) {
770  $this->md_section->setPhysicalTypicalLearningTime(0, 0, 0, 0, 0);
771  $this->md_section->update();
772  }
773  }
774  $this->callListeners('Educational');
775  //Lifecycle...
776  // Authors
777  if ($_POST["life_authors"] != "") {
778  if (!is_object($this->md_section = $this->md_obj->getLifecycle())) {
779  $this->md_section = $this->md_obj->addLifecycle();
780  $this->md_section->save();
781  }
782 
783  // determine all entered authors
784  $auth_arr = explode($this->md_settings->getDelimiter(), $_POST["life_authors"]);
785  for ($i = 0; $i < count($auth_arr); $i++) {
786  $auth_arr[$i] = trim($auth_arr[$i]);
787  }
788 
789  $md_con_author = "";
790 
791  // update existing author entries (delete if not entered)
792  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
793  $md_con = $this->md_section->getContribute($con_id);
794  if ($md_con->getRole() == "Author") {
795  foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
796  $md_ent = $md_con->getEntity($ent_id);
797 
798  // entered author already exists
799  if (in_array($md_ent->getEntity(), $auth_arr)) {
800  unset($auth_arr[array_search($md_ent->getEntity(), $auth_arr)]);
801  } else { // existing author has not been entered again -> delete
802  $md_ent->delete();
803  }
804  }
805  $md_con_author = $md_con;
806  }
807  }
808 
809  // insert enterd, but not existing authors
810  if (count($auth_arr) > 0) {
811  if (!is_object($md_con_author)) {
812  $md_con_author = $this->md_section->addContribute();
813  $md_con_author->setRole("Author");
814  $md_con_author->save();
815  }
816  foreach ($auth_arr as $auth) {
817  $md_ent = $md_con_author->addEntity();
818  $md_ent->setEntity(ilUtil::stripSlashes($auth));
819  $md_ent->save();
820  }
821  }
822  } else { // nothing has been entered: delete all author contribs
823  if (is_object($this->md_section = $this->md_obj->getLifecycle())) {
824  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
825  $md_con = $this->md_section->getContribute($con_id);
826  if ($md_con->getRole() == "Author") {
827  $md_con->delete();
828  }
829  }
830  }
831  }
832  $this->callListeners('Lifecycle');
833 
834  // #18563
835  /*
836  if(!$_REQUEST["wsp_id"])
837  {
838  // (parent) container taxonomies?
839  include_once "Services/Taxonomy/classes/class.ilTaxMDGUI.php";
840  $tax_gui = new ilTaxMDGUI($this->md_obj->getRBACId(),$this->md_obj->getObjId(),$this->md_obj->getObjType());
841  $tax_gui->updateFromMDForm();
842  }*/
843 
844  // Redirect here to read new title and description
845  // Otherwise ('Lifecycle' 'technical' ...) simply call listSection()
846  ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
847  $this->ctrl->redirect($this, 'listSection');
848  }
849 
851  {
852  $module_id = $this->md_obj->obj_id;
853  if ($this->md_obj->obj_type == 'sco') {
854  $module_id = $this->md_obj->rbac_id;
855  }
856  $tree = new ilTree($module_id);
857  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
858  $tree->setTreeTablePK("slm_id");
859  foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
860  $sco_md = new ilMD($module_id, $sco['obj_id'], 'sco');
861  if ($_POST[$request] != "") {
862  $sco_md_section;
863  if (!is_object($sco_md_section = $sco_md->getLifecycle())) {
864  $sco_md_section = $sco_md->addLifecycle();
865  $sco_md_section->save();
866  }
867  // determine all entered authors
868  $auth_arr = explode(",", $_POST[$request]);
869  for ($i = 0; $i < count($auth_arr); $i++) {
870  $auth_arr[$i] = trim($auth_arr[$i]);
871  }
872 
873  $md_con_author = "";
874 
875  // update existing author entries (delete if not entered)
876  foreach (($ids = $sco_md_section->getContributeIds()) as $con_id) {
877  $md_con = $sco_md_section->getContribute($con_id);
878  if ($md_con->getRole() == $type) {
879  foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
880  $md_ent = $md_con->getEntity($ent_id);
881 
882  // entered author already exists
883  if (in_array($md_ent->getEntity(), $auth_arr)) {
884  unset($auth_arr[array_search($md_ent->getEntity(), $auth_arr)]);
885  } else { // existing author has not been entered again -> delete
886  $md_ent->delete();
887  }
888  }
889  $md_con_author = $md_con;
890  }
891  }
892 
893  // insert enterd, but not existing authors
894  if (count($auth_arr) > 0) {
895  if (!is_object($md_con_author)) {
896  $md_con_author = $sco_md_section->addContribute();
897  $md_con_author->setRole($type);
898  $md_con_author->save();
899  }
900  foreach ($auth_arr as $auth) {
901  $md_ent = $md_con_author->addEntity();
902  $md_ent->setEntity(ilUtil::stripSlashes($auth));
903  $md_ent->save();
904  }
905  }
906  } else { // nothing has been entered: delete all author contribs
907  if (is_object($sco_md_section = $sco_md->getLifecycle())) {
908  foreach (($ids = $sco_md_section->getContributeIds()) as $con_id) {
909  $md_con = $sco_md_section->getContribute($con_id);
910  if ($md_con->getRole() == $type) {
911  $md_con->delete();
912  }
913  }
914  }
915  }
916  $sco_md->update();
917  }
918  $this->updateQuickEdit_scorm();
919  }
920 
922  {
923  $this->updateQuickEdit_scorm_propagate("life_experts", "SubjectMatterExpert");
924  }
926  {
927  $this->updateQuickEdit_scorm_propagate("life_designers", "InstructionalDesigner");
928  }
930  {
931  $this->updateQuickEdit_scorm_propagate("life_poc", "PointOfContact");
932  }
936  public function updateQuickEdit_scorm()
937  {
938  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
939 
940  // General values
941  $this->md_section = $this->md_obj->getGeneral();
942  $this->md_section->setTitle(ilUtil::stripSlashes($_POST['gen_title']));
943  $this->md_section->setTitleLanguage(new ilMDLanguageItem($_POST['gen_title_language']));
944  $this->md_section->update();
945 
946  // Language
947  if (is_array($_POST['gen_language'])) {
948  foreach ($_POST['gen_language'] as $id => $data) {
949  if ($id > 0) {
950  $md_lan = $this->md_section->getLanguage($id);
951  $md_lan->setLanguage(new ilMDLanguageItem($data['language']));
952  $md_lan->update();
953  } else {
954  $md_lan = $this->md_section->addLanguage();
955  $md_lan->setLanguage(new ilMDLanguageItem($data['language']));
956  $md_lan->save();
957  }
958  }
959  }
960  // Description
961  if (is_array($_POST['gen_description'])) {
962  foreach ($_POST['gen_description'] as $id => $data) {
963  $md_des = $this->md_section->getDescription($id);
964  $md_des->setDescription(ilUtil::stripSlashes($data['description']));
965  $md_des->setDescriptionLanguage(new ilMDLanguageItem($data['language']));
966  $md_des->update();
967  }
968  }
969 
970 
971  // Keyword
972  if (is_array($_POST["keywords"]["value"])) {
973  $new_keywords = array();
974  foreach ($_POST["keywords"]["value"] as $lang => $keywords) {
975  $language = $_POST["keyword"]["language"][$lang];
976  $keywords = explode(",", $keywords);
977  foreach ($keywords as $keyword) {
978  $new_keywords[$language][] = trim($keyword);
979  }
980  }
981 
982  // update existing author entries (delete if not entered)
983  foreach ($ids = $this->md_section->getKeywordIds() as $id) {
984  $md_key = $this->md_section->getKeyword($id);
985 
986  $lang = $md_key->getKeywordLanguageCode();
987 
988  // entered keyword already exists
989  if (is_array($new_keywords[$lang]) &&
990  in_array($md_key->getKeyword(), $new_keywords[$lang])) {
991  unset($new_keywords[$lang]
992  [array_search($md_key->getKeyword(), $new_keywords[$lang])]);
993  } else { // existing keyword has not been entered again -> delete
994  $md_key->delete();
995  }
996  }
997 
998  // insert entered, but not existing keywords
999  foreach ($new_keywords as $lang => $key_arr) {
1000  foreach ($key_arr as $keyword) {
1001  if ($keyword != "") {
1002  $md_key = $this->md_section->addKeyword();
1003  $md_key->setKeyword(ilUtil::stripSlashes($keyword));
1004  $md_key->setKeywordLanguage(new ilMDLanguageItem($lang));
1005  $md_key->save();
1006  }
1007  }
1008  }
1009  }
1010  $this->callListeners('General');
1011 
1012  // Copyright
1013  if ($_POST['copyright_id'] or $_POST['rights_copyright']) {
1014  if (!is_object($this->md_section = $this->md_obj->getRights())) {
1015  $this->md_section = $this->md_obj->addRights();
1016  $this->md_section->save();
1017  }
1018  if ($_POST['copyright_id']) {
1019  $this->md_section->setCopyrightAndOtherRestrictions("Yes");
1020  $this->md_section->setDescription('il_copyright_entry__' . IL_INST_ID . '__' . (int) $_POST['copyright_id']);
1021  } else {
1022  $this->md_section->setCopyrightAndOtherRestrictions("Yes");
1023  $this->md_section->setDescription(ilUtil::stripSlashes($_POST["rights_copyright"]));
1024  }
1025  $this->md_section->update();
1026  } else {
1027  if (is_object($this->md_section = $this->md_obj->getRights())) {
1028  $this->md_section->setCopyrightAndOtherRestrictions("No");
1029  $this->md_section->setDescription("");
1030  $this->md_section->update();
1031  }
1032  }
1033  $this->callListeners('Rights');
1034 
1035  //Educational...
1036  // Typical Learning Time
1037  if ($_POST['tlt']['mo'] or $_POST['tlt']['d'] or
1038  $_POST["tlt"]['h'] or $_POST['tlt']['m'] or $_POST['tlt']['s']) {
1039  if (!is_object($this->md_section = $this->md_obj->getEducational())) {
1040  $this->md_section = $this->md_obj->addEducational();
1041  $this->md_section->save();
1042  }
1043  $this->md_section->setPhysicalTypicalLearningTime(
1044  (int) $_POST['tlt']['mo'],
1045  (int) $_POST['tlt']['d'],
1046  (int) $_POST['tlt']['h'],
1047  (int) $_POST['tlt']['m'],
1048  (int) $_POST['tlt']['s']
1049  );
1050  $this->md_section->update();
1051  } else {
1052  if (is_object($this->md_section = $this->md_obj->getEducational())) {
1053  $this->md_section->setPhysicalTypicalLearningTime(0, 0, 0, 0, 0);
1054  $this->md_section->update();
1055  }
1056  }
1057  $this->callListeners('Educational');
1058  //Lifecycle...
1059  // experts
1060  if ($_POST["life_experts"] != "") {
1061  if (!is_object($this->md_section = $this->md_obj->getLifecycle())) {
1062  $this->md_section = $this->md_obj->addLifecycle();
1063  $this->md_section->save();
1064  }
1065 
1066  // determine all entered authors
1067  $auth_arr = explode(",", $_POST["life_experts"]);
1068  for ($i = 0; $i < count($auth_arr); $i++) {
1069  $auth_arr[$i] = trim($auth_arr[$i]);
1070  }
1071 
1072  $md_con_author = "";
1073 
1074  // update existing author entries (delete if not entered)
1075  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
1076  $md_con = $this->md_section->getContribute($con_id);
1077  if ($md_con->getRole() == "SubjectMatterExpert") {
1078  foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
1079  $md_ent = $md_con->getEntity($ent_id);
1080 
1081  // entered author already exists
1082  if (in_array($md_ent->getEntity(), $auth_arr)) {
1083  unset($auth_arr[array_search($md_ent->getEntity(), $auth_arr)]);
1084  } else { // existing author has not been entered again -> delete
1085  $md_ent->delete();
1086  }
1087  }
1088  $md_con_author = $md_con;
1089  }
1090  }
1091 
1092  // insert enterd, but not existing authors
1093  if (count($auth_arr) > 0) {
1094  if (!is_object($md_con_author)) {
1095  $md_con_author = $this->md_section->addContribute();
1096  $md_con_author->setRole("SubjectMatterExpert");
1097  $md_con_author->save();
1098  }
1099  foreach ($auth_arr as $auth) {
1100  $md_ent = $md_con_author->addEntity();
1101  $md_ent->setEntity(ilUtil::stripSlashes($auth));
1102  $md_ent->save();
1103  }
1104  }
1105  } else { // nothing has been entered: delete all author contribs
1106  if (is_object($this->md_section = $this->md_obj->getLifecycle())) {
1107  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
1108  $md_con = $this->md_section->getContribute($con_id);
1109  if ($md_con->getRole() == "SubjectMatterExpert") {
1110  $md_con->delete();
1111  }
1112  }
1113  }
1114  }
1115 
1116  // InstructionalDesigner
1117  if ($_POST["life_designers"] != "") {
1118  if (!is_object($this->md_section = $this->md_obj->getLifecycle())) {
1119  $this->md_section = $this->md_obj->addLifecycle();
1120  $this->md_section->save();
1121  }
1122 
1123  // determine all entered authors
1124  $auth_arr = explode(",", $_POST["life_designers"]);
1125  for ($i = 0; $i < count($auth_arr); $i++) {
1126  $auth_arr[$i] = trim($auth_arr[$i]);
1127  }
1128 
1129  $md_con_author = "";
1130 
1131  // update existing author entries (delete if not entered)
1132  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
1133  $md_con = $this->md_section->getContribute($con_id);
1134  if ($md_con->getRole() == "InstructionalDesigner") {
1135  foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
1136  $md_ent = $md_con->getEntity($ent_id);
1137 
1138  // entered author already exists
1139  if (in_array($md_ent->getEntity(), $auth_arr)) {
1140  unset($auth_arr[array_search($md_ent->getEntity(), $auth_arr)]);
1141  } else { // existing author has not been entered again -> delete
1142  $md_ent->delete();
1143  }
1144  }
1145  $md_con_author = $md_con;
1146  }
1147  }
1148 
1149  // insert enterd, but not existing authors
1150  if (count($auth_arr) > 0) {
1151  if (!is_object($md_con_author)) {
1152  $md_con_author = $this->md_section->addContribute();
1153  $md_con_author->setRole("InstructionalDesigner");
1154  $md_con_author->save();
1155  }
1156  foreach ($auth_arr as $auth) {
1157  $md_ent = $md_con_author->addEntity();
1158  $md_ent->setEntity(ilUtil::stripSlashes($auth));
1159  $md_ent->save();
1160  }
1161  }
1162  } else { // nothing has been entered: delete all author contribs
1163  if (is_object($this->md_section = $this->md_obj->getLifecycle())) {
1164  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
1165  $md_con = $this->md_section->getContribute($con_id);
1166  if ($md_con->getRole() == "InstructionalDesigner") {
1167  $md_con->delete();
1168  }
1169  }
1170  }
1171  }
1172 
1173  // Point of Contact
1174  if ($_POST["life_poc"] != "") {
1175  if (!is_object($this->md_section = $this->md_obj->getLifecycle())) {
1176  $this->md_section = $this->md_obj->addLifecycle();
1177  $this->md_section->save();
1178  }
1179 
1180  // determine all entered authors
1181  $auth_arr = explode(",", $_POST["life_poc"]);
1182  for ($i = 0; $i < count($auth_arr); $i++) {
1183  $auth_arr[$i] = trim($auth_arr[$i]);
1184  }
1185 
1186  $md_con_author = "";
1187 
1188  // update existing author entries (delete if not entered)
1189  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
1190  $md_con = $this->md_section->getContribute($con_id);
1191  if ($md_con->getRole() == "PointOfContact") {
1192  foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
1193  $md_ent = $md_con->getEntity($ent_id);
1194 
1195  // entered author already exists
1196  if (in_array($md_ent->getEntity(), $auth_arr)) {
1197  unset($auth_arr[array_search($md_ent->getEntity(), $auth_arr)]);
1198  } else { // existing author has not been entered again -> delete
1199  $md_ent->delete();
1200  }
1201  }
1202  $md_con_author = $md_con;
1203  }
1204  }
1205 
1206  // insert enterd, but not existing authors
1207  if (count($auth_arr) > 0) {
1208  if (!is_object($md_con_author)) {
1209  $md_con_author = $this->md_section->addContribute();
1210  $md_con_author->setRole("PointOfContact");
1211  $md_con_author->save();
1212  }
1213  foreach ($auth_arr as $auth) {
1214  $md_ent = $md_con_author->addEntity();
1215  $md_ent->setEntity(ilUtil::stripSlashes($auth));
1216  $md_ent->save();
1217  }
1218  }
1219  } else { // nothing has been entered: delete all author contribs
1220  if (is_object($this->md_section = $this->md_obj->getLifecycle())) {
1221  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
1222  $md_con = $this->md_section->getContribute($con_id);
1223  if ($md_con->getRole() == "PointOfContact") {
1224  $md_con->delete();
1225  }
1226  }
1227  }
1228  }
1229 
1230  $this->md_section = $this->md_obj->getLifecycle();
1231  $this->md_section->setVersionLanguage(new ilMDLanguageItem($_POST['lif_language']));
1232  $this->md_section->setVersion(ilUtil::stripSlashes($_POST['lif_version']));
1233  $this->md_section->setStatus($_POST['lif_status']);
1234  $this->md_section->update();
1235 
1236 
1237  $this->callListeners('Lifecycle');
1238 
1239  // Redirect here to read new title and description
1240  // Otherwise ('Lifecycle' 'technical' ...) simply call listSection()
1241  ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
1242  $this->ctrl->redirect($this, 'listSection');
1243  }
1244 
1245  /*
1246  * list general sections
1247  */
1248  public function listGeneral()
1249  {
1250  if (!is_object($this->md_section = $this->md_obj->getGeneral())) {
1251  $this->md_section = $this->md_obj->addGeneral();
1252  $this->md_section->save();
1253  }
1254 
1255  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
1256 
1257  $this->__setTabs('meta_general');
1258 
1259  $this->tpl->addBlockFile('MD_CONTENT', 'md_content', 'tpl.md_general.html', 'Services/MetaData');
1260 
1261  $this->ctrl->setReturn($this, 'listGeneral');
1262  $this->ctrl->setParameter($this, 'section', 'meta_general');
1263  $this->tpl->setVariable("EDIT_ACTION", $this->ctrl->getFormAction($this));
1264 
1265  $this->__fillSubelements();
1266 
1267  $this->tpl->setVariable("TXT_GENERAL", $this->lng->txt("meta_general"));
1268  $this->tpl->setVariable("TXT_IDENTIFIER", $this->lng->txt("meta_identifier"));
1269  $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("meta_language"));
1270  $this->tpl->setVariable("TXT_KEYWORD", $this->lng->txt("meta_keyword"));
1271  $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("meta_description"));
1272  $this->tpl->setVariable("TXT_STRUCTURE", $this->lng->txt("meta_structure"));
1273  $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
1274  $this->tpl->setVariable("TXT_ATOMIC", $this->lng->txt("meta_atomic"));
1275  $this->tpl->setVariable("TXT_COLLECTION", $this->lng->txt("meta_collection"));
1276  $this->tpl->setVariable("TXT_NETWORKED", $this->lng->txt("meta_networked"));
1277  $this->tpl->setVariable("TXT_HIERARCHICAL", $this->lng->txt("meta_hierarchical"));
1278  $this->tpl->setVariable("TXT_LINEAR", $this->lng->txt("meta_linear"));
1279 
1280  // Structure
1281  $this->tpl->setVariable("STRUCTURE_VAL_" . strtoupper($this->md_section->getStructure()), " selected=selected");
1282 
1283  // Identifier
1284  $first = true;
1285  foreach ($ids = $this->md_section->getIdentifierIds() as $id) {
1286  $md_ide = $this->md_section->getIdentifier($id);
1287 
1288  //
1289  if ($first) {
1290  $this->tpl->setCurrentBlock("id_head");
1291  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_IDENTIFIER", $this->lng->txt("meta_identifier"));
1292  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_CATALOG", $this->lng->txt("meta_catalog"));
1293  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_ENTRY", $this->lng->txt("meta_entry"));
1294  $this->tpl->setVariable("ROWSPAN_ID", count($ids));
1295  $this->tpl->parseCurrentBlock();
1296  $first = false;
1297  }
1298 
1299  if (count($ids) > 1) {
1300  $this->ctrl->setParameter($this, 'meta_index', $id);
1301  $this->ctrl->setParameter($this, 'meta_path', 'meta_identifier');
1302 
1303  if ($md_ide->getCatalog() != "ILIAS") {
1304  $this->tpl->setCurrentBlock("identifier_delete");
1305  $this->tpl->setVariable("IDENTIFIER_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
1306  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_DELETE", $this->lng->txt('delete'));
1307  $this->tpl->parseCurrentBlock();
1308  }
1309  }
1310 
1311  $this->tpl->setCurrentBlock("identifier_loop");
1312  if ($md_ide->getCatalog() == "ILIAS") {
1313  $this->tpl->setVariable("DISABLE_IDENT", ' disabled="disabled" ');
1314  }
1315  $this->tpl->setVariable("IDENTIFIER_LOOP_NO", $id);
1316  $this->tpl->setVariable(
1317  "IDENTIFIER_LOOP_VAL_IDENTIFIER_CATALOG",
1318  ilUtil::prepareFormOutput($md_ide->getCatalog())
1319  );
1320  $this->tpl->setVariable(
1321  "IDENTIFIER_LOOP_VAL_IDENTIFIER_ENTRY",
1322  ilUtil::prepareFormOutput($md_ide->getEntry())
1323  );
1324  $this->tpl->parseCurrentBlock();
1325  }
1326 
1327 
1328  // Language
1329  $first = true;
1330  foreach ($ids = $this->md_section->getLanguageIds() as $id) {
1331  $md_lan = $this->md_section->getLanguage($id);
1332 
1333  if ($first) {
1334  $this->tpl->setCurrentBlock("language_head");
1335  $this->tpl->setVariable("ROWSPAN_LANG", count($ids));
1336  $this->tpl->setVariable("LANGUAGE_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
1337  $this->tpl->parseCurrentBlock();
1338  $first = false;
1339  }
1340 
1341  if (count($ids) > 1) {
1342  $this->ctrl->setParameter($this, 'meta_index', $id);
1343  $this->ctrl->setParameter($this, 'meta_path', 'meta_language');
1344 
1345  $this->tpl->setCurrentBlock("language_delete");
1346  $this->tpl->setVariable("LANGUAGE_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
1347  $this->tpl->setVariable("LANGUAGE_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
1348  $this->tpl->parseCurrentBlock();
1349  }
1350  $this->tpl->setCurrentBlock("language_loop");
1351  $this->tpl->setVariable("LANGUAGE_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect(
1352  'gen_language[' . $id . '][language]',
1353  $md_lan->getLanguageCode()
1354  ));
1355  $this->tpl->parseCurrentBlock();
1356  }
1357 
1358  // TITLE
1359  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
1360  $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($this->md_section->getTitle()));
1361  $this->tpl->setVariable("VAL_TITLE_LANGUAGE", $this->__showLanguageSelect(
1362  'gen_title_language',
1363  $this->md_section->getTitleLanguageCode()
1364  ));
1365 
1366 
1367  // DESCRIPTION
1368  foreach ($ids = $this->md_section->getDescriptionIds() as $id) {
1369  $md_des = $this->md_section->getDescription($id);
1370 
1371  if (count($ids) > 1) {
1372  $this->ctrl->setParameter($this, 'meta_index', $id);
1373  $this->ctrl->setParameter($this, 'meta_path', 'meta_description');
1374 
1375  $this->tpl->setCurrentBlock("description_delete");
1376  $this->tpl->setVariable("DESCRIPTION_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
1377  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
1378  $this->tpl->parseCurrentBlock();
1379  }
1380 
1381  $this->tpl->setCurrentBlock("description_loop");
1382  $this->tpl->setVariable("DESCRIPTION_LOOP_NO", $id);
1383  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DESCRIPTION", $this->lng->txt("meta_description"));
1384  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
1385  $this->tpl->setVariable("DESCRIPTION_LOOP_VAL", ilUtil::prepareFormOutput($md_des->getDescription()));
1386  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
1387  $this->tpl->setVariable("DESCRIPTION_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect(
1388  "gen_description[" . $id . '][language]',
1389  $md_des->getDescriptionLanguageCode()
1390  ));
1391  $this->tpl->parseCurrentBlock();
1392  }
1393 
1394  // KEYWORD
1395  $first = true;
1396  foreach ($ids = $this->md_section->getKeywordIds() as $id) {
1397  $md_key = $this->md_section->getKeyword($id);
1398 
1399  if ($first) {
1400  $this->tpl->setCurrentBlock("keyword_head");
1401  $this->tpl->setVariable("ROWSPAN_KEYWORD", count($ids));
1402  $this->tpl->setVariable("KEYWORD_LOOP_TXT_KEYWORD", $this->lng->txt("meta_keyword"));
1403  $this->tpl->parseCurrentBlock();
1404  $first = false;
1405  }
1406 
1407 
1408  if (count($ids) > 1) {
1409  $this->ctrl->setParameter($this, 'meta_index', $id);
1410  $this->ctrl->setParameter($this, 'meta_path', 'meta_keyword');
1411 
1412  $this->tpl->setCurrentBlock("keyword_delete");
1413  $this->tpl->setVariable("KEYWORD_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
1414  $this->tpl->setVariable("KEYWORD_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
1415  $this->tpl->parseCurrentBlock();
1416  }
1417 
1418  $this->tpl->setCurrentBlock("keyword_loop");
1419  $this->tpl->setVariable("KEYWORD_LOOP_NO", $id);
1420  $this->tpl->setVariable("KEYWORD_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
1421  $this->tpl->setVariable("KEYWORD_LOOP_VAL", ilUtil::prepareFormOutput($md_key->getKeyword()));
1422  $this->tpl->setVariable("KEYWORD_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
1423  $this->tpl->setVariable("KEYWORD_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect(
1424  "gen_keyword[" . $id . '][language]',
1425  $md_key->getKeywordLanguageCode()
1426  ));
1427 
1428  $this->tpl->parseCurrentBlock();
1429  }
1430 
1431  // Coverage
1432  $this->tpl->setVariable("COVERAGE_LOOP_TXT_COVERAGE", $this->lng->txt('meta_coverage'));
1433  $this->tpl->setVariable("COVERAGE_LOOP_VAL", ilUtil::prepareFormOutput($this->md_section->getCoverage()));
1434  $this->tpl->setVariable("COVERAGE_LOOP_TXT_LANGUAGE", $this->lng->txt('meta_language'));
1435  $this->tpl->setVariable("COVERAGE_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect(
1436  'gen_coverage_language',
1437  $this->md_section->getCoverageLanguageCode()
1438  ));
1439 
1440  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt('save'));
1441  }
1442 
1446  public function updateGeneral()
1447  {
1448  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
1449 
1450  if (!strlen(trim($_POST['gen_title']))) {
1451  if ($this->md_obj->getObjType() != 'sess') {
1452  ilUtil::sendFailure($this->lng->txt('title_required'));
1453  $this->listGeneral();
1454  return false;
1455  }
1456  }
1457 
1458  // General values
1459  $this->md_section = $this->md_obj->getGeneral();
1460  $this->md_section->setStructure($_POST['gen_structure']);
1461  $this->md_section->setTitle(ilUtil::stripSlashes($_POST['gen_title']));
1462  $this->md_section->setTitleLanguage(new ilMDLanguageItem($_POST['gen_title_language']));
1463  $this->md_section->setCoverage(ilUtil::stripSlashes($_POST['gen_coverage']));
1464  $this->md_section->setCoverageLanguage(new ilMDLanguageItem($_POST['gen_coverage_language']));
1465  $this->md_section->update();
1466 
1467  // Identifier
1468  if (is_array($_POST['gen_identifier'])) {
1469  foreach ($_POST['gen_identifier'] as $id => $data) {
1470  $md_ide = $this->md_section->getIdentifier($id);
1471  $md_ide->setCatalog(ilUtil::stripSlashes($data['Catalog']));
1472  $md_ide->setEntry(ilUtil::stripSlashes($data['Entry']));
1473  $md_ide->update();
1474  }
1475  }
1476 
1477  // Language
1478  if (is_array($_POST['gen_language'])) {
1479  foreach ($_POST['gen_language'] as $id => $data) {
1480  $md_lan = $this->md_section->getLanguage($id);
1481  $md_lan->setLanguage(new ilMDLanguageItem($data['language']));
1482  $md_lan->update();
1483  }
1484  }
1485  // Description
1486  if (is_array($_POST['gen_description'])) {
1487  foreach ($_POST['gen_description'] as $id => $data) {
1488  $md_des = $this->md_section->getDescription($id);
1489  $md_des->setDescription(ilUtil::stripSlashes($data['description']));
1490  $md_des->setDescriptionLanguage(new ilMDLanguageItem($data['language']));
1491  $md_des->update();
1492  }
1493  }
1494  // Keyword
1495  if (is_array($_POST['gen_keyword'])) {
1496  foreach ($_POST['gen_keyword'] as $id => $data) {
1497  $md_key = $this->md_section->getKeyword($id);
1498 
1499  $md_key->setKeyword(ilUtil::stripSlashes($data['keyword']));
1500  $md_key->setKeywordLanguage(new ilMDLanguageItem($data['language']));
1501  $md_key->update();
1502  }
1503  }
1504  $this->callListeners('General');
1505 
1506  // Redirect here to read new title and description
1507  // Otherwise ('Lifecycle' 'technical' ...) simply call listSection()
1508  $this->ctrl->setParameter($this, "section", "meta_general");
1509  ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
1510  $this->ctrl->redirect($this, 'listSection');
1511  }
1512 
1513  public function updateTechnical()
1514  {
1515  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
1516 
1517  // update technical section
1518  $this->md_section = $this->md_obj->getTechnical();
1519  $this->md_section->setSize(ilUtil::stripSlashes($_POST['met_size']));
1520  $this->md_section->setInstallationRemarks(ilUtil::stripSlashes($_POST['met_inst']));
1521  $this->md_section->setInstallationRemarksLanguage(new ilMDLanguageItem($_POST['inst_language']));
1522  $this->md_section->setOtherPlatformRequirements(ilUtil::stripSlashes($_POST['met_opr']));
1523  $this->md_section->setOtherPlatformRequirementsLanguage(new ilMDLanguageItem($_POST['opr_language']));
1524  $this->md_section->setDuration(ilUtil::stripSlashes($_POST['duration']));
1525  $this->md_section->update();
1526 
1527  // Format
1528  if (is_array($_POST['met_format'])) {
1529  foreach ($_POST['met_format'] as $id => $data) {
1530  $md_for = $this->md_section->getFormat($id);
1531  $md_for->setFormat(ilUtil::stripSlashes($data['Format']));
1532  $md_for->update();
1533  }
1534  }
1535  // Location
1536  if (is_array($_POST['met_location'])) {
1537  foreach ($_POST['met_location'] as $id => $data) {
1538  $md_loc = $this->md_section->getLocation($id);
1539  $md_loc->setLocation(ilUtil::stripSlashes($data['Location']));
1540  $md_loc->setLocationType(ilUtil::stripSlashes($data['Type']));
1541  $md_loc->update();
1542  }
1543  }
1544  if (is_array($_POST['met_re'])) {
1545  foreach ($_POST['met_re'] as $id => $data) {
1546  $md_re = $this->md_section->getRequirement($id);
1547  $md_re->setOperatingSystemName(ilUtil::stripSlashes($data['os']['name']));
1548  $md_re->setOperatingSystemMinimumVersion(ilUtil::stripSlashes($data['os']['MinimumVersion']));
1549  $md_re->setOperatingSystemMaximumVersion(ilUtil::stripSlashes($data['os']['MaximumVersion']));
1550  $md_re->setBrowserName(ilUtil::stripSlashes($data['browser']['name']));
1551  $md_re->setBrowserMinimumVersion(ilUtil::stripSlashes($data['browser']['MinimumVersion']));
1552  $md_re->setBrowserMaximumVersion(ilUtil::stripSlashes($data['browser']['MaximumVersion']));
1553  $md_re->update();
1554  }
1555  }
1556  $this->callListeners('Technical');
1557 
1558  ilUtil::sendSuccess($this->lng->txt("saved_successfully"));
1559  $this->listSection();
1560  return true;
1561  }
1562 
1563 
1564 
1565  public function listTechnical()
1566  {
1567  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
1568  $this->__setTabs('meta_technical');
1569  $this->tpl->addBlockFile('MD_CONTENT', 'md_content', 'tpl.md_technical.html', 'Services/MetaData');
1570 
1571 
1572  $this->ctrl->setParameter($this, "section", "meta_technical");
1573  if (!is_object($this->md_section = $this->md_obj->getTechnical())) {
1574  $this->tpl->setCurrentBlock("no_technical");
1575  $this->tpl->setVariable("TXT_NO_TECHNICAL", $this->lng->txt("meta_no_technical"));
1576  $this->tpl->setVariable("TXT_ADD_TECHNICAL", $this->lng->txt("meta_add"));
1577  $this->tpl->setVariable("ACTION_ADD_TECHNICAL", $this->ctrl->getLinkTarget($this, "addSection"));
1578  $this->tpl->parseCurrentBlock();
1579 
1580  return true;
1581  }
1582  $this->ctrl->setReturn($this, 'listTechnical');
1583  $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
1584 
1585  $this->tpl->setVariable("EDIT_ACTION", $this->ctrl->getFormAction($this));
1586  $this->tpl->setVariable("TXT_TECHNICAL", $this->lng->txt('meta_technical'));
1587 
1588  // Delete link
1589  $this->tpl->setVariable(
1590  "ACTION_DELETE",
1591  $this->ctrl->getLinkTarget($this, "deleteSection")
1592  );
1593  $this->tpl->setVariable("TXT_DELETE", $this->lng->txt('delete'));
1594 
1595  // New element
1596  $this->__fillSubelements();
1597 
1598  // Format
1599  foreach ($ids = $this->md_section->getFormatIds() as $id) {
1600  $md_for = &$this->md_section->getFormat($id);
1601 
1602  $this->tpl->setCurrentBlock("format_loop");
1603 
1604  $this->ctrl->setParameter($this, 'meta_index', $id);
1605  $this->ctrl->setParameter($this, 'meta_path', 'meta_format');
1606  $this->tpl->setVariable("FORMAT_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
1607  $this->tpl->setVariable("FORMAT_LOOP_TXT_DELETE", $this->lng->txt('delete'));
1608 
1609  $this->tpl->setVariable("FORMAT_LOOP_NO", $id);
1610  $this->tpl->setVariable("FORMAT_LOOP_TXT_FORMAT", $this->lng->txt('meta_format'));
1611  $this->tpl->setVariable("FORMAT_LOOP_VAL", ilUtil::prepareFormOutput($md_for->getFormat()));
1612 
1613  $this->tpl->parseCurrentBlock();
1614  }
1615  // Size
1616  $this->tpl->setVariable("SIZE_TXT_SIZE", $this->lng->txt('meta_size'));
1617  $this->tpl->setVariable("SIZE_VAL", ilUtil::prepareFormOutput($this->md_section->getSize()));
1618 
1619  // Location
1620  foreach ($ids = $this->md_section->getLocationIds() as $id) {
1621  $md_loc = &$this->md_section->getLocation($id);
1622 
1623  $this->tpl->setCurrentBlock("location_loop");
1624 
1625  $this->ctrl->setParameter($this, 'meta_index', $id);
1626  $this->ctrl->setParameter($this, 'meta_path', 'meta_location');
1627  $this->tpl->setVariable("LOCATION_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
1628  $this->tpl->setVariable("LOCATION_LOOP_TXT_DELETE", $this->lng->txt('delete'));
1629 
1630  $this->tpl->setVariable("LOCATION_LOOP_TXT_LOCATION", $this->lng->txt('meta_location'));
1631  $this->tpl->setVariable("LOCATION_LOOP_NO", $id);
1632  $this->tpl->setVariable("LOCATION_LOOP_TXT_TYPE", $this->lng->txt('meta_type'));
1633  $this->tpl->setVariable("LOCATION_LOOP_VAL", ilUtil::prepareFormOutput($md_loc->getLocation()));
1634 
1635  $this->tpl->setVariable(
1636  "SEL_LOCATION_TYPE",
1638  $md_loc->getLocationType(),
1639  "met_location[" . $id . "][Type]",
1640  array(0 => $this->lng->txt('meta_please_select'))
1641  )
1642  );
1643  $this->tpl->parseCurrentBlock();
1644  }
1645  // Requirement
1646  foreach ($ids = $this->md_section->getRequirementIds() as $id) {
1647  $md_re = &$this->md_section->getRequirement($id);
1648 
1649  $this->tpl->setCurrentBlock("requirement_loop");
1650 
1651  $this->ctrl->setParameter($this, 'meta_index', $id);
1652  $this->ctrl->setParameter($this, 'meta_path', 'meta_requirement');
1653  $this->tpl->setVariable("REQUIREMENT_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
1654  $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_DELETE", $this->lng->txt('delete'));
1655 
1656  $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_REQUIREMENT", $this->lng->txt('meta_requirement'));
1657  $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_TYPE", $this->lng->txt('meta_type'));
1658  $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_OPERATINGSYSTEM", $this->lng->txt('meta_operating_system'));
1659  $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_BROWSER", $this->lng->txt('meta_browser'));
1660  $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_NAME", $this->lng->txt('meta_name'));
1661  $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_MINIMUMVERSION", $this->lng->txt('meta_minimum_version'));
1662  $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_MAXIMUMVERSION", $this->lng->txt('meta_maximum_version'));
1663 
1664  $this->tpl->setVariable("REQUIREMENT_LOOP_NO", $id);
1665  $this->tpl->setVariable(
1666  "REQUIREMENT_SEL_OS_NAME",
1668  $md_re->getOperatingSystemName(),
1669  "met_re[" . $id . "][os][name]",
1670  array(0 => $this->lng->txt('meta_please_select'))
1671  )
1672  );
1673  $this->tpl->setVariable(
1674  "REQUIREMENT_SEL_BROWSER_NAME",
1676  $md_re->getBrowserName(),
1677  "met_re[" . $id . "][browser][name]",
1678  array(0 => $this->lng->txt('meta_please_select'))
1679  )
1680  );
1681 
1682  $this->tpl->setVariable(
1683  "REQUIREMENT_LOOP_VAL_OPERATINGSYSTEM_MINIMUMVERSION",
1684  ilUtil::prepareFormOutput($md_re->getOperatingSystemMinimumVersion())
1685  );
1686 
1687  $this->tpl->setVariable(
1688  "REQUIREMENT_LOOP_VAL_OPERATINGSYSTEM_MAXIMUMVERSION",
1689  ilUtil::prepareFormOutput($md_re->getOperatingSystemMaximumVersion())
1690  );
1691 
1692  $this->tpl->setVariable(
1693  "REQUIREMENT_LOOP_VAL_BROWSER_MINIMUMVERSION",
1694  ilUtil::prepareFormOutput($md_re->getBrowserMinimumVersion())
1695  );
1696 
1697  $this->tpl->setVariable(
1698  "REQUIREMENT_LOOP_VAL_BROWSER_MAXIMUMVERSION",
1699  ilUtil::prepareFormOutput($md_re->getBrowserMaximumVersion())
1700  );
1701  $this->tpl->parseCurrentBlock();
1702  }
1703  // OrComposite
1704  foreach ($ids = $this->md_section->getOrCompositeIds() as $or_id) {
1705  $md_or = &$this->md_section->getOrComposite($or_id);
1706  foreach ($ids = $md_or->getRequirementIds() as $id) {
1707  $md_re = &$this->md_section->getRequirement($id);
1708 
1709  $this->tpl->setCurrentBlock("orrequirement_loop");
1710 
1711  $this->ctrl->setParameter($this, 'meta_index', $id);
1712  $this->ctrl->setParameter($this, 'meta_path', 'meta_requirement');
1713  $this->tpl->setVariable("ORREQUIREMENT_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
1714  $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_DELETE", $this->lng->txt('delete'));
1715 
1716  $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_REQUIREMENT", $this->lng->txt('meta_requirement'));
1717  $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_TYPE", $this->lng->txt('meta_type'));
1718  $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_OPERATINGSYSTEM", $this->lng->txt('meta_operating_system'));
1719  $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_BROWSER", $this->lng->txt('meta_browser'));
1720  $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_NAME", $this->lng->txt('meta_name'));
1721  $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_MINIMUMVERSION", $this->lng->txt('meta_minimum_version'));
1722  $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_MAXIMUMVERSION", $this->lng->txt('meta_maximum_version'));
1723 
1724  $this->tpl->setVariable("ORREQUIREMENT_LOOP_NO", $id);
1725  $this->tpl->setVariable(
1726  "ORREQUIREMENT_SEL_OS_NAME",
1728  $md_re->getOperatingSystemName(),
1729  "met_re[" . $id . "][os][name]",
1730  array(0 => $this->lng->txt('meta_please_select'))
1731  )
1732  );
1733  $this->tpl->setVariable(
1734  "ORREQUIREMENT_SEL_BROWSER_NAME",
1736  $md_re->getBrowserName(),
1737  "met_re[" . $id . "][browser][name]",
1738  array(0 => $this->lng->txt('meta_please_select'))
1739  )
1740  );
1741 
1742  $this->tpl->setVariable(
1743  "ORREQUIREMENT_LOOP_VAL_OPERATINGSYSTEM_MINIMUMVERSION",
1744  ilUtil::prepareFormOutput($md_re->getOperatingSystemMinimumVersion())
1745  );
1746 
1747  $this->tpl->setVariable(
1748  "ORREQUIREMENT_LOOP_VAL_OPERATINGSYSTEM_MAXIMUMVERSION",
1749  ilUtil::prepareFormOutput($md_re->getOperatingSystemMaximumVersion())
1750  );
1751 
1752  $this->tpl->setVariable(
1753  "ORREQUIREMENT_LOOP_VAL_BROWSER_MINIMUMVERSION",
1754  ilUtil::prepareFormOutput($md_re->getBrowserMinimumVersion())
1755  );
1756 
1757  $this->tpl->setVariable(
1758  "ORREQUIREMENT_LOOP_VAL_BROWSER_MAXIMUMVERSION",
1759  ilUtil::prepareFormOutput($md_re->getBrowserMaximumVersion())
1760  );
1761  $this->tpl->parseCurrentBlock();
1762  }
1763  $this->tpl->setCurrentBlock("orcomposite_loop");
1764 
1765  $this->ctrl->setParameter($this, 'meta_index', $or_id);
1766  $this->ctrl->setParameter($this, 'meta_path', 'meta_or_composite');
1767  $this->ctrl->setParameter($this, 'meta_technical', $this->md_section->getMetaId());
1768  $this->tpl->setVariable("ORCOMPOSITE_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
1769  $this->tpl->setVariable("ORCOMPOSITE_LOOP_TXT_DELETE", $this->lng->txt('delete'));
1770 
1771  $this->tpl->setVariable("ORCOMPOSITE_LOOP_TXT_ORCOMPOSITE", $this->lng->txt('meta_or_composite'));
1772  $this->tpl->parseCurrentBlock();
1773  }
1774 
1775  // InstallationRemarks
1776  $this->tpl->setVariable("INSTALLATIONREMARKS_TXT_INSTALLATIONREMARKS", $this->lng->txt('meta_installation_remarks'));
1777  $this->tpl->setVariable("INSTALLATIONREMARKS_TXT_LANGUAGE", $this->lng->txt('meta_language'));
1778 
1779  $this->tpl->setVariable("INSTALLATIONREMARKS_VAL", ilUtil::prepareFormOutput($this->md_section->getInstallationRemarks()));
1780  $this->tpl->setVariable(
1781  "INSTALLATIONREMARKS_VAL_LANGUAGE",
1782  $this->__showLanguageSelect(
1783  'inst_language',
1784  $this->md_section->getInstallationRemarksLanguageCode()
1785  )
1786  );
1787 
1788  // Other platform requirement
1789  $this->tpl->setVariable(
1790  "OTHERPLATTFORMREQUIREMENTS_TXT_OTHERPLATTFORMREQUIREMENTS",
1791  $this->lng->txt('meta_other_plattform_requirements')
1792  );
1793  $this->tpl->setVariable("OTHERPLATTFORMREQUIREMENTS_TXT_LANGUAGE", $this->lng->txt('meta_language'));
1794 
1795  $this->tpl->setVariable(
1796  "OTHERPLATTFORMREQUIREMENTS_VAL",
1797  ilUtil::prepareFormOutput($this->md_section->getOtherPlatformRequirements())
1798  );
1799  $this->tpl->setVariable(
1800  "OTHERPLATTFORMREQUIREMENTS_VAL_LANGUAGE",
1801  $this->__showLanguageSelect(
1802  'opr_language',
1803  $this->md_section->getOtherPlatformRequirementsLanguageCode()
1804  )
1805  );
1806 
1807  // Duration
1808  $this->tpl->setVariable("DURATION_TXT_DURATION", $this->lng->txt('meta_duration'));
1809  $this->tpl->setVariable("DURATION_VAL", ilUtil::prepareFormOutput($this->md_section->getDuration()));
1810 
1811  $this->tpl->setCurrentBlock("technical");
1812  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt('save'));
1813  $this->tpl->parseCurrentBlock();
1814  }
1815 
1816 
1817 
1818  public function listLifecycle()
1819  {
1820  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
1821  $this->__setTabs('meta_lifecycle');
1822  $this->tpl->addBlockFile('MD_CONTENT', 'md_content', 'tpl.md_lifecycle.html', 'Services/MetaData');
1823 
1824 
1825  $this->ctrl->setParameter($this, "section", "meta_lifecycle");
1826  if (!is_object($this->md_section = $this->md_obj->getLifecycle())) {
1827  $this->tpl->setCurrentBlock("no_lifecycle");
1828  $this->tpl->setVariable("TXT_NO_LIFECYCLE", $this->lng->txt("meta_no_lifecycle"));
1829  $this->tpl->setVariable("TXT_ADD_LIFECYCLE", $this->lng->txt("meta_add"));
1830  $this->tpl->setVariable("ACTION_ADD_LIFECYCLE", $this->ctrl->getLinkTarget($this, "addSection"));
1831  $this->tpl->parseCurrentBlock();
1832 
1833  return true;
1834  }
1835  $this->ctrl->setReturn($this, 'listLifecycle');
1836  $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
1837 
1838  $this->tpl->setVariable("EDIT_ACTION", $this->ctrl->getFormAction($this));
1839  $this->tpl->setVariable("TXT_LIFECYCLE", $this->lng->txt('meta_lifecycle'));
1840 
1841  // Delete link
1842  $this->tpl->setVariable(
1843  "ACTION_DELETE",
1844  $this->ctrl->getLinkTarget($this, "deleteSection")
1845  );
1846  $this->tpl->setVariable("TXT_DELETE", $this->lng->txt('delete'));
1847 
1848  // New element
1849  $this->__fillSubelements();
1850 
1851  // Status
1852  $this->tpl->setVariable("TXT_STATUS", $this->lng->txt('meta_status'));
1853  $this->tpl->setVariable("SEL_STATUS", ilMDUtilSelect::_getStatusSelect(
1854  $this->md_section->getStatus(),
1855  "lif_status",
1856  array(0 => $this->lng->txt('meta_please_select'))
1857  ));
1858  // Version
1859  $this->tpl->setVariable("TXT_VERSION", $this->lng->txt('meta_version'));
1860  $this->tpl->setVariable("VAL_VERSION", ilUtil::prepareFormOutput($this->md_section->getVersion()));
1861 
1862  $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt('meta_language'));
1863  $this->tpl->setVariable("VAL_VERSION_LANGUAGE", $this->__showLanguageSelect(
1864  'lif_language',
1865  $this->md_section->getVersionLanguageCode()
1866  ));
1867 
1868  // Contributes
1869  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
1870  $md_con = $this->md_section->getContribute($con_id);
1871 
1872  if (count($ids) > 1) {
1873  $this->ctrl->setParameter($this, 'meta_index', $con_id);
1874  $this->ctrl->setParameter($this, 'meta_path', 'meta_contribute');
1875 
1876  $this->tpl->setCurrentBlock("contribute_delete");
1877  $this->tpl->setVariable("CONTRIBUTE_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
1878  $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_DELETE", $this->lng->txt('delete'));
1879  $this->tpl->parseCurrentBlock();
1880  }
1881  // Entities
1882  foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
1883  $md_ent = $md_con->getEntity($ent_id);
1884 
1885  $this->ctrl->setParameter($this, 'meta_path', 'meta_entity');
1886 
1887  if (count($ent_ids) > 1) {
1888  $this->tpl->setCurrentBlock("contribute_entity_delete");
1889 
1890  $this->ctrl->setParameter($this, 'meta_index', $ent_id);
1891  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
1892  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_DELETE", $this->lng->txt('delete'));
1893  $this->tpl->parseCurrentBlock();
1894  }
1895 
1896  $this->tpl->setCurrentBlock("contribute_entity_loop");
1897 
1898  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_CONTRIBUTE_NO", $con_id);
1899  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_NO", $ent_id);
1900  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_VAL_ENTITY", ilUtil::prepareFormOutput($md_ent->getEntity()));
1901  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_ENTITY", $this->lng->txt('meta_entity'));
1902  $this->tpl->parseCurrentBlock();
1903  }
1904  $this->tpl->setCurrentBlock("contribute_loop");
1905 
1906  $this->ctrl->setParameter($this, 'section_element', 'meta_entity');
1907  $this->ctrl->setParameter($this, 'meta_index', $con_id);
1908  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_ACTION_ADD", $this->ctrl->getLinkTarget($this, 'addSectionElement'));
1909  $this->tpl->setVariable(
1910  "CONTRIBUTE_ENTITY_LOOP_TXT_ADD",
1911  $this->lng->txt('add') . " " . $this->lng->txt('meta_entity')
1912  );
1913 
1914  $this->tpl->setVariable("CONTRIBUTE_LOOP_ROWSPAN", 2 + count($ent_ids));
1915  $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_CONTRIBUTE", $this->lng->txt('meta_contribute'));
1916  $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_ROLE", $this->lng->txt('meta_role'));
1917  $this->tpl->setVariable("SEL_CONTRIBUTE_ROLE", ilMDUtilSelect::_getRoleSelect(
1918  $md_con->getRole(),
1919  "met_contribute[" . $con_id . "][Role]",
1920  array(0 => $this->lng->txt('meta_please_select'))
1921  ));
1922  $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_DATE", $this->lng->txt('meta_date'));
1923  $this->tpl->setVariable("CONTRIBUTE_LOOP_NO", $con_id);
1924  $this->tpl->setVariable("CONTRIBUTE_LOOP_VAL_DATE", ilUtil::prepareFormOutput($md_con->getDate()));
1925 
1926  $this->tpl->parseCurrentBlock();
1927  }
1928  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt('save'));
1929  }
1930 
1931  public function updateLifecycle()
1932  {
1933  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
1934 
1935  // update metametadata section
1936  $this->md_section = $this->md_obj->getLifecycle();
1937  $this->md_section->setVersionLanguage(new ilMDLanguageItem($_POST['lif_language']));
1938  $this->md_section->setVersion(ilUtil::stripSlashes($_POST['lif_version']));
1939  $this->md_section->setStatus($_POST['lif_status']);
1940  $this->md_section->update();
1941 
1942  // Identifier
1943  if (is_array($_POST['met_identifier'])) {
1944  foreach ($_POST['met_identifier'] as $id => $data) {
1945  $md_ide = $this->md_section->getIdentifier($id);
1946  $md_ide->setCatalog(ilUtil::stripSlashes($data['Catalog']));
1947  $md_ide->setEntry(ilUtil::stripSlashes($data['Entry']));
1948  $md_ide->update();
1949  }
1950  }
1951  // Contribute
1952  if (is_array($_POST['met_contribute'])) {
1953  foreach ($_POST['met_contribute'] as $id => $data) {
1954  $md_con = &$this->md_section->getContribute($id);
1955  $md_con->setRole(ilUtil::stripSlashes($data['Role']));
1956  $md_con->setDate(ilUtil::stripSlashes($data['Date']));
1957  $md_con->update();
1958 
1959  if (is_array($_POST['met_entity'][$id])) {
1960  foreach ($_POST['met_entity'][$id] as $ent_id => $data) {
1961  $md_ent = &$md_con->getEntity($ent_id);
1962  $md_ent->setEntity(ilUtil::stripSlashes($data['Entity']));
1963  $md_ent->update();
1964  }
1965  }
1966  }
1967  }
1968  $this->callListeners('Lifecycle');
1969  ilUtil::sendSuccess($this->lng->txt("saved_successfully"));
1970  $this->listSection();
1971  return true;
1972  }
1973 
1974 
1975 
1976 
1977 
1978  public function listMetaMetaData()
1979  {
1980  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
1981  $this->__setTabs('meta_meta_metadata');
1982  $this->tpl->addBlockFile('MD_CONTENT', 'md_content', 'tpl.md_meta_metadata.html', 'Services/MetaData');
1983 
1984 
1985  $this->ctrl->setParameter($this, "section", "meta_meta_metadata");
1986  if (!is_object($this->md_section = $this->md_obj->getMetaMetadata())) {
1987  $this->tpl->setCurrentBlock("no_meta_meta");
1988  $this->tpl->setVariable("TXT_NO_META_META", $this->lng->txt("meta_no_meta_metadata"));
1989  $this->tpl->setVariable("TXT_ADD_META_META", $this->lng->txt("meta_add"));
1990  $this->tpl->setVariable("ACTION_ADD_META_META", $this->ctrl->getLinkTarget($this, "addSection"));
1991  $this->tpl->parseCurrentBlock();
1992 
1993  return true;
1994  }
1995  $this->ctrl->setReturn($this, 'listMetaMetaData');
1996  $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
1997 
1998  $this->tpl->setVariable("EDIT_ACTION", $this->ctrl->getFormAction($this));
1999  $this->tpl->setVariable("TXT_META_METADATA", $this->lng->txt('meta_meta_metadata'));
2000 
2001  // Delete link
2002  $this->tpl->setVariable(
2003  "ACTION_DELETE",
2004  $this->ctrl->getLinkTarget($this, "deleteSection")
2005  );
2006  $this->tpl->setVariable("TXT_DELETE", $this->lng->txt('delete'));
2007 
2008  // New element
2009  $this->__fillSubelements();
2010 
2011  $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt('meta_language'));
2012 
2013  $this->tpl->setVariable("VAL_LANGUAGE", $this->__showLanguageSelect('met_language', $this->md_section->getLanguageCode()));
2014  $this->tpl->setVariable("TXT_METADATASCHEME", $this->lng->txt('meta_metadatascheme'));
2015  $this->tpl->setVariable("VAL_METADATASCHEME", $this->md_section->getMetaDataScheme());
2016 
2017 
2018  // Identifier
2019  foreach ($ids = $this->md_section->getIdentifierIds() as $id) {
2020  $md_ide = $this->md_section->getIdentifier($id);
2021 
2022  if (count($ids) > 1) {
2023  $this->ctrl->setParameter($this, 'meta_index', $id);
2024  $this->ctrl->setParameter($this, 'meta_path', 'meta_identifier');
2025 
2026  $this->tpl->setCurrentBlock("identifier_delete");
2027  $this->tpl->setVariable("IDENTIFIER_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
2028  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_DELETE", $this->lng->txt('delete'));
2029  $this->tpl->parseCurrentBlock();
2030  }
2031 
2032  $this->tpl->setCurrentBlock("identifier_loop");
2033  $this->tpl->setVariable("IDENTIFIER_LOOP_NO", $id);
2034  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_IDENTIFIER", $this->lng->txt("meta_identifier"));
2035  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_CATALOG", $this->lng->txt("meta_catalog"));
2036  $this->tpl->setVariable(
2037  "IDENTIFIER_LOOP_VAL_IDENTIFIER_CATALOG",
2038  ilUtil::prepareFormOutput($md_ide->getCatalog())
2039  );
2040  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_ENTRY", $this->lng->txt("meta_entry"));
2041  $this->tpl->setVariable(
2042  "IDENTIFIER_LOOP_VAL_IDENTIFIER_ENTRY",
2043  ilUtil::prepareFormOutput($md_ide->getEntry())
2044  );
2045  $this->tpl->parseCurrentBlock();
2046  }
2047 
2048  // Contributes
2049  foreach (($ids = $this->md_section->getContributeIds()) as $con_id) {
2050  $md_con = $this->md_section->getContribute($con_id);
2051 
2052  if (count($ids) > 1) {
2053  $this->ctrl->setParameter($this, 'meta_index', $con_id);
2054  $this->ctrl->setParameter($this, 'meta_path', 'meta_contribute');
2055 
2056  $this->tpl->setCurrentBlock("contribute_delete");
2057  $this->tpl->setVariable("CONTRIBUTE_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
2058  $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_DELETE", $this->lng->txt('delete'));
2059  $this->tpl->parseCurrentBlock();
2060  }
2061  // Entities
2062  foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
2063  $md_ent = $md_con->getEntity($ent_id);
2064 
2065  $this->ctrl->setParameter($this, 'meta_path', 'meta_entity');
2066 
2067  if (count($ent_ids) > 1) {
2068  $this->tpl->setCurrentBlock("contribute_entity_delete");
2069 
2070  $this->ctrl->setParameter($this, 'meta_index', $ent_id);
2071  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
2072  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_DELETE", $this->lng->txt('delete'));
2073  $this->tpl->parseCurrentBlock();
2074  }
2075 
2076  $this->tpl->setCurrentBlock("contribute_entity_loop");
2077 
2078  $this->ctrl->setParameter($this, 'section_element', 'meta_entity');
2079  $this->ctrl->setParameter($this, 'meta_index', $con_id);
2080  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_ACTION_ADD", $this->ctrl->getLinkTarget($this, 'addSectionElement'));
2081  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_ADD", $this->lng->txt('add'));
2082 
2083 
2084  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_CONTRIBUTE_NO", $con_id);
2085  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_NO", $ent_id);
2086  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_VAL_ENTITY", ilUtil::prepareFormOutput($md_ent->getEntity()));
2087  $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_ENTITY", $this->lng->txt('meta_entity'));
2088  $this->tpl->parseCurrentBlock();
2089  }
2090  $this->tpl->setCurrentBlock("contribute_loop");
2091  $this->tpl->setVariable("CONTRIBUTE_LOOP_ROWSPAN", 2 + count($ent_ids));
2092  $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_CONTRIBUTE", $this->lng->txt('meta_contribute'));
2093  $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_ROLE", $this->lng->txt('meta_role'));
2094  $this->tpl->setVariable("SEL_CONTRIBUTE_ROLE", ilMDUtilSelect::_getRoleSelect(
2095  $md_con->getRole(),
2096  "met_contribute[" . $con_id . "][Role]",
2097  array(0 => $this->lng->txt('meta_please_select'))
2098  ));
2099  $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_DATE", $this->lng->txt('meta_date'));
2100  $this->tpl->setVariable("CONTRIBUTE_LOOP_NO", $con_id);
2101  $this->tpl->setVariable("CONTRIBUTE_LOOP_VAL_DATE", ilUtil::prepareFormOutput($md_con->getDate()));
2102 
2103  $this->tpl->parseCurrentBlock();
2104  }
2105  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt('save'));
2106  }
2107 
2108 
2109  public function updateMetaMetaData()
2110  {
2111  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
2112 
2113  // update metametadata section
2114  $this->md_section = $this->md_obj->getMetaMetadata();
2115  $this->md_section->setLanguage(new ilMDLanguageItem($_POST['met_language']));
2116  $this->md_section->update();
2117 
2118  // Identifier
2119  if (is_array($_POST['met_identifier'])) {
2120  foreach ($_POST['met_identifier'] as $id => $data) {
2121  $md_ide = $this->md_section->getIdentifier($id);
2122  $md_ide->setCatalog(ilUtil::stripSlashes($data['Catalog']));
2123  $md_ide->setEntry(ilUtil::stripSlashes($data['Entry']));
2124  $md_ide->update();
2125  }
2126  }
2127  // Contribute
2128  if (is_array($_POST['met_contribute'])) {
2129  foreach ($_POST['met_contribute'] as $id => $data) {
2130  $md_con = &$this->md_section->getContribute($id);
2131  $md_con->setRole(ilUtil::stripSlashes($data['Role']));
2132  $md_con->setDate(ilUtil::stripSlashes($data['Date']));
2133  $md_con->update();
2134 
2135  if (is_array($_POST['met_entity'][$id])) {
2136  foreach ($_POST['met_entity'][$id] as $ent_id => $data) {
2137  $md_ent = &$md_con->getEntity($ent_id);
2138  $md_ent->setEntity(ilUtil::stripSlashes($data['Entity']));
2139  $md_ent->update();
2140  }
2141  }
2142  }
2143  }
2144  $this->callListeners('MetaMetaData');
2145  ilUtil::sendSuccess($this->lng->txt("saved_successfully"));
2146  $this->listSection();
2147  return true;
2148  }
2149 
2150 
2151  /*
2152  * list rights section
2153  */
2154  public function listRights()
2155  {
2156  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
2157  $this->__setTabs('meta_rights');
2158  $this->tpl->addBlockFile('MD_CONTENT', 'md_content', 'tpl.md_rights.html', 'Services/MetaData');
2159 
2160  if (!is_object($this->md_section = $this->md_obj->getRights())) {
2161  $this->tpl->setCurrentBlock("no_rights");
2162  $this->tpl->setVariable("TXT_NO_RIGHTS", $this->lng->txt("meta_no_rights"));
2163  $this->tpl->setVariable("TXT_ADD_RIGHTS", $this->lng->txt("meta_add"));
2164  $this->ctrl->setParameter($this, "section", "meta_rights");
2165  $this->tpl->setVariable(
2166  "ACTION_ADD_RIGHTS",
2167  $this->ctrl->getLinkTarget($this, "addSection")
2168  );
2169  $this->tpl->parseCurrentBlock();
2170  } else {
2171  $this->ctrl->setReturn($this, 'listRights');
2172  $this->ctrl->setParameter($this, 'section', 'meta_rights');
2173  $this->tpl->setVariable("EDIT_ACTION", $this->ctrl->getFormAction($this));
2174 
2175  $this->tpl->setVariable("TXT_RIGHTS", $this->lng->txt("meta_rights"));
2176  $this->tpl->setVariable("TXT_COST", $this->lng->txt("meta_cost"));
2177  $this->tpl->setVariable("TXT_COPYRIGHTANDOTHERRESTRICTIONS", $this->lng->txt("meta_copyright_and_other_restrictions"));
2178  $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
2179  $this->tpl->setVariable("TXT_YES", $this->lng->txt("meta_yes"));
2180  $this->tpl->setVariable("TXT_NO", $this->lng->txt("meta_no"));
2181 
2182  $this->ctrl->setParameter($this, "section", "meta_rights");
2183  $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
2184  $this->tpl->setVariable(
2185  "ACTION_DELETE",
2186  $this->ctrl->getLinkTarget($this, "deleteSection")
2187  );
2188 
2189  $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("meta_delete"));
2190 
2191  $this->tpl->setVariable("VAL_COST_" . strtoupper($this->md_section->getCosts()), " selected");
2192  $this->tpl->setVariable("VAL_COPYRIGHTANDOTHERRESTRICTIONS_" .
2193  strtoupper($this->md_section->getCopyrightAndOtherRestrictions()), " selected");
2194 
2195  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DESCRIPTION", $this->lng->txt("meta_description"));
2196  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
2197  $this->tpl->setVariable("DESCRIPTION_LOOP_VAL", ilUtil::prepareFormOutput($this->md_section->getDescription()));
2198  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
2199  $this->tpl->setVariable(
2200  "DESCRIPTION_LOOP_VAL_LANGUAGE",
2201  $this->__showLanguageSelect(
2202  'rights[DescriptionLanguage]',
2203  $this->md_section->getDescriptionLanguageCode()
2204  )
2205  );
2206 
2207  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
2208 
2209  $this->tpl->setCurrentBlock("rights");
2210  $this->tpl->parseCurrentBlock();
2211  }
2212  }
2213 
2214  public function updateRights()
2215  {
2216  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
2217 
2218  // update rights section
2219  $this->md_section = $this->md_obj->getRights();
2220  $this->md_section->setCosts($_POST['rights']['Cost']);
2221  $this->md_section->setCopyrightAndOtherRestrictions($_POST['rights']['CopyrightAndOtherRestrictions']);
2222  $this->md_section->setDescriptionLanguage(new ilMDLanguageItem($_POST['rights']['DescriptionLanguage']));
2223  $this->md_section->setDescription(ilUtil::stripSlashes($_POST['rights']['Description']));
2224  $this->md_section->update();
2225 
2226  $this->callListeners('Rights');
2227  ilUtil::sendSuccess($this->lng->txt("saved_successfully"));
2228  $this->listSection();
2229  }
2230 
2231  /*
2232  * list educational section
2233  */
2234  public function listEducational()
2235  {
2236  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
2237  $this->__setTabs('meta_educational');
2238  $this->tpl->addBlockFile('MD_CONTENT', 'md_content', 'tpl.md_educational.html', 'Services/MetaData');
2239 
2240  if (!is_object($this->md_section = $this->md_obj->getEducational())) {
2241  $this->tpl->setCurrentBlock("no_educational");
2242  $this->tpl->setVariable("TXT_NO_EDUCATIONAL", $this->lng->txt("meta_no_educational"));
2243  $this->tpl->setVariable("TXT_ADD_EDUCATIONAL", $this->lng->txt("meta_add"));
2244  $this->ctrl->setParameter($this, "section", "meta_educational");
2245  $this->tpl->setVariable(
2246  "ACTION_ADD_EDUCATIONAL",
2247  $this->ctrl->getLinkTarget($this, "addSection")
2248  );
2249  $this->tpl->parseCurrentBlock();
2250  } else {
2251  $this->ctrl->setReturn($this, 'listEducational');
2252  $this->ctrl->setParameter($this, 'section', 'meta_educational');
2253  $this->tpl->setVariable("EDIT_ACTION", $this->ctrl->getFormAction($this));
2254 
2255  $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
2256  $this->tpl->setVariable(
2257  "ACTION_DELETE",
2258  $this->ctrl->getLinkTarget($this, "deleteSection")
2259  );
2260 
2261  $this->tpl->setVariable("TXT_EDUCATIONAL", $this->lng->txt("meta_educational"));
2262  $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("meta_delete"));
2263  $this->tpl->setVariable("TXT_NEW_ELEMENT", $this->lng->txt("meta_new_element"));
2264  $this->tpl->setVariable("TXT_TYPICALAGERANGE", $this->lng->txt("meta_typical_age_range"));
2265  $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("meta_description"));
2266  $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("meta_language"));
2267  $this->tpl->setVariable("TXT_ADD", $this->lng->txt("meta_add"));
2268  $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
2269 
2270  $this->tpl->setVariable("TXT_INTERACTIVITYTYPE", $this->lng->txt("meta_interactivity_type"));
2271  $this->tpl->setVariable("TXT_LEARNINGRESOURCETYPE", $this->lng->txt("meta_learning_resource_type"));
2272  $this->tpl->setVariable("TXT_INTERACTIVITYLEVEL", $this->lng->txt("meta_interactivity_level"));
2273  $this->tpl->setVariable("TXT_SEMANTICDENSITY", $this->lng->txt("meta_semantic_density"));
2274  $this->tpl->setVariable("TXT_INTENDEDENDUSERROLE", $this->lng->txt("meta_intended_end_user_role"));
2275  $this->tpl->setVariable("TXT_CONTEXT", $this->lng->txt("meta_context"));
2276  $this->tpl->setVariable("TXT_DIFFICULTY", $this->lng->txt("meta_difficulty"));
2277 
2278  $this->tpl->setVariable("VAL_INTERACTIVITYTYPE_" . strtoupper($this->md_section->getInteractivityType()), " selected");
2279  $this->tpl->setVariable("VAL_LEARNINGRESOURCETYPE_" . strtoupper($this->md_section->getLearningResourceType()), " selected");
2280  $this->tpl->setVariable("VAL_INTERACTIVITYLEVEL_" . strtoupper($this->md_section->getInteractivityLevel()), " selected");
2281  $this->tpl->setVariable("VAL_SEMANTICDENSITY_" . strtoupper($this->md_section->getSemanticDensity()), " selected");
2282  $this->tpl->setVariable("VAL_INTENDEDENDUSERROLE_" . strtoupper($this->md_section->getIntendedEndUserRole()), " selected");
2283  $this->tpl->setVariable("VAL_CONTEXT_" . strtoupper($this->md_section->getContext()), " selected");
2284  $this->tpl->setVariable("VAL_DIFFICULTY_" . strtoupper($this->md_section->getDifficulty()), " selected");
2285  #$this->tpl->setVariable("VAL_TYPICALLEARNINGTIME", ilUtil::prepareFormOutput($this->md_section->getTypicalLearningTime()));
2286 
2287  $this->tpl->setVariable("TXT_ACTIVE", $this->lng->txt("meta_active"));
2288  $this->tpl->setVariable("TXT_EXPOSITIVE", $this->lng->txt("meta_expositive"));
2289  $this->tpl->setVariable("TXT_MIXED", $this->lng->txt("meta_mixed"));
2290  $this->tpl->setVariable("TXT_EXERCISE", $this->lng->txt("meta_exercise"));
2291  $this->tpl->setVariable("TXT_SIMULATION", $this->lng->txt("meta_simulation"));
2292  $this->tpl->setVariable("TXT_QUESTIONNAIRE", $this->lng->txt("meta_questionnaire"));
2293  $this->tpl->setVariable("TXT_DIAGRAMM", $this->lng->txt("meta_diagramm"));
2294  $this->tpl->setVariable("TXT_FIGURE", $this->lng->txt("meta_figure"));
2295  $this->tpl->setVariable("TXT_GRAPH", $this->lng->txt("meta_graph"));
2296  $this->tpl->setVariable("TXT_INDEX", $this->lng->txt("meta_index"));
2297  $this->tpl->setVariable("TXT_SLIDE", $this->lng->txt("meta_slide"));
2298  $this->tpl->setVariable("TXT_TABLE", $this->lng->txt("meta_table"));
2299  $this->tpl->setVariable("TXT_NARRATIVETEXT", $this->lng->txt("meta_narrative_text"));
2300  $this->tpl->setVariable("TXT_EXAM", $this->lng->txt("meta_exam"));
2301  $this->tpl->setVariable("TXT_EXPERIMENT", $this->lng->txt("meta_experiment"));
2302  $this->tpl->setVariable("TXT_PROBLEMSTATEMENT", $this->lng->txt("meta_problem_statement"));
2303  $this->tpl->setVariable("TXT_SELFASSESSMENT", $this->lng->txt("meta_self_assessment"));
2304  $this->tpl->setVariable("TXT_LECTURE", $this->lng->txt("meta_lecture"));
2305  $this->tpl->setVariable("TXT_VERYLOW", $this->lng->txt("meta_very_low"));
2306  $this->tpl->setVariable("TXT_LOW", $this->lng->txt("meta_low"));
2307  $this->tpl->setVariable("TXT_MEDIUM", $this->lng->txt("meta_medium"));
2308  $this->tpl->setVariable("TXT_HIGH", $this->lng->txt("meta_high"));
2309  $this->tpl->setVariable("TXT_VERYHIGH", $this->lng->txt("meta_very_high"));
2310  $this->tpl->setVariable("TXT_TEACHER", $this->lng->txt("meta_teacher"));
2311  $this->tpl->setVariable("TXT_AUTHOR", $this->lng->txt("meta_author"));
2312  $this->tpl->setVariable("TXT_LEARNER", $this->lng->txt("meta_learner"));
2313  $this->tpl->setVariable("TXT_MANAGER", $this->lng->txt("meta_manager"));
2314  $this->tpl->setVariable("TXT_SCHOOL", $this->lng->txt("meta_school"));
2315  $this->tpl->setVariable("TXT_HIGHEREDUCATION", $this->lng->txt("meta_higher_education"));
2316  $this->tpl->setVariable("TXT_TRAINING", $this->lng->txt("meta_training"));
2317  $this->tpl->setVariable("TXT_OTHER", $this->lng->txt("meta_other"));
2318  $this->tpl->setVariable("TXT_VERYEASY", $this->lng->txt("meta_very_easy"));
2319  $this->tpl->setVariable("TXT_EASY", $this->lng->txt("meta_easy"));
2320  $this->tpl->setVariable("TXT_DIFFICULT", $this->lng->txt("meta_difficult"));
2321  $this->tpl->setVariable("TXT_VERYDIFFICULT", $this->lng->txt("meta_very_difficult"));
2322  $this->tpl->setVariable("TXT_TYPICALLEARNINGTIME", $this->lng->txt("meta_typical_learning_time"));
2323 
2324 
2325  // Typical learning time
2326  $tlt = array(0,0,0,0,0);
2327  $valid = true;
2328 
2329  include_once 'Services/MetaData/classes/class.ilMDUtils.php';
2330 
2331  if (!$tlt = ilMDUtils::_LOMDurationToArray($this->md_section->getTypicalLearningTime())) {
2332  if (strlen($this->md_section->getTypicalLearningTime())) {
2333  $tlt = array(0,0,0,0,0);
2334  $valid = false;
2335  }
2336  }
2337 
2338  $this->tpl->setVariable("TXT_MONTH", $this->lng->txt('md_months'));
2339  $this->tpl->setVariable("SEL_MONTHS", $this->__buildMonthsSelect($tlt[0]));
2340  $this->tpl->setVariable("SEL_DAYS", $this->__buildDaysSelect($tlt[1]));
2341 
2342  $this->tpl->setVariable("TXT_DAYS", $this->lng->txt('md_days'));
2343  $this->tpl->setVariable("TXT_TIME", $this->lng->txt('md_time'));
2344 
2345  $this->tpl->setVariable("TXT_TYPICAL_LEARN_TIME", $this->lng->txt('meta_typical_learning_time'));
2346  $this->tpl->setVariable("SEL_TLT", ilUtil::makeTimeSelect(
2347  'tlt',
2348  $tlt[4] ? false : true,
2349  $tlt[2],
2350  $tlt[3],
2351  $tlt[4],
2352  false
2353  ));
2354  $this->tpl->setVariable("TLT_HINT", $tlt[4] ? '(hh:mm:ss)' : '(hh:mm)');
2355 
2356  if (!$valid) {
2357  $this->tpl->setCurrentBlock("tlt_not_valid");
2358  $this->tpl->setVariable("TXT_CURRENT_VAL", $this->lng->txt('meta_current_value'));
2359  $this->tpl->setVariable("TLT", $this->md_section->getTypicalLearningTime());
2360  $this->tpl->setVariable("INFO_TLT_NOT_VALID", $this->lng->txt('meta_info_tlt_not_valid'));
2361  $this->tpl->parseCurrentBlock();
2362  }
2363 
2364 
2365  /* TypicalAgeRange */
2366  $first = true;
2367  foreach ($ids = $this->md_section->getTypicalAgeRangeIds() as $id) {
2368  $md_age = $this->md_section->getTypicalAgeRange($id);
2369 
2370  // extra test due to bug 5316 (may be due to eLaix import)
2371  if (is_object($md_age)) {
2372  if ($first) {
2373  $this->tpl->setCurrentBlock("agerange_head");
2374  $this->tpl->setVariable(
2375  "TYPICALAGERANGE_LOOP_TXT_TYPICALAGERANGE",
2376  $this->lng->txt("meta_typical_age_range")
2377  );
2378  $this->tpl->setVariable("ROWSPAN_AGERANGE", count($ids));
2379  $this->tpl->parseCurrentBlock();
2380  $first = false;
2381  }
2382 
2383 
2384  $this->ctrl->setParameter($this, 'meta_index', $id);
2385  $this->ctrl->setParameter($this, 'meta_path', 'educational_typical_age_range');
2386 
2387  $this->tpl->setCurrentBlock("typicalagerange_delete");
2388  $this->tpl->setVariable(
2389  "TYPICALAGERANGE_LOOP_ACTION_DELETE",
2390  $this->ctrl->getLinkTarget($this, "deleteElement")
2391  );
2392  $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
2393  $this->tpl->parseCurrentBlock();
2394 
2395  $this->tpl->setCurrentBlock("typicalagerange_loop");
2396  $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
2397  $this->tpl->setVariable("TYPICALAGERANGE_LOOP_VAL", ilUtil::prepareFormOutput($md_age->getTypicalAgeRange()));
2398  $this->tpl->setVariable("TYPICALAGERANGE_LOOP_NO", $id);
2399  $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
2400  $this->tpl->setVariable(
2401  "TYPICALAGERANGE_LOOP_VAL_LANGUAGE",
2402  $this->__showLanguageSelect(
2403  'educational[TypicalAgeRange][' . $id . '][Language]',
2404  $md_age->getTypicalAgeRangeLanguageCode()
2405  )
2406  );
2407  $this->ctrl->setParameter($this, "section_element", "educational_typical_age_range");
2408  $this->tpl->setVariable(
2409  "TYPICALAGERANGE_LOOP_ACTION_ADD",
2410  $this->ctrl->getLinkTarget($this, "addSectionElement")
2411  );
2412  $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
2413  $this->tpl->parseCurrentBlock();
2414  }
2415  }
2416 
2417  /* Description */
2418  $first = true;
2419  foreach ($ids = $this->md_section->getDescriptionIds() as $id) {
2420  if ($first) {
2421  $this->tpl->setCurrentBlock("desc_head");
2422  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DESCRIPTION", $this->lng->txt("meta_description"));
2423  $this->tpl->setVariable("ROWSPAN_DESC", count($ids));
2424  $this->tpl->parseCurrentBlock();
2425  $first = false;
2426  }
2427 
2428  $md_des = $this->md_section->getDescription($id);
2429 
2430  $this->ctrl->setParameter($this, 'meta_index', $id);
2431  $this->ctrl->setParameter($this, 'meta_path', 'educational_description');
2432 
2433  $this->tpl->setCurrentBlock("description_loop");
2434  $this->tpl->setVariable("DESCRIPTION_LOOP_NO", $id);
2435  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
2436  $this->tpl->setVariable("DESCRIPTION_LOOP_VAL", ilUtil::prepareFormOutput($md_des->getDescription()));
2437  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
2438  $this->tpl->setVariable(
2439  "DESCRIPTION_LOOP_VAL_LANGUAGE",
2440  $this->__showLanguageSelect(
2441  'educational[Description][' . $id . '][Language]',
2442  $md_des->getDescriptionLanguageCode()
2443  )
2444  );
2445  $this->tpl->setVariable(
2446  "DESCRIPTION_LOOP_ACTION_DELETE",
2447  $this->ctrl->getLinkTarget($this, "deleteElement")
2448  );
2449  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
2450  $this->ctrl->setParameter($this, "section_element", "educational_description");
2451  $this->tpl->setVariable(
2452  "DESCRIPTION_LOOP_ACTION_ADD",
2453  $this->ctrl->getLinkTarget($this, "addSectionElement")
2454  );
2455  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
2456  $this->tpl->parseCurrentBlock();
2457  }
2458 
2459 
2460  /* Language */
2461  $first = true;
2462  foreach ($ids = $this->md_section->getLanguageIds() as $id) {
2463  if ($first) {
2464  $this->tpl->setCurrentBlock("language_head");
2465  $this->tpl->setVariable("LANGUAGE_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
2466  $this->tpl->setVariable("ROWSPAN_LANG", count($ids));
2467  $this->tpl->parseCurrentBlock();
2468  $first = false;
2469  }
2470 
2471  $md_lang = $this->md_section->getLanguage($id);
2472 
2473  $this->ctrl->setParameter($this, 'meta_index', $id);
2474  $this->ctrl->setParameter($this, 'meta_path', 'educational_language');
2475 
2476  $this->tpl->setCurrentBlock("language_loop");
2477  $this->tpl->setVariable(
2478  "LANGUAGE_LOOP_VAL_LANGUAGE",
2479  $this->__showLanguageSelect(
2480  'educational[Language][' . $id . ']',
2481  $md_lang->getLanguageCode()
2482  )
2483  );
2484 
2485  $this->tpl->setVariable(
2486  "LANGUAGE_LOOP_ACTION_DELETE",
2487  $this->ctrl->getLinkTarget($this, "deleteElement")
2488  );
2489  $this->tpl->setVariable("LANGUAGE_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
2490  $this->ctrl->setParameter($this, "section_element", "educational_language");
2491  $this->tpl->setVariable(
2492  "LANGUAGE_LOOP_ACTION_ADD",
2493  $this->ctrl->getLinkTarget($this, "addSectionElement")
2494  );
2495  $this->tpl->setVariable("LANGUAGE_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
2496  $this->tpl->parseCurrentBlock();
2497  }
2498 
2499  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
2500 
2501  $this->tpl->setCurrentBlock("educational");
2502  $this->tpl->parseCurrentBlock();
2503  }
2504  }
2505 
2506  public function updateEducational()
2507  {
2508  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
2509 
2510  // update rights section
2511  $this->md_section = $this->md_obj->getEducational();
2512  $this->md_section->setInteractivityType($_POST['educational']['InteractivityType']);
2513  $this->md_section->setLearningResourceType($_POST['educational']['LearningResourceType']);
2514  $this->md_section->setInteractivityLevel($_POST['educational']['InteractivityLevel']);
2515  $this->md_section->setSemanticDensity($_POST['educational']['SemanticDensity']);
2516  $this->md_section->setIntendedEndUserRole($_POST['educational']['IntendedEndUserRole']);
2517  $this->md_section->setContext($_POST['educational']['Context']);
2518  $this->md_section->setDifficulty($_POST['educational']['Difficulty']);
2519 
2520 
2521  // TLT
2522 
2523  if ($_POST['tlt']['mo'] or $_POST['tlt']['d'] or
2524  $_POST['tlt']['h'] or $_POST['tlt']['m'] or $_POST['tlt']['s']) {
2525  $this->md_section->setPhysicalTypicalLearningTime(
2526  (int) $_POST['tlt']['mo'],
2527  (int) $_POST['tlt']['d'],
2528  (int) $_POST['tlt']['h'],
2529  (int) $_POST['tlt']['m'],
2530  (int) $_POST['tlt']['s']
2531  );
2532  } else {
2533  $this->md_section->setTypicalLearningTime('');
2534  }
2535  $this->callListeners('Educational');
2536 
2537 
2538  /* TypicalAgeRange */
2539  foreach ($ids = $this->md_section->getTypicalAgeRangeIds() as $id) {
2540  $md_age = $this->md_section->getTypicalAgeRange($id);
2541  $md_age->setTypicalAgeRange(ilUtil::stripSlashes($_POST['educational']['TypicalAgeRange'][$id]['Value']));
2542  $md_age->setTypicalAgeRangeLanguage(
2543  new ilMDLanguageItem($_POST['educational']['TypicalAgeRange'][$id]['Language'])
2544  );
2545  $md_age->update();
2546  }
2547 
2548  /* Description */
2549  foreach ($ids = $this->md_section->getDescriptionIds() as $id) {
2550  $md_des = $this->md_section->getDescription($id);
2551  $md_des->setDescription(ilUtil::stripSlashes($_POST['educational']['Description'][$id]['Value']));
2552  $md_des->setDescriptionLanguage(
2553  new ilMDLanguageItem($_POST['educational']['Description'][$id]['Language'])
2554  );
2555  $md_des->update();
2556  }
2557 
2558  /* Language */
2559  foreach ($ids = $this->md_section->getLanguageIds() as $id) {
2560  $md_lang = $this->md_section->getLanguage($id);
2561  $md_lang->setLanguage(
2562  new ilMDLanguageItem($_POST['educational']['Language'][$id])
2563  );
2564  $md_lang->update();
2565  }
2566 
2567  $this->md_section->update();
2568 
2569  $this->callListeners('Educational');
2570  ilUtil::sendSuccess($this->lng->txt("saved_successfully"));
2571  $this->listSection();
2572  }
2573 
2574  /*
2575  * list relation section
2576  */
2577  public function listRelation()
2578  {
2579  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
2580  $this->__setTabs('meta_relation');
2581  $this->tpl->addBlockFile('MD_CONTENT', 'md_content', 'tpl.md_relation.html', 'Services/MetaData');
2582 
2583  $rel_ids = $this->md_obj->getRelationIds();
2584  if (!is_array($rel_ids) || count($rel_ids) == 0) {
2585  $this->tpl->setCurrentBlock("no_relation");
2586  $this->tpl->setVariable("TXT_NO_RELATION", $this->lng->txt("meta_no_relation"));
2587  $this->tpl->setVariable("TXT_ADD_RELATION", $this->lng->txt("meta_add"));
2588  $this->ctrl->setParameter($this, "section", "meta_relation");
2589  $this->tpl->setVariable(
2590  "ACTION_ADD_RELATION",
2591  $this->ctrl->getLinkTarget($this, "addSection")
2592  );
2593  $this->tpl->parseCurrentBlock();
2594  } else {
2595  foreach ($rel_ids as $rel_id) {
2596  $this->md_section = $this->md_obj->getRelation($rel_id);
2597 
2598  $this->ctrl->setParameter($this, 'meta_index', $rel_id);
2599  $this->ctrl->setParameter($this, "section", "meta_relation");
2600 
2601  /* Identifier_ */
2602  $res_ids = $this->md_section->getIdentifier_Ids();
2603  foreach ($res_ids as $res_id) {
2604  $ident = $this->md_section->getIdentifier_($res_id);
2605  $this->ctrl->setParameter($this, "meta_index", $res_id);
2606 
2607  if (count($res_ids) > 1) {
2608  $this->tpl->setCurrentBlock("identifier_delete");
2609  $this->ctrl->setParameter($this, "meta_path", "relation_resource_identifier");
2610  $this->tpl->setVariable(
2611  "IDENTIFIER_LOOP_ACTION_DELETE",
2612  $this->ctrl->getLinkTarget($this, "deleteElement")
2613  );
2614  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
2615  $this->tpl->parseCurrentBlock();
2616  }
2617 
2618  $this->tpl->setCurrentBlock("identifier_loop");
2619 
2620  $this->tpl->setVariable("IDENTIFIER_LOOP_NO", $res_id);
2621  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_IDENTIFIER", $this->lng->txt("meta_identifier"));
2622  $this->ctrl->setParameter($this, 'meta_index', $rel_id);
2623  $this->ctrl->setParameter($this, "section_element", "relation_resource_identifier");
2624  $this->tpl->setVariable(
2625  "IDENTIFIER_LOOP_ACTION_ADD",
2626  $this->ctrl->getLinkTarget($this, "addSectionElement")
2627  );
2628  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
2629  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_ENTRY", $this->lng->txt("meta_entry"));
2630  $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_CATALOG", $this->lng->txt("meta_catalog"));
2631  $this->tpl->setVariable(
2632  "IDENTIFIER_LOOP_VAL_CATALOG",
2633  ilUtil::prepareFormOutput($ident->getCatalog())
2634  );
2635  $this->tpl->setVariable(
2636  "IDENTIFIER_LOOP_VAL_ENTRY",
2637  ilUtil::prepareFormOutput($ident->getEntry())
2638  );
2639  $this->tpl->parseCurrentBlock();
2640  }
2641 
2642  /* Description */
2643  $res_dess = $this->md_section->getDescriptionIds();
2644  foreach ($res_dess as $res_des) {
2645  $des = $this->md_section->getDescription($res_des);
2646  $this->ctrl->setParameter($this, "meta_index", $res_des);
2647 
2648  if (count($res_dess) > 1) {
2649  $this->tpl->setCurrentBlock("description_delete");
2650  $this->ctrl->setParameter($this, "meta_path", "relation_resource_description");
2651  $this->tpl->setVariable(
2652  "DESCRIPTION_LOOP_ACTION_DELETE",
2653  $this->ctrl->getLinkTarget($this, "deleteElement")
2654  );
2655  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
2656  $this->tpl->parseCurrentBlock();
2657  }
2658 
2659  $this->tpl->setCurrentBlock("description_loop");
2660  $this->tpl->setVariable("DESCRIPTION_LOOP_NO", $res_des);
2661  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DESCRIPTION", $this->lng->txt("meta_description"));
2662  $this->ctrl->setParameter($this, 'meta_index', $rel_id);
2663  $this->ctrl->setParameter($this, "section_element", "relation_resource_description");
2664  $this->tpl->setVariable(
2665  "DESCRIPTION_LOOP_ACTION_ADD",
2666  $this->ctrl->getLinkTarget($this, "addSectionElement")
2667  );
2668  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
2669  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
2670  $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
2671  $this->tpl->setVariable(
2672  "DESCRIPTION_LOOP_VAL",
2673  ilUtil::prepareFormOutput($des->getDescription())
2674  );
2675  $this->tpl->setVariable(
2676  "DESCRIPTION_LOOP_VAL_LANGUAGE",
2677  $this->__showLanguageSelect(
2678  'relation[Resource][Description][' . $res_des . '][Language]',
2679  $des->getDescriptionLanguageCode()
2680  )
2681  );
2682  $this->tpl->parseCurrentBlock();
2683  }
2684 
2685  $this->tpl->setCurrentBlock("relation_loop");
2686  $this->tpl->setVariable("REL_ID", $rel_id);
2687  $this->tpl->setVariable("TXT_RELATION", $this->lng->txt("meta_relation"));
2688  $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
2689  $this->tpl->setVariable(
2690  "ACTION_DELETE",
2691  $this->ctrl->getLinkTarget($this, "deleteSection")
2692  );
2693  $this->ctrl->setParameter($this, "section", "meta_relation");
2694  $this->tpl->setVariable(
2695  "ACTION_ADD",
2696  $this->ctrl->getLinkTarget($this, "addSection")
2697  );
2698  $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("meta_delete"));
2699  $this->tpl->setVariable("TXT_ADD", $this->lng->txt("meta_add"));
2700  $this->tpl->setVariable("TXT_NEW_ELEMENT", $this->lng->txt("meta_new_element"));
2701  $this->tpl->setVariable("TXT_KIND", $this->lng->txt("meta_kind"));
2702  $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
2703  $this->tpl->setVariable("TXT_ISPARTOF", $this->lng->txt("meta_is_part_of"));
2704  $this->tpl->setVariable("TXT_HASPART", $this->lng->txt("meta_has_part"));
2705  $this->tpl->setVariable("TXT_ISVERSIONOF", $this->lng->txt("meta_is_version_of"));
2706  $this->tpl->setVariable("TXT_HASVERSION", $this->lng->txt("meta_has_version"));
2707  $this->tpl->setVariable("TXT_ISFORMATOF", $this->lng->txt("meta_is_format_of"));
2708  $this->tpl->setVariable("TXT_HASFORMAT", $this->lng->txt("meta_has_format"));
2709  $this->tpl->setVariable("TXT_REFERENCES", $this->lng->txt("meta_references"));
2710  $this->tpl->setVariable("TXT_ISREFERENCEDBY", $this->lng->txt("meta_is_referenced_by"));
2711  $this->tpl->setVariable("TXT_ISBASEDON", $this->lng->txt("meta_is_based_on"));
2712  $this->tpl->setVariable("TXT_ISBASISFOR", $this->lng->txt("meta_is_basis_for"));
2713  $this->tpl->setVariable("TXT_REQUIRES", $this->lng->txt("meta_requires"));
2714  $this->tpl->setVariable("TXT_ISREQUIREDBY", $this->lng->txt("meta_is_required_by"));
2715  $this->tpl->setVariable("TXT_RESOURCE", $this->lng->txt("meta_resource"));
2716  $this->tpl->setVariable("VAL_KIND_" . strtoupper($this->md_section->getKind()), " selected");
2717  $this->tpl->parseCurrentBlock();
2718  }
2719 
2720  $this->tpl->setCurrentBlock("relation");
2721  $this->tpl->setVariable("EDIT_ACTION", $this->ctrl->getFormAction($this));
2722  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
2723  $this->tpl->parseCurrentBlock();
2724  }
2725  }
2726 
2727  public function updateRelation()
2728  {
2729  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
2730 
2731  // relation
2732  foreach ($ids = $this->md_obj->getRelationIds() as $id) {
2733  // kind
2734  $relation = $this->md_obj->getRelation($id);
2735  $relation->setKind($_POST['relation'][$id]['Kind']);
2736 
2737  $relation->update();
2738 
2739  // identifiers
2740  $res_idents = $relation->getIdentifier_Ids();
2741  foreach ($res_idents as $res_id) {
2742  $ident = $relation->getIdentifier_($res_id);
2743  $ident->setCatalog(ilUtil::stripSlashes($_POST['relation']['Resource']['Identifier'][$res_id]['Catalog']));
2744  $ident->setEntry(ilUtil::stripSlashes($_POST['relation']['Resource']['Identifier'][$res_id]['Entry']));
2745  $ident->update();
2746  }
2747 
2748  // descriptions
2749  $res_dess = $relation->getDescriptionIds();
2750  foreach ($res_dess as $res_des) {
2751  $des = $relation->getDescription($res_des);
2752  $des->setDescription(ilUtil::stripSlashes($_POST['relation']['Resource']['Description'][$res_des]['Value']));
2753  $des->setDescriptionLanguage(
2754  new ilMDLanguageItem($_POST['relation']['Resource']['Description'][$res_des]['Language'])
2755  );
2756  $des->update();
2757  }
2758  }
2759 
2760  $this->callListeners('Relation');
2761  ilUtil::sendSuccess($this->lng->txt("saved_successfully"));
2762  $this->listSection();
2763  }
2764 
2765  /*
2766  * list annotation section
2767  */
2768  public function listAnnotation()
2769  {
2770  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
2771  $this->__setTabs('meta_annotation');
2772  $this->tpl->addBlockFile('MD_CONTENT', 'md_content', 'tpl.md_annotation.html', 'Services/MetaData');
2773 
2774  $anno_ids = $this->md_obj->getAnnotationIds();
2775  if (!is_array($anno_ids) || count($anno_ids) == 0) {
2776  $this->tpl->setCurrentBlock("no_annotation");
2777  $this->tpl->setVariable("TXT_NO_ANNOTATION", $this->lng->txt("meta_no_annotation"));
2778  $this->tpl->setVariable("TXT_ADD_ANNOTATION", $this->lng->txt("meta_add"));
2779  $this->ctrl->setParameter($this, "section", "meta_annotation");
2780  $this->tpl->setVariable(
2781  "ACTION_ADD_ANNOTATION",
2782  $this->ctrl->getLinkTarget($this, "addSection")
2783  );
2784  $this->tpl->parseCurrentBlock();
2785  } else {
2786  foreach ($anno_ids as $anno_id) {
2787  $this->ctrl->setParameter($this, 'meta_index', $anno_id);
2788  $this->ctrl->setParameter($this, "section", "meta_annotation");
2789 
2790  $this->md_section = $this->md_obj->getAnnotation($anno_id);
2791 
2792  $this->tpl->setCurrentBlock("annotation_loop");
2793  $this->tpl->setVariable("ANNOTATION_ID", $anno_id);
2794  $this->tpl->setVariable("TXT_ANNOTATION", $this->lng->txt("meta_annotation"));
2795  $this->ctrl->setParameter($this, "meta_index", $anno_id);
2796  $this->tpl->setVariable(
2797  "ACTION_DELETE",
2798  $this->ctrl->getLinkTarget($this, "deleteSection")
2799  );
2800  $this->ctrl->setParameter($this, "section", "meta_annotation");
2801  $this->tpl->setVariable(
2802  "ACTION_ADD",
2803  $this->ctrl->getLinkTarget($this, "addSection")
2804  );
2805  $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("meta_delete"));
2806  $this->tpl->setVariable("TXT_ADD", $this->lng->txt("meta_add"));
2807 
2808  $this->tpl->setVariable("TXT_ENTITY", $this->lng->txt("meta_entity"));
2809  $this->tpl->setVariable("VAL_ENTITY", ilUtil::prepareFormOutput($this->md_section->getEntity()));
2810  $this->tpl->setVariable("TXT_DATE", $this->lng->txt("meta_date"));
2811  $this->tpl->setVariable("VAL_DATE", ilUtil::prepareFormOutput($this->md_section->getDate()));
2812 
2813  /* Description */
2814  $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("meta_description"));
2815  $this->tpl->setVariable("TXT_VALUE", $this->lng->txt("meta_value"));
2816  $this->tpl->setVariable("VAL_DESCRIPTION", ilUtil::prepareFormOutput($this->md_section->getDescription()));
2817  $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("meta_language"));
2818  $this->tpl->setVariable(
2819  "VAL_DESCRIPTION_LANGUAGE",
2820  $this->__showLanguageSelect(
2821  'annotation[' . $anno_id . '][Language]',
2822  $this->md_section->getDescriptionLanguageCode()
2823  )
2824  );
2825 
2826  $this->tpl->parseCurrentBlock();
2827  }
2828 
2829  $this->tpl->setCurrentBlock("annotation");
2830  $this->tpl->setVariable("EDIT_ACTION", $this->ctrl->getFormAction($this));
2831  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
2832  $this->tpl->parseCurrentBlock();
2833  }
2834  }
2835 
2836  public function updateAnnotation()
2837  {
2838  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
2839 
2840  // relation
2841  foreach ($ids = $this->md_obj->getAnnotationIds() as $id) {
2842  // entity
2843  $annotation = $this->md_obj->getAnnotation($id);
2844  $annotation->setEntity(ilUtil::stripSlashes($_POST['annotation'][$id]['Entity']));
2845  $annotation->setDate(ilUtil::stripSlashes($_POST['annotation'][$id]['Date']));
2846  $annotation->setDescription(ilUtil::stripSlashes($_POST['annotation'][$id]['Description']));
2847  $annotation->setDescriptionLanguage(
2848  new ilMDLanguageItem($_POST['annotation'][$id]['Language'])
2849  );
2850 
2851  $annotation->update();
2852  }
2853 
2854  $this->callListeners('Annotation');
2855  ilUtil::sendSuccess($this->lng->txt("saved_successfully"));
2856  $this->listSection();
2857  }
2858 
2859  /*
2860  * list classification section
2861  */
2862  public function listClassification()
2863  {
2864  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
2865  $this->__setTabs('meta_classification');
2866  $this->tpl->addBlockFile('MD_CONTENT', 'md_content', 'tpl.md_classification.html', 'Services/MetaData');
2867 
2868  $class_ids = $this->md_obj->getClassificationIds();
2869  if (!is_array($class_ids) || count($class_ids) == 0) {
2870  $this->tpl->setCurrentBlock("no_classification");
2871  $this->tpl->setVariable("TXT_NO_CLASSIFICATION", $this->lng->txt("meta_no_classification"));
2872  $this->tpl->setVariable("TXT_ADD_CLASSIFICATION", $this->lng->txt("meta_add"));
2873  $this->ctrl->setParameter($this, "section", "meta_classification");
2874  $this->tpl->setVariable(
2875  "ACTION_ADD_CLASSIFICATION",
2876  $this->ctrl->getLinkTarget($this, "addSection")
2877  );
2878  $this->tpl->parseCurrentBlock();
2879  } else {
2880  foreach ($class_ids as $class_id) {
2881  $this->md_section = $this->md_obj->getClassification($class_id);
2882  $this->ctrl->setParameter($this, "section", "meta_classification");
2883 
2884  /* TaxonPath */
2885  $tp_ids = $this->md_section->getTaxonPathIds();
2886  foreach ($tp_ids as $tp_id) {
2887  $tax_path = $this->md_section->getTaxonPath($tp_id);
2888 
2889  $tax_ids = $tax_path->getTaxonIds();
2890 
2891  foreach ($tax_ids as $tax_id) {
2892  $taxon = $tax_path->getTaxon($tax_id);
2893 
2894  if (count($tax_ids) > 1) {
2895  $this->tpl->setCurrentBlock("taxon_delete");
2896  $this->ctrl->setParameter($this, "meta_index", $tax_id);
2897  $this->ctrl->setParameter($this, "meta_path", "classification_taxon");
2898  $this->tpl->setVariable(
2899  "TAXONPATH_TAXON_LOOP_ACTION_DELETE",
2900  $this->ctrl->getLinkTarget($this, "deleteElement")
2901  );
2902  $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
2903  $this->tpl->parseCurrentBlock();
2904  }
2905 
2906  $this->tpl->setCurrentBlock("taxonpath_taxon_loop");
2907  $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_NO", $tax_id);
2908  $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TAXONPATH_NO", $tp_id);
2909  $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TXT_TAXON", $this->lng->txt("meta_taxon"));
2910  $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
2911  $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_VAL_TAXON", ilUtil::prepareFormOutput($taxon->getTaxon()));
2912  $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TXT_ID", $this->lng->txt("meta_id"));
2913  $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_VAL_ID", ilUtil::prepareFormOutput($taxon->getTaxonId()));
2914  $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
2915  $this->tpl->setVariable(
2916  "TAXONPATH_TAXON_LOOP_VAL_TAXON_LANGUAGE",
2917  $this->__showLanguageSelect(
2918  'classification[TaxonPath][Taxon][' . $tax_id . '][Language]',
2919  $taxon->getTaxonLanguageCode()
2920  )
2921  );
2922 
2923  $this->ctrl->setParameter($this, "section_element", "Taxon_" . $class_id);
2924  $this->ctrl->setParameter($this, "meta_index", $tp_id);
2925  $this->tpl->setVariable(
2926  "TAXONPATH_TAXON_LOOP_ACTION_ADD",
2927  $this->ctrl->getLinkTarget($this, "addSectionElement")
2928  );
2929  $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
2930  $this->tpl->parseCurrentBlock();
2931  }
2932 
2933  if (count($tp_ids) > 1) {
2934  $this->tpl->setCurrentBlock("taxonpath_delete");
2935  $this->ctrl->setParameter($this, "meta_index", $tp_id);
2936  $this->ctrl->setParameter($this, "meta_path", "classification_taxon_path");
2937  $this->tpl->setVariable(
2938  "TAXONPATH_LOOP_ACTION_DELETE",
2939  $this->ctrl->getLinkTarget($this, "deleteElement")
2940  );
2941  $this->tpl->setVariable("TAXONPATH_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
2942  $this->tpl->parseCurrentBlock();
2943  }
2944 
2945  $this->tpl->setCurrentBlock("taxonpath_loop");
2946  $this->tpl->setVariable("TAXONPATH_LOOP_NO", $tp_id);
2947  $this->tpl->setVariable("TAXONPATH_LOOP_ROWSPAN", (3 * count($tax_ids)) + 2);
2948  $this->tpl->setVariable("TAXONPATH_LOOP_TXT_TAXONPATH", $this->lng->txt("meta_taxon_path"));
2949  $this->tpl->setVariable("TAXONPATH_LOOP_TXT_SOURCE", $this->lng->txt("meta_source"));
2950  $this->tpl->setVariable("TAXONPATH_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
2951  $this->tpl->setVariable("TAXONPATH_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
2952  $this->tpl->setVariable("TAXONPATH_LOOP_VAL_SOURCE", ilUtil::prepareFormOutput($tax_path->getSource()));
2953  $this->tpl->setVariable(
2954  "TAXONPATH_LOOP_VAL_SOURCE_LANGUAGE",
2955  $this->__showLanguageSelect(
2956  'classification[TaxonPath][' . $tp_id . '][Source][Language]',
2957  $tax_path->getSourceLanguageCode()
2958  )
2959  );
2960  $this->ctrl->setParameter($this, "section_element", "TaxonPath_" . $class_id);
2961  $this->ctrl->setParameter($this, "meta_index", $class_id);
2962  $this->tpl->setVariable(
2963  "TAXONPATH_LOOP_ACTION_ADD",
2964  $this->ctrl->getLinkTarget($this, "addSectionElement")
2965  );
2966  $this->tpl->setVariable("TAXONPATH_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
2967  $this->tpl->parseCurrentBlock();
2968  }
2969 
2970  /* Description */
2971  $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("meta_description"));
2972  $this->tpl->setVariable("TXT_VALUE", $this->lng->txt("meta_value"));
2973  $this->tpl->setVariable(
2974  "VAL_DESCRIPTION",
2975  ilUtil::prepareFormOutput($this->md_section->getDescription())
2976  );
2977  $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("meta_language"));
2978  $this->tpl->setVariable(
2979  "VAL_DESCRIPTION_LANGUAGE",
2980  $this->__showLanguageSelect(
2981  'classification[' . $class_id . '][Language]',
2982  $this->md_section->getDescriptionLanguageCode()
2983  )
2984  );
2985 
2986  /* Keyword */
2987  $key_ids = $this->md_section->getKeywordIds();
2988  foreach ($key_ids as $key_id) {
2989  if (count($key_ids) > 1) {
2990  $this->ctrl->setParameter($this, "meta_index", $key_id);
2991  $this->ctrl->setParameter($this, "meta_path", "classification_keyword");
2992  $this->tpl->setCurrentBlock("keyword_delete");
2993  $this->tpl->setVariable(
2994  "KEYWORD_LOOP_ACTION_DELETE",
2995  $this->ctrl->getLinkTarget($this, "deleteElement")
2996  );
2997  $this->tpl->setVariable("KEYWORD_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
2998  $this->tpl->parseCurrentBlock();
2999  }
3000 
3001  $keyword = $this->md_section->getKeyword($key_id);
3002  $this->tpl->setCurrentBlock("keyword_loop");
3003  $this->tpl->setVariable("KEYWORD_LOOP_NO", $key_id);
3004  $this->tpl->setVariable("KEYWORD_LOOP_TXT_KEYWORD", $this->lng->txt("meta_keyword"));
3005  $this->tpl->setVariable("KEYWORD_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
3006  $this->tpl->setVariable(
3007  "KEYWORD_LOOP_VAL",
3008  ilUtil::prepareFormOutput($keyword->getKeyword())
3009  );
3010  $this->tpl->setVariable("KEYWORD_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
3011  $this->tpl->setVariable(
3012  "KEYWORD_LOOP_VAL_LANGUAGE",
3013  $this->__showLanguageSelect(
3014  'classification[Keyword][' . $key_id . '][Language]',
3015  $keyword->getKeywordLanguageCode()
3016  )
3017  );
3018  $this->ctrl->setParameter($this, "meta_index", $class_id);
3019  $this->ctrl->setParameter($this, "section_element", "Keyword_" . $class_id);
3020  $this->tpl->setVariable(
3021  "KEYWORD_LOOP_ACTION_ADD",
3022  $this->ctrl->getLinkTarget($this, "addSectionElement")
3023  );
3024  $this->tpl->setVariable("KEYWORD_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
3025  $this->tpl->parseCurrentBlock();
3026  }
3027 
3028  $this->tpl->setCurrentBlock("classification_loop");
3029  $this->tpl->setVariable("TXT_CLASSIFICATION", $this->lng->txt("meta_classification"));
3030  $this->ctrl->setParameter($this, "meta_index", $class_id);
3031  $this->tpl->setVariable(
3032  "ACTION_DELETE",
3033  $this->ctrl->getLinkTarget($this, "deleteSection")
3034  );
3035  $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("meta_delete"));
3036  $this->tpl->setVariable(
3037  "ACTION_ADD",
3038  $this->ctrl->getLinkTarget($this, "addSection")
3039  );
3040  $this->tpl->setVariable("TXT_ADD", $this->lng->txt("meta_add"));
3041 
3042  $this->tpl->setVariable("TXT_NEW_ELEMENT", $this->lng->txt("meta_new_element"));
3043  $this->tpl->setVariable("TXT_TAXONPATH", $this->lng->txt("meta_taxon_path"));
3044  $this->tpl->setVariable("TXT_KEYWORD", $this->lng->txt("meta_keyword"));
3045  $this->tpl->setVariable("TXT_ADD", $this->lng->txt("meta_add"));
3046 
3047  $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
3048  $this->tpl->setVariable("CLASS_ID", $class_id);
3049  $this->tpl->setVariable("TXT_PURPOSE", $this->lng->txt("meta_purpose"));
3050  $this->tpl->setVariable("TXT_DISCIPLINE", $this->lng->txt("meta_learning_resource_type"));
3051  $this->tpl->setVariable("TXT_IDEA", $this->lng->txt("meta_idea"));
3052  $this->tpl->setVariable("TXT_PREREQUISITE", $this->lng->txt("meta_prerequisite"));
3053  $this->tpl->setVariable("TXT_EDUCATIONALOBJECTIVE", $this->lng->txt("meta_educational_objective"));
3054  $this->tpl->setVariable("TXT_ACCESSIBILITYRESTRICTIONS", $this->lng->txt("meta_accessibility_restrictions"));
3055  $this->tpl->setVariable("TXT_EDUCATIONALLEVEL", $this->lng->txt("meta_educational_level"));
3056  $this->tpl->setVariable("TXT_SKILLLEVEL", $this->lng->txt("meta_skill_level"));
3057  $this->tpl->setVariable("TXT_SECURITYLEVEL", $this->lng->txt("meta_security_level"));
3058  $this->tpl->setVariable("TXT_COMPETENCY", $this->lng->txt("meta_competency"));
3059  $this->tpl->setVariable("VAL_PURPOSE_" . strtoupper($this->md_section->getPurpose()), " selected");
3060  $this->tpl->parseCurrentBlock();
3061  }
3062 
3063  $this->tpl->setCurrentBlock("classification");
3064  $this->tpl->setVariable(
3065  "EDIT_ACTION",
3066  $this->ctrl->getFormAction($this)
3067  );
3068  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
3069  $this->tpl->parseCurrentBlock();
3070  }
3071  }
3072 
3073  public function updateClassification()
3074  {
3075  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
3076 
3077  // relation
3078  foreach ($ids = $this->md_obj->getClassificationIds() as $id) {
3079  // entity
3080  $classification = $this->md_obj->getClassification($id);
3081  $classification->setPurpose($_POST['classification'][$id]['Purpose']);
3082 
3083  $classification->setDescription(ilUtil::stripSlashes($_POST['classification'][$id]['Description']));
3084  $classification->setDescriptionLanguage(
3085  new ilMDLanguageItem($_POST['classification'][$id]['Language'])
3086  );
3087 
3088  $classification->update();
3089 
3090  $key_ids = $classification->getKeywordIds();
3091  foreach ($key_ids as $key_id) {
3092  $keyword = $classification->getKeyword($key_id);
3093  $keyword->setKeyword(ilUtil::stripSlashes($_POST['classification']['Keyword'][$key_id]['Value']));
3094  $keyword->setKeywordLanguage(
3095  new ilMDLanguageItem($_POST['classification']['Keyword'][$key_id]['Language'])
3096  );
3097  $keyword->update();
3098  }
3099 
3100  $tp_ids = $classification->getTaxonPathIds();
3101  foreach ($tp_ids as $tp_id) {
3102  $tax_path = $classification->getTaxonPath($tp_id);
3103  $tax_path->setSource(ilUtil::stripSlashes($_POST['classification']['TaxonPath'][$tp_id]['Source']['Value']));
3104  $tax_path->setSourceLanguage(
3105  new ilMDLanguageItem($_POST['classification']['TaxonPath'][$tp_id]['Source']['Language'])
3106  );
3107  $tax_path->update();
3108 
3109  $tax_ids = $tax_path->getTaxonIds();
3110 
3111  foreach ($tax_ids as $tax_id) {
3112  $taxon = $tax_path->getTaxon($tax_id);
3113  $taxon->setTaxon(ilUtil::stripSlashes($_POST['classification']['TaxonPath']['Taxon'][$tax_id]['Value']));
3114  $taxon->setTaxonLanguage(
3115  new ilMDLanguageItem($_POST['classification']['TaxonPath']['Taxon'][$tax_id]['Language'])
3116  );
3117  $taxon->setTaxonId(ilUtil::stripSlashes($_POST['classification']['TaxonPath']['Taxon'][$tax_id]['Id']));
3118  $taxon->update();
3119  }
3120  }
3121  }
3122 
3123  $this->callListeners('Classification');
3124  ilUtil::sendSuccess($this->lng->txt("saved_successfully"));
3125  $this->listSection();
3126  }
3127 
3128  public function deleteElement()
3129  {
3130  include_once 'Services/MetaData/classes/class.ilMDFactory.php';
3131 
3132  $md_element = ilMDFactory::_getInstance($_GET['meta_path'], $_GET['meta_index'], $_GET['meta_technical']);
3133  $md_element->delete();
3134 
3135  $this->listSection();
3136 
3137  return true;
3138  }
3139 
3140  public function deleteSection()
3141  {
3142  include_once 'Services/MetaData/classes/class.ilMDFactory.php';
3143 
3144  $md_element = ilMDFactory::_getInstance($_GET['section'], $_GET['meta_index']);
3145  $md_element->delete();
3146 
3147  $this->listSection();
3148 
3149  return true;
3150  }
3151 
3152  public function addSection()
3153  {
3154  // Switch section
3155  switch ($_GET['section']) {
3156  case 'meta_technical':
3157  $this->md_section = &$this->md_obj->addTechnical();
3158  $this->md_section->save();
3159  break;
3160 
3161 
3162  case 'meta_lifecycle':
3163  $this->md_section = &$this->md_obj->addLifecycle();
3164  $this->md_section->save();
3165  $con = &$this->md_section->addContribute();
3166  $con->save();
3167 
3168  $ent = &$con->addEntity();
3169  $ent->save();
3170  break;
3171 
3172  case 'meta_meta_metadata':
3173  $this->md_section = $this->md_obj->addMetaMetadata();
3174  $this->md_section->save();
3175 
3176  $ide = &$this->md_section->addIdentifier();
3177  $ide->save();
3178 
3179  $con = &$this->md_section->addContribute();
3180  $con->save();
3181 
3182  $ent = &$con->addEntity();
3183  $ent->save();
3184  break;
3185 
3186  case 'meta_rights':
3187  $this->md_section = $this->md_obj->addRights();
3188  $this->md_section->save();
3189  break;
3190 
3191  case 'meta_educational':
3192  $this->md_section = $this->md_obj->addEducational();
3193  $this->md_section->save();
3194  break;
3195 
3196  case 'meta_relation':
3197  $this->md_section = $this->md_obj->addRelation();
3198  $this->md_section->save();
3199  $ident = $this->md_section->addIdentifier_();
3200  $ident->save();
3201  $des = $this->md_section->addDescription();
3202  $des->save();
3203  break;
3204 
3205  case 'meta_annotation':
3206  $this->md_section = $this->md_obj->addAnnotation();
3207  $this->md_section->save();
3208  break;
3209 
3210  case 'meta_classification':
3211  $this->md_section = $this->md_obj->addClassification();
3212  $this->md_section->save();
3213 
3214  $taxon_path = &$this->md_section->addTaxonPath();
3215  $taxon_path->save();
3216 
3217  $taxon = &$taxon_path->addTaxon();
3218  $taxon->save();
3219 
3220  $key = &$this->md_section->addKeyword();
3221  $key->save();
3222  break;
3223 
3224  }
3225 
3226  $this->listSection();
3227  return true;
3228  }
3229 
3230  public function addSectionElement()
3231  {
3232  $section_element = (empty($_POST['section_element']))
3233  ? $_GET['section_element']
3234  : $_POST['section_element'];
3235 
3236 
3237  // Switch section
3238  switch ($_GET['section']) {
3239  case 'meta_technical':
3240  $this->md_section = &$this->md_obj->getTechnical();
3241  break;
3242 
3243  case 'meta_lifecycle':
3244  $this->md_section = &$this->md_obj->getLifecycle();
3245  break;
3246 
3247  case 'meta_meta_metadata':
3248  $this->md_section = &$this->md_obj->getMetaMetadata();
3249  break;
3250 
3251  case 'meta_general':
3252  $this->md_section = $this->md_obj->getGeneral();
3253  break;
3254 
3255  case 'meta_educational':
3256  $this->md_section = $this->md_obj->getEducational();
3257  break;
3258 
3259  case 'meta_classification':
3260  $arr = explode("_", $section_element);
3261  $section_element = $arr[0];
3262  $this->md_section = $this->md_obj->getClassification($arr[1]);
3263  break;
3264  }
3265 
3266  // Switch new element
3267  switch ($section_element) {
3268  case 'meta_or_composite':
3269  $md_new = &$this->md_section->addOrComposite();
3270  $md_new = $md_new->addRequirement();
3271  break;
3272 
3273  case 'meta_requirement':
3274  $md_new = &$this->md_section->addRequirement();
3275  break;
3276 
3277  case 'meta_location':
3278  $md_new = &$this->md_section->addLocation();
3279  break;
3280 
3281  case 'meta_format':
3282  $md_new = $this->md_section->addFormat();
3283  break;
3284 
3285  case 'meta_entity':
3286  $md_new = $this->md_section->getContribute((int) $_GET['meta_index']);
3287  $md_new = $md_new->addEntity();
3288  break;
3289 
3290  case 'meta_identifier':
3291  $md_new = $this->md_section->addIdentifier();
3292  break;
3293 
3294  case 'meta_contribute':
3295  $md_new = &$this->md_section->addContribute();
3296  $md_new->save();
3297  $md_new = $md_new->addEntity();
3298  break;
3299 
3300  case 'educational_language':
3301  case 'meta_language':
3302  $md_new = $this->md_section->addLanguage();
3303  break;
3304 
3305  case 'educational_description':
3306  case 'meta_description':
3307  $md_new = $this->md_section->addDescription();
3308  break;
3309 
3310  case 'Keyword':
3311  case 'meta_keyword':
3312  $md_new = $this->md_section->addKeyword();
3313  break;
3314 
3315  case 'educational_typical_age_range':
3316  $md_new = $this->md_section->addTypicalAgeRange();
3317  break;
3318 
3319  case 'relation_resource_identifier':
3320  $rel = $this->md_obj->getRelation($_GET['meta_index']);
3321  $md_new = $rel->addIdentifier_();
3322  break;
3323 
3324  case 'relation_resource_description':
3325  $rel = $this->md_obj->getRelation($_GET['meta_index']);
3326  $md_new = $rel->addDescription();
3327  break;
3328 
3329  case 'TaxonPath':
3330  $md_new = $this->md_section->addTaxonPath();
3331  $md_new->save();
3332  $md_new = $md_new->addTaxon();
3333  break;
3334 
3335  case 'Taxon':
3336  $tax_path = $this->md_section->getTaxonPath($_GET['meta_index']);
3337  $md_new = $tax_path->addTaxon();
3338  break;
3339  }
3340 
3341  $md_new->save();
3342 
3343  $this->listSection();
3344 
3345  return true;
3346  }
3347 
3348  public function listSection()
3349  {
3350  switch ($_REQUEST['section']) {
3351  case 'meta_general':
3352  return $this->listGeneral();
3353 
3354  case 'meta_lifecycle':
3355  return $this->listLifecycle();
3356 
3357  case 'meta_technical':
3358  return $this->listTechnical();
3359 
3360  case 'meta_meta_metadata':
3361  return $this->listMetaMetadata();
3362 
3363  case 'debug':
3364  return $this->debug();
3365 
3366  case 'meta_rights':
3367  return $this->listRights();
3368 
3369  case 'meta_educational':
3370  return $this->listEducational();
3371 
3372  case 'meta_relation':
3373  return $this->listRelation();
3374 
3375  case 'meta_annotation':
3376  return $this->listAnnotation();
3377 
3378  case 'meta_classification':
3379  return $this->listClassification();
3380 
3381  default:
3382  if ($this->md_obj->obj_type == 'sahs' || $this->md_obj->obj_type == 'sco') {
3383  return $this->listQuickEdit_scorm();
3384  } else {
3385  return $this->listQuickEdit();
3386  }
3387  }
3388  }
3389 
3390 
3391  // PRIVATE
3392  public function __fillSubelements()
3393  {
3394  if (count($subs = $this->md_section->getPossibleSubelements())) {
3395  //$subs = array_merge(array('' => 'meta_please_select'),$subs);
3396 
3397  $this->tpl->setCurrentBlock("subelements");
3398  $this->tpl->setVariable("SEL_SUBELEMENTS", ilUtil::formSelect('', 'section_element', $subs));
3399  $this->tpl->setVariable("TXT_NEW_ELEMENT", $this->lng->txt("meta_new_element"));
3400  $this->tpl->parseCurrentBlock();
3401 
3402  $this->tpl->setVariable("TXT_ADD", $this->lng->txt('meta_add'));
3403  }
3404  return true;
3405  }
3406 
3407 
3408 
3409  public function __setTabs($a_active)
3410  {
3411  global $DIC;
3412 
3413  $ilToolbar = $DIC['ilToolbar'];
3414 
3415  $tabs = array('meta_quickedit' => 'listQuickEdit',
3416  'meta_general' => 'listGeneral',
3417  'meta_lifecycle' => 'listLifecycle',
3418  'meta_meta_metadata' => 'listMetaMetadata',
3419  'meta_technical' => 'listTechnical',
3420  'meta_educational' => 'listEducational',
3421  'meta_rights' => 'listRights',
3422  'meta_relation' => 'listRelation',
3423  'meta_annotation' => 'listAnnotation',
3424  'meta_classification' => 'listClassification');
3425 
3426  if (DEVMODE) {
3427  $tabs['debug'] = 'debug';
3428  }
3429 
3430  include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
3431  $section = new ilSelectInputGUI($this->lng->txt("meta_section"), "section");
3432 
3433  $options = array();
3434  foreach (array_keys($tabs) as $key) {
3435  $options[$key] = $this->lng->txt($key);
3436  }
3437  $section->setOptions($options);
3438  $section->setValue($a_active);
3439 
3440  $ilToolbar->addStickyItem($section, true);
3441 
3442  include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
3443  $button = ilSubmitButton::getInstance();
3444  $button->setCaption("show");
3445  $button->setCommand("listSection");
3446  $ilToolbar->addStickyItem($button);
3447 
3448  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "listSection"));
3449 
3450  return true;
3451  }
3452 
3453 
3457  public function __showLanguageSelect($a_name, $a_value = "")
3458  {
3459  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
3460 
3461  $tpl = new ilTemplate(
3462  "tpl.lang_selection.html",
3463  true,
3464  true,
3465  "Services/MetaData"
3466  );
3467 
3468  foreach (ilMDLanguageItem::_getLanguages() as $code => $text) {
3469  $tpl->setCurrentBlock("lg_option");
3470  $tpl->setVariable("VAL_LG", $code);
3471  $tpl->setVariable("TXT_LG", $text);
3472 
3473  if ($a_value != "" &&
3474  $a_value == $code) {
3475  $tpl->setVariable("SELECTED", "selected");
3476  }
3477 
3478  $tpl->parseCurrentBlock();
3479  }
3480  $tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
3481  $tpl->setVariable("SEL_NAME", $a_name);
3482 
3483  $return = $tpl->get();
3484  unset($tpl);
3485 
3486  return $return;
3487  }
3488 
3489  public function __buildMonthsSelect($sel_month)
3490  {
3491  for ($i = 0;$i <= 24;$i++) {
3492  $options[$i] = sprintf('%02d', $i);
3493  }
3494  return ilUtil::formSelect($sel_month, 'tlt[mo]', $options, false, true);
3495  }
3496 
3497 
3498  public function __buildDaysSelect($sel_day)
3499  {
3500  for ($i = 0;$i <= 31;$i++) {
3501  $options[$i] = sprintf('%02d', $i);
3502  }
3503  return ilUtil::formSelect($sel_day, 'tlt[d]', $options, false, true);
3504  }
3505 
3506 
3507 
3508  // Observer methods
3509  public function addObserver(&$a_class, $a_method, $a_element)
3510  {
3511  $this->observers[$a_element]['class'] = &$a_class;
3512  $this->observers[$a_element]['method'] = &$a_method;
3513 
3514  return true;
3515  }
3516  public function callListeners($a_element)
3517  {
3518  if (isset($this->observers[$a_element])) {
3519  $class = &$this->observers[$a_element]['class'];
3520  $method = $this->observers[$a_element]['method'];
3521 
3522  return $class->$method($a_element);
3523  }
3524  return false;
3525  }
3526 
3532  protected function getChangeCopyrightModal()
3533  {
3534  $md_settings = ilMDSettings::_getInstance();
3535  if (!$md_settings->isCopyrightSelectionActive()) {
3536  return null;
3537  }
3538 
3539  $link = $this->ctrl->getLinkTarget($this, 'updateQuickEdit');
3540  return $this->ui_factory
3541  ->modal()
3542  ->interruptive(
3543  $this->lng->txt("meta_copyright_change_warning_title"),
3544  $this->lng->txt("meta_copyright_change_info"),
3545  $link
3546  );
3547  }
3548 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents an option in a radio group.
setTitle($a_title)
Set Title.
setDataSource($href, $a_delimiter=null)
set datasource link for js autocomplete
updateQuickEdit_scorm()
update quick edit properties - SCORM customization
This class represents a selection list property in a property form.
$result
keywordAutocomplete()
Keyword list for autocomplete.
This class represents a property form user interface.
foreach($paths as $path) $request
Definition: asyncclient.php:32
$type
global $DIC
Definition: saml.php:7
static _getInstance($a_type, $a_index, $a_technical_id=0)
$_GET["client_id"]
$code
Definition: example_050.php:99
This class represents a typical learning time property in a property form.
$valid
static _getLocationTypeSelect($a_selected, $a_name, $prepend=array())
Prepare a meta location type.
setValueByLOMDuration($a_value)
Set by LOM duration.
addObserver(&$a_class, $a_method, $a_element)
if(!array_key_exists('StateId', $_REQUEST)) $id
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
$auth
Definition: fileserver.php:48
updateGeneral()
update general section
static makeTimeSelect($prefix, $short=true, $hour="", $minute="", $second="", $a_use_default=true, $a_further_options=array())
Creates a combination of HTML selects for time inputs.
static _LOMDurationToArray($a_string)
LOM datatype duration is a string like P2M4DT7H18M2S (2 months 4 days 7 hours 18 minutes 2 seconds) T...
static _getStatusSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
static updateKeywords(ilMDGeneral $a_md_section, array $a_keywords)
Update keywords from input array.
global $ilCtrl
Definition: ilias.php:18
static _getInstance()
get instance
setInfo($a_info)
Set Information Text.
$section
Definition: Utf8Test.php:83
getChangeCopyrightModal()
Get cnange copyright modal.
static _lookupDescription($a_rbac_id, $a_obj_id)
Lookup description (copyright)
$r
Definition: example_031.php:79
This class represents a property in a property form.
setValue($a_value)
Set Value.
static encode($mixed, $suppress_native=false)
initQuickEditForm($a_signal_id)
Init quick edit form.
foreach($_POST as $key=> $value) $res
static _getBrowserSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical browser selector.
if(isset($_POST['submit'])) $form
updateQuickEdit()
update quick edit properties
__showLanguageSelect($a_name, $a_value="")
shows language select box
special template class to simplify handling of ITX/PEAR
$text
Definition: errorreport.php:18
updateQuickEdit_scorm_propagate($request, $type)
This class represents a text property in a property form.
static _extractEntryId($a_cp_string)
extract entry id
setMaxLength($a_maxlength)
Set Max Length.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
callListeners($a_element)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if(!empty($this->data['faventry'])) $tabs
Definition: disco.tpl.php:124
static _getOperatingSystemSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical os selector.
static _getMatchingKeywords($a_query, $a_type, $a_rbac_id=0)
Search for keywords.
exit
Definition: backend.php:16
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
This class represents a text area property in a property form.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
$i
Definition: disco.tpl.php:19
static getLogger($a_component_id)
Get component logger.
static _getRoleSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
__construct($a_rbac_id, $a_obj_id, $a_obj_type)
__buildMonthsSelect($sel_month)
$key
Definition: croninfo.php:18
$_POST["username"]
$data
Definition: bench.php:6
listQuickEditCopyright(ilPropertyFormGUI $form)
Show copyright selecetion.