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