ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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;
20
21
25 public function __construct($a_parent_type, $a_parent_obj_id = 0)
26 {
27 $this->parent_type = $a_parent_type;
28 $this->parent_obj_id = $a_parent_obj_id;
29
30 $this->ctrl = $GLOBALS['DIC']['ilCtrl'];
31 $this->lng = $GLOBALS['DIC']['lng'];
32 $this->lng->loadLanguageModule('crs');
33 $this->lng->loadLanguageModule('mem');
34 }
35
40 private function getLang()
41 {
42 return $this->lng;
43 }
44
45
49 public function executeCommand()
50 {
51 $next_class = $this->ctrl->getNextClass($this);
52 $cmd = $this->ctrl->getCmd('printViewSettings');
53
54
55 switch ($next_class) {
56 default:
57 $this->$cmd();
58 break;
59 }
60 return true;
61 }
62
63
67 protected function printViewSettings(ilPropertyFormGUI $form = null)
68 {
69 if (!$form instanceof ilPropertyFormGUI) {
70 $form = $this->initForm(self::TYPE_PRINT_VIEW_SETTINGS);
71 }
72
73 $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
74 }
75
79 protected function initForm($a_type)
80 {
81 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
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['DIC']['lng']->txt('name');
88 $fields['login'] = $GLOBALS['DIC']['lng']->txt('login');
89 $fields['email'] = $GLOBALS['DIC']['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 switch ($field) {
101 case 'username':
102 case 'firstname':
103 case 'lastname':
104 case 'email':
105 continue 2;
106 }
107
108 // Check if default enabled
109 $fields[$field] = $GLOBALS['DIC']['lng']->txt($field);
110 }
111
112
113 // udf
114 include_once './Services/User/classes/class.ilUserDefinedFields.php';
116 $exportable = array();
117 if ($this->parent_type == 'crs') {
118 $exportable = $udf->getCourseExportableFields();
119 } elseif ($this->parent_type == 'grp') {
120 $exportable = $udf->getGroupExportableFields();
121 }
122 foreach ((array) $exportable as $field_id => $udf_data) {
123 $fields['udf_' . $field_id] = $udf_data['field_name'];
124 }
125
126
127 $ufields = new ilCheckboxGroupInputGUI($GLOBALS['DIC']['lng']->txt('user_detail'), 'preset');
128 foreach ($fields as $id => $name) {
129 $ufields->addOption(new ilCheckboxOption($name, $id));
130 }
131 $form->addItem($ufields);
132
133
134 include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
136 if ($this->parent_type == 'crs') {
137 if ($privacy->enabledCourseAccessTimes()) {
138 $ufields->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('last_access'), 'access'));
139 }
140 }
141 if ($this->parent_type == 'grp') {
142 if ($privacy->enabledGroupAccessTimes()) {
143 $ufields->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('last_access'), 'access'));
144 }
145 }
146 $ufields->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('crs_status'), 'status'));
147 $ufields->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('crs_passed'), 'passed'));
148
149
150 $blank = new ilTextInputGUI($GLOBALS['DIC']['lng']->txt('event_blank_columns'), 'blank');
151 $blank->setMulti(true);
152 $form->addItem($blank);
153
154 $roles = new ilCheckboxGroupInputGUI($GLOBALS['DIC']['lng']->txt('event_user_selection'), 'selection_of_users');
155
156 $roles->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('event_tbl_admin'), 'role_adm'));
157 if ($this->parent_type == 'crs') {
158 $roles->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('event_tbl_tutor'), 'role_tut'));
159 }
160 $roles->addOption(new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('event_tbl_member'), 'role_mem'));
161
162 if (!$this->parent_obj_id) {
163 $subscriber = new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('event_user_selection_include_requests'), 'subscr');
164 $roles->addOption($subscriber);
165
166 $waiting_list = new ilCheckboxOption($GLOBALS['DIC']['lng']->txt('event_user_selection_include_waiting_list'), 'wlist');
167 $roles->addOption($waiting_list);
168 }
169 $form->addItem($roles);
170
171 switch ($a_type) {
173 $form->addCommandButton('savePrintViewSettings', $this->getLang()->txt('save'));
174 break;
175 }
176
177 include_once "Services/User/classes/class.ilUserFormSettings.php";
178 $identifier = $this->parent_type . 's_pview';
179 if ($this->parent_obj_id) {
180 $identifier_for_object = $identifier . '_' . $this->parent_obj_id;
181 }
182
183 $settings = new ilUserFormSettings($identifier_for_object, -1);
184 if (!$settings->hasStoredEntry()) {
185 // use default settings
186 $settings = new ilUserFormSettings($identifier, -1);
187 }
188 $settings->exportToForm($form);
189
190 return $form;
191 }
192
196 protected function savePrintViewSettings()
197 {
198 $form = $this->initForm(self::TYPE_PRINT_VIEW_SETTINGS);
199 if ($form->checkInput()) {
200 $form->setValuesByPost();
201
202 include_once "Services/User/classes/class.ilUserFormSettings.php";
203
206
207 $identifier = $this->parent_type . 's_pview';
208 if ($this->parent_obj_id) {
209 $identifier .= '_' . $this->parent_obj_id;
210 }
211
212 $settings = new ilUserFormSettings($identifier, -1);
213 $settings->importFromForm($form);
214 $settings->store();
215
216 ilUtil::sendSuccess($GLOBALS['DIC']['lng']->txt('settings_saved'));
217 $GLOBALS['DIC']['ilCtrl']->redirect($this, 'printViewSettings');
218 }
219 }
220}
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(!array_key_exists('StateId', $_REQUEST)) $id
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
if(isset($_POST['submit'])) $form
$lng
$a_type
Definition: workflow.php:92