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

Services/MetaData/classes/class.ilMDCopyrightSelectionGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 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 
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 ?>

Generated on Fri Dec 13 2013 17:56:59 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1