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