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

Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldTableGUI.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 
00032 include_once('Services/Table/classes/class.ilTable2GUI.php');
00033 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
00034 
00035 class ilAdvancedMDFieldTableGUI extends ilTable2GUI
00036 {
00045         public function __construct($a_parent_obj,$a_parent_cmd = '')
00046         {
00047                 global $lng,$ilCtrl;
00048                 
00049                 $this->lng = $lng;
00050                 $this->ctrl = $ilCtrl;
00051                 
00052                 parent::__construct($a_parent_obj,$a_parent_cmd);
00053                 $this->addColumn('','f',1);
00054                 $this->addColumn($this->lng->txt('position'),'position',"5%");
00055                 $this->addColumn($this->lng->txt('title'),'title',"30%");
00056                 $this->addColumn($this->lng->txt('md_adv_field_fields'),'fields',"35%");
00057                 $this->addColumn($this->lng->txt('options'),'obj_types',"30%");
00058                 
00059                 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
00060                 $this->setRowTemplate("tpl.edit_fields_row.html","Services/AdvancedMetaData");
00061                 $this->setDefaultOrderField("position");
00062                 #$this->setDefaultOrderDirection("desc");
00063         }
00064         
00072         public function fillRow($a_set)
00073         {
00074                 $this->tpl->setVariable('TXT_SEARCHABLE',$this->lng->txt('md_adv_searchable'));
00075                 $this->tpl->setVariable('ASS_ID',$a_set['id']);
00076                 if($a_set['searchable'])
00077                 {
00078                         $this->tpl->setVariable('ASS_CHECKED','checked="checked"');
00079                 }
00080                 $this->tpl->setVariable('VAL_POS',$a_set['position']);
00081                 
00082                 $this->tpl->setVariable('VAL_ID',$a_set['id']);
00083                 $this->tpl->setVariable('VAL_TITLE',$a_set['title']);
00084                 if(strlen($a_set['description']))
00085                 {
00086                         $this->tpl->setVariable('VAL_DESCRIPTION',$a_set['description']);
00087                 }
00088                 
00089                 foreach($a_set['values'] as $value)
00090                 {
00091                         $this->tpl->setCurrentBlock('field_value');
00092                         $this->tpl->setVariable('FIELD_VAL',$value);
00093                         $this->tpl->parseCurrentBlock();
00094                 }
00095                 if(count($a_set['values']))
00096                 {
00097 #                       $this->tpl->setCurrentBlock('field_select');
00098 #                       $this->tpl->parseCurrentBlock();
00099                 }
00100                 switch($a_set['type'])
00101                 {
00102                         case ilAdvancedMDFieldDefinition::TYPE_TEXT:
00103                                 $this->tpl->setVariable('FIELD_TYPE',$this->lng->txt('udf_type_text'));
00104                                 break;
00105                                 
00106                         case ilAdvancedMDFieldDefinition::TYPE_SELECT:
00107                                 $this->tpl->setVariable('FIELD_TYPE',$this->lng->txt('udf_type_select'));
00108                                 break;
00109                                 
00110                         case ilAdvancedMDFieldDefinition::TYPE_DATE:
00111                                 $this->tpl->setVariable('FIELD_TYPE',$this->lng->txt('udf_type_date'));
00112                                 break;                          
00113                 }
00114                 $this->ctrl->setParameter($this->parent_obj,'field_id',$a_set['id']);
00115                 $this->tpl->setVariable('EDIT_LINK',$this->ctrl->getLinkTarget($this->parent_obj,'editField'));
00116                 $this->tpl->setVariable('TXT_EDIT_RECORD',$this->lng->txt('edit'));
00117         }
00118         
00119         
00127         public function parseDefinitions($a_definitions)
00128         {
00129                 $counter = 1;
00130                 foreach($a_definitions as $definition)
00131                 {               
00132                         $tmp_arr['position'] = sprintf("%.1f",$counter++);
00133                         $tmp_arr['id'] = $definition->getFieldId();
00134                         $tmp_arr['title'] = $definition->getTitle();
00135                         $tmp_arr['description'] = $definition->getDescription();
00136                         $tmp_arr['fields'] = array();
00137                         $tmp_arr['searchable'] = $definition->isSearchable();
00138                         $tmp_arr['type'] = $definition->getFieldType();
00139                         $tmp_arr['values'] = $definition->getFieldValues();
00140                         
00141                         $defs_arr[] = $tmp_arr;
00142                 }
00143                 $this->setData($defs_arr ? $defs_arr : array());
00144         }
00145         
00146 }
00147 
00148 
00149 ?>

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