ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilExportFieldsInfo Class Reference
+ Collaboration diagram for ilExportFieldsInfo:

Public Member Functions

 getType ()
 
 isExportable ($a_field_name)
 Check if field is exportable. More...
 
 getFieldsInfo ()
 Get informations (exportable) about user data profile fields @access public. More...
 
 getExportableFields ()
 Get Exportable Fields. More...
 
 getSelectableFieldsInfo (?int $a_obj_id=null)
 Get selectable fields. More...
 
 exportableFieldsToInfoString ()
 Get exportable fields as info string. More...
 
 sortExportFields ()
 sort Exports fields User for Name Presentation Guideline More...
 

Static Public Member Functions

static _getInstanceByType (string $a_type)
 Get Singleton Instance. More...
 

Private Member Functions

 __construct (string $a_type)
 Private Singleton Constructor. More...
 
 read ()
 Read info about exportable fields. More...
 

Private Attributes

ilSetting $settings
 
ilLanguage $lng
 
Profile $profile
 
string $obj_type = ''
 
array $possible_fields = array()
 

Static Private Attributes

static array $instances = []
 

Detailed Description

Definition at line 30 of file class.ilExportFieldsInfo.php.

Constructor & Destructor Documentation

◆ __construct()

ilExportFieldsInfo::__construct ( string  $a_type)
private

Private Singleton Constructor.

Use getInstance @access private

Definition at line 44 of file class.ilExportFieldsInfo.php.

