/** * get public profile html code * * Used in Personal Profile (as preview) and Portfolio (as page block) */ function getEmbeddable($a_add_goto = false) { global $ilSetting, $lng, $ilCtrl, $lng, $ilSetting, $ilUser; // get user object if (!ilObject::_exists($this->getUserId())) { return ""; } $user = new ilObjUser($this->getUserId()); $tpl = new ilTemplate("tpl.usr_public_profile.html", true, true, "Services/User"); $tpl->setVariable("ROWCOL1", "tblrow1"); $tpl->setVariable("ROWCOL2", "tblrow2"); if (!$this->offline && $ilUser->getId() != ANONYMOUS_USER_ID) { $ref_url = str_replace("&", "&", $this->getBackUrl()); if (!$ref_url) { $ref_url = basename($_SERVER['REQUEST_URI']); } $tpl->setCurrentBlock("mail"); $tpl->setVariable("TXT_MAIL", $lng->txt("send_mail")); require_once 'Services/Mail/classes/class.ilMailFormCall.php'; $tpl->setVariable('HREF_MAIL', ilMailFormCall::getLinkTarget($ref_url, '', array(), array('type' => 'new', 'rcp_to' => urlencode($user->getLogin())))); $tpl->parseCurrentBlock(); } $first_name = ""; if ($this->getPublicPref($user, "public_title") == "y") { $first_name .= $user->getUTitle() . " "; } $first_name .= $user->getFirstName(); $tpl->setVariable("TXT_NAME", $lng->txt("name")); $tpl->setVariable("FIRSTNAME", $first_name); $tpl->setVariable("LASTNAME", $user->getLastName()); if (!$this->offline) { // vcard $tpl->setCurrentBlock("vcard"); $tpl->setVariable("TXT_VCARD", $lng->txt("vcard")); $tpl->setVariable("TXT_DOWNLOAD_VCARD", $lng->txt("vcard_download")); $ilCtrl->setParameter($this, "user", $this->getUserId()); $tpl->setVariable("HREF_VCARD", $ilCtrl->getLinkTarget($this, "deliverVCard")); //$tpl->setVariable("IMG_VCARD", ilUtil::getImagePath("vcard.png")); } $webspace_dir = ilUtil::getWebspaceDir("user"); $check_dir = ilUtil::getWebspaceDir(); $imagefile = $webspace_dir . "/usr_images/" . $user->getPref("profile_image") . "?dummy=" . rand(1, 999999); $check_file = $check_dir . "/usr_images/" . $user->getPref("profile_image"); if (!@is_file($check_file)) { $imagefile = $check_file = ilObjUser::_getPersonalPicturePath($user->getId(), "small", false, true); } if ($this->getPublicPref($user, "public_upload") == "y" && $imagefile != "") { //Getting the flexible path of image form ini file //$webspace_dir = ilUtil::getWebspaceDir("output"); $tpl->setCurrentBlock("image"); $tpl->setVariable("TXT_IMAGE", $lng->txt("image")); $tpl->setVariable("IMAGE_PATH", $imagefile); $tpl->setVariable("IMAGE_ALT", $lng->txt("personal_picture")); $tpl->parseCurrentBlock(); } // address if ($this->getPublicPref($user, "public_street") == "y" || $this->getPublicPref($user, "public_zipcode") == "y" || $this->getPublicPref($user, "public_city") == "y" || $this->getPublicPref($user, "public_country") == "y") { $address = array(); $val_arr = array("getStreet" => "street", "getZipcode" => "zipcode", "getCity" => "city", "getCountry" => "country", "getSelectedCountry" => "sel_country"); foreach ($val_arr as $key => $value) { // if value "y" show information if ($this->getPublicPref($user, "public_" . $value) == "y") { $address_value = $user->{$key}(); // only if set if (trim($address_value) != "") { switch ($value) { case "street": $address[0] = $address_value; break; case "zipcode": case "city": $address[1] .= " " . $address_value; break; case "sel_country": $lng->loadLanguageModule("meta"); $address[2] = $lng->txt("meta_c_" . $address_value); break; case "country": $address[2] = $address_value; break; } } } } if (sizeof($address)) { $tpl->setCurrentBlock("address_line"); foreach ($address as $line) { if (trim($line)) { $tpl->setVariable("TXT_ADDRESS_LINE", trim($line)); $tpl->parseCurrentBlock(); } } $tpl->setCurrentBlock("address"); $tpl->setVariable("TXT_ADDRESS", $lng->txt("address")); $tpl->parseCurrentBlock(); } } // institution / department if ($this->getPublicPref($user, "public_institution") == "y" || $this->getPublicPref($user, "public_department") == "y") { $tpl->setCurrentBlock("inst_dep"); $sep = ""; if ($this->getPublicPref($user, "public_institution") == "y") { $h = $lng->txt("institution"); $v = $user->getInstitution(); $sep = " / "; } if ($this->getPublicPref($user, "public_department") == "y") { $h .= $sep . $lng->txt("department"); $v .= $sep . $user->getDepartment(); } $tpl->setVariable("TXT_INST_DEP", $h); $tpl->setVariable("INST_DEP", $v); $tpl->parseCurrentBlock(); } // contact $val_arr = array("getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home", "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email"); $v = $sep = ""; foreach ($val_arr as $key => $value) { // if value "y" show information if ($this->getPublicPref($user, "public_" . $value) == "y") { $v .= $sep . $lng->txt($value) . ": " . $user->{$key}(); $sep = "<br />"; } } if ($ilSetting->get("usr_settings_hide_instant_messengers") != 1) { $im_arr = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip"); foreach ($im_arr as $im_name) { if ($im_id = $user->getInstantMessengerId($im_name)) { if ($this->getPublicPref($user, "public_im_" . $im_name) != "n") { $v .= $sep . $lng->txt('im_' . $im_name) . ": " . $im_id; $sep = "<br />"; } } } } if ($v != "") { $tpl->parseCurrentBlock("contact"); $tpl->setVariable("TXT_CONTACT", $lng->txt("contact")); $tpl->setVariable("CONTACT", $v); $tpl->parseCurrentBlock(); } $val_arr = array("getHobby" => "hobby", "getMatriculation" => "matriculation", "getClientIP" => "client_ip"); foreach ($val_arr as $key => $value) { // if value "y" show information if ($this->getPublicPref($user, "public_" . $value) == "y") { $tpl->setCurrentBlock("profile_data"); $tpl->setVariable("TXT_DATA", $lng->txt($value)); $tpl->setVariable("DATA", $user->{$key}()); $tpl->parseCurrentBlock(); } } // delicious row //$d_set = new ilSetting("delicious"); if ($this->getPublicPref($user, "public_delicious") == "y") { $tpl->setCurrentBlock("delicious_row"); $tpl->setVariable("TXT_DELICIOUS", $lng->txt("delicious")); $tpl->setVariable("TXT_DEL_ICON", $lng->txt("delicious")); $tpl->setVariable("SRC_DEL_ICON", ilUtil::getImagePath("icon_delicious.png")); $tpl->setVariable("DEL_ACCOUNT", $user->getDelicious()); $tpl->parseCurrentBlock(); } // map include_once "./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php"; if (ilGoogleMapUtil::isActivated() && $this->getPublicPref($user, "public_location") == "y" && $user->getLatitude() != "") { $tpl->setVariable("TXT_LOCATION", $lng->txt("location")); include_once "./Services/GoogleMaps/classes/class.ilGoogleMapGUI.php"; $map_gui = new ilGoogleMapGUI(); $map_gui->setMapId("user_map"); $map_gui->setWidth("350px"); $map_gui->setHeight("230px"); $map_gui->setLatitude($user->getLatitude()); $map_gui->setLongitude($user->getLongitude()); $map_gui->setZoom($user->getLocationZoom()); $map_gui->setEnableNavigationControl(true); $map_gui->addUserMarker($user->getId()); $tpl->setVariable("MAP_CONTENT", $map_gui->getHTML()); } // additional defined user data fields include_once './Services/User/classes/class.ilUserDefinedFields.php'; $this->user_defined_fields =& ilUserDefinedFields::_getInstance(); $user_defined_data = $user->getUserDefinedData(); foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) { // public setting if ($this->getPublicPref($user, "public_udf_" . $definition["field_id"]) == "y") { if ($user_defined_data["f_" . $definition["field_id"]] != "") { $tpl->setCurrentBlock("udf_data"); $tpl->setVariable("TXT_UDF_DATA", $definition["field_name"]); $tpl->setVariable("UDF_DATA", $user_defined_data["f_" . $definition["field_id"]]); $tpl->parseCurrentBlock(); } } } // additional information $additional = $this->getAdditional(); if (is_array($additional)) { foreach ($additional as $key => $val) { $tpl->setCurrentBlock("profile_data"); $tpl->setVariable("TXT_DATA", $key); $tpl->setVariable("DATA", $val); $tpl->parseCurrentBlock(); } } $goto = ""; if ($a_add_goto) { include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php'; $goto = new ilPermanentLinkGUI("usr", $user->getId()); $goto = $goto->getHTML(); } return $tpl->get() . $goto; }
/** * Members map */ public function membersMapObject() { global $tpl; $this->setSubTabs('members'); $this->tabs_gui->setTabActive('members'); include_once "./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php"; if (!ilGoogleMapUtil::isActivated() || !$this->object->getEnableGroupMap()) { return; } include_once "./Services/GoogleMaps/classes/class.ilGoogleMapGUI.php"; $map = new ilGoogleMapGUI(); $map->setMapId("group_map"); $map->setWidth("700px"); $map->setHeight("500px"); $map->setLatitude($this->object->getLatitude()); $map->setLongitude($this->object->getLongitude()); $map->setZoom($this->object->getLocationZoom()); $map->setEnableTypeControl(true); $map->setEnableNavigationControl(true); $map->setEnableCentralMarker(true); $member_ids = $this->object->getGroupMemberIds(); $admin_ids = $this->object->getGroupAdminIds(); // fetch all users data in one shot to improve performance $members = $this->object->getGroupMemberData($member_ids); foreach ($member_ids as $user_id) { $map->addUserMarker($user_id); } $tpl->setContent($map->getHTML()); $tpl->setLeftContent($map->getUserListHTML()); }
/** * Modify page content after xsl * * @param string $a_output * @return string */ function modifyPageContentPostXsl($a_html, $a_mode) { $c_pos = 0; $start = strpos($a_html, "[[[[[Map;"); if (is_int($start)) { $end = strpos($a_html, "]]]]]", $start); } $i = 1; while ($end > 0) { $param = substr($a_html, $start + 9, $end - $start - 9); $param = explode(";", $param); if (is_numeric($param[0]) && is_numeric($param[1]) && is_numeric($param[2])) { include_once "./Services/GoogleMaps/classes/class.ilGoogleMapGUI.php"; $map_gui = new ilGoogleMapGUI(); $map_gui->setMapId("map_" . $i); $map_gui->setLatitude($param[0]); $map_gui->setLongitude($param[1]); $map_gui->setZoom($param[2]); $map_gui->setWidth($param[3] . "px"); $map_gui->setHeight($param[4] . "px"); $map_gui->setEnableTypeControl(true); $map_gui->setEnableNavigationControl(true); $map_gui->setEnableCentralMarker(true); $h2 = substr($a_html, 0, $start) . $map_gui->getHtml() . substr($a_html, $end + 5); $a_html = $h2; $i++; } $start = strpos($a_html, "[[[[[Map;", $start + 5); $end = 0; if (is_int($start)) { $end = strpos($a_html, "]]]]]", $start); } } return $a_html; }
/** * Members map */ function membersMapObject() { global $tpl; $this->tabs_gui->setTabActive("members"); $this->setSubTabs('members'); $this->tabs_gui->setSubTabActive("crs_members_map"); include_once "./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php"; if (!ilGoogleMapUtil::isActivated() || !$this->object->getEnableCourseMap()) { return; } include_once "./Services/GoogleMaps/classes/class.ilGoogleMapGUI.php"; $map = new ilGoogleMapGUI(); $map->setMapId("course_map"); $map->setWidth("700px"); $map->setHeight("500px"); $map->setLatitude($this->object->getLatitude()); $map->setLongitude($this->object->getLongitude()); $map->setZoom($this->object->getLocationZoom()); $map->setEnableTypeControl(true); $map->setEnableNavigationControl(true); $map->setEnableCentralMarker(true); include_once './Modules/Course/classes/class.ilCourseParticipants.php'; $members = ilCourseParticipants::_getInstanceByObjId($this->object->getId())->getParticipants(); if (count($members)) { foreach ($members as $user_id) { $map->addUserMarker($user_id); } } $tpl->setContent($map->getHTML()); $tpl->setLeftContent($map->getUserListHTML()); }
/** * Insert property html * */ function insert(&$a_tpl) { global $lng; $lng->loadLanguageModule("gmaps"); $tpl = new ilTemplate("tpl.prop_location.html", true, true, "Services/Form"); $tpl->setVariable("POST_VAR", $this->getPostVar()); $tpl->setVariable("TXT_ZOOM", $lng->txt("gmaps_zoom_level")); $tpl->setVariable("TXT_LATITUDE", $lng->txt("gmaps_latitude")); $tpl->setVariable("TXT_LONGITUDE", $lng->txt("gmaps_longitude")); $tpl->setVariable("TXT_ADDR", $lng->txt("address")); $tpl->setVariable("LOC_DESCRIPTION", $lng->txt("gmaps_std_location_desc")); $lat = is_numeric($this->getLatitude()) ? $this->getLatitude() : 0; $long = is_numeric($this->getLongitude()) ? $this->getLongitude() : 0; $tpl->setVariable("PROPERTY_VALUE_LAT", $lat); $tpl->setVariable("PROPERTY_VALUE_LONG", $long); for ($i = 0; $i <= 18; $i++) { $levels[$i] = $i; } $tpl->setVariable("ZOOM_SELECT", ilUtil::formSelect($this->getZoom(), $this->getPostVar() . "[zoom]", $levels, false, true, 0, "", array("id" => "map_" . $this->getPostVar() . "_zoom", "onchange" => "ilUpdateMap('" . "map_" . $this->getPostVar() . "');"))); $tpl->setVariable("MAP_ID", "map_" . $this->getPostVar()); $tpl->setVariable("ID", $this->getPostVar()); $tpl->setVariable("TXT_LOOKUP", $lng->txt("gmaps_lookup_address")); $tpl->setVariable("TXT_ADDRESS", $this->getAddress()); include_once "./Services/GoogleMaps/classes/class.ilGoogleMapGUI.php"; $map_gui = new ilGoogleMapGUI(); $map_gui->setMapId("map_" . $this->getPostVar()); $map_gui->setLatitude($lat); $map_gui->setLongitude($long); $map_gui->setZoom($this->getZoom()); $map_gui->setEnableTypeControl(true); $map_gui->setEnableLargeMapControl(true); $map_gui->setEnableUpdateListener(true); $map_gui->setEnableCentralMarker(true); $tpl->setVariable("MAP", $map_gui->getHtml()); $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $tpl->get()); $a_tpl->parseCurrentBlock(); }