ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
4include_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 const TYPE_PRINT_VIEW_MEMBERS = 'prv_members';
16
17
18 private $parent_type = '';
19 private $parent_obj_id = 0;
23 private $dic;
24
25
29 public function __construct($a_parent_type, $a_parent_obj_id = 0)
30 {
31 global $DIC;
32 $this->dic = $DIC;
33 $this->parent_type = $a_parent_type;
34 $this->parent_obj_id = $a_parent_obj_id;
35
36 $this->ctrl = $GLOBALS['DIC']['ilCtrl'];
37 $this->lng = $GLOBALS['DIC']['lng'];
38 $this->lng->loadLanguageModule('crs');
39 $this->lng->loadLanguageModule('mem');
40 }
41
46 private function getLang()
47 {
48 return $this->lng;
49 }
50
51
55 public function executeCommand()
56 {
57 $next_class = $this->ctrl->getNextClass($this);
58 $cmd = $this->ctrl->getCmd('printViewSettings');
59
60
61 switch ($next_class) {
62 default:
63 $this->$cmd();
64 break;
65 }
66 return true;
67 }
68
69
73 protected function printViewSettings(ilPropertyFormGUI $form = null)
74 {
75 if (!$form instanceof ilPropertyFormGUI) {
76 $form = $this->initForm(self::TYPE_PRINT_VIEW_SETTINGS);
77 }
78
79 $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
80 }
81
85 protected function initForm($a_type)
86 {
87 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
88 $form = new ilPropertyFormGUI();
89 $form->setFormAction($this->ctrl->getFormAction($this));
90 $form->setTitle($this->getLang()->txt('mem_' . $a_type . '_form'));
91
92 // profile fields
93 $fields['name'] = $GLOBALS['DIC']['lng']->txt('name');
94 $fields['login'] = $GLOBALS['DIC']['lng']->txt('login');
95 $fields['email'] = $GLOBALS['DIC']['lng']->txt('email');
96
97 include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
98 include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
99 include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
100 include_once('Services/User/classes/class.ilUserDefinedFields.php');
101
102 $field_info = ilExportFieldsInfo::_getInstanceByType($this->parent_type);
103 $field_info->sortExportFields();
104
105 foreach ($field_info->getExportableFields() as $field) {
106 switch ($field) {
107 case 'username':
108 case 'firstname':
109 case 'lastname':
110 case 'email':
111 continue 2;
112 }
113
114 // Check if default enabled
115 $fields[$field] = $GLOBALS['DIC']['lng']->txt($field);
116 }
117
118
119 // udf
120 include_once './Services/User/classes/class.ilUserDefinedFields.php';
122 $exportable = array();
123 if ($this->parent_type == 'crs') {
124 $exportable = $udf->getCourseExportableFields();
125 } elseif ($this->parent_type == 'grp') {
126 $exportable = $udf->getGroupExportableFields();
127 }
128 foreach ((array) $exportable as $field_id => $udf_data) {
129 $fields['udf_' . $field_id] = $udf_data['field_name'];
130 }
131
132
133 $ufields = new ilCheckboxGroupInputGUI($GLOBALS['DIC']['lng']->txt('user_detail'), 'preset');
134 foreach ($fields as $id => $name) {
135 $ufields->addOption(new ilCheckboxOption($name, $id));
136 }
137 $form->addItem($ufields);
138
139
140 include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
142 if ($this->parent_type == 'crs') {
143 if ($privacy->enabledCourseAccessTimes()) {
144 $ufields->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('last_access'), 'access'));
145 }
146 }
147 if ($this->parent_type == 'grp') {
148 if ($privacy->enabledGroupAccessTimes()) {
149 $ufields->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('last_access'), 'access'));
150 }
151 }
152 $ufields->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('crs_status'), 'status'));
153 $ufields->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('crs_passed'), 'passed'));
154
155
156 $blank = new ilTextInputGUI($GLOBALS['DIC']['lng']->txt('event_blank_columns'), 'blank');
157 $blank->setMulti(true);
158 $form->addItem($blank);
159
160 $roles = new ilCheckboxGroupInputGUI($GLOBALS['DIC']['lng']->txt('event_user_selection'), 'selection_of_users');
161
162 $roles->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('event_tbl_admin'), 'role_adm'));
163 if ($this->parent_type == 'crs') {
164 $roles->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('event_tbl_tutor'), 'role_tut'));
165 }
166 $roles->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('event_tbl_member'), 'role_mem'));
167
168 if (!$this->parent_obj_id) {
169 $subscriber = new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('event_user_selection_include_requests'), 'subscr');
170 $roles->addOption($subscriber);
171
172 $waiting_list = new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('event_user_selection_include_waiting_list'), 'wlist');
173 $roles->addOption($waiting_list);
174 }
175 $form->addItem($roles);
176
177 switch ($a_type) {
179 if ($this->dic->rbac()->system()->checkAccess('write', $_GET['ref_id'])) {
180 $form->addCommandButton('savePrintViewSettings', $this->getLang()->txt('save'));
181 }
182 break;
183 }
184
185 include_once "Services/User/classes/class.ilUserFormSettings.php";
186 $identifier = $this->parent_type . 's_pview';
187 if ($this->parent_obj_id) {
188 $identifier_for_object = $identifier . '_' . $this->parent_obj_id;
189 }
190
191 $settings = new ilUserFormSettings($identifier_for_object, -1);
192 if (!$settings->hasStoredEntry()) {
193 // use default settings
194 $settings = new ilUserFormSettings($identifier, -1);
195 }
196 $settings->exportToForm($form);
197
198 return $form;
199 }
200
204 protected function savePrintViewSettings()
205 {
206 $form = $this->initForm(self::TYPE_PRINT_VIEW_SETTINGS);
207 if ($form->checkInput()) {
208 $form->setValuesByPost();
209
212
213 $identifier = $this->parent_type . 's_pview';
214 if ($this->parent_obj_id) {
215 $identifier .= '_' . $this->parent_obj_id;
216 }
217
218 $settings = new ilUserFormSettings($identifier, -1);
219 $settings->importFromForm($form);
220 $settings->store();
221
222 ilUtil::sendSuccess($GLOBALS['DIC']['lng']->txt('settings_saved'),true);
223 $GLOBALS['DIC']['ilCtrl']->redirect($this, 'printViewSettings');
224 }
225 }
226}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a property in a property form.
This class represents an option in a checkbox group.
static _getInstanceByType($a_type)
Get Singleton Instance.
savePrintViewSettings()
Save print view settings.
__construct($a_parent_type, $a_parent_obj_id=0)
Constructor.
printViewSettings(ilPropertyFormGUI $form=null)
Show print view settings.
static _getInstance()
Get instance of ilPrivacySettings.
This class represents a property form user interface.
This class represents a text property in a property form.
static _getInstance()
Get instance.
static deleteAllForPrefix($a_prefix)
Delete all entries for prefix.
if($format !==null) $name
Definition: metadata.php:230
$lng
$a_type
Definition: workflow.php:92
$DIC
Definition: xapitoken.php:46