• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/MetaData/classes/class.ilMDEditorGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 
00032 include_once 'Services/MetaData/classes/class.ilMD.php';
00033 include_once 'Services/MetaData/classes/class.ilMDUtilSelect.php';
00034 
00035 define('IL_TLT_MAX_HOURS',99);
00036 
00037 
00038 class ilMDEditorGUI
00039 {
00040         var $ctrl = null;
00041         var $lng = null;
00042         var $tpl = null;
00043         var $md_obj = null;
00044 
00045         var $observers = array();
00046 
00047         var $rbac_id = null;
00048         var $obj_id = null;
00049         var $obj_type = null;
00050 
00051         function ilMDEditorGUI($a_rbac_id,$a_obj_id,$a_obj_type)
00052         {
00053                 global $ilCtrl,$lng,$tpl,$ilTabs;
00054 
00055                 $this->md_obj =& new ilMD($a_rbac_id,$a_obj_id,$a_obj_type);
00056                 $this->ctrl =& $ilCtrl;
00057 
00058                 $this->lng =& $lng;
00059                 $this->lng->loadLanguageModule('meta');
00060 
00061                 $this->tpl =& $tpl;
00062 
00063                 $this->tabs_gui =& $ilTabs;
00064 
00065         }
00066 
00067         function &executeCommand()
00068         {
00069                 global $rbacsystem;
00070 
00071                 $next_class = $this->ctrl->getNextClass($this);
00072 
00073                 $cmd = $this->ctrl->getCmd();
00074                 switch($next_class)
00075                 {
00076                         default:
00077                                 if(!$cmd)
00078                                 {
00079                                         $cmd = "listSection";
00080                                 }
00081                                 $this->$cmd();
00082                                 break;
00083                 }
00084                 return true;
00085         }
00086 
00087 
00088         function debug()
00089         {
00090                 include_once 'Services/MetaData/classes/class.ilMD2XML.php';
00091 
00092 
00093                 $xml_writer =& new ilMD2XML($this->md_obj->getRBACId(),$this->md_obj->getObjId(),$this->md_obj->getObjType());
00094                 $xml_writer->startExport();
00095 
00096                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.md_editor.html','Services/MetaData');
00097                 
00098                 $this->__setTabs('meta_general');
00099 
00100                 $this->tpl->setVariable("MD_CONTENT",htmlentities($xml_writer->getXML()));
00101 
00102                 return true;
00103         }
00104         
00105         /*
00106          * list quick edit screen
00107          */
00108         function listQuickEdit()
00109         {
00110                 if(!is_object($this->md_section = $this->md_obj->getGeneral()))
00111                 {
00112                         $this->md_section = $this->md_obj->addGeneral();
00113                         $this->md_section->save();
00114                 }
00115 
00116                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.md_editor.html','Services/MetaData');
00117                 
00118                 $this->__setTabs('meta_quickedit');
00119 
00120                 $this->tpl->addBlockFile('MD_CONTENT','md_content','tpl.md_quick_edit.html','Services/MetaData');
00121 
00122                 $this->ctrl->setReturn($this,'listGeneral');
00123                 $this->ctrl->setParameter($this,'section','meta_general');
00124                 $this->tpl->setVariable("EDIT_ACTION",$this->ctrl->getFormAction($this));
00125 
00126                 $this->tpl->setVariable("TXT_QUICK_EDIT", $this->lng->txt("meta_quickedit"));
00127                 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("meta_language"));
00128                 $this->tpl->setVariable("TXT_KEYWORD", $this->lng->txt("meta_keyword"));
00129                 $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("meta_description"));
00130                 $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
00131 
00132                 // Language
00133                 $first = true;
00134                 foreach($ids = $this->md_section->getLanguageIds() as $id)
00135                 {
00136                         $md_lan = $this->md_section->getLanguage($id);
00137                         
00138                         if ($first)
00139                         {
00140                                 $this->tpl->setCurrentBlock("language_head");
00141                                 $this->tpl->setVariable("ROWSPAN_LANG", count($ids));
00142                                 $this->tpl->setVariable("LANGUAGE_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
00143                                 $this->tpl->parseCurrentBlock();
00144                                 $first = false;
00145                         }
00146 
00147                         if (count($ids) > 1)
00148                         {
00149                                 $this->ctrl->setParameter($this,'meta_index',$id);
00150                                 $this->ctrl->setParameter($this,'meta_path','meta_language');
00151 
00152                                 $this->tpl->setCurrentBlock("language_delete");
00153                                 $this->tpl->setVariable("LANGUAGE_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
00154                                 $this->tpl->setVariable("LANGUAGE_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
00155                                 $this->tpl->parseCurrentBlock();
00156                         }
00157                         $this->tpl->setCurrentBlock("language_loop");
00158                         $this->tpl->setVariable("LANGUAGE_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect('gen_language['.$id.'][language]',
00159                                                                                                                                                                                 $md_lan->getLanguageCode()));
00160                         $this->tpl->parseCurrentBlock();
00161                 }
00162 
00163                 if ($first)
00164                 {
00165                         $this->tpl->setCurrentBlock("language_head");
00166                         $this->tpl->setVariable("ROWSPAN_LANG", 1);
00167                         $this->tpl->setVariable("LANGUAGE_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
00168                         $this->tpl->parseCurrentBlock();
00169                         $this->tpl->setCurrentBlock("language_loop");
00170                         $this->tpl->setVariable("LANGUAGE_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect('gen_language[][language]',
00171                                 ""));
00172                         $this->tpl->parseCurrentBlock();
00173                 }
00174 
00175                 // TITLE
00176                 $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('title'));
00177                 $this->tpl->setVariable("VAL_TITLE",ilUtil::prepareFormOutput($this->md_section->getTitle()));
00178                 $this->tpl->setVariable("VAL_TITLE_LANGUAGE",$this->__showLanguageSelect('gen_title_language',
00179                                                                                                                                                            $this->md_section->getTitleLanguageCode()));
00180 
00181                 // DESCRIPTION
00182                 foreach($ids = $this->md_section->getDescriptionIds() as $id)
00183                 { 
00184                         $md_des = $this->md_section->getDescription($id);
00185 
00186                         if (count($ids) > 1)
00187                         {
00188                                 $this->ctrl->setParameter($this,'meta_index',$id);
00189                                 $this->ctrl->setParameter($this,'meta_path','meta_description');
00190 
00191                                 $this->tpl->setCurrentBlock("description_delete");
00192                                 $this->tpl->setVariable("DESCRIPTION_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
00193                                 $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
00194                                 $this->tpl->parseCurrentBlock();
00195                         }
00196 
00197                         $this->tpl->setCurrentBlock("description_loop");
00198                         $this->tpl->setVariable("DESCRIPTION_LOOP_NO",$id);
00199                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DESCRIPTION", $this->lng->txt("meta_description"));
00200                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
00201                         $this->tpl->setVariable("DESCRIPTION_LOOP_VAL",ilUtil::prepareFormOutput($md_des->getDescription()));
00202                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
00203                         $this->tpl->setVariable("DESCRIPTION_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect("gen_description[".$id.'][language]', 
00204                                                                                                                                                                   $md_des->getDescriptionLanguageCode()));
00205                         $this->tpl->parseCurrentBlock();
00206                 }
00207 
00208                 // KEYWORD
00209                 $first = true;
00210                 $keywords = array();
00211                 foreach($ids = $this->md_section->getKeywordIds() as $id)
00212                 {
00213                         $md_key = $this->md_section->getKeyword($id);
00214                         $keywords[$md_key->getKeywordLanguageCode()][]
00215                                 = $md_key->getKeyword();
00216                 }
00217                 
00218                 foreach($keywords as $lang => $keyword_set)
00219                 {
00220                         if ($first)
00221                         {
00222                                 $this->tpl->setCurrentBlock("keyword_head");
00223                                 $this->tpl->setVariable("ROWSPAN_KEYWORD", count($keywords));
00224                                 $this->tpl->setVariable("TXT_COMMA_SEP2",$this->lng->txt('comma_separated'));
00225                                 $this->tpl->setVariable("KEYWORD_LOOP_TXT_KEYWORD", $this->lng->txt("keywords"));
00226                                 $this->tpl->parseCurrentBlock();
00227                                 $first = false;
00228                         }
00229 
00230                         $this->tpl->setCurrentBlock("keyword_loop");
00231                         $this->tpl->setVariable("KEYWORD_LOOP_VAL", ilUtil::prepareFormOutput(
00232                                 implode($keyword_set, ", ")));
00233                         $this->tpl->setVariable("LANG", $lang);
00234                         $this->tpl->setVariable("KEYWORD_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect("keyword[language][$lang]",
00235                                                                                                                                                                            $lang));
00236                         $this->tpl->parseCurrentBlock();
00237                 }
00238 
00239                 if (count($keywords) == 0)
00240                 {
00241                         $this->tpl->setCurrentBlock("keyword_head");
00242                         $this->tpl->setVariable("ROWSPAN_KEYWORD", 1);
00243                         $this->tpl->setVariable("TXT_COMMA_SEP2",$this->lng->txt('comma_separated'));
00244                         $this->tpl->setVariable("KEYWORD_LOOP_TXT_KEYWORD", $this->lng->txt("keywords"));
00245                         $this->tpl->parseCurrentBlock();
00246                         $this->tpl->setCurrentBlock("keyword_loop");
00247                         $this->tpl->setVariable("KEYWORD_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect("keyword[language][$lang]",
00248                                 $lang));
00249                 }
00250                 
00251                 // Lifecycle...
00252                 // Authors
00253                 $this->tpl->setVariable("TXT_AUTHORS",$this->lng->txt('authors'));
00254                 $this->tpl->setVariable("TXT_COMMA_SEP",$this->lng->txt('comma_separated'));
00255                 if(is_object($this->md_section = $this->md_obj->getLifecycle()))
00256                 {
00257                         $sep = $ent_str = "";
00258                         foreach(($ids = $this->md_section->getContributeIds()) as $con_id)
00259                         {
00260                                 $md_con = $this->md_section->getContribute($con_id);
00261                                 if ($md_con->getRole() == "Author")
00262                                 {
00263                                         foreach($ent_ids = $md_con->getEntityIds() as $ent_id)
00264                                         {
00265                                                 $md_ent = $md_con->getEntity($ent_id);
00266                                                 $ent_str = $ent_str.$sep.$md_ent->getEntity();
00267                                                 $sep = ", ";
00268                                         }
00269                                 }
00270                         }
00271                         $this->tpl->setVariable("AUTHORS_VAL", ilUtil::prepareFormOutput($ent_str));
00272                 }
00273                 
00274                 
00275                 // Rights...
00276                 // Copyright
00277                 if(is_object($this->md_section = $this->md_obj->getRights()))
00278                 {
00279                         $this->tpl->setVariable("COPYRIGHT_VAL", ilUtil::prepareFormOutput($this->md_section->getDescription()));
00280                 }
00281                 $this->tpl->setVariable("TXT_COPYRIGHT",$this->lng->txt('meta_copyright'));
00282 
00283                 // Educational...
00284                 // Typical learning time
00285                 // creates entries like 2H59M12S. If entry is not parsable => warning.
00286 
00287                 #if(is_object($this->md_section = $this->md_obj->getEducational()))
00288                 #{
00289                 #       $this->tpl->setVariable("VAL_TYPICAL_LEARN_TIME", ilUtil::prepareFormOutput($this->md_section->getTypicalLearningTime()));
00290                 #}
00291                 
00292                 $tlt = array(0,0,0,0,0);
00293                 $valid = true;
00294                 if(is_object($this->md_section = $this->md_obj->getEducational()))
00295                 {
00296                         include_once 'Services/MetaData/classes/class.ilMDUtils.php';
00297                         
00298                         if(!$tlt = ilMDUtils::_LOMDurationToArray($this->md_section->getTypicalLearningTime()))
00299                         {
00300                                 if(strlen($this->md_section->getTypicalLearningTime()))
00301                                 {
00302                                         $tlt = array(0,0,0,0,0);
00303                                         $valid = false;
00304                                 }
00305                         }
00306                 }
00307                 $this->tpl->setVariable("TXT_MONTH",$this->lng->txt('md_months'));              
00308                 $this->tpl->setVariable("SEL_MONTHS",$this->__buildMonthsSelect($tlt[0]));
00309                 $this->tpl->setVariable("SEL_DAYS",$this->__buildDaysSelect($tlt[1]));
00310                 
00311                 $this->tpl->setVariable("TXT_DAYS",$this->lng->txt('md_days'));
00312                 $this->tpl->setVariable("TXT_TIME",$this->lng->txt('md_time'));
00313 
00314                 $this->tpl->setVariable("TXT_TYPICAL_LEARN_TIME",$this->lng->txt('meta_typical_learning_time'));
00315                 $this->tpl->setVariable("SEL_TLT",ilUtil::makeTimeSelect('tlt',$tlt[4] ? false : true,
00316                                                                                                                                  $tlt[2],$tlt[3],$tlt[4],
00317                                                                                                                                  false));
00318                 $this->tpl->setVariable("TLT_HINT",$tlt[4] ? '(hh:mm:ss)' : '(hh:mm)');
00319 
00320                 if(!$valid)
00321                 {
00322                         $this->tpl->setCurrentBlock("tlt_not_valid");
00323                         $this->tpl->setVariable("TXT_CURRENT_VAL",$this->lng->txt('meta_current_value'));
00324                         $this->tpl->setVariable("TLT",$this->md_section->getTypicalLearningTime());
00325                         $this->tpl->setVariable("INFO_TLT_NOT_VALID",$this->lng->txt('meta_info_tlt_not_valid'));
00326                         $this->tpl->parseCurrentBlock();
00327                 }
00328                 
00329         
00330                 $this->tpl->setVariable("TXT_SAVE",$this->lng->txt('save'));
00331         }
00332 
00336         function updateQuickEdit()
00337         {
00338                 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
00339 
00340                 // General values
00341                 $this->md_section = $this->md_obj->getGeneral();
00342                 $this->md_section->setTitle(ilUtil::stripSlashes($_POST['gen_title']));
00343                 $this->md_section->setTitleLanguage(new ilMDLanguageItem($_POST['gen_title_language']));
00344                 $this->md_section->update();
00345 
00346                 // Language
00347                 if(is_array($_POST['gen_language']))
00348                 {
00349                         foreach($_POST['gen_language'] as $id => $data)
00350                         {
00351                                 if ($id > 0)
00352                                 {
00353                                         $md_lan = $this->md_section->getLanguage($id);
00354                                         $md_lan->setLanguage(new ilMDLanguageItem($data['language']));
00355                                         $md_lan->update();
00356                                 }
00357                                 else
00358                                 {
00359                                         $md_lan = $this->md_section->addLanguage();
00360                                         $md_lan->setLanguage(new ilMDLanguageItem($data['language']));
00361                                         $md_lan->save();
00362                                 }
00363                         }
00364                 }
00365                 // Description
00366                 if(is_array($_POST['gen_description']))
00367                 {
00368                         foreach($_POST['gen_description'] as $id => $data)
00369                         {
00370                                 $md_des = $this->md_section->getDescription($id);
00371                                 $md_des->setDescription(ilUtil::stripSlashes($data['description']));
00372                                 $md_des->setDescriptionLanguage(new ilMDLanguageItem($data['language']));
00373                                 $md_des->update();
00374                         }
00375                 }
00376                 
00377                 
00378                 // Keyword
00379                 if(is_array($_POST["keywords"]["value"]))
00380                 {
00381                         $new_keywords = array();
00382                         foreach($_POST["keywords"]["value"] as $lang => $keywords)
00383                         {
00384                                 $language = $_POST["keyword"]["language"][$lang];
00385                                 $keywords = explode(",", $keywords);
00386                                 foreach($keywords as $keyword)
00387                                 {
00388                                         $new_keywords[$language][] = trim($keyword);
00389                                 }
00390                         }
00391                         
00392                         // update existing author entries (delete if not entered)
00393                         foreach($ids = $this->md_section->getKeywordIds() as $id)
00394                         {
00395                                 $md_key = $this->md_section->getKeyword($id);
00396 
00397                                 $lang = $md_key->getKeywordLanguageCode();
00398                                 
00399                                 // entered keyword already exists
00400                                 if (is_array($new_keywords[$lang]) &&
00401                                         in_array($md_key->getKeyword(), $new_keywords[$lang]))
00402                                 {
00403                                         unset($new_keywords[$lang]
00404                                                 [array_search($md_key->getKeyword(), $new_keywords[$lang])]);
00405                                 }
00406                                 else  // existing keyword has not been entered again -> delete
00407                                 {
00408                                         $md_key->delete();
00409                                 }
00410                         }
00411                         
00412                         // insert entered, but not existing keywords
00413                         foreach ($new_keywords as $lang => $key_arr)
00414                         {
00415                                 foreach($key_arr as $keyword)
00416                                 {
00417                                         if ($keyword != "")
00418                                         {
00419                                                 $md_key = $this->md_section->addKeyword();
00420                                                 $md_key->setKeyword(ilUtil::stripSlashes($keyword));
00421                                                 $md_key->setKeywordLanguage(new ilMDLanguageItem($lang));
00422                                                 $md_key->save();
00423                                         }
00424                                 }
00425                         }
00426 
00427                 }
00428                 $this->callListeners('General');
00429                 
00430                 //Rights...
00431                 // Copyright
00432                 if ($_POST["rights_copyright"] != "")
00433                 {
00434                         if(!is_object($this->md_section = $this->md_obj->getRights()))
00435                         {
00436                                 $this->md_section = $this->md_obj->addRights();
00437                                 $this->md_section->save();
00438                         }
00439                         $this->md_section->setCopyrightAndOtherRestrictions("Yes");
00440                         $this->md_section->setDescription(ilUtil::stripSlashes($_POST["rights_copyright"]));
00441                         $this->md_section->update();
00442                 }
00443                 else
00444                 {
00445                         if(is_object($this->md_section = $this->md_obj->getRights()))
00446                         {
00447                                 $this->md_section->setCopyrightAndOtherRestrictions("No");
00448                                 $this->md_section->setDescription("");
00449                                 $this->md_section->update();
00450                         }
00451                 }
00452                 $this->callListeners('Rights');
00453 
00454                 //Educational...
00455                 // Typical Learning Time
00456                 if($_POST['tlt']['mo'] or $_POST['tlt']['d'] or 
00457                    $_POST["tlt"]['h'] or $_POST['tlt']['m'] or $_POST['tlt']['s'])
00458                 {
00459                         if(!is_object($this->md_section = $this->md_obj->getEducational()))
00460                         {
00461                                 $this->md_section = $this->md_obj->addEducational();
00462                                 $this->md_section->save();
00463                         }
00464                         $this->md_section->setPhysicalTypicalLearningTime($_POST['tlt']['mo'],$_POST['tlt']['d'],
00465                                                                                                                           $_POST['tlt']['h'],$_POST['tlt']['m'],$_POST['tlt']['s']);
00466                         $this->md_section->update();
00467                 }
00468                 else
00469                 {
00470                         if(is_object($this->md_section = $this->md_obj->getEducational()))
00471                         {
00472                                 $this->md_section->setPhysicalTypicalLearningTime(0,0,0,0,0);
00473                                 $this->md_section->update();
00474                         }
00475                 }
00476                 $this->callListeners('Educational');
00477                 //Lifecycle...
00478                 // Authors
00479                 if ($_POST["life_authors"] != "")
00480                 {
00481                         if(!is_object($this->md_section = $this->md_obj->getLifecycle()))
00482                         {
00483                                 $this->md_section = $this->md_obj->addLifecycle();
00484                                 $this->md_section->save();
00485                         }
00486                         
00487                         // determine all entered authors
00488                         $auth_arr = explode(",", $_POST["life_authors"]);
00489                         for($i = 0; $i < count($auth_arr); $i++)
00490                         {
00491                                 $auth_arr[$i] = trim($auth_arr[$i]);
00492                         }
00493                         
00494                         $md_con_author = "";
00495                         
00496                         // update existing author entries (delete if not entered)
00497                         foreach(($ids = $this->md_section->getContributeIds()) as $con_id)
00498                         {
00499                                 $md_con = $this->md_section->getContribute($con_id);
00500                                 if ($md_con->getRole() == "Author")
00501                                 {
00502                                         foreach($ent_ids = $md_con->getEntityIds() as $ent_id)
00503                                         {
00504                                                 $md_ent = $md_con->getEntity($ent_id);
00505                                                 
00506                                                 // entered author already exists
00507                                                 if (in_array($md_ent->getEntity(), $auth_arr))
00508                                                 {
00509                                                         unset($auth_arr[array_search($md_ent->getEntity(), $auth_arr)]);
00510                                                 }
00511                                                 else  // existing author has not been entered again -> delete
00512                                                 {
00513                                                         $md_ent->delete();
00514                                                 }
00515                                         }
00516                                         $md_con_author = $md_con;
00517                                 }
00518                         }
00519                         
00520                         // insert enterd, but not existing authors
00521                         if (count($auth_arr) > 0)
00522                         {
00523                                 if (!is_object($md_con_author))
00524                                 {
00525                                         $md_con_author = $this->md_section->addContribute();
00526                                         $md_con_author->setRole("Author");
00527                                         $md_con_author->save();
00528                                 }
00529                                 foreach ($auth_arr as $auth)
00530                                 {
00531                                         $md_ent = $md_con_author->addEntity();
00532                                         $md_ent->setEntity(ilUtil::stripSlashes($auth));
00533                                         $md_ent->save();
00534                                 }
00535                         }
00536                 }
00537                 else    // nothing has been entered: delete all author contribs
00538                 {
00539                         if(is_object($this->md_section = $this->md_obj->getLifecycle()))
00540                         {
00541                                 foreach(($ids = $this->md_section->getContributeIds()) as $con_id)
00542                                 {
00543                                         $md_con = $this->md_section->getContribute($con_id);
00544                                         if ($md_con->getRole() == "Author")
00545                                         {
00546                                                 $md_con->delete();
00547                                         }
00548                                 }
00549                         }
00550                 }
00551                 $this->callListeners('Lifecycle');
00552                 
00553                 // Redirect here to read new title and description
00554                 // Otherwise ('Lifecycle' 'technical' ...) simply call listSection()
00555                 sendinfo($this->lng->txt("saved_successfully"), true);
00556                 $this->ctrl->redirect($this,'listSection');
00557         }
00558 
00559         /*
00560          * list general sections
00561          */
00562         function listGeneral()
00563         {
00564                 if(!is_object($this->md_section = $this->md_obj->getGeneral()))
00565                 {
00566                         $this->md_section = $this->md_obj->addGeneral();
00567                         $this->md_section->save();
00568                 }
00569 
00570                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.md_editor.html','Services/MetaData');
00571                 
00572                 $this->__setTabs('meta_general');
00573 
00574                 $this->tpl->addBlockFile('MD_CONTENT','md_content','tpl.md_general.html','Services/MetaData');
00575 
00576                 $this->ctrl->setReturn($this,'listGeneral');
00577                 $this->ctrl->setParameter($this,'section','meta_general');
00578                 $this->tpl->setVariable("EDIT_ACTION",$this->ctrl->getFormAction($this));
00579 
00580                 $this->__fillSubelements();
00581                 
00582                 $this->tpl->setVariable("TXT_GENERAL", $this->lng->txt("meta_general"));
00583                 $this->tpl->setVariable("TXT_IDENTIFIER", $this->lng->txt("meta_identifier"));
00584                 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("meta_language"));
00585                 $this->tpl->setVariable("TXT_KEYWORD", $this->lng->txt("meta_keyword"));
00586                 $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("meta_description"));
00587                 $this->tpl->setVariable("TXT_STRUCTURE", $this->lng->txt("meta_structure"));
00588                 $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
00589                 $this->tpl->setVariable("TXT_ATOMIC", $this->lng->txt("meta_atomic"));
00590                 $this->tpl->setVariable("TXT_COLLECTION", $this->lng->txt("meta_collection"));
00591                 $this->tpl->setVariable("TXT_NETWORKED", $this->lng->txt("meta_networked"));
00592                 $this->tpl->setVariable("TXT_HIERARCHICAL", $this->lng->txt("meta_hierarchical"));
00593                 $this->tpl->setVariable("TXT_LINEAR", $this->lng->txt("meta_linear"));
00594 
00595                 // Structure
00596                 $this->tpl->setVariable("STRUCTURE_VAL_".strtoupper($this->md_section->getStructure())," selected=selected");
00597 
00598                 // Identifier
00599                 $first = true;
00600                 foreach($ids = $this->md_section->getIdentifierIds() as $id)
00601                 {
00602                         $md_ide = $this->md_section->getIdentifier($id);
00603 
00604                         // 
00605                         if ($first)
00606                         {
00607                                 $this->tpl->setCurrentBlock("id_head");
00608                                 $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_IDENTIFIER", $this->lng->txt("meta_identifier"));
00609                                 $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_CATALOG", $this->lng->txt("meta_catalog"));
00610                                 $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_ENTRY", $this->lng->txt("meta_entry"));
00611                                 $this->tpl->setVariable("ROWSPAN_ID", count($ids));
00612                                 $this->tpl->parseCurrentBlock();
00613                                 $first = false;
00614                         }
00615                         
00616                         if(count($ids) > 1)
00617                         {
00618                                 $this->ctrl->setParameter($this,'meta_index',$id);
00619                                 $this->ctrl->setParameter($this,'meta_path','meta_identifier');
00620 
00621                                 if ($md_ide->getCatalog() != "ILIAS")
00622                                 {
00623                                         $this->tpl->setCurrentBlock("identifier_delete");
00624                                         $this->tpl->setVariable("IDENTIFIER_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
00625                                         $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_DELETE",$this->lng->txt('delete'));
00626                                         $this->tpl->parseCurrentBlock();
00627                                 }
00628                         }
00629 
00630                         $this->tpl->setCurrentBlock("identifier_loop");
00631                         if ($md_ide->getCatalog() == "ILIAS")
00632                         {
00633                                 $this->tpl->setVariable("DISABLE_IDENT", ' disabled="disabled" ');
00634                         }
00635                         $this->tpl->setVariable("IDENTIFIER_LOOP_NO", $id);
00636                         $this->tpl->setVariable("IDENTIFIER_LOOP_VAL_IDENTIFIER_CATALOG", 
00637                                                                         ilUtil::prepareFormOutput($md_ide->getCatalog()));
00638                         $this->tpl->setVariable("IDENTIFIER_LOOP_VAL_IDENTIFIER_ENTRY", 
00639                                                                         ilUtil::prepareFormOutput($md_ide->getEntry()));
00640                         $this->tpl->parseCurrentBlock();
00641                 }
00642 
00643 
00644                 // Language
00645                 $first = true;
00646                 foreach($ids = $this->md_section->getLanguageIds() as $id)
00647                 {
00648                         $md_lan = $this->md_section->getLanguage($id);
00649                         
00650                         if ($first)
00651                         {
00652                                 $this->tpl->setCurrentBlock("language_head");
00653                                 $this->tpl->setVariable("ROWSPAN_LANG", count($ids));
00654                                 $this->tpl->setVariable("LANGUAGE_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
00655                                 $this->tpl->parseCurrentBlock();
00656                                 $first = false;
00657                         }
00658 
00659                         if (count($ids) > 1)
00660                         {
00661                                 $this->ctrl->setParameter($this,'meta_index',$id);
00662                                 $this->ctrl->setParameter($this,'meta_path','meta_language');
00663 
00664                                 $this->tpl->setCurrentBlock("language_delete");
00665                                 $this->tpl->setVariable("LANGUAGE_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
00666                                 $this->tpl->setVariable("LANGUAGE_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
00667                                 $this->tpl->parseCurrentBlock();
00668                         }
00669                         $this->tpl->setCurrentBlock("language_loop");
00670                         $this->tpl->setVariable("LANGUAGE_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect('gen_language['.$id.'][language]',
00671                                                                                                                                                                                 $md_lan->getLanguageCode()));
00672                         $this->tpl->parseCurrentBlock();
00673                 }
00674 
00675                 // TITLE
00676                 $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('title'));
00677                 $this->tpl->setVariable("VAL_TITLE",ilUtil::prepareFormOutput($this->md_section->getTitle()));
00678                 $this->tpl->setVariable("VAL_TITLE_LANGUAGE",$this->__showLanguageSelect('gen_title_language',
00679                                                                                                                                                            $this->md_section->getTitleLanguageCode()));
00680 
00681 
00682                 // DESCRIPTION
00683                 foreach($ids = $this->md_section->getDescriptionIds() as $id)
00684                 { 
00685                         $md_des = $this->md_section->getDescription($id);
00686 
00687                         if (count($ids) > 1)
00688                         {
00689                                 $this->ctrl->setParameter($this,'meta_index',$id);
00690                                 $this->ctrl->setParameter($this,'meta_path','meta_description');
00691 
00692                                 $this->tpl->setCurrentBlock("description_delete");
00693                                 $this->tpl->setVariable("DESCRIPTION_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
00694                                 $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
00695                                 $this->tpl->parseCurrentBlock();
00696                         }
00697 
00698                         $this->tpl->setCurrentBlock("description_loop");
00699                         $this->tpl->setVariable("DESCRIPTION_LOOP_NO",$id);
00700                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DESCRIPTION", $this->lng->txt("meta_description"));
00701                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
00702                         $this->tpl->setVariable("DESCRIPTION_LOOP_VAL", ilUtil::prepareFormOutput($md_des->getDescription()));
00703                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
00704                         $this->tpl->setVariable("DESCRIPTION_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect("gen_description[".$id.'][language]', 
00705                                                                                                                                                                   $md_des->getDescriptionLanguageCode()));
00706                         $this->tpl->parseCurrentBlock();
00707                 }
00708 
00709                 // KEYWORD
00710                 $first = true;
00711                 foreach($ids = $this->md_section->getKeywordIds() as $id)
00712                 {
00713                         $md_key = $this->md_section->getKeyword($id);
00714                         
00715                         if ($first)
00716                         {
00717                                 $this->tpl->setCurrentBlock("keyword_head");
00718                                 $this->tpl->setVariable("ROWSPAN_KEYWORD", count($ids));
00719                                 $this->tpl->setVariable("KEYWORD_LOOP_TXT_KEYWORD", $this->lng->txt("meta_keyword"));
00720                                 $this->tpl->parseCurrentBlock();
00721                                 $first = false;
00722                         }
00723 
00724 
00725                         if(count($ids) > 1)
00726                         {
00727                                 $this->ctrl->setParameter($this,'meta_index',$id);
00728                                 $this->ctrl->setParameter($this,'meta_path','meta_keyword');
00729 
00730                                 $this->tpl->setCurrentBlock("keyword_delete");
00731                                 $this->tpl->setVariable("KEYWORD_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
00732                                 $this->tpl->setVariable("KEYWORD_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
00733                                 $this->tpl->parseCurrentBlock();
00734                         }
00735                         
00736                         $this->tpl->setCurrentBlock("keyword_loop");
00737                         $this->tpl->setVariable("KEYWORD_LOOP_NO",$id);
00738                         $this->tpl->setVariable("KEYWORD_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
00739                         $this->tpl->setVariable("KEYWORD_LOOP_VAL", ilUtil::prepareFormOutput($md_key->getKeyword()));
00740                         $this->tpl->setVariable("KEYWORD_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
00741                         $this->tpl->setVariable("KEYWORD_LOOP_VAL_LANGUAGE", $this->__showLanguageSelect("gen_keyword[".$id.'][language]',
00742                                                                                                                                                                            $md_key->getKeywordLanguageCode()));
00743 
00744                         $this->tpl->parseCurrentBlock();
00745                 }
00746 
00747                 // Coverage
00748                 $this->tpl->setVariable("COVERAGE_LOOP_TXT_COVERAGE",$this->lng->txt('meta_coverage'));
00749                 $this->tpl->setVariable("COVERAGE_LOOP_VAL",ilUtil::prepareFormOutput($this->md_section->getCoverage()));
00750                 $this->tpl->setVariable("COVERAGE_LOOP_TXT_LANGUAGE",$this->lng->txt('meta_language'));
00751                 $this->tpl->setVariable("COVERAGE_LOOP_VAL_LANGUAGE",$this->__showLanguageSelect('gen_coverage_language',
00752                                                                                                                                                                                  $this->md_section->getCoverageLanguageCode()));
00753 
00754                 $this->tpl->setVariable("TXT_SAVE",$this->lng->txt('save'));
00755         }
00756 
00760         function updateGeneral()
00761         {
00762                 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
00763                 
00764                 // General values
00765                 $this->md_section = $this->md_obj->getGeneral();
00766                 $this->md_section->setStructure($_POST['gen_structure']);
00767                 $this->md_section->setTitle(ilUtil::stripSlashes($_POST['gen_title']));
00768                 $this->md_section->setTitleLanguage(new ilMDLanguageItem($_POST['gen_title_language']));
00769                 $this->md_section->setCoverage(ilUtil::stripSlashes($_POST['gen_coverage']));
00770                 $this->md_section->setCoverageLanguage(new ilMDLanguageItem($_POST['gen_coverage_language']));
00771                 $this->md_section->update();
00772 
00773                 // Identifier
00774                 if(is_array($_POST['gen_identifier']))
00775                 {
00776                         foreach($_POST['gen_identifier'] as $id => $data)
00777                         {
00778                                 $md_ide = $this->md_section->getIdentifier($id);
00779                                 $md_ide->setCatalog(ilUtil::stripSlashes($data['Catalog']));
00780                                 $md_ide->setEntry(ilUtil::stripSlashes($data['Entry']));
00781                                 $md_ide->update();
00782                         }
00783                 }
00784 
00785                 // Language
00786                 if(is_array($_POST['gen_language']))
00787                 {
00788                         foreach($_POST['gen_language'] as $id => $data)
00789                         {
00790                                 $md_lan = $this->md_section->getLanguage($id);
00791                                 $md_lan->setLanguage(new ilMDLanguageItem($data['language']));
00792                                 $md_lan->update();
00793                         }
00794                 }
00795                 // Description
00796                 if(is_array($_POST['gen_description']))
00797                 {
00798                         foreach($_POST['gen_description'] as $id => $data)
00799                         {
00800                                 $md_des = $this->md_section->getDescription($id);
00801                                 $md_des->setDescription(ilUtil::stripSlashes($data['description']));
00802                                 $md_des->setDescriptionLanguage(new ilMDLanguageItem($data['language']));
00803                                 $md_des->update();
00804                         }
00805                 }
00806                 // Keyword
00807                 if(is_array($_POST['gen_keyword']))
00808                 {
00809                         foreach($_POST['gen_keyword'] as $id => $data)
00810                         {
00811                                 $md_key = $this->md_section->getKeyword($id);
00812 
00813                                 $md_key->setKeyword(ilUtil::stripSlashes($data['keyword']));
00814                                 $md_key->setKeywordLanguage(new ilMDLanguageItem($data['language']));
00815                                 $md_key->update();
00816                         }
00817                 }
00818                 $this->callListeners('General');
00819 
00820                 // Redirect here to read new title and description
00821                 // Otherwise ('Lifecycle' 'technical' ...) simply call listSection()
00822                 $this->ctrl->setParameter($this, "section", "meta_general");
00823                 sendinfo($this->lng->txt("saved_successfully"), true);
00824                 $this->ctrl->redirect($this,'listSection');
00825         }
00826 
00827         function updateTechnical()
00828         {
00829                 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
00830 
00831                 // update technical section
00832                 $this->md_section = $this->md_obj->getTechnical();
00833                 $this->md_section->setSize(ilUtil::stripSlashes($_POST['met_size']));
00834                 $this->md_section->setInstallationRemarks(ilUtil::stripSlashes($_POST['met_inst']));
00835                 $this->md_section->setInstallationRemarksLanguage(new ilMDLanguageItem($_POST['inst_language']));
00836                 $this->md_section->setOtherPlatformRequirements(ilUtil::stripSlashes($_POST['met_opr']));
00837                 $this->md_section->setOtherPlatformRequirementsLanguage(new ilMDLanguageItem($_POST['opr_language']));
00838                 $this->md_section->setDuration(ilUtil::stripSlashes($_POST['duration']));
00839                 $this->md_section->update();
00840 
00841                 // Format
00842                 if(is_array($_POST['met_format']))
00843                 {
00844                         foreach($_POST['met_format'] as $id => $data)
00845                         {
00846                                 $md_for = $this->md_section->getFormat($id);
00847                                 $md_for->setFormat(ilUtil::stripSlashes($data['Format']));
00848                                 $md_for->update();
00849                         }
00850                 }
00851                 // Location
00852                 if(is_array($_POST['met_location']))
00853                 {
00854                         foreach($_POST['met_location'] as $id => $data)
00855                         {
00856                                 $md_loc = $this->md_section->getLocation($id);
00857                                 $md_loc->setLocation(ilUtil::stripSlashes($data['Location']));
00858                                 $md_loc->setLocationType(ilUtil::stripSlashes($data['Type']));
00859                                 $md_loc->update();
00860                         }
00861                 }
00862                 if(is_array($_POST['met_re']))
00863                 {
00864                         foreach($_POST['met_re'] as $id => $data)
00865                         {
00866 
00867                                 $md_re = $this->md_section->getRequirement($id);
00868                                 $md_re->setOperatingSystemName(ilUtil::stripSlashes($data['os']['name']));
00869                                 $md_re->setOperatingSystemMinimumVersion(ilUtil::stripSlashes($data['os']['MinimumVersion']));
00870                                 $md_re->setOperatingSystemMaximumVersion(ilUtil::stripSlashes($data['os']['MaximumVersion']));
00871                                 $md_re->setBrowserName(ilUtil::stripSlashes($data['browser']['name']));
00872                                 $md_re->setBrowserMinimumVersion(ilUtil::stripSlashes($data['browser']['MinimumVersion']));
00873                                 $md_re->setBrowserMaximumVersion(ilUtil::stripSlashes($data['browser']['MaximumVersion']));
00874                                 $md_re->update();
00875                         }
00876                 }
00877                 $this->callListeners('Technical');
00878 
00879                 sendinfo($this->lng->txt("saved_successfully"));
00880                 $this->listSection();
00881                 return true;
00882         }
00883                 
00884 
00885 
00886         function listTechnical()
00887         {
00888                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.md_editor.html','Services/MetaData');
00889                 $this->__setTabs('meta_technical');
00890                 $this->tpl->addBlockFile('MD_CONTENT','md_content','tpl.md_technical.html','Services/MetaData');
00891 
00892 
00893                 $this->ctrl->setParameter($this, "section", "meta_technical");
00894                 if(!is_object($this->md_section = $this->md_obj->getTechnical()))
00895                 {
00896                         $this->tpl->setCurrentBlock("no_technical");
00897                         $this->tpl->setVariable("TXT_NO_TECHNICAL", $this->lng->txt("meta_no_technical"));
00898                         $this->tpl->setVariable("TXT_ADD_TECHNICAL", $this->lng->txt("meta_add"));
00899                         $this->tpl->setVariable("ACTION_ADD_TECHNICAL",$this->ctrl->getLinkTarget($this, "addSection"));
00900                         $this->tpl->parseCurrentBlock();
00901 
00902                         return true;
00903                 }
00904                 $this->ctrl->setReturn($this,'listTechnical');
00905                 $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
00906 
00907                 $this->tpl->setVariable("EDIT_ACTION",$this->ctrl->getFormAction($this));
00908                 $this->tpl->setVariable("TXT_TECHNICAL",$this->lng->txt('meta_technical'));
00909 
00910                 // Delete link
00911                 $this->tpl->setVariable("ACTION_DELETE",
00912                                                                 $this->ctrl->getLinkTarget($this, "deleteSection"));
00913                 $this->tpl->setVariable("TXT_DELETE",$this->lng->txt('delete'));
00914 
00915                 // New element
00916                 $this->__fillSubelements();
00917 
00918                 // Format
00919                 foreach($ids = $this->md_section->getFormatIds() as $id)
00920                 {
00921                         $md_for =& $this->md_section->getFormat($id);
00922 
00923                         $this->tpl->setCurrentBlock("format_loop");
00924 
00925                         $this->ctrl->setParameter($this,'meta_index',$id);
00926                         $this->ctrl->setParameter($this,'meta_path','meta_format');
00927                         $this->tpl->setVariable("FORMAT_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
00928                         $this->tpl->setVariable("FORMAT_LOOP_TXT_DELETE",$this->lng->txt('delete'));
00929 
00930                         $this->tpl->setVariable("FORMAT_LOOP_NO",$id);
00931                         $this->tpl->setVariable("FORMAT_LOOP_TXT_FORMAT",$this->lng->txt('meta_format'));
00932                         $this->tpl->setVariable("FORMAT_LOOP_VAL",ilUtil::prepareFormOutput($md_for->getFormat()));
00933 
00934                         $this->tpl->parseCurrentBlock();
00935                 }
00936                 // Size
00937                 $this->tpl->setVariable("SIZE_TXT_SIZE",$this->lng->txt('meta_size'));
00938                 $this->tpl->setVariable("SIZE_VAL",ilUtil::prepareFormOutput($this->md_section->getSize()));
00939 
00940                 // Location
00941                 foreach($ids = $this->md_section->getLocationIds() as $id)
00942                 {
00943                         $md_loc =& $this->md_section->getLocation($id);
00944 
00945                         $this->tpl->setCurrentBlock("location_loop");
00946 
00947                         $this->ctrl->setParameter($this,'meta_index',$id);
00948                         $this->ctrl->setParameter($this,'meta_path','meta_location');
00949                         $this->tpl->setVariable("LOCATION_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
00950                         $this->tpl->setVariable("LOCATION_LOOP_TXT_DELETE",$this->lng->txt('delete'));
00951 
00952                         $this->tpl->setVariable("LOCATION_LOOP_TXT_LOCATION",$this->lng->txt('meta_location'));
00953                         $this->tpl->setVariable("LOCATION_LOOP_NO",$id);
00954                         $this->tpl->setVariable("LOCATION_LOOP_TXT_TYPE",$this->lng->txt('meta_type'));
00955                         $this->tpl->setVariable("LOCATION_LOOP_VAL",ilUtil::prepareFormOutput($md_loc->getLocation()));
00956 
00957                         $this->tpl->setVariable("SEL_LOCATION_TYPE",
00958                                                                         ilMDUtilSelect::_getLocationTypeSelect($md_loc->getLocationType(),
00959                                                                                                                                                    "met_location[".$id."][Type]",
00960                                                                                                                                                    array(0 => $this->lng->txt('meta_please_select'))));
00961                         $this->tpl->parseCurrentBlock();
00962                 }
00963                 // Requirement
00964                 foreach($ids = $this->md_section->getRequirementIds() as $id)
00965                 {
00966                         $md_re =& $this->md_section->getRequirement($id);
00967 
00968                         $this->tpl->setCurrentBlock("requirement_loop");
00969 
00970                         $this->ctrl->setParameter($this,'meta_index',$id);
00971                         $this->ctrl->setParameter($this,'meta_path','meta_requirement');
00972                         $this->tpl->setVariable("REQUIREMENT_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
00973                         $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_DELETE",$this->lng->txt('delete'));
00974 
00975                         $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_REQUIREMENT",$this->lng->txt('meta_requirement'));
00976                         $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_TYPE",$this->lng->txt('meta_type'));
00977                         $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_OPERATINGSYSTEM",$this->lng->txt('meta_operating_system'));
00978                         $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_BROWSER",$this->lng->txt('meta_browser'));
00979                         $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_NAME",$this->lng->txt('meta_name'));
00980                         $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_MINIMUMVERSION",$this->lng->txt('meta_minimum_version'));
00981                         $this->tpl->setVariable("REQUIREMENT_LOOP_TXT_MAXIMUMVERSION",$this->lng->txt('meta_maximum_version'));
00982 
00983                         $this->tpl->setVariable("REQUIREMENT_LOOP_NO",$id);
00984                         $this->tpl->setVariable("REQUIREMENT_SEL_OS_NAME",
00985                                                                         ilMDUtilSelect::_getOperatingSystemSelect($md_re->getOperatingSystemName(),
00986                                                                                                                                                    "met_re[".$id."][os][name]",
00987                                                                                                                                                    array(0 => $this->lng->txt('meta_please_select'))));
00988                         $this->tpl->setVariable("REQUIREMENT_SEL_BROWSER_NAME",
00989                                                                         ilMDUtilSelect::_getBrowserSelect($md_re->getBrowserName(),
00990                                                                                                                                                    "met_re[".$id."][browser][name]",
00991                                                                                                                                                    array(0 => $this->lng->txt('meta_please_select'))));
00992 
00993                         $this->tpl->setVariable("REQUIREMENT_LOOP_VAL_OPERATINGSYSTEM_MINIMUMVERSION",
00994                                                                         ilUtil::prepareFormOutput($md_re->getOperatingSystemMinimumVersion()));
00995                         
00996                         $this->tpl->setVariable("REQUIREMENT_LOOP_VAL_OPERATINGSYSTEM_MAXIMUMVERSION",
00997                                                                         ilUtil::prepareFormOutput($md_re->getOperatingSystemMaximumVersion()));
00998 
00999                         $this->tpl->setVariable("REQUIREMENT_LOOP_VAL_BROWSER_MINIMUMVERSION",
01000                                                                         ilUtil::prepareFormOutput($md_re->getBrowserMinimumVersion()));
01001                         
01002                         $this->tpl->setVariable("REQUIREMENT_LOOP_VAL_BROWSER_MAXIMUMVERSION",
01003                                                                         ilUtil::prepareFormOutput($md_re->getBrowserMaximumVersion()));
01004                         $this->tpl->parseCurrentBlock();
01005 
01006                 }
01007                 // OrComposite
01008                 foreach($ids = $this->md_section->getOrCompositeIds() as $or_id)
01009                 {
01010                         $md_or =& $this->md_section->getOrComposite($or_id);
01011                         foreach($ids = $md_or->getRequirementIds() as $id)
01012                         {
01013                                 $md_re =& $this->md_section->getRequirement($id);
01014 
01015                                 $this->tpl->setCurrentBlock("orrequirement_loop");
01016 
01017                                 $this->ctrl->setParameter($this,'meta_index',$id);
01018                                 $this->ctrl->setParameter($this,'meta_path','meta_requirement');
01019                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
01020                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_DELETE",$this->lng->txt('delete'));
01021 
01022                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_REQUIREMENT",$this->lng->txt('meta_requirement'));
01023                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_TYPE",$this->lng->txt('meta_type'));
01024                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_OPERATINGSYSTEM",$this->lng->txt('meta_operating_system'));
01025                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_BROWSER",$this->lng->txt('meta_browser'));
01026                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_NAME",$this->lng->txt('meta_name'));
01027                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_MINIMUMVERSION",$this->lng->txt('meta_minimum_version'));
01028                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_TXT_MAXIMUMVERSION",$this->lng->txt('meta_maximum_version'));
01029 
01030                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_NO",$id);
01031                                 $this->tpl->setVariable("ORREQUIREMENT_SEL_OS_NAME",
01032                                                                                 ilMDUtilSelect::_getOperatingSystemSelect($md_re->getOperatingSystemName(),
01033                                                                                                                                                                   "met_re[".$id."][os][name]",
01034                                                                                                                                                                   array(0 => $this->lng->txt('meta_please_select'))));
01035                                 $this->tpl->setVariable("ORREQUIREMENT_SEL_BROWSER_NAME",
01036                                                                                 ilMDUtilSelect::_getBrowserSelect($md_re->getBrowserName(),
01037                                                                                                                                                   "met_re[".$id."][browser][name]",
01038                                                                                                                                                   array(0 => $this->lng->txt('meta_please_select'))));
01039 
01040                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_VAL_OPERATINGSYSTEM_MINIMUMVERSION",
01041                                                                                 ilUtil::prepareFormOutput($md_re->getOperatingSystemMinimumVersion()));
01042                         
01043                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_VAL_OPERATINGSYSTEM_MAXIMUMVERSION",
01044                                                                                 ilUtil::prepareFormOutput($md_re->getOperatingSystemMaximumVersion()));
01045 
01046                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_VAL_BROWSER_MINIMUMVERSION",
01047                                                                                 ilUtil::prepareFormOutput($md_re->getBrowserMinimumVersion()));
01048                         
01049                                 $this->tpl->setVariable("ORREQUIREMENT_LOOP_VAL_BROWSER_MAXIMUMVERSION",
01050                                                                                 ilUtil::prepareFormOutput($md_re->getBrowserMaximumVersion()));
01051                                 $this->tpl->parseCurrentBlock();
01052                         }
01053                         $this->tpl->setCurrentBlock("orcomposite_loop");
01054 
01055                         $this->ctrl->setParameter($this,'meta_index',$or_id);
01056                         $this->ctrl->setParameter($this,'meta_path','meta_or_composite');
01057                         $this->ctrl->setParameter($this,'meta_technical',$this->md_section->getMetaId());
01058                         $this->tpl->setVariable("ORCOMPOSITE_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
01059                         $this->tpl->setVariable("ORCOMPOSITE_LOOP_TXT_DELETE",$this->lng->txt('delete'));
01060 
01061                         $this->tpl->setVariable("ORCOMPOSITE_LOOP_TXT_ORCOMPOSITE",$this->lng->txt('meta_or_composite'));
01062                         $this->tpl->parseCurrentBlock();
01063                 }
01064 
01065                 // InstallationRemarks
01066                 $this->tpl->setVariable("INSTALLATIONREMARKS_TXT_INSTALLATIONREMARKS",$this->lng->txt('meta_installation_remarks'));
01067                 $this->tpl->setVariable("INSTALLATIONREMARKS_TXT_LANGUAGE",$this->lng->txt('meta_language'));
01068 
01069                 $this->tpl->setVariable("INSTALLATIONREMARKS_VAL",ilUtil::prepareFormOutput($this->md_section->getInstallationRemarks()));
01070                 $this->tpl->setVariable("INSTALLATIONREMARKS_VAL_LANGUAGE",
01071                                                                 $this->__showLanguageSelect('inst_language',
01072                                                                                                                         $this->md_section->getInstallationRemarksLanguageCode()));
01073 
01074                 // Other platform requirement
01075                 $this->tpl->setVariable("OTHERPLATTFORMREQUIREMENTS_TXT_OTHERPLATTFORMREQUIREMENTS",
01076                                                                 $this->lng->txt('meta_other_plattform_requirements'));
01077                 $this->tpl->setVariable("OTHERPLATTFORMREQUIREMENTS_TXT_LANGUAGE",$this->lng->txt('meta_language'));
01078 
01079                 $this->tpl->setVariable("OTHERPLATTFORMREQUIREMENTS_VAL",
01080                                                                 ilUtil::prepareFormOutput($this->md_section->getOtherPlatformRequirements()));
01081                 $this->tpl->setVariable("OTHERPLATTFORMREQUIREMENTS_VAL_LANGUAGE",
01082                                                                 $this->__showLanguageSelect('opr_language',
01083                                                                                                                         $this->md_section->getOtherPlatformRequirementsLanguageCode()));
01084 
01085                 // Duration
01086                 $this->tpl->setVariable("DURATION_TXT_DURATION",$this->lng->txt('meta_duration'));
01087                 $this->tpl->setVariable("DURATION_VAL",ilUtil::prepareFormOutput($this->md_section->getDuration()));
01088 
01089                 $this->tpl->setCurrentBlock("technical");
01090                 $this->tpl->setVariable("TXT_SAVE",$this->lng->txt('save'));
01091                 $this->tpl->parseCurrentBlock();
01092         }
01093         
01094 
01095 
01096         function listLifecycle()
01097         {
01098                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.md_editor.html','Services/MetaData');
01099                 $this->__setTabs('meta_lifecycle');
01100                 $this->tpl->addBlockFile('MD_CONTENT','md_content','tpl.md_lifecycle.html','Services/MetaData');
01101 
01102 
01103                 $this->ctrl->setParameter($this, "section", "meta_lifecycle");
01104                 if(!is_object($this->md_section = $this->md_obj->getLifecycle()))
01105                 {
01106                         $this->tpl->setCurrentBlock("no_lifecycle");
01107                         $this->tpl->setVariable("TXT_NO_LIFECYCLE", $this->lng->txt("meta_no_lifecycle"));
01108                         $this->tpl->setVariable("TXT_ADD_LIFECYCLE", $this->lng->txt("meta_add"));
01109                         $this->tpl->setVariable("ACTION_ADD_LIFECYCLE",$this->ctrl->getLinkTarget($this, "addSection"));
01110                         $this->tpl->parseCurrentBlock();
01111 
01112                         return true;
01113                 }
01114                 $this->ctrl->setReturn($this,'listLifecycle');
01115                 $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
01116 
01117                 $this->tpl->setVariable("EDIT_ACTION",$this->ctrl->getFormAction($this));
01118                 $this->tpl->setVariable("TXT_LIFECYCLE",$this->lng->txt('meta_lifecycle'));
01119 
01120                 // Delete link
01121                 $this->tpl->setVariable("ACTION_DELETE",
01122                                                                 $this->ctrl->getLinkTarget($this, "deleteSection"));
01123                 $this->tpl->setVariable("TXT_DELETE",$this->lng->txt('delete'));
01124 
01125                 // New element
01126                 $this->__fillSubelements();
01127 
01128                 // Status
01129                 $this->tpl->setVariable("TXT_STATUS",$this->lng->txt('meta_status'));
01130                 $this->tpl->setVariable("SEL_STATUS",ilMDUtilSelect::_getStatusSelect($this->md_section->getStatus(),
01131                                                                                                                                                         "lif_status",
01132                                                                                                                                                         array(0 => $this->lng->txt('meta_please_select'))));
01133                 // Version
01134                 $this->tpl->setVariable("TXT_VERSION",$this->lng->txt('meta_version'));
01135                 $this->tpl->setVariable("VAL_VERSION",ilUtil::prepareFormOutput($this->md_section->getVersion()));
01136 
01137                 $this->tpl->setVariable("TXT_LANGUAGE",$this->lng->txt('meta_language'));
01138                 $this->tpl->setVariable("VAL_VERSION_LANGUAGE",$this->__showLanguageSelect('lif_language',
01139                                                                                                                                                                    $this->md_section->getVersionLanguageCode()));
01140 
01141                 // Contributes
01142                 foreach(($ids = $this->md_section->getContributeIds()) as $con_id)
01143                 {
01144                         $md_con = $this->md_section->getContribute($con_id);
01145 
01146                         if(count($ids) > 1)
01147                         {
01148                                 $this->ctrl->setParameter($this,'meta_index',$con_id);
01149                                 $this->ctrl->setParameter($this,'meta_path','meta_contribute');
01150                                 
01151                                 $this->tpl->setCurrentBlock("contribute_delete");
01152                                 $this->tpl->setVariable("CONTRIBUTE_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
01153                                 $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_DELETE",$this->lng->txt('delete'));
01154                                 $this->tpl->parseCurrentBlock();
01155                         }
01156                         // Entities
01157                         foreach($ent_ids = $md_con->getEntityIds() as $ent_id)
01158                         {
01159                                 $md_ent = $md_con->getEntity($ent_id);
01160                                 
01161                                 $this->ctrl->setParameter($this,'meta_path','meta_entity');
01162                                 
01163                                 if(count($ent_ids) > 1)
01164                                 {
01165                                         $this->tpl->setCurrentBlock("contribute_entity_delete");
01166                                         
01167                                         $this->ctrl->setParameter($this,'meta_index',$ent_id);
01168                                         $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
01169                                         $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_DELETE",$this->lng->txt('delete'));
01170                                         $this->tpl->parseCurrentBlock();
01171                                 }
01172                                 
01173                                 $this->tpl->setCurrentBlock("contribute_entity_loop");
01174 
01175                                 $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_CONTRIBUTE_NO",$con_id);
01176                                 $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_NO",$ent_id);
01177                                 $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_VAL_ENTITY",ilUtil::prepareFormOutput($md_ent->getEntity()));
01178                                 $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_ENTITY",$this->lng->txt('meta_entity'));
01179                                 $this->tpl->parseCurrentBlock();
01180                         }
01181                         $this->tpl->setCurrentBlock("contribute_loop");
01182                         
01183                         $this->ctrl->setParameter($this,'section_element','meta_entity');
01184                         $this->ctrl->setParameter($this,'meta_index',$con_id);
01185                         $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_ACTION_ADD",$this->ctrl->getLinkTarget($this,'addSectionElement'));
01186                         $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_ADD",
01187                                 $this->lng->txt('add')." ".$this->lng->txt('meta_entity'));
01188 
01189                         $this->tpl->setVariable("CONTRIBUTE_LOOP_ROWSPAN",2 + count($ent_ids));
01190                         $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_CONTRIBUTE",$this->lng->txt('meta_contribute'));
01191                         $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_ROLE",$this->lng->txt('meta_role'));
01192                         $this->tpl->setVariable("SEL_CONTRIBUTE_ROLE",ilMDUtilSelect::_getRoleSelect($md_con->getRole(),
01193                                 "met_contribute[".$con_id."][Role]",
01194                                 array(0 => $this->lng->txt('meta_please_select'))));
01195                         $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_DATE",$this->lng->txt('meta_date'));
01196                         $this->tpl->setVariable("CONTRIBUTE_LOOP_NO",$con_id);
01197                         $this->tpl->setVariable("CONTRIBUTE_LOOP_VAL_DATE",ilUtil::prepareFormOutput($md_con->getDate()));
01198                         
01199                         $this->tpl->parseCurrentBlock();
01200                 }
01201                 $this->tpl->setVariable("TXT_SAVE",$this->lng->txt('save'));
01202 
01203         }
01204 
01205         function updateLifecycle()
01206         {
01207                 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
01208 
01209                 // update metametadata section
01210                 $this->md_section = $this->md_obj->getLifecycle();
01211                 $this->md_section->setVersionLanguage(new ilMDLanguageItem($_POST['lif_language']));
01212                 $this->md_section->setVersion(ilUtil::stripSlashes($_POST['lif_version']));
01213                 $this->md_section->setStatus($_POST['lif_status']);
01214                 $this->md_section->update();
01215 
01216                 // Identifier
01217                 if(is_array($_POST['met_identifier']))
01218                 {
01219                         foreach($_POST['met_identifier'] as $id => $data)
01220                         {
01221                                 $md_ide = $this->md_section->getIdentifier($id);
01222                                 $md_ide->setCatalog(ilUtil::stripSlashes($data['Catalog']));
01223                                 $md_ide->setEntry(ilUtil::stripSlashes($data['Entry']));
01224                                 $md_ide->update();
01225                         }
01226                 }
01227                 // Contribute
01228                 if(is_array($_POST['met_contribute']))
01229                 {
01230                         foreach($_POST['met_contribute'] as $id => $data)
01231                         {
01232                                 $md_con =& $this->md_section->getContribute($id);
01233                                 $md_con->setRole(ilUtil::stripSlashes($data['Role']));
01234                                 $md_con->setDate(ilUtil::stripSlashes($data['Date']));
01235                                 $md_con->update();
01236 
01237                                 if(is_array($_POST['met_entity'][$id]))
01238                                 {
01239                                         foreach($_POST['met_entity'][$id] as $ent_id => $data)
01240                                         {
01241                                                 $md_ent =& $md_con->getEntity($ent_id);
01242                                                 $md_ent->setEntity(ilUtil::stripSlashes($data['Entity']));
01243                                                 $md_ent->update();
01244                                         }
01245                                 }
01246                         }
01247                 }
01248                 $this->callListeners('Lifecycle');
01249                 sendinfo($this->lng->txt("saved_successfully"));
01250                 $this->listSection();
01251                 return true;
01252         }               
01253 
01254 
01255 
01256 
01257 
01258         function listMetaMetaData()
01259         {
01260                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.md_editor.html','Services/MetaData');
01261                 $this->__setTabs('meta_meta_metadata');
01262                 $this->tpl->addBlockFile('MD_CONTENT','md_content','tpl.md_meta_metadata.html','Services/MetaData');
01263 
01264 
01265                 $this->ctrl->setParameter($this, "section", "meta_meta_metadata");
01266                 if(!is_object($this->md_section = $this->md_obj->getMetaMetadata()))
01267                 {
01268                         $this->tpl->setCurrentBlock("no_meta_meta");
01269                         $this->tpl->setVariable("TXT_NO_META_META", $this->lng->txt("meta_no_meta_metadata"));
01270                         $this->tpl->setVariable("TXT_ADD_META_META", $this->lng->txt("meta_add"));
01271                         $this->tpl->setVariable("ACTION_ADD_META_META",$this->ctrl->getLinkTarget($this, "addSection"));
01272                         $this->tpl->parseCurrentBlock();
01273 
01274                         return true;
01275                 }
01276                 $this->ctrl->setReturn($this,'listMetaMetaData');
01277                 $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
01278 
01279                 $this->tpl->setVariable("EDIT_ACTION",$this->ctrl->getFormAction($this));
01280                 $this->tpl->setVariable("TXT_META_METADATA",$this->lng->txt('meta_meta_metadata'));
01281 
01282                 // Delete link
01283                 $this->tpl->setVariable("ACTION_DELETE",
01284                                                                 $this->ctrl->getLinkTarget($this, "deleteSection"));
01285                 $this->tpl->setVariable("TXT_DELETE",$this->lng->txt('delete'));
01286 
01287                 // New element
01288                 $this->__fillSubelements();
01289 
01290                 $this->tpl->setVariable("TXT_LANGUAGE",$this->lng->txt('meta_language'));
01291 
01292                 $this->tpl->setVariable("VAL_LANGUAGE",$this->__showLanguageSelect('met_language',$this->md_section->getLanguageCode()));
01293                 $this->tpl->setVariable("TXT_METADATASCHEME",$this->lng->txt('meta_metadatascheme'));
01294                 $this->tpl->setVariable("VAL_METADATASCHEME",$this->md_section->getMetaDataScheme());
01295 
01296 
01297                 // Identifier
01298                 foreach($ids = $this->md_section->getIdentifierIds() as $id)
01299                 {
01300                         $md_ide = $this->md_section->getIdentifier($id);
01301 
01302                         if(count($ids) > 1)
01303                         {
01304                                 $this->ctrl->setParameter($this,'meta_index',$id);
01305                                 $this->ctrl->setParameter($this,'meta_path','meta_identifier');
01306                                 
01307                                 $this->tpl->setCurrentBlock("identifier_delete");
01308                                 $this->tpl->setVariable("IDENTIFIER_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
01309                                 $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_DELETE",$this->lng->txt('delete'));
01310                                 $this->tpl->parseCurrentBlock();
01311                         }
01312 
01313                         $this->tpl->setCurrentBlock("identifier_loop");
01314                         $this->tpl->setVariable("IDENTIFIER_LOOP_NO", $id);
01315                         $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_IDENTIFIER", $this->lng->txt("meta_identifier"));
01316                         $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_CATALOG", $this->lng->txt("meta_catalog"));
01317                         $this->tpl->setVariable("IDENTIFIER_LOOP_VAL_IDENTIFIER_CATALOG", 
01318                                                                         ilUtil::prepareFormOutput($md_ide->getCatalog()));
01319                         $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_ENTRY", $this->lng->txt("meta_entry"));
01320                         $this->tpl->setVariable("IDENTIFIER_LOOP_VAL_IDENTIFIER_ENTRY", 
01321                                                                         ilUtil::prepareFormOutput($md_ide->getEntry()));
01322                         $this->tpl->parseCurrentBlock();
01323                 }
01324 
01325                 // Contributes
01326                 foreach(($ids = $this->md_section->getContributeIds()) as $con_id)
01327                 {
01328                         $md_con = $this->md_section->getContribute($con_id);
01329 
01330                         if(count($ids) > 1)
01331                         {
01332                                 $this->ctrl->setParameter($this,'meta_index',$con_id);
01333                                 $this->ctrl->setParameter($this,'meta_path','meta_contribute');
01334                                 
01335                                 $this->tpl->setCurrentBlock("contribute_delete");
01336                                 $this->tpl->setVariable("CONTRIBUTE_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
01337                                 $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_DELETE",$this->lng->txt('delete'));
01338                                 $this->tpl->parseCurrentBlock();
01339                         }
01340                         // Entities
01341                         foreach($ent_ids = $md_con->getEntityIds() as $ent_id)
01342                         {
01343                                 $md_ent = $md_con->getEntity($ent_id);
01344                                 
01345                                 $this->ctrl->setParameter($this,'meta_path','meta_entity');
01346                                 
01347                                 if(count($ent_ids) > 1)
01348                                 {
01349                                         $this->tpl->setCurrentBlock("contribute_entity_delete");
01350                                         
01351                                         $this->ctrl->setParameter($this,'meta_index',$ent_id);
01352                                         $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_ACTION_DELETE",$this->ctrl->getLinkTarget($this,'deleteElement'));
01353                                         $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_DELETE",$this->lng->txt('delete'));
01354                                         $this->tpl->parseCurrentBlock();
01355                                 }
01356                                 
01357                                 $this->tpl->setCurrentBlock("contribute_entity_loop");
01358 
01359                                 $this->ctrl->setParameter($this,'section_element','meta_entity');
01360                                 $this->ctrl->setParameter($this,'meta_index',$con_id);
01361                                 $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_ACTION_ADD",$this->ctrl->getLinkTarget($this,'addSectionElement'));
01362                                 $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_ADD",$this->lng->txt('add'));
01363 
01364 
01365                                 $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_CONTRIBUTE_NO",$con_id);
01366                                 $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_NO",$ent_id);
01367                                 $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_VAL_ENTITY",ilUtil::prepareFormOutput($md_ent->getEntity()));
01368                                 $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_ENTITY",$this->lng->txt('meta_entity'));
01369                                 $this->tpl->parseCurrentBlock();
01370                         }
01371                         $this->tpl->setCurrentBlock("contribute_loop");
01372                         $this->tpl->setVariable("CONTRIBUTE_LOOP_ROWSPAN",2 + count($ent_ids));
01373                         $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_CONTRIBUTE",$this->lng->txt('meta_contribute'));
01374                         $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_ROLE",$this->lng->txt('meta_role'));
01375                         $this->tpl->setVariable("SEL_CONTRIBUTE_ROLE",ilMDUtilSelect::_getRoleSelect($md_con->getRole(),
01376                                                                                                                                                                         "met_contribute[".$con_id."][Role]",
01377                                                                                                                                                                         array(0 => $this->lng->txt('meta_please_select'))));
01378                         $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_DATE",$this->lng->txt('meta_date'));
01379                         $this->tpl->setVariable("CONTRIBUTE_LOOP_NO",$con_id);
01380                         $this->tpl->setVariable("CONTRIBUTE_LOOP_VAL_DATE",ilUtil::prepareFormOutput($md_con->getDate()));
01381                         
01382                         $this->tpl->parseCurrentBlock();
01383                 }
01384                 $this->tpl->setVariable("TXT_SAVE",$this->lng->txt('save'));
01385         }
01386 
01387 
01388         function updateMetaMetaData()
01389         {
01390                 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
01391 
01392                 // update metametadata section
01393                 $this->md_section = $this->md_obj->getMetaMetadata();
01394                 $this->md_section->setLanguage(new ilMDLanguageItem($_POST['met_language']));
01395                 $this->md_section->update();
01396 
01397                 // Identifier
01398                 if(is_array($_POST['met_identifier']))
01399                 {
01400                         foreach($_POST['met_identifier'] as $id => $data)
01401                         {
01402                                 $md_ide = $this->md_section->getIdentifier($id);
01403                                 $md_ide->setCatalog(ilUtil::stripSlashes($data['Catalog']));
01404                                 $md_ide->setEntry(ilUtil::stripSlashes($data['Entry']));
01405                                 $md_ide->update();
01406                         }
01407                 }
01408                 // Contribute
01409                 if(is_array($_POST['met_contribute']))
01410                 {
01411                         foreach($_POST['met_contribute'] as $id => $data)
01412                         {
01413                                 $md_con =& $this->md_section->getContribute($id);
01414                                 $md_con->setRole(ilUtil::stripSlashes($data['Role']));
01415                                 $md_con->setDate(ilUtil::stripSlashes($data['Date']));
01416                                 $md_con->update();
01417 
01418                                 if(is_array($_POST['met_entity'][$id]))
01419                                 {
01420                                         foreach($_POST['met_entity'][$id] as $ent_id => $data)
01421                                         {
01422                                                 $md_ent =& $md_con->getEntity($ent_id);
01423                                                 $md_ent->setEntity(ilUtil::stripSlashes($data['Entity']));
01424                                                 $md_ent->update();
01425                                         }
01426                                 }
01427                         }
01428                 }
01429                 $this->callListeners('MetaMetaData');
01430                 sendinfo($this->lng->txt("saved_successfully"));
01431                 $this->listSection();
01432                 return true;
01433         }               
01434 
01435 
01436         /*
01437          * list rights section
01438          */
01439         function listRights()
01440         {
01441                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.md_editor.html','Services/MetaData');
01442                 $this->__setTabs('meta_rights');
01443                 $this->tpl->addBlockFile('MD_CONTENT','md_content','tpl.md_rights.html','Services/MetaData');
01444 
01445                 if(!is_object($this->md_section = $this->md_obj->getRights()))
01446                 {
01447                         $this->tpl->setCurrentBlock("no_rights");
01448                         $this->tpl->setVariable("TXT_NO_RIGHTS", $this->lng->txt("meta_no_rights"));
01449                         $this->tpl->setVariable("TXT_ADD_RIGHTS", $this->lng->txt("meta_add"));
01450                         $this->ctrl->setParameter($this, "section", "meta_rights");
01451                         $this->tpl->setVariable("ACTION_ADD_RIGHTS",
01452                                 $this->ctrl->getLinkTarget($this, "addSection"));
01453                         $this->tpl->parseCurrentBlock();
01454                 }
01455                 else
01456                 {
01457         
01458                         $this->ctrl->setReturn($this,'listRights');
01459                         $this->ctrl->setParameter($this,'section','meta_rights');
01460                         $this->tpl->setVariable("EDIT_ACTION",$this->ctrl->getFormAction($this));
01461 
01462                         $this->tpl->setVariable("TXT_RIGHTS", $this->lng->txt("meta_rights"));
01463                         $this->tpl->setVariable("TXT_COST", $this->lng->txt("meta_cost"));
01464                         $this->tpl->setVariable("TXT_COPYRIGHTANDOTHERRESTRICTIONS", $this->lng->txt("meta_copyright_and_other_restrictions"));
01465                         $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
01466                         $this->tpl->setVariable("TXT_YES", $this->lng->txt("meta_yes"));
01467                         $this->tpl->setVariable("TXT_NO", $this->lng->txt("meta_no"));
01468 
01469                         $this->ctrl->setParameter($this, "section", "meta_rights");
01470                         $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
01471                         $this->tpl->setVariable("ACTION_DELETE",
01472                                 $this->ctrl->getLinkTarget($this, "deleteSection"));
01473 
01474                         $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("meta_delete"));
01475 
01476                         $this->tpl->setVariable("VAL_COST_".strtoupper($this->md_section->getCosts()), " selected");
01477                         $this->tpl->setVariable("VAL_COPYRIGHTANDOTHERRESTRICTIONS_".
01478                                 strtoupper($this->md_section->getCopyrightAndOtherRestrictions()), " selected");
01479 
01480                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DESCRIPTION", $this->lng->txt("meta_description"));
01481                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
01482                         $this->tpl->setVariable("DESCRIPTION_LOOP_VAL", ilUtil::prepareFormOutput($this->md_section->getDescription()));
01483                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
01484                         $this->tpl->setVariable("DESCRIPTION_LOOP_VAL_LANGUAGE",
01485                         $this->__showLanguageSelect('rights[DescriptionLanguage]',
01486                                 $this->md_section->getDescriptionLanguageCode()));
01487 
01488                         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
01489         
01490                         $this->tpl->setCurrentBlock("rights");
01491                         $this->tpl->parseCurrentBlock();
01492                         
01493                 }
01494         }
01495 
01496         function updateRights()
01497         {
01498                 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
01499 
01500                 // update rights section
01501                 $this->md_section = $this->md_obj->getRights();
01502                 $this->md_section->setCosts($_POST['rights']['Cost']);
01503                 $this->md_section->setCopyrightAndOtherRestrictions($_POST['rights']['CopyrightAndOtherRestrictions']);
01504                 $this->md_section->setDescriptionLanguage(new ilMDLanguageItem($_POST['rights']['DescriptionLanguage']));
01505                 $this->md_section->setDescription(ilUtil::stripSlashes($_POST['rights']['Description']));
01506                 $this->md_section->update();
01507                 
01508                 $this->callListeners('Rights');
01509                 sendinfo($this->lng->txt("saved_successfully"));
01510                 $this->listSection();
01511         }
01512 
01513         /*
01514          * list educational section
01515          */
01516         function listEducational()
01517         {
01518                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.md_editor.html','Services/MetaData');
01519                 $this->__setTabs('meta_educational');
01520                 $this->tpl->addBlockFile('MD_CONTENT','md_content','tpl.md_educational.html','Services/MetaData');
01521 
01522                 if(!is_object($this->md_section = $this->md_obj->getEducational()))
01523                 {
01524                         $this->tpl->setCurrentBlock("no_educational");
01525                         $this->tpl->setVariable("TXT_NO_EDUCATIONAL", $this->lng->txt("meta_no_educational"));
01526                         $this->tpl->setVariable("TXT_ADD_EDUCATIONAL", $this->lng->txt("meta_add"));
01527                         $this->ctrl->setParameter($this, "section", "meta_educational");
01528                         $this->tpl->setVariable("ACTION_ADD_EDUCATIONAL",
01529                                 $this->ctrl->getLinkTarget($this, "addSection"));
01530                         $this->tpl->parseCurrentBlock();
01531                 }
01532                 else
01533                 {
01534                         $this->ctrl->setReturn($this,'listEducational');
01535                         $this->ctrl->setParameter($this,'section','meta_educational');
01536                         $this->tpl->setVariable("EDIT_ACTION",$this->ctrl->getFormAction($this));
01537 
01538                         $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
01539                         $this->tpl->setVariable("ACTION_DELETE",
01540                                                                         $this->ctrl->getLinkTarget($this, "deleteSection"));
01541 
01542                         $this->tpl->setVariable("TXT_EDUCATIONAL", $this->lng->txt("meta_educational"));
01543                         $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("meta_delete"));
01544                         $this->tpl->setVariable("TXT_NEW_ELEMENT", $this->lng->txt("meta_new_element"));
01545                         $this->tpl->setVariable("TXT_TYPICALAGERANGE", $this->lng->txt("meta_typical_age_range"));
01546                         $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("meta_description"));
01547                         $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("meta_language"));
01548                         $this->tpl->setVariable("TXT_ADD", $this->lng->txt("meta_add"));
01549                         $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
01550 
01551                         $this->tpl->setVariable("TXT_INTERACTIVITYTYPE", $this->lng->txt("meta_interactivity_type"));
01552                         $this->tpl->setVariable("TXT_LEARNINGRESOURCETYPE", $this->lng->txt("meta_learning_resource_type"));
01553                         $this->tpl->setVariable("TXT_INTERACTIVITYLEVEL", $this->lng->txt("meta_interactivity_level"));
01554                         $this->tpl->setVariable("TXT_SEMANTICDENSITY", $this->lng->txt("meta_semantic_density"));
01555                         $this->tpl->setVariable("TXT_INTENDEDENDUSERROLE", $this->lng->txt("meta_intended_end_user_role"));
01556                         $this->tpl->setVariable("TXT_CONTEXT", $this->lng->txt("meta_context"));
01557                         $this->tpl->setVariable("TXT_DIFFICULTY", $this->lng->txt("meta_difficulty"));
01558                         
01559                         $this->tpl->setVariable("VAL_INTERACTIVITYTYPE_" . strtoupper($this->md_section->getInteractivityType()), " selected");
01560                         $this->tpl->setVariable("VAL_LEARNINGRESOURCETYPE_" . strtoupper($this->md_section->getLearningResourceType()), " selected");
01561                         $this->tpl->setVariable("VAL_INTERACTIVITYLEVEL_" . strtoupper($this->md_section->getInteractivityLevel()), " selected");
01562                         $this->tpl->setVariable("VAL_SEMANTICDENSITY_" . strtoupper($this->md_section->getSemanticDensity()), " selected");
01563                         $this->tpl->setVariable("VAL_INTENDEDENDUSERROLE_" . strtoupper($this->md_section->getIntendedEndUserRole()), " selected");
01564                         $this->tpl->setVariable("VAL_CONTEXT_" . strtoupper($this->md_section->getContext()), " selected");
01565                         $this->tpl->setVariable("VAL_DIFFICULTY_" . strtoupper($this->md_section->getDifficulty()), " selected");
01566                         #$this->tpl->setVariable("VAL_TYPICALLEARNINGTIME", ilUtil::prepareFormOutput($this->md_section->getTypicalLearningTime()));
01567                         
01568                         $this->tpl->setVariable("TXT_ACTIVE", $this->lng->txt("meta_active"));
01569                         $this->tpl->setVariable("TXT_EXPOSITIVE", $this->lng->txt("meta_expositive"));
01570                         $this->tpl->setVariable("TXT_MIXED", $this->lng->txt("meta_mixed"));
01571                         $this->tpl->setVariable("TXT_EXERCISE", $this->lng->txt("meta_exercise"));
01572                         $this->tpl->setVariable("TXT_SIMULATION", $this->lng->txt("meta_simulation"));
01573                         $this->tpl->setVariable("TXT_QUESTIONNAIRE", $this->lng->txt("meta_questionnaire"));
01574                         $this->tpl->setVariable("TXT_DIAGRAMM", $this->lng->txt("meta_diagramm"));
01575                         $this->tpl->setVariable("TXT_FIGURE", $this->lng->txt("meta_figure"));
01576                         $this->tpl->setVariable("TXT_GRAPH", $this->lng->txt("meta_graph"));
01577                         $this->tpl->setVariable("TXT_INDEX", $this->lng->txt("meta_index"));
01578                         $this->tpl->setVariable("TXT_SLIDE", $this->lng->txt("meta_slide"));
01579                         $this->tpl->setVariable("TXT_TABLE", $this->lng->txt("meta_table"));
01580                         $this->tpl->setVariable("TXT_NARRATIVETEXT", $this->lng->txt("meta_narrative_text"));
01581                         $this->tpl->setVariable("TXT_EXAM", $this->lng->txt("meta_exam"));
01582                         $this->tpl->setVariable("TXT_EXPERIMENT", $this->lng->txt("meta_experiment"));
01583                         $this->tpl->setVariable("TXT_PROBLEMSTATEMENT", $this->lng->txt("meta_problem_statement"));
01584                         $this->tpl->setVariable("TXT_SELFASSESSMENT", $this->lng->txt("meta_self_assessment"));
01585                         $this->tpl->setVariable("TXT_LECTURE", $this->lng->txt("meta_lecture"));
01586                         $this->tpl->setVariable("TXT_VERYLOW", $this->lng->txt("meta_very_low"));
01587                         $this->tpl->setVariable("TXT_LOW", $this->lng->txt("meta_low"));
01588                         $this->tpl->setVariable("TXT_MEDIUM", $this->lng->txt("meta_medium"));
01589                         $this->tpl->setVariable("TXT_HIGH", $this->lng->txt("meta_high"));
01590                         $this->tpl->setVariable("TXT_VERYHIGH", $this->lng->txt("meta_very_high"));
01591                         $this->tpl->setVariable("TXT_TEACHER", $this->lng->txt("meta_teacher"));
01592                         $this->tpl->setVariable("TXT_AUTHOR", $this->lng->txt("meta_author"));
01593                         $this->tpl->setVariable("TXT_LEARNER", $this->lng->txt("meta_learner"));
01594                         $this->tpl->setVariable("TXT_MANAGER", $this->lng->txt("meta_manager"));
01595                         $this->tpl->setVariable("TXT_SCHOOL", $this->lng->txt("meta_school"));
01596                         $this->tpl->setVariable("TXT_HIGHEREDUCATION", $this->lng->txt("meta_higher_education"));
01597                         $this->tpl->setVariable("TXT_TRAINING", $this->lng->txt("meta_training"));
01598                         $this->tpl->setVariable("TXT_OTHER", $this->lng->txt("meta_other"));
01599                         $this->tpl->setVariable("TXT_VERYEASY", $this->lng->txt("meta_very_easy"));
01600                         $this->tpl->setVariable("TXT_EASY", $this->lng->txt("meta_easy"));
01601                         $this->tpl->setVariable("TXT_DIFFICULT", $this->lng->txt("meta_difficult"));
01602                         $this->tpl->setVariable("TXT_VERYDIFFICULT", $this->lng->txt("meta_very_difficult"));
01603                         $this->tpl->setVariable("TXT_TYPICALLEARNINGTIME", $this->lng->txt("meta_typical_learning_time"));
01604 
01605 
01606                         // Typical learning time
01607                         $tlt = array(0,0,0,0,0);
01608                         $valid = true;
01609 
01610                         include_once 'Services/MetaData/classes/class.ilMDUtils.php';
01611                         
01612                         if(!$tlt = ilMDUtils::_LOMDurationToArray($this->md_section->getTypicalLearningTime()))
01613                         {
01614                                 if(strlen($this->md_section->getTypicalLearningTime()))
01615                                 {
01616                                         $tlt = array(0,0,0,0,0);
01617                                         $valid = false;
01618                                 }
01619                         }
01620 
01621                         $this->tpl->setVariable("TXT_MONTH",$this->lng->txt('md_months'));              
01622                         $this->tpl->setVariable("SEL_MONTHS",$this->__buildMonthsSelect($tlt[0]));
01623                         $this->tpl->setVariable("SEL_DAYS",$this->__buildDaysSelect($tlt[1]));
01624                 
01625                         $this->tpl->setVariable("TXT_DAYS",$this->lng->txt('md_days'));
01626                         $this->tpl->setVariable("TXT_TIME",$this->lng->txt('md_time'));
01627 
01628                         $this->tpl->setVariable("TXT_TYPICAL_LEARN_TIME",$this->lng->txt('meta_typical_learning_time'));
01629                         $this->tpl->setVariable("SEL_TLT",ilUtil::makeTimeSelect('tlt',$tlt[4] ? false : true,
01630                                                                                                                                          $tlt[2],$tlt[3],$tlt[4],
01631                                                                                                                                          false));
01632                         $this->tpl->setVariable("TLT_HINT",$tlt[4] ? '(hh:mm:ss)' : '(hh:mm)');
01633 
01634                         if(!$valid)
01635                         {
01636                                 $this->tpl->setCurrentBlock("tlt_not_valid");
01637                                 $this->tpl->setVariable("TXT_CURRENT_VAL",$this->lng->txt('meta_current_value'));
01638                                 $this->tpl->setVariable("TLT",$this->md_section->getTypicalLearningTime());
01639                                 $this->tpl->setVariable("INFO_TLT_NOT_VALID",$this->lng->txt('meta_info_tlt_not_valid'));
01640                                 $this->tpl->parseCurrentBlock();
01641                         }
01642 
01643 
01644                         /* TypicalAgeRange */
01645                         $first = true;
01646                         foreach($ids = $this->md_section->getTypicalAgeRangeIds() as $id)
01647                         {
01648                                 if ($first)
01649                                 {
01650                                         $this->tpl->setCurrentBlock("agerange_head");
01651                                         $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_TYPICALAGERANGE",
01652                                                 $this->lng->txt("meta_typical_age_range"));
01653                                         $this->tpl->setVariable("ROWSPAN_AGERANGE", count($ids));
01654                                         $this->tpl->parseCurrentBlock();
01655                                         $first = false;
01656                                 }
01657                                         
01658                                 $md_age = $this->md_section->getTypicalAgeRange($id);
01659                                 
01660                                 $this->ctrl->setParameter($this, 'meta_index', $id);
01661                                 $this->ctrl->setParameter($this, 'meta_path', 'educational_typical_age_range');
01662         
01663                                 $this->tpl->setCurrentBlock("typicalagerange_delete");
01664                                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_ACTION_DELETE",
01665                                         $this->ctrl->getLinkTarget($this, "deleteElement"));
01666                                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
01667                                 $this->tpl->parseCurrentBlock();
01668 
01669                                 $this->tpl->setCurrentBlock("typicalagerange_loop");
01670                                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
01671                                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_VAL", ilUtil::prepareFormOutput($md_age->getTypicalAgeRange()));
01672                                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_NO", $id);
01673                                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
01674                                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_VAL_LANGUAGE",
01675                                         $this->__showLanguageSelect('educational[TypicalAgeRange]['.$id.'][Language]',
01676                                         $md_age->getTypicalAgeRangeLanguageCode()));
01677                                 $this->ctrl->setParameter($this, "section_element", "educational_typical_age_range");
01678                                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_ACTION_ADD",
01679                                         $this->ctrl->getLinkTarget($this, "addSectionElement"));
01680                                 $this->tpl->setVariable("TYPICALAGERANGE_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
01681                                 $this->tpl->parseCurrentBlock();
01682                         }
01683 
01684                         /* Description */
01685                         $first = true;
01686                         foreach($ids = $this->md_section->getDescriptionIds() as $id)
01687                         {
01688                                 if ($first)
01689                                 {
01690                                         $this->tpl->setCurrentBlock("desc_head");
01691                                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DESCRIPTION", $this->lng->txt("meta_description"));
01692                                         $this->tpl->setVariable("ROWSPAN_DESC", count($ids));
01693                                         $this->tpl->parseCurrentBlock();
01694                                         $first = false;
01695                                 }
01696 
01697                                 $md_des = $this->md_section->getDescription($id);
01698                                 
01699                                 $this->ctrl->setParameter($this, 'meta_index', $id);
01700                                 $this->ctrl->setParameter($this, 'meta_path', 'educational_description');
01701                                 
01702                                 $this->tpl->setCurrentBlock("description_loop");
01703                                 $this->tpl->setVariable("DESCRIPTION_LOOP_NO", $id);
01704                                 $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
01705                                 $this->tpl->setVariable("DESCRIPTION_LOOP_VAL", ilUtil::prepareFormOutput($md_des->getDescription()));
01706                                 $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
01707                                 $this->tpl->setVariable("DESCRIPTION_LOOP_VAL_LANGUAGE",
01708                                         $this->__showLanguageSelect('educational[Description]['.$id.'][Language]',
01709                                                 $md_des->getDescriptionLanguageCode()));
01710                                 $this->tpl->setVariable("DESCRIPTION_LOOP_ACTION_DELETE",
01711                                         $this->ctrl->getLinkTarget($this, "deleteElement"));
01712                                 $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
01713                                 $this->ctrl->setParameter($this, "section_element", "educational_description");
01714                                 $this->tpl->setVariable("DESCRIPTION_LOOP_ACTION_ADD",
01715                                         $this->ctrl->getLinkTarget($this, "addSectionElement"));
01716                                 $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
01717                                 $this->tpl->parseCurrentBlock();
01718                         }
01719 
01720 
01721                         /* Language */
01722                         $first = true;
01723                         foreach($ids = $this->md_section->getLanguageIds() as $id)
01724                         {
01725                                 if ($first)
01726                                 {
01727                                         $this->tpl->setCurrentBlock("language_head");
01728                                         $this->tpl->setVariable("LANGUAGE_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
01729                                         $this->tpl->setVariable("ROWSPAN_LANG", count($ids));
01730                                         $this->tpl->parseCurrentBlock();
01731                                         $first = false;
01732                                 }
01733                                 
01734                                 $md_lang = $this->md_section->getLanguage($id);
01735                                 
01736                                 $this->ctrl->setParameter($this, 'meta_index', $id);
01737                                 $this->ctrl->setParameter($this, 'meta_path', 'educational_language');
01738 
01739                                 $this->tpl->setCurrentBlock("language_loop");
01740                                 $this->tpl->setVariable("LANGUAGE_LOOP_VAL_LANGUAGE",
01741                                         $this->__showLanguageSelect('educational[Language]['.$id.']',
01742                                                 $md_lang->getLanguageCode()));
01743 
01744                                 $this->tpl->setVariable("LANGUAGE_LOOP_ACTION_DELETE",
01745                                         $this->ctrl->getLinkTarget($this, "deleteElement"));
01746                                 $this->tpl->setVariable("LANGUAGE_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
01747                                 $this->ctrl->setParameter($this, "section_element", "educational_language");
01748                                 $this->tpl->setVariable("LANGUAGE_LOOP_ACTION_ADD",
01749                                         $this->ctrl->getLinkTarget($this, "addSectionElement"));
01750                                 $this->tpl->setVariable("LANGUAGE_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
01751                                 $this->tpl->parseCurrentBlock();
01752 
01753                         }
01754 
01755                         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
01756 
01757                         $this->tpl->setCurrentBlock("educational");
01758                         $this->tpl->parseCurrentBlock();
01759                 }
01760         }
01761 
01762         function updateEducational()
01763         {
01764                 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
01765 
01766                 // update rights section
01767                 $this->md_section = $this->md_obj->getEducational();
01768                 $this->md_section->setInteractivityType($_POST['educational']['InteractivityType']);
01769                 $this->md_section->setLearningResourceType($_POST['educational']['LearningResourceType']);
01770                 $this->md_section->setInteractivityLevel($_POST['educational']['InteractivityLevel']);
01771                 $this->md_section->setSemanticDensity($_POST['educational']['SemanticDensity']);
01772                 $this->md_section->setIntendedEndUserRole($_POST['educational']['IntendedEndUserRole']);
01773                 $this->md_section->setContext($_POST['educational']['Context']);
01774                 $this->md_section->setDifficulty($_POST['educational']['Difficulty']);
01775 
01776 
01777                 // TLT
01778                 
01779                 if($_POST['tlt']['mo'] or $_POST['tlt']['d'] or 
01780                    $_POST['tlt']['h'] or $_POST['tlt']['m'] or $_POST['tlt']['s'])
01781                 {
01782                         $this->md_section->setPhysicalTypicalLearningTime($_POST['tlt']['mo'],$_POST['tlt']['d'],
01783                                                                                                                           $_POST['tlt']['h'],$_POST['tlt']['m'],$_POST['tlt']['s']);
01784                 }
01785                 else
01786                 {
01787                         $this->md_section->setTypicalLearningTime('');
01788                 }
01789                 $this->callListeners('Educational');
01790 
01791 
01792                 /* TypicalAgeRange */
01793                 foreach($ids = $this->md_section->getTypicalAgeRangeIds() as $id)
01794                 {
01795                         $md_age = $this->md_section->getTypicalAgeRange($id);
01796                         $md_age->setTypicalAgeRange(ilUtil::stripSlashes($_POST['educational']['TypicalAgeRange'][$id]['Value']));
01797                         $md_age->setTypicalAgeRangeLanguage(
01798                                 new ilMDLanguageItem($_POST['educational']['TypicalAgeRange'][$id]['Language']));
01799                         $md_age->update();
01800                 }
01801 
01802                 /* Description */
01803                 foreach($ids = $this->md_section->getDescriptionIds() as $id)
01804                 {
01805                         $md_des = $this->md_section->getDescription($id);
01806                         $md_des->setDescription(ilUtil::stripSlashes($_POST['educational']['Description'][$id]['Value']));
01807                         $md_des->setDescriptionLanguage(
01808                                 new ilMDLanguageItem($_POST['educational']['Description'][$id]['Language']));
01809                         $md_des->update();
01810                 }
01811 
01812                 /* Language */
01813                 foreach($ids = $this->md_section->getLanguageIds() as $id)
01814                 {
01815                         $md_lang = $this->md_section->getLanguage($id);
01816                         $md_lang->setLanguage(
01817                                 new ilMDLanguageItem($_POST['educational']['Language'][$id]));
01818                         $md_lang->update();
01819                 }
01820                 
01821                 $this->md_section->update();
01822                 
01823                 $this->callListeners('Educational');
01824                 sendinfo($this->lng->txt("saved_successfully"));
01825                 $this->listSection();
01826         }
01827 
01828         /*
01829          * list relation section
01830          */
01831         function listRelation()
01832         {
01833                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.md_editor.html','Services/MetaData');
01834                 $this->__setTabs('meta_relation');
01835                 $this->tpl->addBlockFile('MD_CONTENT','md_content','tpl.md_relation.html','Services/MetaData');
01836 
01837                 $rel_ids = $this->md_obj->getRelationIds();
01838                 if (!is_array($rel_ids) || count($rel_ids) == 0)
01839                 {
01840                         $this->tpl->setCurrentBlock("no_relation");
01841                         $this->tpl->setVariable("TXT_NO_RELATION", $this->lng->txt("meta_no_relation"));
01842                         $this->tpl->setVariable("TXT_ADD_RELATION", $this->lng->txt("meta_add"));
01843                         $this->ctrl->setParameter($this, "section", "meta_relation");
01844                         $this->tpl->setVariable("ACTION_ADD_RELATION",
01845                                 $this->ctrl->getLinkTarget($this, "addSection"));
01846                         $this->tpl->parseCurrentBlock();
01847                 }
01848                 else
01849                 {
01850                         foreach($rel_ids as $rel_id)
01851                         {
01852                                 $this->md_section = $this->md_obj->getRelation($rel_id);
01853                                 
01854                                 $this->ctrl->setParameter($this, 'meta_index', $rel_id);
01855                                 $this->ctrl->setParameter($this, "section", "meta_relation");
01856                                 
01857                                 /* Identifier_ */
01858                                 $res_ids = $this->md_section->getIdentifier_Ids();
01859                                 foreach ($res_ids as $res_id)
01860                                 {
01861                                         $ident = $this->md_section->getIdentifier_($res_id);
01862                                         $this->ctrl->setParameter($this, "meta_index", $res_id);
01863 
01864                                         if (count($res_ids) > 1)
01865                                         {
01866                                                 $this->tpl->setCurrentBlock("identifier_delete");
01867                                                 $this->ctrl->setParameter($this, "meta_path", "relation_resource_identifier");
01868                                                 $this->tpl->setVariable("IDENTIFIER_LOOP_ACTION_DELETE",
01869                                                         $this->ctrl->getLinkTarget($this, "deleteElement"));
01870                                                 $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
01871                                                 $this->tpl->parseCurrentBlock();
01872                                         }
01873 
01874                                         $this->tpl->setCurrentBlock("identifier_loop");
01875 
01876                                         $this->tpl->setVariable("IDENTIFIER_LOOP_NO", $res_id);
01877                                         $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_IDENTIFIER", $this->lng->txt("meta_identifier"));
01878                                         $this->ctrl->setParameter($this, 'meta_index', $rel_id);
01879                                         $this->ctrl->setParameter($this, "section_element", "relation_resource_identifier");
01880                                         $this->tpl->setVariable("IDENTIFIER_LOOP_ACTION_ADD",
01881                                                 $this->ctrl->getLinkTarget($this, "addSectionElement"));
01882                                         $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
01883                                         $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_ENTRY", $this->lng->txt("meta_entry"));
01884                                         $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_CATALOG", $this->lng->txt("meta_catalog"));
01885                                         $this->tpl->setVariable("IDENTIFIER_LOOP_VAL_CATALOG",
01886                                                 ilUtil::prepareFormOutput($ident->getCatalog()));
01887                                         $this->tpl->setVariable("IDENTIFIER_LOOP_VAL_ENTRY",
01888                                                 ilUtil::prepareFormOutput($ident->getEntry()));
01889                                         $this->tpl->parseCurrentBlock();
01890                                 }
01891         
01892                                 /* Description */
01893                                 $res_dess = $this->md_section->getDescriptionIds();
01894                                 foreach ($res_dess as $res_des)
01895                                 {
01896                                         $des = $this->md_section->getDescription($res_des);
01897                                         $this->ctrl->setParameter($this, "meta_index", $res_des);
01898 
01899                                         if (count($res_dess) > 1)
01900                                         {
01901                                                 $this->tpl->setCurrentBlock("description_delete");
01902                                                 $this->ctrl->setParameter($this, "meta_path", "relation_resource_description");
01903                                                 $this->tpl->setVariable("DESCRIPTION_LOOP_ACTION_DELETE",
01904                                                         $this->ctrl->getLinkTarget($this, "deleteElement"));
01905                                                 $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
01906                                                 $this->tpl->parseCurrentBlock();
01907                                         }
01908         
01909                                         $this->tpl->setCurrentBlock("description_loop");
01910                                         $this->tpl->setVariable("DESCRIPTION_LOOP_NO", $res_des);
01911                                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_DESCRIPTION", $this->lng->txt("meta_description"));
01912                                         $this->ctrl->setParameter($this, 'meta_index', $rel_id);
01913                                         $this->ctrl->setParameter($this, "section_element", "relation_resource_description");
01914                                         $this->tpl->setVariable("DESCRIPTION_LOOP_ACTION_ADD",
01915                                                 $this->ctrl->getLinkTarget($this, "addSectionElement"));
01916                                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
01917                                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
01918                                         $this->tpl->setVariable("DESCRIPTION_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
01919                                         $this->tpl->setVariable("DESCRIPTION_LOOP_VAL",
01920                                                 ilUtil::prepareFormOutput($des->getDescription()));
01921                                         $this->tpl->setVariable("DESCRIPTION_LOOP_VAL_LANGUAGE",
01922                                                 $this->__showLanguageSelect('relation[Resource][Description]['.$res_des.'][Language]',
01923                                                 $des->getDescriptionLanguageCode()));
01924                                         $this->tpl->parseCurrentBlock();
01925                                 }
01926                                 
01927                                 $this->tpl->setCurrentBlock("relation_loop");
01928                                 $this->tpl->setVariable("REL_ID", $rel_id);
01929                                 $this->tpl->setVariable("TXT_RELATION", $this->lng->txt("meta_relation"));                              
01930                                 $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
01931                                 $this->tpl->setVariable("ACTION_DELETE",
01932                                                                                 $this->ctrl->getLinkTarget($this, "deleteSection"));
01933                                 $this->ctrl->setParameter($this, "section", "meta_relation");
01934                                 $this->tpl->setVariable("ACTION_ADD",
01935                                                                                 $this->ctrl->getLinkTarget($this, "addSection"));
01936                                 $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("meta_delete"));
01937                                 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("meta_add"));
01938                                 $this->tpl->setVariable("TXT_NEW_ELEMENT", $this->lng->txt("meta_new_element"));
01939                                 $this->tpl->setVariable("TXT_KIND", $this->lng->txt("meta_kind"));
01940                                 $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
01941                                 $this->tpl->setVariable("TXT_ISPARTOF", $this->lng->txt("meta_is_part_of"));
01942                                 $this->tpl->setVariable("TXT_HASPART", $this->lng->txt("meta_has_part"));
01943                                 $this->tpl->setVariable("TXT_ISVERSIONOF", $this->lng->txt("meta_is_version_of"));
01944                                 $this->tpl->setVariable("TXT_HASVERSION", $this->lng->txt("meta_has_version"));
01945                                 $this->tpl->setVariable("TXT_ISFORMATOF", $this->lng->txt("meta_is_format_of"));
01946                                 $this->tpl->setVariable("TXT_HASFORMAT", $this->lng->txt("meta_has_format"));
01947                                 $this->tpl->setVariable("TXT_REFERENCES", $this->lng->txt("meta_references"));
01948                                 $this->tpl->setVariable("TXT_ISREFERENCEDBY", $this->lng->txt("meta_is_referenced_by"));
01949                                 $this->tpl->setVariable("TXT_ISBASEDON", $this->lng->txt("meta_is_based_on"));
01950                                 $this->tpl->setVariable("TXT_ISBASISFOR", $this->lng->txt("meta_is_basis_for"));
01951                                 $this->tpl->setVariable("TXT_REQUIRES", $this->lng->txt("meta_requires"));
01952                                 $this->tpl->setVariable("TXT_ISREQUIREDBY", $this->lng->txt("meta_is_required_by"));
01953                                 $this->tpl->setVariable("TXT_RESOURCE", $this->lng->txt("meta_resource"));
01954                                 $this->tpl->setVariable("VAL_KIND_" . strtoupper($this->md_section->getKind()), " selected");
01955                                 $this->tpl->parseCurrentBlock();
01956                         }
01957                         
01958                         $this->tpl->setCurrentBlock("relation");
01959                         $this->tpl->setVariable("EDIT_ACTION",$this->ctrl->getFormAction($this));
01960                         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
01961                         $this->tpl->parseCurrentBlock();
01962                 }
01963         }               
01964 
01965         function updateRelation()
01966         {
01967                 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
01968 
01969                 // relation
01970                 foreach($ids = $this->md_obj->getRelationIds() as $id)
01971                 {
01972                         // kind
01973                         $relation = $this->md_obj->getRelation($id);
01974                         $relation->setKind($_POST['relation'][$id]['Kind']);
01975                         
01976                         $relation->update();
01977                         
01978                         // identifiers
01979                         $res_idents = $relation->getIdentifier_Ids();
01980                         foreach ($res_idents as $res_id)
01981                         {
01982                                 $ident = $relation->getIdentifier_($res_id);
01983                                 $ident->setCatalog(ilUtil::stripSlashes($_POST['relation']['Resource']['Identifier'][$res_id][Catalog]));
01984                                 $ident->setEntry(ilUtil::stripSlashes($_POST['relation']['Resource']['Identifier'][$res_id][Entry]));
01985                                 $ident->update();
01986                         }
01987                         
01988                         // descriptions
01989                         $res_dess = $relation->getDescriptionIds();
01990                         foreach ($res_dess as $res_des)
01991                         {
01992                                 $des = $relation->getDescription($res_des);
01993                                 $des->setDescription(ilUtil::stripSlashes($_POST['relation']['Resource']['Description'][$res_des][Value]));
01994                                 $des->setDescriptionLanguage(
01995                                         new ilMDLanguageItem($_POST['relation']['Resource']['Description'][$res_des]['Language']));
01996                                 $des->update();
01997                         }
01998                 }
01999                 
02000                 $this->callListeners('Relation');
02001                 sendinfo($this->lng->txt("saved_successfully"));
02002                 $this->listSection();
02003         }
02004 
02005         /*
02006          * list annotation section
02007          */
02008         function listAnnotation()
02009         {
02010                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.md_editor.html','Services/MetaData');
02011                 $this->__setTabs('meta_annotation');
02012                 $this->tpl->addBlockFile('MD_CONTENT','md_content','tpl.md_annotation.html','Services/MetaData');
02013 
02014                 $anno_ids = $this->md_obj->getAnnotationIds();
02015                 if (!is_array($anno_ids) || count($anno_ids) == 0)
02016                 {
02017                         $this->tpl->setCurrentBlock("no_annotation");
02018                         $this->tpl->setVariable("TXT_NO_ANNOTATION", $this->lng->txt("meta_no_annotation"));
02019                         $this->tpl->setVariable("TXT_ADD_ANNOTATION", $this->lng->txt("meta_add"));
02020                         $this->ctrl->setParameter($this, "section", "meta_annotation");
02021                         $this->tpl->setVariable("ACTION_ADD_ANNOTATION",
02022                                                                         $this->ctrl->getLinkTarget($this, "addSection"));
02023                         $this->tpl->parseCurrentBlock();
02024                 }
02025                 else
02026                 {
02027                         foreach($anno_ids as $anno_id)
02028                         {
02029                                 $this->ctrl->setParameter($this, 'meta_index', $anno_id);
02030                                 $this->ctrl->setParameter($this, "section", "meta_annotation");
02031 
02032                                 $this->md_section = $this->md_obj->getAnnotation($anno_id);
02033                                                                 
02034                                 $this->tpl->setCurrentBlock("annotation_loop");
02035                                 $this->tpl->setVariable("ANNOTATION_ID", $anno_id);
02036                                 $this->tpl->setVariable("TXT_ANNOTATION", $this->lng->txt("meta_annotation"));                          
02037                                 $this->ctrl->setParameter($this, "meta_index", $anno_id);
02038                                 $this->tpl->setVariable("ACTION_DELETE",
02039                                         $this->ctrl->getLinkTarget($this, "deleteSection"));
02040                                 $this->ctrl->setParameter($this, "section", "meta_annotation");
02041                                 $this->tpl->setVariable("ACTION_ADD",
02042                                         $this->ctrl->getLinkTarget($this, "addSection"));
02043                                 $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("meta_delete"));
02044                                 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("meta_add"));
02045                                 
02046                                 $this->tpl->setVariable("TXT_ENTITY", $this->lng->txt("meta_entity"));
02047                                 $this->tpl->setVariable("VAL_ENTITY", ilUtil::prepareFormOutput($this->md_section->getEntity()));
02048                                 $this->tpl->setVariable("TXT_DATE", $this->lng->txt("meta_date"));
02049                                 $this->tpl->setVariable("VAL_DATE", ilUtil::prepareFormOutput($this->md_section->getDate()));
02050         
02051                                 /* Description */
02052                                 $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("meta_description"));
02053                                 $this->tpl->setVariable("TXT_VALUE", $this->lng->txt("meta_value"));
02054                                 $this->tpl->setVariable("VAL_DESCRIPTION", ilUtil::prepareFormOutput($this->md_section->getDescription()));
02055                                 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("meta_language"));
02056                                 $this->tpl->setVariable("VAL_DESCRIPTION_LANGUAGE",
02057                                         $this->__showLanguageSelect('annotation['.$anno_id.'][Language]',
02058                                         $this->md_section->getDescriptionLanguageCode()));
02059                                 
02060                                 $this->tpl->parseCurrentBlock();
02061                         }
02062                         
02063                         $this->tpl->setCurrentBlock("annotation");
02064                         $this->tpl->setVariable("EDIT_ACTION",$this->ctrl->getFormAction($this));
02065                         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
02066                         $this->tpl->parseCurrentBlock();
02067                 }
02068         }               
02069 
02070         function updateAnnotation()
02071         {
02072                 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
02073 
02074                 // relation
02075                 foreach($ids = $this->md_obj->getAnnotationIds() as $id)
02076                 {
02077                         // entity
02078                         $annotation = $this->md_obj->getAnnotation($id);
02079                         $annotation->setEntity(ilUtil::stripSlashes($_POST['annotation'][$id]['Entity']));
02080                         $annotation->setDate(ilUtil::stripSlashes($_POST['annotation'][$id]['Date']));
02081                         $annotation->setDescription(ilUtil::stripSlashes($_POST['annotation'][$id]['Description']));
02082                         $annotation->setDescriptionLanguage(
02083                                 new ilMDLanguageItem($_POST['annotation'][$id]['Language']));
02084 
02085                         $annotation->update();
02086                 }
02087                 
02088                 $this->callListeners('Annotation');
02089                 sendinfo($this->lng->txt("saved_successfully"));
02090                 $this->listSection();
02091         }
02092         
02093         /*
02094          * list classification section
02095          */
02096         function listClassification()
02097         {
02098                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.md_editor.html','Services/MetaData');
02099                 $this->__setTabs('meta_classification');
02100                 $this->tpl->addBlockFile('MD_CONTENT','md_content','tpl.md_classification.html','Services/MetaData');
02101 
02102                 $class_ids = $this->md_obj->getClassificationIds();
02103                 if (!is_array($class_ids) || count($class_ids) == 0)
02104                 {
02105                         $this->tpl->setCurrentBlock("no_classification");
02106                         $this->tpl->setVariable("TXT_NO_CLASSIFICATION", $this->lng->txt("meta_no_classification"));
02107                         $this->tpl->setVariable("TXT_ADD_CLASSIFICATION", $this->lng->txt("meta_add"));
02108                         $this->ctrl->setParameter($this, "section", "meta_classification");
02109                         $this->tpl->setVariable("ACTION_ADD_CLASSIFICATION",
02110                                 $this->ctrl->getLinkTarget($this, "addSection"));
02111                         $this->tpl->parseCurrentBlock();
02112                 }
02113                 else
02114                 {
02115                         foreach($class_ids as $class_id)
02116                         {
02117                                 $this->md_section = $this->md_obj->getClassification($class_id);
02118                                 $this->ctrl->setParameter($this, "section", "meta_classification");
02119                                 
02120                                 /* TaxonPath */
02121                                 $tp_ids = $this->md_section->getTaxonPathIds();
02122                                 foreach ($tp_ids as $tp_id)
02123                                 {
02124                                         $tax_path = $this->md_section->getTaxonPath($tp_id);
02125                                         
02126                                         $tax_ids = $tax_path->getTaxonIds();
02127                                         
02128                                         foreach($tax_ids as $tax_id)
02129                                         {
02130                                                 $taxon = $tax_path->getTaxon($tax_id);
02131                                                 
02132                                                 if (count($tax_ids) > 1)
02133                                                 {
02134                                                         $this->tpl->setCurrentBlock("taxon_delete");
02135                                                         $this->ctrl->setParameter($this, "meta_index", $tax_id);
02136                                                         $this->ctrl->setParameter($this, "meta_path", "classification_taxon");
02137                                                         $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_ACTION_DELETE",
02138                                                                 $this->ctrl->getLinkTarget($this, "deleteElement"));
02139                                                         $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
02140                                                         $this->tpl->parseCurrentBlock();
02141                                                 }
02142 
02143                                                 $this->tpl->setCurrentBlock("taxonpath_taxon_loop");
02144                                                 $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_NO", $tax_id);
02145                                                 $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TAXONPATH_NO", $tp_id);
02146                                                 $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TXT_TAXON", $this->lng->txt("meta_taxon"));
02147                                                 $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
02148                                                 $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_VAL_TAXON", ilUtil::prepareFormOutput($taxon->getTaxon()));
02149                                                 $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TXT_ID", $this->lng->txt("meta_id"));
02150                                                 $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_VAL_ID", ilUtil::prepareFormOutput($taxon->getTaxonId()));
02151                                                 $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
02152                                                 $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_VAL_TAXON_LANGUAGE",
02153                                                         $this->__showLanguageSelect('classification[TaxonPath][Taxon]['.$tax_id.'][Language]',
02154                                                         $taxon->getTaxonLanguageCode()));
02155 
02156                                                 $this->ctrl->setParameter($this, "section_element", "Taxon_".$class_id);
02157                                                 $this->ctrl->setParameter($this, "meta_index", $tp_id);
02158                                                 $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_ACTION_ADD",
02159                                                         $this->ctrl->getLinkTarget($this, "addSectionElement"));
02160                                                 $this->tpl->setVariable("TAXONPATH_TAXON_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
02161                                                 $this->tpl->parseCurrentBlock();
02162                                         }
02163 
02164                                         if (count($tp_ids) > 1)
02165                                         {
02166                                                 $this->tpl->setCurrentBlock("taxonpath_delete");
02167                                                 $this->ctrl->setParameter($this, "meta_index", $tp_id);
02168                                                 $this->ctrl->setParameter($this, "meta_path", "classification_taxon_path");
02169                                                 $this->tpl->setVariable("TAXONPATH_LOOP_ACTION_DELETE",
02170                                                         $this->ctrl->getLinkTarget($this, "deleteElement"));
02171                                                 $this->tpl->setVariable("TAXONPATH_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
02172                                                 $this->tpl->parseCurrentBlock();
02173                                         }
02174 
02175                                         $this->tpl->setCurrentBlock("taxonpath_loop");
02176                                         $this->tpl->setVariable("TAXONPATH_LOOP_NO", $tp_id);
02177                                         $this->tpl->setVariable("TAXONPATH_LOOP_ROWSPAN", (3 * count($tax_ids)) + 2);
02178                                         $this->tpl->setVariable("TAXONPATH_LOOP_TXT_TAXONPATH", $this->lng->txt("meta_taxon_path"));
02179                                         $this->tpl->setVariable("TAXONPATH_LOOP_TXT_SOURCE", $this->lng->txt("meta_source"));
02180                                         $this->tpl->setVariable("TAXONPATH_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
02181                                         $this->tpl->setVariable("TAXONPATH_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
02182                                         $this->tpl->setVariable("TAXONPATH_LOOP_VAL_SOURCE", ilUtil::prepareFormOutput($tax_path->getSource()));
02183                                         $this->tpl->setVariable("TAXONPATH_LOOP_VAL_SOURCE_LANGUAGE",
02184                                                 $this->__showLanguageSelect('classification[TaxonPath]['.$tp_id.'][Source][Language]',
02185                                                 $tax_path->getSourceLanguageCode()));
02186                                         $this->ctrl->setParameter($this, "section_element", "TaxonPath_".$class_id);
02187                                         $this->ctrl->setParameter($this, "meta_index", $class_id);
02188                                         $this->tpl->setVariable("TAXONPATH_LOOP_ACTION_ADD",
02189                                                 $this->ctrl->getLinkTarget($this, "addSectionElement"));
02190                                         $this->tpl->setVariable("TAXONPATH_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
02191                                         $this->tpl->parseCurrentBlock();
02192                                 }
02193 
02194                                 /* Description */
02195                                 $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("meta_description"));
02196                                 $this->tpl->setVariable("TXT_VALUE", $this->lng->txt("meta_value"));
02197                                 $this->tpl->setVariable("VAL_DESCRIPTION",
02198                                         ilUtil::prepareFormOutput($this->md_section->getDescription()));
02199                                 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("meta_language"));
02200                                 $this->tpl->setVariable("VAL_DESCRIPTION_LANGUAGE",
02201                                         $this->__showLanguageSelect('classification['.$class_id.'][Language]',
02202                                         $this->md_section->getDescriptionLanguageCode()));
02203 
02204                                 /* Keyword */
02205                                 $key_ids = $this->md_section->getKeywordIds();
02206                                 foreach ($key_ids as $key_id)
02207                                 {
02208                                         if (count($key_ids) > 1)
02209                                         {
02210                                                 $this->ctrl->setParameter($this, "meta_index", $key_id);
02211                                                 $this->ctrl->setParameter($this, "meta_path", "classification_keyword");
02212                                                 $this->tpl->setCurrentBlock("keyword_delete");
02213                                                 $this->tpl->setVariable("KEYWORD_LOOP_ACTION_DELETE",
02214                                                         $this->ctrl->getLinkTarget($this, "deleteElement"));
02215                                                 $this->tpl->setVariable("KEYWORD_LOOP_TXT_DELETE", $this->lng->txt("meta_delete"));
02216                                                 $this->tpl->parseCurrentBlock();
02217                                         }
02218                                         
02219                                         $keyword = $this->md_section->getKeyword($key_id);
02220                                         $this->tpl->setCurrentBlock("keyword_loop");
02221                                         $this->tpl->setVariable("KEYWORD_LOOP_NO", $key_id);
02222                                         $this->tpl->setVariable("KEYWORD_LOOP_TXT_KEYWORD", $this->lng->txt("meta_keyword"));
02223                                         $this->tpl->setVariable("KEYWORD_LOOP_TXT_VALUE", $this->lng->txt("meta_value"));
02224                                         $this->tpl->setVariable("KEYWORD_LOOP_VAL",
02225                                                 ilUtil::prepareFormOutput($keyword->getKeyword()));
02226                                         $this->tpl->setVariable("KEYWORD_LOOP_TXT_LANGUAGE", $this->lng->txt("meta_language"));
02227                                         $this->tpl->setVariable("KEYWORD_LOOP_VAL_LANGUAGE",
02228                                                 $this->__showLanguageSelect('classification[Keyword]['.$key_id.'][Language]',
02229                                                 $keyword->getKeywordLanguageCode()));
02230                                         $this->ctrl->setParameter($this, "meta_index", $class_id);
02231                                         $this->ctrl->setParameter($this, "section_element", "Keyword_".$class_id);
02232                                         $this->tpl->setVariable("KEYWORD_LOOP_ACTION_ADD",
02233                                                 $this->ctrl->getLinkTarget($this, "addSectionElement"));
02234                                         $this->tpl->setVariable("KEYWORD_LOOP_TXT_ADD", $this->lng->txt("meta_add"));
02235                                         $this->tpl->parseCurrentBlock();
02236                                 }
02237                                 
02238                                 $this->tpl->setCurrentBlock("classification_loop");
02239                                 $this->tpl->setVariable("TXT_CLASSIFICATION", $this->lng->txt("meta_classification"));
02240                                 $this->ctrl->setParameter($this, "meta_index", $class_id);
02241                                 $this->tpl->setVariable("ACTION_DELETE",
02242                                         $this->ctrl->getLinkTarget($this, "deleteSection"));
02243                                 $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("meta_delete"));
02244                                 $this->tpl->setVariable("ACTION_ADD",
02245                                         $this->ctrl->getLinkTarget($this, "addSection"));
02246                                 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("meta_add"));
02247         
02248                                 $this->tpl->setVariable("TXT_NEW_ELEMENT", $this->lng->txt("meta_new_element"));
02249                                 $this->tpl->setVariable("TXT_TAXONPATH", $this->lng->txt("meta_taxon_path"));
02250                                 $this->tpl->setVariable("TXT_KEYWORD", $this->lng->txt("meta_keyword"));
02251                                 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("meta_add"));
02252                                 
02253                                 $this->tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
02254                                 $this->tpl->setVariable("CLASS_ID", $class_id);
02255                                 $this->tpl->setVariable("TXT_PURPOSE", $this->lng->txt("meta_purpose"));
02256                                 $this->tpl->setVariable("TXT_DISCIPLINE", $this->lng->txt("meta_learning_resource_type"));
02257                                 $this->tpl->setVariable("TXT_IDEA", $this->lng->txt("meta_idea"));
02258                                 $this->tpl->setVariable("TXT_PREREQUISITE", $this->lng->txt("meta_prerequisite"));
02259                                 $this->tpl->setVariable("TXT_EDUCATIONALOBJECTIVE", $this->lng->txt("meta_educational_objective"));
02260                                 $this->tpl->setVariable("TXT_ACCESSIBILITYRESTRICTIONS", $this->lng->txt("meta_accessibility_restrictions"));
02261                                 $this->tpl->setVariable("TXT_EDUCATIONALLEVEL", $this->lng->txt("meta_educational_level"));
02262                                 $this->tpl->setVariable("TXT_SKILLLEVEL", $this->lng->txt("meta_skill_level"));
02263                                 $this->tpl->setVariable("TXT_SECURITYLEVEL", $this->lng->txt("meta_security_level"));
02264                                 $this->tpl->setVariable("TXT_COMPETENCY", $this->lng->txt("meta_competency"));
02265                                 $this->tpl->setVariable("VAL_PURPOSE_" . strtoupper($this->md_section->getPurpose()), " selected");
02266                                 $this->tpl->parseCurrentBlock();
02267                         }
02268                         
02269                         $this->tpl->setCurrentBlock("classification");
02270                         $this->tpl->setVariable("EDIT_ACTION",
02271                                 $this->ctrl->getFormAction($this));
02272                         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
02273                         $this->tpl->parseCurrentBlock();
02274                 }
02275         }
02276 
02277         function updateClassification()
02278         {
02279                 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
02280 
02281                 // relation
02282                 foreach($ids = $this->md_obj->getClassificationIds() as $id)
02283                 {
02284                         // entity
02285                         $classification = $this->md_obj->getClassification($id);
02286                         $classification->setPurpose($_POST['classification'][$id]['Purpose']);
02287                         
02288                         $classification->setDescription(ilUtil::stripSlashes($_POST['classification'][$id]['Description']));
02289                         $classification->setDescriptionLanguage(
02290                                 new ilMDLanguageItem($_POST['classification'][$id]['Language']));
02291 
02292                         $classification->update();
02293                         
02294                         $key_ids = $classification->getKeywordIds();
02295                         foreach ($key_ids as $key_id)
02296                         {
02297                                 $keyword = $classification->getKeyword($key_id);
02298                                 $keyword->setKeyword(ilUtil::stripSlashes($_POST['classification']['Keyword'][$key_id]['Value']));
02299                                 $keyword->setKeywordLanguage(
02300                                         new ilMDLanguageItem($_POST['classification']['Keyword'][$key_id]['Language']));
02301                                 $keyword->update();
02302                         }
02303                         
02304                         $tp_ids = $classification->getTaxonPathIds();
02305                         foreach ($tp_ids as $tp_id)
02306                         {
02307                                 $tax_path = $classification->getTaxonPath($tp_id);
02308                                 $tax_path->setSource(ilUtil::stripSlashes($_POST['classification']['TaxonPath'][$tp_id]['Source']['Value']));
02309                                 $tax_path->setSourceLanguage(
02310                                         new ilMDLanguageItem($_POST['classification']['TaxonPath'][$tp_id]['Source']['Language']));
02311                                 $tax_path->update();
02312 
02313                                 $tax_ids = $tax_path->getTaxonIds();
02314                                         
02315                                 foreach($tax_ids as $tax_id)
02316                                 {
02317                                         $taxon = $tax_path->getTaxon($tax_id);
02318                                         $taxon->setTaxon(ilUtil::stripSlashes($_POST['classification']['TaxonPath']['Taxon'][$tax_id]['Value']));
02319                                         $taxon->setTaxonLanguage(
02320                                                 new ilMDLanguageItem($_POST['classification']['TaxonPath']['Taxon'][$tax_id]['Language']));
02321                                         $taxon->setTaxonId(ilUtil::stripSlashes($_POST['classification']['TaxonPath']['Taxon'][$tax_id]['Id']));
02322                                         $taxon->update();
02323                                 }
02324                         }
02325 
02326 
02327                 }
02328                 
02329                 $this->callListeners('Classification');
02330                 sendinfo($this->lng->txt("saved_successfully"));
02331                 $this->listSection();
02332         }
02333 
02334         function deleteElement()
02335         {
02336                 include_once 'Services/MetaData/classes/class.ilMDFactory.php';
02337 
02338                 $md_element = ilMDFactory::_getInstance($_GET['meta_path'],$_GET['meta_index'],$_GET['meta_technical']);
02339                 $md_element->delete();
02340                 
02341                 $this->listSection();
02342 
02343                 return true;
02344         }
02345         
02346         function deleteSection()
02347         {
02348                 include_once 'Services/MetaData/classes/class.ilMDFactory.php';
02349 
02350                 $md_element = ilMDFactory::_getInstance($_GET['section'],$_GET['meta_index']);
02351                 $md_element->delete();
02352                 
02353                 $this->listSection();
02354 
02355                 return true;
02356         }
02357         
02358         function addSection()
02359         {
02360                 // Switch section
02361                 switch($_GET['section'])
02362                 {
02363                         case 'meta_technical':
02364                                 $this->md_section =& $this->md_obj->addTechnical();
02365                                 $this->md_section->save();
02366                                 break;
02367 
02368 
02369                         case 'meta_lifecycle':
02370                                 $this->md_section =& $this->md_obj->addLifecycle();
02371                                 $this->md_section->save();
02372                                 $con =& $this->md_section->addContribute();
02373                                 $con->save();
02374 
02375                                 $ent =& $con->addEntity();
02376                                 $ent->save();
02377                                 break;
02378 
02379                         case 'meta_meta_metadata':
02380                                 $this->md_section = $this->md_obj->addMetaMetadata();
02381                                 $this->md_section->save();
02382 
02383                                 $ide =& $this->md_section->addIdentifier();
02384                                 $ide->save();
02385 
02386                                 $con =& $this->md_section->addContribute();
02387                                 $con->save();
02388 
02389                                 $ent =& $con->addEntity();
02390                                 $ent->save();
02391                                 break;
02392 
02393                         case 'meta_rights':
02394                                 $this->md_section = $this->md_obj->addRights();
02395                                 $this->md_section->save();
02396                                 break;
02397                                 
02398                         case 'meta_educational':
02399                                 $this->md_section = $this->md_obj->addEducational();
02400                                 $this->md_section->save();
02401                                 break;
02402                                 
02403                         case 'meta_relation':
02404                                 $this->md_section = $this->md_obj->addRelation();
02405                                 $this->md_section->save();
02406                                 $ident = $this->md_section->addIdentifier_();
02407                                 $ident->save();
02408                                 $des = $this->md_section->addDescription();
02409                                 $des->save();
02410                                 break;
02411                                 
02412                         case 'meta_annotation':
02413                                 $this->md_section = $this->md_obj->addAnnotation();
02414                                 $this->md_section->save();
02415                                 break;
02416 
02417                         case 'meta_classification':
02418                                 $this->md_section = $this->md_obj->addClassification();
02419                                 $this->md_section->save();
02420 
02421                                 $taxon_path =& $this->md_section->addTaxonPath();
02422                                 $taxon_path->save();
02423 
02424                                 $taxon =& $taxon_path->addTaxon();
02425                                 $taxon->save();
02426 
02427                                 $key =& $this->md_section->addKeyword();
02428                                 $key->save();
02429                                 break;
02430 
02431                 }
02432                 
02433                 $this->listSection();
02434                 return true;
02435         }
02436 
02437         function addSectionElement()
02438         {
02439                 $section_element = (empty($_POST['section_element']))
02440                         ? $_GET['section_element']
02441                         : $_POST['section_element'];
02442                         
02443 
02444                 // Switch section
02445                 switch($_GET['section'])
02446                 {
02447                         case 'meta_technical':
02448                                 $this->md_section =& $this->md_obj->getTechnical();
02449                                 break;
02450 
02451                         case 'meta_lifecycle':
02452                                 $this->md_section =& $this->md_obj->getLifecycle();
02453                                 break;
02454 
02455                         case 'meta_meta_metadata':
02456                                 $this->md_section =& $this->md_obj->getMetaMetadata();
02457                                 break;
02458 
02459                         case 'meta_general':
02460                                 $this->md_section = $this->md_obj->getGeneral();
02461                                 break;
02462                                 
02463                         case 'meta_educational':
02464                                 $this->md_section = $this->md_obj->getEducational();
02465                                 break;
02466 
02467                         case 'meta_classification':
02468                                 $arr = explode("_", $section_element);
02469                                 $section_element = $arr[0];
02470                                 $this->md_section = $this->md_obj->getClassification($arr[1]);
02471                                 break;
02472                 }
02473 
02474                 // Switch new element
02475                 switch($section_element)
02476                 {
02477                         case 'meta_or_composite':
02478                                 $md_new =& $this->md_section->addOrComposite();
02479                                 $md_new = $md_new->addRequirement();
02480                                 break;
02481 
02482                         case 'meta_requirement':
02483                                 $md_new =& $this->md_section->addRequirement();
02484                                 break;
02485 
02486                         case 'meta_location':
02487                                 $md_new =& $this->md_section->addLocation();
02488                                 break;
02489 
02490                         case 'meta_format':
02491                                 $md_new = $this->md_section->addFormat();
02492                                 break;
02493 
02494                         case 'meta_entity':
02495                                 $md_new = $this->md_section->getContribute((int) $_GET['meta_index']);
02496                                 $md_new = $md_new->addEntity();
02497                                 break;
02498 
02499                         case 'meta_identifier':
02500                                 $md_new = $this->md_section->addIdentifier();
02501                                 break;
02502 
02503                         case 'meta_contribute':
02504                                 $md_new =& $this->md_section->addContribute();
02505                                 $md_new->save();
02506                                 $md_new = $md_new->addEntity();
02507                                 break;
02508 
02509                         case 'educational_language':
02510                         case 'meta_language':
02511                                 $md_new = $this->md_section->addLanguage();
02512                                 break;
02513 
02514                         case 'educational_description':
02515                         case 'meta_description':
02516                                 $md_new = $this->md_section->addDescription();
02517                                 break;
02518 
02519                         case 'Keyword':
02520                         case 'meta_keyword':
02521                                 $md_new = $this->md_section->addKeyword();
02522                                 break;
02523 
02524                         case 'educational_typical_age_range':
02525                                 $md_new = $this->md_section->addTypicalAgeRange();
02526                                 break;
02527                                 
02528                         case 'relation_resource_identifier':
02529                                 $rel = $this->md_obj->getRelation($_GET['meta_index']);
02530                                 $md_new = $rel->addIdentifier_();
02531                                 break;
02532                                 
02533                         case 'relation_resource_description':
02534                                 $rel = $this->md_obj->getRelation($_GET['meta_index']);
02535                                 $md_new = $rel->addDescription();
02536                                 break;
02537                                 
02538                         case 'TaxonPath':
02539                                 $md_new = $this->md_section->addTaxonPath();
02540                                 $md_new->save();
02541                                 $md_new = $md_new->addTaxon();
02542                                 break;
02543                                 
02544                         case 'Taxon':
02545                                 $tax_path = $this->md_section->getTaxonPath($_GET['meta_index']);
02546                                 $md_new = $tax_path->addTaxon();
02547                                 break;
02548                 }
02549 
02550                 $md_new->save();
02551 
02552                 $this->listSection();
02553 
02554                 return true;
02555         }
02556 
02557         function listSection()
02558         {
02559                 switch($_REQUEST['section'])
02560                 {
02561                         case 'meta_general':
02562                                 return $this->listGeneral();
02563 
02564                         case 'meta_lifecycle':
02565                                 return $this->listLifecycle();
02566 
02567                         case 'meta_technical':
02568                                 return $this->listTechnical();
02569 
02570                         case 'meta_meta_metadata':
02571                                 return $this->listMetaMetadata();
02572                                 
02573                         case 'debug':
02574                                 return $this->debug();
02575                                 
02576                         case 'meta_rights':
02577                                 return $this->listRights();
02578                                 
02579                         case 'meta_educational':
02580                                 return $this->listEducational();
02581 
02582                         case 'meta_relation':
02583                                 return $this->listRelation();
02584 
02585                         case 'meta_annotation':
02586                                 return $this->listAnnotation();
02587 
02588                         case 'meta_classification':
02589                                 return $this->listClassification();
02590 
02591                         default:
02592                                 return $this->listQuickEdit();
02593                 }
02594         }               
02595 
02596 
02597         // PRIVATE
02598         function __fillSubelements()
02599         {
02600                 if(count($subs = $this->md_section->getPossibleSubelements()))
02601                 {
02602                         //$subs = array_merge(array('' => 'meta_please_select'),$subs);
02603 
02604                         $this->tpl->setCurrentBlock("subelements");
02605                         $this->tpl->setVariable("SEL_SUBELEMENTS",ilUtil::formSelect('','section_element',$subs));
02606                         $this->tpl->setVariable("TXT_NEW_ELEMENT", $this->lng->txt("meta_new_element"));
02607                         $this->tpl->parseCurrentBlock();
02608 
02609                         $this->tpl->setVariable("TXT_ADD",$this->lng->txt('meta_add'));
02610 
02611                 }
02612                 return true;
02613         }
02614 
02615 
02616 
02617         function __setTabs($a_active)
02618         {
02619                 $tabs = array('meta_quickedit' => 'listQuickEdit',
02620                                           'meta_general' => 'listGeneral',
02621                                           'meta_lifecycle' => 'listLifecycle',
02622                                           'meta_meta_metadata'  => 'listMetaMetadata',
02623                                           'meta_technical' => 'listTechnical',
02624                                           'meta_educational' => 'listEducational',
02625                                           'meta_rights' => 'listRights',
02626                                           'meta_relation' => 'listRelation',
02627                                           'meta_annotation' => 'listAnnotation',
02628                                           'meta_classification' => 'listClassification');
02629 
02630                 if(DEVMODE)
02631                 {
02632                         $tabs['debug'] = 'debug';
02633                 }
02634                 
02635                 #include_once("classes/class.ilTabsGUI.php");
02636                 #$tab_gui = new ilTabsGUI();
02637                 #$tab_gui->setSubTabs();
02638                 foreach($tabs as $key => $target)
02639                 {
02640                         if($a_active == $key)
02641                         {
02642                                 $active = true;
02643                         }
02644                         else
02645                         {
02646                                 $active = false;
02647                         }
02648                         $this->ctrl->setParameter($this,'section',$key);
02649                         $this->tabs_gui->addSubTabTarget($key, $this->ctrl->getLinkTarget($this,'listSection'),
02650                                 "", "", "", $active);
02651                 }
02652                 #$this->tpl->setVariable("SUB_TABS", $tab_gui->getHTML());
02653                 return true;
02654         }
02655 
02656 
02660         function __showLanguageSelect($a_name, $a_value = "")
02661         {
02662                 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
02663 
02664                 $tpl = new ilTemplate("tpl.lang_selection.html", true, true);
02665 
02666                 foreach(ilMDLanguageItem::_getLanguages() as $code => $text)
02667                 {
02668                         $tpl->setCurrentBlock("lg_option");
02669                         $tpl->setVariable("VAL_LG", $code);
02670                         $tpl->setVariable("TXT_LG", $text);
02671 
02672                         if ($a_value != "" &&
02673                                 $a_value == $code)
02674                         {
02675                                 $tpl->setVariable("SELECTED", "selected");
02676                         }
02677 
02678                         $tpl->parseCurrentBlock();
02679                 }
02680                 $tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("meta_please_select"));
02681                 $tpl->setVariable("SEL_NAME", $a_name);
02682 
02683                 $return = $tpl->get();
02684                 unset($tpl);
02685 
02686                 return $return;
02687         }
02688 
02689         function __buildMonthsSelect($sel_month)
02690         {
02691                 for($i = 0;$i <= 24;$i++)
02692                 {
02693                         $options[$i] = sprintf('%02d',$i);
02694                 }
02695                 return ilUtil::formSelect($sel_month,'tlt[mo]',$options,false,true);
02696         }
02697 
02698 
02699         function __buildDaysSelect($sel_day)
02700         {
02701                 for($i = 0;$i <= 31;$i++)
02702                 {
02703                         $options[$i] = sprintf('%02d',$i);
02704                 }
02705                 return ilUtil::formSelect($sel_day,'tlt[d]',$options,false,true);
02706         }
02707                                 
02708                 
02709 
02710         // Observer methods
02711         function addObserver(&$a_class,$a_method,$a_element)
02712         {
02713                 $this->observers[$a_element]['class'] =& $a_class;
02714                 $this->observers[$a_element]['method'] =& $a_method;
02715 
02716                 return true;
02717         }
02718         function callListeners($a_element)
02719         {
02720                 if(isset($this->observers[$a_element]))
02721                 {
02722                         $class =& $this->observers[$a_element]['class'];
02723                         $method = $this->observers[$a_element]['method'];
02724 
02725                         return $class->$method($a_element);
02726                 }
02727                 return false;
02728         }
02729                         
02730 
02731 }
02732 ?>

Generated on Fri Dec 13 2013 13:52:11 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1