ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilUserProfile.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 // mjansen@databay.de essential for mail constants, do not remove this include
5 include_once 'Services/Mail/classes/class.ilMailOptions.php';
6 
16 {
17  const MODE_DESKTOP = 1;
18  const MODE_REGISTRATION = 2;
19 
20  private static $mode = self::MODE_DESKTOP;
21 
22  // this array should be used in all places where user data is tackled
23  // in the future: registration, personal profile, user administration
24  // public profile, user import/export
25  // for now this is not implemented yet. Please list places, that already use it:
26  //
27  // - personal profile
28  // - (global) standard user profile fields settings
29  //
30  // the following attributes are defined (can be extended if needed):
31  // - input: input type
32  // standard inputs: text, radio, selection, textarea
33  // special inputs: login
34  // - input dependend attributes
35  // - maxlength, sizte for text
36  // - values array for radio
37  // - cols/rows for text areas
38  // - options array for selections
39  // - method: ilObjUser get-method, e.g. getFirstname
40  // - group: group id (id is also used as lang_var for sub headers in forms
41  // - lang_var: if key should not be used as lang var, this overwrites the usage in forms
42  // - settings property related attributes, settingsproperties are ("visible", "changeable",
43  // "searchable", "required", "export", "course_export" and "registration")
44  // - <settingsproperty>_hide: hide this property in settings (not implemented)
45  // - <settingsproperty>_fix_value: property has a fix value (cannot be changed)
46  private static $user_field = array(
47  "username" => array(
48  "input" => "login",
49  "maxlength" => 32,
50  "size" => 40,
51  "method" => "getLogin",
52  "course_export_fix_value" => 1,
53  "group_export_fix_value" => 1,
54  "changeable_hide" => true,
55  "required_hide" => true,
56  "group" => "personal_data"),
57  "password" => array(
58  "input" => "password",
59  "required_hide" => true,
60  "visib_reg_hide" => true,
61  'visib_lua_fix_value' => 0,
62  "course_export_hide" => true,
63  "group_export_hide" => true,
64  "lists_hide" => true,
65  "group" => "personal_data"),
66  "firstname" => array(
67  "input" => "text",
68  "maxlength" => 32,
69  "size" => 40,
70  "method" => "getFirstname",
71  "required_fix_value" => 1,
72  "visib_reg_fix_value" => 1,
73  'visib_lua_fix_value' => 1,
74  "course_export_fix_value" => 1,
75  "group_export_fix_value" => 1,
76  "group" => "personal_data"),
77  "lastname" => array(
78  "input" => "text",
79  "maxlength" => 32,
80  "size" => 40,
81  "method" => "getLastname",
82  "required_fix_value" => 1,
83  "visib_reg_fix_value" => 1,
84  'visib_lua_fix_value' => 1,
85  "course_export_fix_value" => 1,
86  "group_export_fix_value" => 1,
87  "group" => "personal_data"),
88  "title" => array(
89  "input" => "text",
90  "lang_var" => "person_title",
91  "maxlength" => 32,
92  "size" => 40,
93  "method" => "getUTitle",
94  "group" => "personal_data"),
95  "birthday" => array(
96  "input" => "birthday",
97  "lang_var" => "birthday",
98  "maxlength" => 32,
99  "size" => 40,
100  "method" => "getBirthday",
101  "group" => "personal_data"),
102  "gender" => array(
103  "input" => "radio",
104  "values" => array("f" => "gender_f", "m" => "gender_m"),
105  "method" => "getGender",
106  "group" => "personal_data"),
107  "upload" => array(
108  "input" => "picture",
109  "required_hide" => true,
110  "visib_reg_hide" => true,
111  "course_export_hide" => true,
112  "group_export_hide" => true,
113  "lists_hide" => true,
114  "lang_var" => "personal_picture",
115  "group" => "personal_data"),
116  "roles" => array(
117  "input" => "roles",
118  "changeable_hide" => true,
119  "required_hide" => true,
120  "visib_reg_hide" => true,
121  "export_hide" => true,
122  "course_export_hide" => true,
123  "lists_hide" => true,
124  "group" => "personal_data"),
125  "institution" => array(
126  "input" => "text",
127  "maxlength" => 80,
128  "size" => 40,
129  "method" => "getInstitution",
130  "group" => "contact_data"),
131  "department" => array(
132  "input" => "text",
133  "maxlength" => 80,
134  "size" => 40,
135  "method" => "getDepartment",
136  "group" => "contact_data"),
137  "street" => array(
138  "input" => "text",
139  "maxlength" => 40,
140  "size" => 40,
141  "method" => "getStreet",
142  "group" => "contact_data"),
143  "zipcode" => array(
144  "input" => "text",
145  "maxlength" => 10,
146  "size" => 10,
147  "method" => "getZipcode",
148  "group" => "contact_data"),
149  "city" => array(
150  "input" => "text",
151  "maxlength" => 40,
152  "size" => 40,
153  "method" => "getCity",
154  "group" => "contact_data"),
155  "country" => array(
156  "input" => "text",
157  "maxlength" => 40,
158  "size" => 40,
159  "method" => "getCountry",
160  "group" => "contact_data"),
161  "sel_country" => array(
162  "input" => "sel_country",
163  "method" => "getSelectedCountry",
164  "group" => "contact_data"),
165  "phone_office" => array(
166  "input" => "text",
167  "maxlength" => 40,
168  "size" => 40,
169  "method" => "getPhoneOffice",
170  "group" => "contact_data"),
171  "phone_home" => array(
172  "input" => "text",
173  "maxlength" => 40,
174  "size" => 40,
175  "method" => "getPhoneHome",
176  "group" => "contact_data"),
177  "phone_mobile" => array(
178  "input" => "text",
179  "maxlength" => 40,
180  "size" => 40,
181  "method" => "getPhoneMobile",
182  "group" => "contact_data"),
183  "fax" => array(
184  "input" => "text",
185  "maxlength" => 40,
186  "size" => 40,
187  "method" => "getFax",
188  "group" => "contact_data"),
189  "email" => array(
190  "input" => "email",
191  "maxlength" => 40,
192  "size" => 40,
193  "method" => "getEmail",
194  "group" => "contact_data"),
195  "hobby" => array(
196  "input" => "textarea",
197  "rows" => 3,
198  "cols" => 45,
199  "method" => "getHobby",
200  "lists_hide" => true,
201  "group" => "contact_data"),
202  "referral_comment" => array(
203  "input" => "textarea",
204  "rows" => 3,
205  "cols" => 45,
206  "method" => "getComment",
207  "course_export_hide" => true,
208  "group_export_hide" => true,
209  "lists_hide" => true,
210  "group" => "contact_data"),
211  "instant_messengers" => array(
212  "input" => "messenger",
213  "types" => array("icq","yahoo","msn","aim","skype","jabber","voip"),
214  "maxlength" => 40,
215  "size" => 40,
216  "course_export_hide" => true,
217  "group_export_hide" => true,
218  "lists_hide" => true,
219  "group" => "instant_messengers"),
220  "matriculation" => array(
221  "input" => "text",
222  "maxlength" => 40,
223  "size" => 40,
224  "method" => "getMatriculation",
225  "group" => "other"),
226  "delicious" => array(
227  "input" => "text",
228  "maxlength" => 40,
229  "size" => 40,
230  "method" => "getDelicious",
231  "group" => "other"),
232  "language" => array(
233  "input" => "language",
234  "method" => "getLanguage",
235  "required_hide" => true,
236  "visib_reg_hide" => true,
237  "course_export_hide" => true,
238  "group_export_hide" => true,
239  "group" => "settings"),
240  "skin_style" => array(
241  "input" => "skinstyle",
242  "required_hide" => true,
243  "visib_reg_hide" => true,
244  "course_export_hide" => true,
245  "group_export_hide" => true,
246  "group" => "settings"),
247  "hits_per_page" => array(
248  "input" => "hitsperpage",
249  "default" => 10,
250  "options" => array(
251  10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40,
252  50 => 50, 100 => 100, 9999 => 9999),
253  "required_hide" => true,
254  "visib_reg_hide" => true,
255  "course_export_hide" => true,
256  "group_export_hide" => true,
257  "group" => "settings"),
258  "show_users_online" => array(
259  "input" => "selection",
260  "default" => "y",
261  "options" => array(
262  "y" => "users_online_show_short_y",
263  "associated" => "users_online_show_short_associated",
264  "n" => "users_online_show_short_n"),
265  "required_hide" => true,
266  "visib_reg_hide" => true,
267  "course_export_hide" => true,
268  "group_export_hide" => true,
269  "group" => "settings"),
270  "hide_own_online_status" => array(
271  "input" => "selection",
272  "required_hide" => true,
273  "visib_reg_hide" => true,
274  "course_export_hide" => true,
275  "group_export_hide" => true,
276  "group" => "settings"),
277  "preferences" => array(
278  "visible_fix_value" => 1,
279  "changeable_fix_value" => 1,
280  "required_hide" => true,
281  "visib_reg_hide" => true,
282  "course_export_hide" => true,
283  "group_export_hide" => true,
284  "group" => "preferences"),
285  "mail_incoming_mail" => array(
286  "input" => "selection",
287  "default" => "y",
288  "options" => array(
289  IL_MAIL_LOCAL => "mail_incoming_local",
290  IL_MAIL_EMAIL => "mail_incoming_smtp",
291  IL_MAIL_BOTH => "mail_incoming_both"),
292  "required_hide" => true,
293  "visib_reg_hide" => true,
294  "course_export_hide" => true,
295  "group_export_hide" => true,
296  "export_hide" => true,
297  "search_hide" => true,
298  "group" => "settings")
299 
300  );
301 
305  function __construct()
306  {
307  $this->skip_groups = array();
308  $this->skip_fields = array();
309  }
310 
314  function getStandardFields()
315  {
316  $fields = array();
317  foreach (self::$user_field as $f => $p)
318  {
319  // skip hidden groups
320  if (in_array($p["group"], $this->skip_groups) ||
321  in_array($f, $this->skip_fields))
322  {
323  continue;
324  }
325  $fields[$f] = $p;
326  }
327  return $fields;
328  }
329 
335  {
336  global $ilSetting;
337 
338  $settings = $ilSetting->getAll();
339 
340  $fields = array();
341  foreach($this->getStandardFields() as $field => $info)
342  {
343  if($ilSetting->get('usr_settings_visib_lua_'.$field,1))
344  {
345  $fields[$field] = $info;
346  }
347  elseif($info['visib_lua_fix_value'])
348  {
349  $fields[$field] = $info;
350  }
351  }
352  return $fields;
353  }
354 
355 
359  function skipGroup($a_group)
360  {
361  $this->skip_groups[] = $a_group;
362  }
363 
367  function skipField($a_field)
368  {
369  $this->skip_fields[] = $a_field;
370  }
371 
375  function addStandardFieldsToForm($a_form, $a_user = NULL, array $custom_fields = NULL)
376  {
377  global $ilSetting, $lng, $rbacreview, $ilias;
378 
379  // custom registration settings
380  if(self::$mode == self::MODE_REGISTRATION)
381  {
382  include_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
383  $registration_settings = new ilRegistrationSettings();
384 
385  self::$user_field["username"]["group"] = "login_data";
386  self::$user_field["password"]["group"] = "login_data";
387  self::$user_field["language"]["default"] = $lng->lang_key;
388 
389  // different position for role
390  $roles = self::$user_field["roles"];
391  unset(self::$user_field["roles"]);
392  self::$user_field["roles"] = $roles;
393  self::$user_field["roles"]["group"] = "settings";
394  }
395 
396  $fields = $this->getStandardFields();
397  $current_group = "";
398  $custom_fields_done = false;
399  foreach ($fields as $f => $p)
400  {
401  // next group? -> diplay subheader
402  if (($p["group"] != $current_group) &&
404  {
405  if (is_array($custom_fields) && !$custom_fields_done)
406  {
407  // should be appended to "other" or at least before "settings"
408  if($current_group == "other" || $p["group"] == "settings")
409  {
410  // add "other" subheader
411  if($current_group != "other")
412  {
413  $sh = new ilFormSectionHeaderGUI();
414  $sh->setTitle($lng->txt("other"));
415  $a_form->addItem($sh);
416  }
417  foreach($custom_fields as $custom_field)
418  {
419  $a_form->addItem($custom_field);
420  }
421  $custom_fields_done = true;
422  }
423  }
424 
425  $sh = new ilFormSectionHeaderGUI();
426  $sh->setTitle($lng->txt($p["group"]));
427  $a_form->addItem($sh);
428  $current_group = $p["group"];
429  }
430 
431  $m = "";
432  if (isset($p["method"]))
433  {
434  $m = $p["method"];
435  }
436 
437  $lv = (isset($p["lang_var"]) && $p["lang_var"] != "")
438  ? $p["lang_var"]
439  : $f;
440 
441  switch ($p["input"])
442  {
443  case "login":
444  if ((int)$ilSetting->get('allow_change_loginname') || self::$mode == self::MODE_REGISTRATION)
445  {
446  $val = new ilTextInputGUI($lng->txt('username'),'username');
447  if($a_user)
448  {
449  $val->setValue($a_user->getLogin());
450  }
451  $val->setMaxLength(32);
452  $val->setSize(40);
453  $val->setRequired(true);
454  }
455  else
456  {
457  // user account name
458  $val = new ilNonEditableValueGUI($lng->txt("username"), 'ne_un');
459  if($a_user)
460  {
461  $val->setValue($a_user->getLogin());
462  }
463  }
464  $a_form->addItem($val);
465  break;
466 
467  case "text":
469  {
470  $ti = new ilTextInputGUI($lng->txt($lv), "usr_".$f);
471  if($a_user)
472  {
473  $ti->setValue($a_user->$m());
474  }
475  $ti->setMaxLength($p["maxlength"]);
476  $ti->setSize($p["size"]);
477  $ti->setRequired($ilSetting->get("require_".$f));
478  if(!$ti->getRequired() || $ti->getValue())
479  {
480  $ti->setDisabled($ilSetting->get("usr_settings_disable_".$f));
481  }
482  $a_form->addItem($ti);
483  }
484  break;
485 
486  case "sel_country":
488  {
489  include_once("./Services/Form/classes/class.ilCountrySelectInputGUI.php");
490  $ci = new ilCountrySelectInputGUI($lng->txt($lv), "usr_".$f);
491  if($a_user)
492  {
493  $ci->setValue($a_user->$m());
494  }
495  $ci->setRequired($ilSetting->get("require_".$f));
496  if(!$ci->getRequired() || $ci->getValue())
497  {
498  $ci->setDisabled($ilSetting->get("usr_settings_disable_".$f));
499  }
500  $a_form->addItem($ci);
501  }
502  break;
503 
504  case "birthday":
506  {
507  $bi = new ilBirthdayInputGUI($lng->txt($lv), "usr_".$f);
508  include_once "./Services/Calendar/classes/class.ilDateTime.php";
509  $date = null;
510  if ($a_user && strlen($a_user->$m()))
511  {
512  $date = new ilDateTime($a_user->$m(), IL_CAL_DATE);
513  $bi->setDate($date);
514  }
515  $bi->setShowEmpty(true);
516  $bi->setStartYear(1900);
517  $bi->setRequired($ilSetting->get("require_".$f));
518  if(!$bi->getRequired() || $date)
519  {
520  $bi->setDisabled($ilSetting->get("usr_settings_disable_".$f));
521  }
522  $a_form->addItem($bi);
523  }
524  break;
525 
526  case "radio":
528  {
529  $rg = new ilRadioGroupInputGUI($lng->txt($lv), "usr_".$f);
530  if($a_user)
531  {
532  $rg->setValue($a_user->$m());
533  }
534  foreach ($p["values"] as $k => $v)
535  {
536  $op = new ilRadioOption($lng->txt($v), $k);
537  $rg->addOption($op);
538  }
539  $rg->setRequired($ilSetting->get("require_".$f));
540  if(!$rg->getRequired() || $rg->getValue())
541  {
542  $rg->setDisabled($ilSetting->get("usr_settings_disable_".$f));
543  }
544  $a_form->addItem($rg);
545  }
546  break;
547 
548  case "picture":
549  if (ilUserProfile::userSettingVisible("upload") && $a_user)
550  {
551  $ii = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile");
552  $ii->setDisabled($ilSetting->get("usr_settings_disable_upload"));
553 
554  $upload = $a_form->getFileUpload("userfile");
555  if($upload["name"])
556  {
557  $ii->setPending($upload["name"]);
558  }
559  else
560  {
561  $im = ilObjUser::_getPersonalPicturePath($a_user->getId(), "small", true,
562  true);
563  if ($im != "")
564  {
565  $ii->setImage($im);
566  $ii->setAlt($lng->txt("personal_picture"));
567  }
568  }
569 
570  // ilinc link as info
571  if (ilUserProfile::userSettingVisible("upload") and
572  $ilSetting->get("ilinc_active"))
573  {
574  include_once ('./Modules/ILinc/classes/class.ilObjiLincUser.php');
575  $ilinc_user = new ilObjiLincUser($a_user);
576 
577  if ($ilinc_user->id)
578  {
579  include_once ('./Modules/ILinc/classes/class.ilnetucateXMLAPI.php');
580  $ilincAPI = new ilnetucateXMLAPI();
581  $ilincAPI->uploadPicture($ilinc_user);
582  $response = $ilincAPI->sendRequest("uploadPicture");
583 
584  // return URL to user's personal page
585  $url = trim($response->data['url']['cdata']);
586  $desc =
587  $lng->txt("ilinc_upload_pic_text")." ".
588  '<a href="'.$url.'">'.$lng->txt("ilinc_upload_pic_linktext").'</a>';
589  $ii->setInfo($desc);
590  }
591  }
592 
593  $a_form->addItem($ii);
594  }
595  break;
596 
597  case "roles":
598  if(self::$mode == self::MODE_DESKTOP)
599  {
601  {
602  $global_roles = $rbacreview->getGlobalRoles();
603  foreach($global_roles as $role_id)
604  {
605  if (in_array($role_id,$rbacreview->assignedRoles($a_user->getId())))
606  {
607  $roleObj = $ilias->obj_factory->getInstanceByObjId($role_id);
608  $role_names .= $roleObj->getTitle().", ";
609  unset($roleObj);
610  }
611  }
612  $dr = new ilNonEditableValueGUI($lng->txt("default_roles"), "ne_dr");
613  $dr->setValue(substr($role_names,0,-2));
614  $a_form->addItem($dr);
615  }
616  }
617  else if(self::$mode == self::MODE_REGISTRATION)
618  {
619  if($registration_settings->roleSelectionEnabled())
620  {
621  include_once("./Services/AccessControl/classes/class.ilObjRole.php");
622  $options = array();
623  foreach (ilObjRole::_lookupRegisterAllowed() as $role)
624  {
625  $options[$role["id"]] = $role["title"];
626  }
627  // registration form validation will take care of missing field / value
628  if($options)
629  {
630  $ta = new ilSelectInputGUI($lng->txt('default_role'), "usr_".$f);
631  $ta->setOptions($options);
632  $ta->setRequired($ilSetting->get("require_".$f));
633  if(!$ta->getRequired())
634  {
635  $ta->setDisabled($ilSetting->get("usr_settings_disable_".$f));
636  }
637  $a_form->addItem($ta);
638  }
639  }
640  }
641  break;
642 
643  case "email":
645  {
646  $em = new ilEMailInputGUI($lng->txt($lv), "usr_".$f);
647  if($a_user)
648  {
649  $em->setValue($a_user->$m());
650  }
651  $em->setRequired($ilSetting->get("require_".$f));
652  if(!$em->getRequired() || $em->getValue())
653  {
654  $em->setDisabled($ilSetting->get("usr_settings_disable_".$f));
655  }
656  $a_form->addItem($em);
657  }
658  break;
659 
660  case "textarea":
662  {
663  $ta = new ilTextAreaInputGUI($lng->txt($lv), "usr_".$f);
664  if($a_user)
665  {
666  $ta->setValue($a_user->$m());
667  }
668  $ta->setRows($p["rows"]);
669  $ta->setCols($p["cols"]);
670  $ta->setRequired($ilSetting->get("require_".$f));
671  if(!$ta->getRequired() || $ta->getValue())
672  {
673  $ta->setDisabled($ilSetting->get("usr_settings_disable_".$f));
674  }
675  $a_form->addItem($ta);
676  }
677  break;
678 
679  case "messenger":
680  if (ilUserProfile::userSettingVisible("instant_messengers"))
681  {
682  $im_arr = $p["types"];
683  foreach ($im_arr as $im_name)
684  {
685  $im = new ilTextInputGUI($lng->txt("im_".$im_name), "usr_im_".$im_name);
686  if($a_user)
687  {
688  $im->setValue($a_user->getInstantMessengerId($im_name));
689  }
690  $im->setMaxLength($p["maxlength"]);
691  $im->setSize($p["size"]);
692  $im->setRequired($ilSetting->get("require_"."instant_messengers"));
693  if(!$im->getRequired() || $im->getValue())
694  {
695  $im->setDisabled($ilSetting->get("usr_settings_disable_"."instant_messengers"));
696  }
697  $a_form->addItem($im);
698  }
699  }
700  break;
701 
702  case "password":
703  if (self::$mode == self::MODE_REGISTRATION)
704  {
705  if(!$registration_settings->passwordGenerationEnabled())
706  {
707  $ta = new ilPasswordInputGUI($lng->txt($lv), "usr_".$f);
708  $ta->setRequired(true);
709  // $ta->setDisabled($ilSetting->get("usr_settings_disable_".$f));
710  }
711  else
712  {
713  $ta = new ilNonEditableValueGUI($lng->txt($lv));
714  $ta->setValue($lng->txt("reg_passwd_via_mail"));
715  }
716  $a_form->addItem($ta);
717  }
718  break;
719 
720  case "language":
722  {
723  $ta = new ilSelectInputGUI($lng->txt($lv), "usr_".$f);
724  if($a_user)
725  {
726  $ta->setValue($a_user->$m());
727  }
728  // #8787
729  $lng->loadLanguageModule("meta");
730  $options = array();
731  foreach ($lng->getInstalledLanguages() as $lang_key)
732  {
733  $options[$lang_key] = $lng->txt("meta_l_".$lang_key);
734  }
735  $ta->setOptions($options);
736  asort($options); // #9728
737  $ta->setRequired($ilSetting->get("require_".$f));
738  if(!$ta->getRequired() || $ta->getValue())
739  {
740  $ta->setDisabled($ilSetting->get("usr_settings_disable_".$f));
741  }
742  $a_form->addItem($ta);
743  }
744  break;
745  }
746  }
747 
748  // append custom fields as "other"
749  if(is_array($custom_fields) && !$custom_fields_done)
750  {
751  // add "other" subheader
752  if($current_group != "other")
753  {
754  $sh = new ilFormSectionHeaderGUI();
755  $sh->setTitle($lng->txt("other"));
756  $a_form->addItem($sh);
757  }
758  foreach($custom_fields as $custom_field)
759  {
760  $a_form->addItem($custom_field);
761  }
762  }
763  }
764 
765 
769  static function userSettingVisible($a_setting)
770  {
771  global $ilSetting;
772 
773  if(self::$mode == self::MODE_DESKTOP)
774  {
775  return ($ilSetting->get("usr_settings_hide_".$a_setting) != 1);
776  }
777  else
778  {
779  if(isset(self::$user_field[$a_setting]["visib_reg_hide"]) && self::$user_field[$a_setting]["visib_reg_hide"] === true)
780  {
781  return true;
782  }
783  return ($ilSetting->get("usr_settings_visib_reg_".$a_setting, "1") || $ilSetting->get("require_".$a_setting, "0"));
784  }
785  }
786 
787  static function setMode($mode)
788  {
789  global $lng;
790 
791  if(in_array($mode, array(self::MODE_DESKTOP, self::MODE_REGISTRATION)))
792  {
793  self::$mode = $mode;
794  return true;
795  }
796  return false;
797  }
798 
807  static function isProfileIncomplete($a_user, $a_include_udf = true, $a_personal_data_only = true)
808  {
809  global $ilSetting;
810 
811  // standard fields
812  foreach(self::$user_field as $field => $definition)
813  {
814  // only if visible in personal data
815  if($a_personal_data_only && $ilSetting->get("usr_settings_hide_".$field))
816  {
817  continue;
818  }
819 
820  if($ilSetting->get("require_".$field) && $definition["method"])
821  {
822  $value = $a_user->{$definition["method"]}();
823  if($value == "")
824  {
825  return true;
826  }
827  }
828  }
829 
830  // custom fields
831  if($a_include_udf)
832  {
833  $user_defined_data = $a_user->getUserDefinedData();
834 
835  include_once './Services/User/classes/class.ilUserDefinedFields.php';
836  $user_defined_fields = ilUserDefinedFields::_getInstance();
837  foreach($user_defined_fields->getRequiredDefinitions() as $field => $definition)
838  {
839  // only if visible in personal data
840  if($a_personal_data_only && !$definition["visible"])
841  {
842  continue;
843  }
844 
845  if(!$user_defined_data["f_".$field])
846  {
847  return true;
848  }
849  }
850  }
851 
852  return false;
853  }
854 }
855 ?>