/**
  * parse
  *
  * @access public
  * 
  */
 public function fillTemplate()
 {
     include_once 'Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php';
     $desc = ilMDRights::_lookupDescription($this->rbac_id, $this->obj_id);
     if (!$this->settings->isCopyrightSelectionActive() or !count($entries = ilMDCopyrightSelectionEntry::_getEntries())) {
         $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt('meta_copyright'));
         $this->tpl->setVariable('COPYRIGHT_VAL', ilUtil::prepareFormOutput($desc));
         return true;
     }
     $default_id = ilMDCopyrightSelectionEntry::_extractEntryId($desc);
     include_once 'Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php';
     $found = false;
     foreach ($entries as $entry) {
         $this->tpl->setCurrentBlock('copyright_selection');
         if ($entry->getEntryId() == $default_id) {
             $found = true;
             $this->tpl->setVariable('COPYRIGHT_CHECKED', 'checked="checked"');
         }
         $this->tpl->setVariable('COPYRIGHT_ID', $entry->getEntryId());
         $this->tpl->setVariable('COPYRIGHT_TITLE', $entry->getTitle());
         $this->tpl->setVariable('COPYRIGHT_DESCRIPTION', $entry->getDescription());
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setCurrentBlock('copyright_selection');
     if (!$found) {
         $this->tpl->setVariable('COPYRIGHT_CHECKED', 'checked="checked"');
     }
     $this->tpl->setVariable('COPYRIGHT_ID', 0);
     $this->tpl->setVariable('COPYRIGHT_TITLE', $this->lng->txt('meta_cp_own'));
     $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt('meta_copyright'));
     if (!$found) {
         $this->tpl->setVariable('COPYRIGHT_VAL', $desc);
     }
 }
 /**
  * Parse records
  *
  * @access public
  * @param array array of record objects
  * 
  */
 public function parseSelections()
 {
     foreach (ilMDCopyrightSelectionEntry::_getEntries() as $entry) {
         $tmp_arr['id'] = $entry->getEntryId();
         $tmp_arr['title'] = $entry->getTitle();
         $tmp_arr['description'] = $entry->getDescription();
         $tmp_arr['used'] = $entry->getUsage();
         $tmp_arr['preview'] = $entry->getCopyright();
         $entry_arr[] = $tmp_arr;
     }
     $this->setData($entry_arr ? $entry_arr : array());
 }
 /**
  * Insert property html
  */
 function insert(&$a_tpl)
 {
     include_once 'Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php';
     $ttpl = new ilTemplate("tpl.prop_copyright.html", true, true, "Services/MetaData");
     $entries = ilMDCopyrightSelectionEntry::_getEntries();
     $use_selection = $this->settings->isCopyrightSelectionActive() && count($entries);
     $val = $this->getValue();
     if ($use_selection) {
         $default_id = ilMDCopyrightSelectionEntry::_extractEntryId($val["ta"]);
         include_once 'Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php';
         $found = false;
         foreach ($entries as $entry) {
             $ttpl->setCurrentBlock('copyright_selection');
             if ($entry->getEntryId() == $default_id) {
                 $found = true;
                 $ttpl->setVariable('COPYRIGHT_CHECKED', 'checked="checked"');
             }
             $ttpl->setVariable('COPYRIGHT_ID', $entry->getEntryId());
             $ttpl->setVariable('COPYRIGHT_TITLE', $entry->getTitle());
             $ttpl->setVariable('COPYRIGHT_DESCRIPTION', $entry->getDescription());
             $ttpl->setVariable('SPOST_VAR', $this->getPostVar());
             $ttpl->parseCurrentBlock();
         }
         $ttpl->setCurrentBlock('copyright_selection');
         if (!$found) {
             $ttpl->setVariable('COPYRIGHT_CHECKED', 'checked="checked"');
         }
         $ttpl->setVariable('COPYRIGHT_ID', 0);
         $ttpl->setVariable('COPYRIGHT_TITLE', $this->lng->txt('meta_cp_own'));
         $ttpl->setVariable('SPOST_VAR', $this->getPostVar());
         $ttpl->parseCurrentBlock();
     }
     if ($this->getCols() > 5) {
         $ttpl->setCurrentBlock("prop_ta_c");
         $ttpl->setVariable("COLS", $this->getCols());
         $ttpl->parseCurrentBlock();
     } else {
         $ttpl->touchBlock("prop_ta_w");
     }
     $ttpl->setCurrentBlock("prop_copyright");
     $ttpl->setVariable("ROWS", $this->getRows());
     if (!$this->getDisabled()) {
         $ttpl->setVariable("POST_VAR", $this->getPostVar());
     }
     $ttpl->setVariable("ID", $this->getFieldId());
     if ($this->getDisabled()) {
         $ttpl->setVariable('DISABLED', 'disabled="disabled" ');
     }
     if ($this->getDisabled()) {
         $ttpl->setVariable("HIDDEN_INPUT", $this->getHiddenTag($this->getPostVar(), $this->getValue()));
     }
     if (!$use_selection || !$found) {
         $ttpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($val["ta"]));
     }
     $ttpl->parseCurrentBlock();
     $a_tpl->setCurrentBlock("prop_generic");
     $a_tpl->setVariable("PROP_GENERIC", $ttpl->get());
     $a_tpl->parseCurrentBlock();
 }