Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00033 include_once('Services/MetaData/classes/class.ilMDSettings.php');
00034 include_once('Services/MetaData/classes/class.ilMDRights.php');
00035
00036 class ilMDCopyrightSelectionGUI
00037 {
00038 const MODE_QUICKEDIT = 1;
00039 const MODE_EDIT = 2;
00040
00041 protected $tpl;
00042 protected $lng;
00043 protected $settings;
00044
00045 private $mode;
00046 private $rbac_id;
00047 private $obj_id;
00048
00054 public function __construct($a_mode,$a_rbac_id,$a_obj_id)
00055 {
00056 global $lng,$tpl;
00057
00058 $this->tpl = $tpl;
00059 $this->lng = $lng;
00060
00061 $this->mode = $a_mode;
00062 $this->rbac_id = $a_rbac_id;
00063 $this->obj_id = $a_obj_id;
00064
00065 $this->settings = ilMDSettings::_getInstance();
00066 }
00067
00074 public function fillTemplate()
00075 {
00076 include_once('Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php');
00077
00078 $desc = ilMDRights::_lookupDescription($this->rbac_id,$this->obj_id);
00079
00080 if(!$this->settings->isCopyrightSelectionActive() or
00081 !count($entries = ilMDCopyrightSelectionEntry::_getEntries()))
00082 {
00083 $this->tpl->setVariable("TXT_COPYRIGHT",$this->lng->txt('meta_copyright'));
00084 $this->tpl->setVariable('COPYRIGHT_VAL',
00085 ilUtil::prepareFormOutput($desc));
00086 return true;
00087 }
00088
00089 $default_id = ilMDCopyrightSelectionEntry::_extractEntryId($desc);
00090
00091 include_once('Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php');
00092 $found = false;
00093 foreach($entries as $entry)
00094 {
00095 $this->tpl->setCurrentBlock('copyright_selection');
00096
00097 if($entry->getEntryId() == $default_id)
00098 {
00099 $found = true;
00100 $this->tpl->setVariable('COPYRIGHT_CHECKED','checked="checked"');
00101 }
00102 $this->tpl->setVariable('COPYRIGHT_ID',$entry->getEntryId());
00103 $this->tpl->setVariable('COPYRIGHT_TITLE',$entry->getTitle());
00104 $this->tpl->setVariable('COPYRIGHT_DESCRIPTION',$entry->getDescription());
00105 $this->tpl->parseCurrentBlock();
00106 }
00107
00108 $this->tpl->setCurrentBlock('copyright_selection');
00109 if(!$found)
00110 {
00111 $this->tpl->setVariable('COPYRIGHT_CHECKED','checked="checked"');
00112 }
00113 $this->tpl->setVariable('COPYRIGHT_ID',0);
00114 $this->tpl->setVariable('COPYRIGHT_TITLE',$this->lng->txt('meta_cp_own'));
00115
00116 $this->tpl->setVariable("TXT_COPYRIGHT",$this->lng->txt('meta_copyright'));
00117 if(!$found)
00118 {
00119 $this->tpl->setVariable('COPYRIGHT_VAL',$desc);
00120 }
00121 }
00122 }
00123
00124
00125 ?>