/**
  * Deliver vcard information.
  */
 function deliverVCard()
 {
     // get user object
     if (!ilObject::_exists($this->getUserId())) {
         return "";
     }
     $user = new ilObjUser($this->getUserId());
     require_once "./Services/User/classes/class.ilvCard.php";
     $vcard = new ilvCard();
     // ilsharedresourceGUI: embedded in shared portfolio
     if ($user->getPref("public_profile") != "y" && $user->getPref("public_profile") != "g" && $_GET["baseClass"] != "ilsharedresourceGUI") {
         return;
     }
     $vcard->setName($user->getLastName(), $user->getFirstName(), "", $user->getUTitle());
     $vcard->setNickname($user->getLogin());
     $webspace_dir = ilUtil::getWebspaceDir("output");
     $imagefile = $webspace_dir . "/usr_images/" . $user->getPref("profile_image");
     if ($user->getPref("public_upload") == "y" && @is_file($imagefile)) {
         $fh = fopen($imagefile, "r");
         if ($fh) {
             $image = fread($fh, filesize($imagefile));
             fclose($fh);
             require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
             $mimetype = ilObjMediaObject::getMimeType($imagefile);
             if (preg_match("/^image/", $mimetype)) {
                 $type = $mimetype;
             }
             $vcard->setPhoto($image, $type);
         }
     }
     $val_arr = array("getInstitution" => "institution", "getDepartment" => "department", "getStreet" => "street", "getZipcode" => "zipcode", "getCity" => "city", "getCountry" => "country", "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home", "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email", "getHobby" => "hobby", "getMatriculation" => "matriculation", "getClientIP" => "client_ip", "dummy" => "location");
     $org = array();
     $adr = array();
     foreach ($val_arr as $key => $value) {
         // if value "y" show information
         if ($user->getPref("public_" . $value) == "y") {
             switch ($value) {
                 case "institution":
                     $org[0] = $user->{$key}();
                     break;
                 case "department":
                     $org[1] = $user->{$key}();
                     break;
                 case "street":
                     $adr[2] = $user->{$key}();
                     break;
                 case "zipcode":
                     $adr[5] = $user->{$key}();
                     break;
                 case "city":
                     $adr[3] = $user->{$key}();
                     break;
                 case "country":
                     $adr[6] = $user->{$key}();
                     break;
                 case "phone_office":
                     $vcard->setPhone($user->{$key}(), TEL_TYPE_WORK);
                     break;
                 case "phone_home":
                     $vcard->setPhone($user->{$key}(), TEL_TYPE_HOME);
                     break;
                 case "phone_mobile":
                     $vcard->setPhone($user->{$key}(), TEL_TYPE_CELL);
                     break;
                 case "fax":
                     $vcard->setPhone($user->{$key}(), TEL_TYPE_FAX);
                     break;
                 case "email":
                     $vcard->setEmail($user->{$key}());
                     break;
                 case "hobby":
                     $vcard->setNote($user->{$key}());
                     break;
                 case "location":
                     $vcard->setPosition($user->getLatitude(), $user->getLongitude());
                     break;
             }
         }
     }
     if (count($org)) {
         $vcard->setOrganization(join(";", $org));
     }
     if (count($adr)) {
         $vcard->setAddress($adr[0], $adr[1], $adr[2], $adr[3], $adr[4], $adr[5], $adr[6]);
     }
     ilUtil::deliverData($vcard->buildVCard(), $vcard->getFilename(), $vcard->getMimetype());
 }
 /**
  * Get User List HTML (to be displayed besides the map)
  */
 function getUserListHtml()
 {
     $list_tpl = new ilTemplate("tpl.openlayers_map_user_list.html", true, true, "Services/Maps");
     $cnt = 0;
     foreach ($this->user_marker as $user_id) {
         if (ilObject::_exists($user_id)) {
             $user = new ilObjUser($user_id);
             $this->css_row = $this->css_row != "tblrow1_mo" ? "tblrow1_mo" : "tblrow2_mo";
             if ($user->getLatitude() != 0 && $user->getLongitude() != 0 && $user->getPref("public_location") == "y") {
                 $list_tpl->setCurrentBlock("item");
                 $list_tpl->setVariable("MARKER_CNT", $cnt);
                 $list_tpl->setVariable("MAP_ID", $this->getMapId());
                 $cnt++;
             } else {
                 $list_tpl->setCurrentBlock("item_no_link");
             }
             $list_tpl->setVariable("CSS_ROW", $this->css_row);
             $list_tpl->setVariable("TXT_USER", $user->getLogin());
             $list_tpl->setVariable("IMG_USER", $user->getPersonalPicturePath("xxsmall"));
             $list_tpl->parseCurrentBlock();
             $list_tpl->touchBlock("row");
         }
     }
     return $list_tpl->get();
 }
 /**
  * Add location fields to form if activated
  * 
  * @param ilPropertyFormGUI $a_form
  * @param ilObjUser $a_user
  */
 function addLocationToForm(ilPropertyFormGUI $a_form, ilObjUser $a_user)
 {
     global $ilCtrl;
     // check map activation
     include_once "./Services/Maps/classes/class.ilMapUtil.php";
     if (!ilMapUtil::isActivated()) {
         return;
     }
     // Don't really know if this is still necessary...
     $this->lng->loadLanguageModule("maps");
     // Get user settings
     $latitude = $a_user->getLatitude();
     $longitude = $a_user->getLongitude();
     $zoom = $a_user->getLocationZoom();
     // Get Default settings, when nothing is set
     if ($latitude == 0 && $longitude == 0 && $zoom == 0) {
         $def = ilMapUtil::getDefaultSettings();
         $latitude = $def["latitude"];
         $longitude = $def["longitude"];
         $zoom = $def["zoom"];
     }
     $street = $a_user->getStreet();
     if (!$street) {
         $street = $this->lng->txt("street");
     }
     $city = $a_user->getCity();
     if (!$city) {
         $city = $this->lng->txt("city");
     }
     $country = $a_user->getCountry();
     if (!$country) {
         $country = $this->lng->txt("country");
     }
     // location property
     $loc_prop = new ilLocationInputGUI($this->lng->txt("location"), "location");
     $loc_prop->setLatitude($latitude);
     $loc_prop->setLongitude($longitude);
     $loc_prop->setZoom($zoom);
     $loc_prop->setAddress($street . "," . $city . "," . $country);
     $a_form->addItem($loc_prop);
 }