45 {
46 global $DIC;
47
48 $this->lng = $DIC->language();
49 $this->settings = $DIC->settings();
50 $this->profile = $DIC['user']->getProfile();
51 $this->obj_type = $a_type;
52
53 $this->read();
54 }
read()
Read info about exportable fields.
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\lng(), ILIAS\Repository\profile(), read(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstanceByType()

◆ exportableFieldsToInfoString()

ilExportFieldsInfo::exportableFieldsToInfoString ( )

Get exportable fields as info string.

Returns
string info page string

Definition at line 169 of file class.ilExportFieldsInfo.php.

169 : string
170 {
171 $fields = [];
172 foreach ($this->getExportableFields() as $field) {
173 $fields[] = $this->lng->txt($field);
174 }
175 return implode('<br />', $fields);
176 }
getExportableFields()
Get Exportable Fields.

References getExportableFields(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getExportableFields()

ilExportFieldsInfo::getExportableFields ( )

Get Exportable Fields.

Definition at line 92 of file class.ilExportFieldsInfo.php.

92 : array
93 {
94 $fields = [];
95 foreach ($this->possible_fields as $field => $exportable) {
96 if ($exportable) {
97 $fields[] = $field;
98 }
99 }
100 return $fields;
101 }

Referenced by exportableFieldsToInfoString(), and getSelectableFieldsInfo().

+ Here is the caller graph for this function:

◆ getFieldsInfo()

ilExportFieldsInfo::getFieldsInfo ( )

Get informations (exportable) about user data profile fields @access public.

Definition at line 84 of file class.ilExportFieldsInfo.php.

84 : array
85 {
87 }

References $possible_fields.

◆ getSelectableFieldsInfo()

ilExportFieldsInfo::getSelectableFieldsInfo ( ?int  $a_obj_id = null)

Get selectable fields.

Definition at line 106 of file class.ilExportFieldsInfo.php.

106 : array
107 {
108 global $DIC;
109
110 $user = $DIC->user();
111 $profile = $DIC['user']->getProfile();
112
113 $fields = [];
114 foreach ($this->getExportableFields() as $field) {
115 switch ($field) {
116 case 'lastname':
117 case 'firstname':
118 break;
119
120 case 'username':
121 $fields['login']['txt'] = $this->lng->txt('login');
122 $fields['login']['default'] = 1;
123 break;
124
125 default:
126 // #18795
127 $caption = ($field == "title")
128 ? "person_title"
129 : $field;
130 $fields[$field]['txt'] = $this->lng->txt($caption);
131 $fields[$field]['default'] = 0;
132 break;
133 }
134 }
135
136 if ($a_obj_id && ilBookingEntry::hasObjectBookingEntries($a_obj_id, $user->getId())) {
137 $this->lng->loadLanguageModule('dateplaner');
138 $fields['consultation_hour']['txt'] = $this->lng->txt('cal_ch_field_ch');
139 $fields['consultation_hour']['default'] = 0;
140 }
141
142 $udf = $profile->getVisibleUserDefinedFields(Context::buildFromObjectType($this->getType()));
143 if ($udf !== []) {
144 foreach ($udf as $field_id => $field) {
145 $fields['udf_' . $field_id]['txt'] = $field->getLabel($this->lng);
146 $fields['udf_' . $field_id]['default'] = 0;
147 }
148 }
149
150 if ($a_obj_id) {
152 foreach ($cdf as $def) {
153 $fields['odf_' . $def->getId()]['txt'] = $def->getName();
154 $fields['odf_' . $def->getId()]['default'] = 0;
155 }
156 if (count($cdf)) {
157 // add last edit
158 $fields['odf_last_update']['txt'] = $this->lng->txt($this->getType() . '_cdf_tbl_last_edit');
159 $fields['odf_last_update']['default'] = 0;
160 }
161 }
162 return $fields;
163 }
static hasObjectBookingEntries(int $a_obj_id, int $a_usr_id)
Check if object has assigned consultation hour appointments.
static _getFields(int $a_container_id, $a_sort=self::IL_CDF_SORT_NAME)
Get all fields of a container.
getVisibleUserDefinedFields(Context $context)

References $DIC, $profile, ilCourseDefinedFieldDefinition\_getFields(), getExportableFields(), getType(), ILIAS\User\Profile\Profile\getVisibleUserDefinedFields(), ilBookingEntry\hasObjectBookingEntries(), and ILIAS\Repository\lng().

Referenced by ilPRGAssignmentDBRepository\__construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilExportFieldsInfo::getType ( )

Definition at line 67 of file class.ilExportFieldsInfo.php.

67 : string
68 {
69 return $this->obj_type;
70 }

References $obj_type.

Referenced by getSelectableFieldsInfo(), and read().

+ Here is the caller graph for this function:

◆ isExportable()

ilExportFieldsInfo::isExportable (   $a_field_name)

Check if field is exportable.

Definition at line 75 of file class.ilExportFieldsInfo.php.

75 : bool
76 {
77 return array_key_exists($a_field_name, $this->possible_fields);
78 }

◆ read()

ilExportFieldsInfo::read ( )
private

Read info about exportable fields.

Definition at line 181 of file class.ilExportFieldsInfo.php.

181 : void
182 {
183 $type = $this->getType();
184 $this->possible_fields = array_reduce(
185 $this->profile->getFields(),
186 function (array $c, ProfileField $v) use ($type): array {
187 if ($v->isCustom()) {
188 return $c;
189 }
190 if ($type === 'crs') {
191 $c[$v->getIdentifier()] = $v->isVisibleInCourses();
192 }
193
194 if ($type === 'grp') {
195 $c[$v->getIdentifier()] = $v->isVisibleInGroups();
196 }
197
198 if ($type === 'prg') {
199 $c[$v->getIdentifier()] = $v->isVisibleInStudyProgrammes();
200 }
201
202 return $c;
203 },
205 );
206 }
$c
Definition: deliver.php:25
if(!file_exists('../ilias.ini.php'))

References $c, $possible_fields, getType(), if, and ILIAS\Repository\profile().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sortExportFields()

ilExportFieldsInfo::sortExportFields ( )

sort Exports fields User for Name Presentation Guideline

Definition at line 211 of file class.ilExportFieldsInfo.php.

211 : void
212 {
213 $start_order = ['lastname' => [], 'firstname' => [], 'username' => []];
214
215 foreach (array_keys($start_order) as $key) {
216 if (isset($this->possible_fields[$key])) {
217 $start_order[$key] = $this->possible_fields[$key];
218 unset($this->possible_fields[$key]);
219 } else {
220 unset($start_order[$key]);
221 }
222 }
223
224 if (count($start_order) > 0) {
225 $this->possible_fields = array_merge($start_order, $this->possible_fields);
226 }
227 }

Field Documentation

◆ $instances

array ilExportFieldsInfo::$instances = []
staticprivate

Definition at line 32 of file class.ilExportFieldsInfo.php.

◆ $lng

ilLanguage ilExportFieldsInfo::$lng
private

Definition at line 35 of file class.ilExportFieldsInfo.php.

◆ $obj_type

string ilExportFieldsInfo::$obj_type = ''
private

Definition at line 37 of file class.ilExportFieldsInfo.php.

Referenced by getType().

◆ $possible_fields

array ilExportFieldsInfo::$possible_fields = array()
private

Definition at line 38 of file class.ilExportFieldsInfo.php.

Referenced by getFieldsInfo(), and read().

◆ $profile

Profile ilExportFieldsInfo::$profile
private

Definition at line 36 of file class.ilExportFieldsInfo.php.

Referenced by getSelectableFieldsInfo().

◆ $settings

ilSetting ilExportFieldsInfo::$settings
private

Definition at line 34 of file class.ilExportFieldsInfo.php.


The documentation for this class was generated from the following file: