ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilMemberExportSettingsGUI.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 
12 {
13  const TYPE_PRINT_VIEW_SETTINGS = 'print_view';
14  const TYPE_EXPORT_SETTINGS = 'member_export';
15 
16 
17  private $parent_type = '';
18 
19 
23  public function __construct($a_parent_type)
24  {
25  $this->parent_type = $a_parent_type;
26 
27  $this->ctrl = $GLOBALS['ilCtrl'];
28  $this->lng = $GLOBALS['lng'];
29  $this->lng->loadLanguageModule('crs');
30  $this->lng->loadLanguageModule('mem');
31  }
32 
37  private function getLang()
38  {
39  return $this->lng;
40  }
41 
42 
46  public function executeCommand()
47  {
48  $next_class = $this->ctrl->getNextClass($this);
49  $cmd = $this->ctrl->getCmd();
50 
51 
52  switch($next_class)
53  {
54 
55  default:
56  $this->$cmd();
57  break;
58  }
59  return true;
60  }
61 
62 
66  protected function printViewSettings(ilPropertyFormGUI $form = null)
67  {
68  if(!$form instanceof ilPropertyFormGUI)
69  {
70  $form = $this->initForm(self::TYPE_PRINT_VIEW_SETTINGS);
71  }
72 
73  $GLOBALS['tpl']->setContent($form->getHTML());
74  }
75 
79  protected function initForm($a_type)
80  {
81  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
82  $form = new ilPropertyFormGUI();
83  $form->setFormAction($this->ctrl->getFormAction($this));
84  $form->setTitle($this->getLang()->txt('mem_'.$a_type.'_form'));
85 
86  // profile fields
87  $fields['name'] = $GLOBALS['lng']->txt('name');
88  $fields['login'] = $GLOBALS['lng']->txt('login');
89  $fields['email'] = $GLOBALS['lng']->txt('email');
90 
91  include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
92  include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
93  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
94  include_once('Services/User/classes/class.ilUserDefinedFields.php');
95 
96  $field_info = ilExportFieldsInfo::_getInstanceByType($this->parent_type);
97  $field_info->sortExportFields();
98 
99  foreach($field_info->getExportableFields() as $field)
100  {
101  switch($field)
102  {
103  case 'username':
104  case 'firstname':
105  case 'lastname':
106  case 'email':
107  continue 2;
108  }
109 
110  // Check if default enabled
111  $fields[$field] = $GLOBALS['lng']->txt($field);
112  }
113 
114 
115  // udf
116  include_once './Services/User/classes/class.ilUserDefinedFields.php';
118  $exportable = array();
119  if($this->parent_type == 'crs')
120  {
121  $exportable = $udf->getCourseExportableFields();
122  }
123  elseif($this->parent_type == 'grp')
124  {
125  $exportable = $udf->getGroupExportableFields();
126  }
127  foreach((array) $exportable as $field_id => $udf_data)
128  {
129  $fields['udf_'.$field_id] = $udf_data['field_name'];
130  }
131 
132 
133  $ufields = new ilCheckboxGroupInputGUI($GLOBALS['lng']->txt('user_detail'), 'preset');
134  foreach($fields as $id => $name)
135  {
136  $ufields->addOption(new ilCheckboxOption($name, $id));
137  }
138  $form->addItem($ufields);
139 
140 
141  include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
142  $privacy = ilPrivacySettings::_getInstance();
143  if($this->parent_type == 'crs')
144  {
145  if($privacy->enabledCourseAccessTimes())
146  {
147  $ufields->addOption(new ilCheckboxOption($GLOBALS['lng']->txt('last_access'),'access'));
148  }
149  }
150  if($this->parent_type == 'grp')
151  {
152  if($privacy->enabledGroupAccessTimes())
153  {
154  $ufields->addOption(new ilCheckboxOption($GLOBALS['lng']->txt('last_access'),'access'));
155  }
156  }
157  $ufields->addOption(new ilCheckboxOption($GLOBALS['lng']->txt('crs_status'),'status'));
158  $ufields->addOption(new ilCheckboxOption($GLOBALS['lng']->txt('crs_passed'),'passed'));
159 
160 
161  $blank = new ilTextInputGUI($GLOBALS['lng']->txt('event_blank_columns'), 'blank');
162  $blank->setMulti(true);
163  $form->addItem($blank);
164 
165  $roles = new ilCheckboxGroupInputGUI($GLOBALS['lng']->txt('event_user_selection'), 'selection_of_users');
166 
167  $roles->addOption(new ilCheckboxOption($GLOBALS['lng']->txt('event_tbl_admin'),'role_adm'));
168  if($this->parent_type == 'crs')
169  {
170  $roles->addOption(new ilCheckboxOption($GLOBALS['lng']->txt('event_tbl_tutor'),'role_tut'));
171  }
172  $roles->addOption(new ilCheckboxOption($GLOBALS['lng']->txt('event_tbl_member'),'role_mem'));
173 
174  $subscriber = new ilCheckboxOption($GLOBALS['lng']->txt('event_user_selection_include_requests'), 'subscr');
175  $roles->addOption($subscriber);
176 
177  $waiting_list = new ilCheckboxOption($GLOBALS['lng']->txt('event_user_selection_include_waiting_list'),'wlist');
178  $roles->addOption($waiting_list);
179 
180  $form->addItem($roles);
181 
182  switch($a_type)
183  {
184  case self::TYPE_PRINT_VIEW_SETTINGS:
185  $form->addCommandButton('savePrintViewSettings', $this->getLang()->txt('save'));
186  break;
187  }
188 
189  include_once "Services/User/classes/class.ilUserFormSettings.php";
190  $settings = new ilUserFormSettings($this->parent_type.'s_pview',-1);
191  $settings->exportToForm($form);
192 
193  return $form;
194  }
195 
199  protected function savePrintViewSettings()
200  {
201  $form = $this->initForm(self::TYPE_PRINT_VIEW_SETTINGS);
202  if($form->checkInput())
203  {
204  $form->setValuesByPost();
205 
206  include_once "Services/User/classes/class.ilUserFormSettings.php";
207 
210 
211  $settings = new ilUserFormSettings($this->parent_type.'s_pview',-1);
212  $settings->importFromForm($form);
213  $settings->store();
214 
215  ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'));
216  $GLOBALS['ilCtrl']->redirect($this, 'printViewSettings');
217  }
218 
219  }
220 }
221 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
savePrintViewSettings()
Save print view settings.
This class represents an option in a checkbox group.
static _getInstance()
Get instance.
This class represents a property form user interface.
initForm($a_type)
init settings form
printViewSettings(ilPropertyFormGUI $form=null)
Show print view settings.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$cmd
Definition: sahs_server.php:35
static deleteAllForPrefix($a_prefix)
Delete all entries for prefix.
$a_type
Definition: workflow.php:93
static _getInstanceByType($a_type)
Get Singleton Instance.
This class represents a text property in a property form.
This class represents a property in a property form.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
static _getInstance()
Get instance of ilPrivacySettings.
__construct($a_parent_type)
Constructor.