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