ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjectCustomUserFieldsTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Table/classes/class.ilTable2GUI.php';
5 
13 {
17  public function __construct($a_parent_obj, $a_parent_cmd)
18  {
19  global $ilCtrl,$lng;
20 
21  $this->ctrl = $ilCtrl;
22  $this->lng = $lng;
23 
24  parent::__construct($a_parent_obj,$a_parent_cmd);
25 
26  $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(),$this->getParentCmd()));
27 
28  $this->setTitle($this->lng->txt('ps_cdf_data_fields'));
29 
30  $this->addColumn('','f',1);
31  $this->addColumn($this->lng->txt('ps_cdf_name'),'name','30%');
32  $this->addColumn($this->lng->txt('ps_cdf_type'),'type','30%');
33  $this->addColumn($this->lng->txt('ps_cdf_required'),'','20%');
34  $this->addColumn('','','20%');
35 
36  $this->addMultiCommand('confirmDeleteFields', $this->lng->txt('delete'));
37  $this->addCommandButton('saveFields', $this->lng->txt('save'));
38 
39  $this->setSelectAllCheckbox('field_ids[]');
40 
41  $this->enable('sort');
42  $this->enable('header');
43  $this->enable('numinfo');
44  $this->enable('select_all');
45 
46  $this->setRowTemplate('tpl.mem_cust_user_data_table_row.html','Services/Membership');
47  }
48 
54  public function fillRow($row)
55  {
56  $this->tpl->setVariable('VAL_ID',$row['field_id']);
57  $this->tpl->setVariable('VAL_NAME',$row['name']);
58  $this->tpl->setVariable('VAL_TYPE',$row['type']);
59  $this->tpl->setVariable('REQUIRED_CHECKED',$row['required'] ? 'checked="checked"' : '');
60 
61  $this->ctrl->setParameter($this->getParentObject(),'field_id',$row['field_id']);
62  $this->tpl->setVariable('EDIT_LINK',$this->ctrl->getLinkTarget($this->getParentObject(),'editField'));
63  $this->tpl->setVariable('TXT_EDIT',$this->lng->txt('edit'));
64  }
65 
71  public function parse($a_defs)
72  {
73  $rows = array();
74  foreach($a_defs as $def)
75  {
76  $rows[$def->getId()]['field_id'] = $def->getId();
77  $rows[$def->getId()]['name'] = $def->getName();
78 
79  switch($def->getType())
80  {
81  case IL_CDF_TYPE_SELECT:
82  $rows[$def->getId()]['type'] = $this->lng->txt('ps_type_select');
83  break;
84 
85  case IL_CDF_TYPE_TEXT:
86  $rows[$def->getId()]['type'] = $this->lng->txt('ps_type_text');
87  break;
88  }
89 
90  $rows[$def->getId()]['required'] = (bool) $def->isRequired();
91  }
92  $this->setData($rows);
93  }
94 }
95 ?>