Exemplo n.º 1
0
 /**
  * Get HTML
  */
 function getHtml()
 {
     global $tpl, $lng, $https;
     $this->tpl = new ilTemplate("tpl.openlayers_map.html", true, true, "Services/Maps");
     $lng->loadLanguageModule("maps");
     $tpl->addJavaScript("Services/Maps/js/OpenLayers.js");
     $tpl->addJavaScript("Services/Maps/js/ServiceOpenLayers.js");
     // add user markers
     $cnt = 0;
     foreach ($this->user_marker as $user_id) {
         if (ilObject::_exists($user_id)) {
             $user = new ilObjUser($user_id);
             if ($user->getLatitude() != 0 && $user->getLongitude() != 0 && $user->getPref("public_location") == "y") {
                 $this->tpl->setCurrentBlock("user_marker");
                 $this->tpl->setVariable("UMAP_ID", $this->getMapId());
                 $this->tpl->setVariable("CNT", $cnt);
                 $this->tpl->setVariable("ULAT", htmlspecialchars($user->getLatitude()));
                 $this->tpl->setVariable("ULONG", htmlspecialchars($user->getLongitude()));
                 $info = htmlspecialchars($user->getFirstName() . " " . $user->getLastName());
                 $delim = "<br \\/>";
                 if ($user->getPref("public_institution") == "y") {
                     $info .= $delim . htmlspecialchars($user->getInstitution());
                     $delim = ", ";
                 }
                 if ($user->getPref("public_department") == "y") {
                     $info .= $delim . htmlspecialchars($user->getDepartment());
                 }
                 $delim = "<br \\/>";
                 if ($user->getPref("public_street") == "y") {
                     $info .= $delim . htmlspecialchars($user->getStreet());
                 }
                 if ($user->getPref("public_zip") == "y") {
                     $info .= $delim . htmlspecialchars($user->getZipcode());
                     $delim = " ";
                 }
                 if ($user->getPref("public_city") == "y") {
                     $info .= $delim . htmlspecialchars($user->getCity());
                 }
                 $delim = "<br \\/>";
                 if ($user->getPref("public_country") == "y") {
                     $info .= $delim . htmlspecialchars($user->getCountry());
                 }
                 $this->tpl->setVariable("USER_INFO", $info);
                 $this->tpl->setVariable("IMG_USER", $user->getPersonalPicturePath("xsmall"));
                 $this->tpl->parseCurrentBlock();
                 $cnt++;
             }
         }
     }
     $this->tpl->setVariable("MAP_ID", $this->getMapId());
     $this->tpl->setVariable("WIDTH", $this->getWidth());
     $this->tpl->setVariable("HEIGHT", $this->getHeight());
     $this->tpl->setVariable("LAT", $this->getLatitude());
     $this->tpl->setVariable("LONG", $this->getLongitude());
     $this->tpl->setVariable("ZOOM", (int) $this->getZoom());
     $nav_control = $this->getEnableNavigationControl() ? "true" : "false";
     $this->tpl->setVariable("NAV_CONTROL", $nav_control);
     $central_marker = $this->getEnableCentralMarker() ? "true" : "false";
     $this->tpl->setVariable("CENTRAL_MARKER", $central_marker);
     $replace_marker = $this->getEnableUpdateListener() ? "true" : "false";
     $this->tpl->setVariable("REPLACE_MARKER", $replace_marker);
     $this->tpl->setVariable("INVALID_ADDRESS_STRING", $lng->txt("invalid_address"));
     return $this->tpl->get();
 }
 /**
  * Return all Placeholders of user data
  *
  * @param ilObjUser $user
  * @return array
  */
 protected function parseUserPlaceholders(ilObjUser $user)
 {
     return array('USER_LOGIN' => $this->anonymized ? 'johndoe' : $user->getLogin(), 'USER_TITLE' => $this->anonymized ? 'Mister' : $user->getUTitle(), 'USER_FULLNAME' => $this->anonymized ? 'John Doe' : $user->getFullname(), 'USER_FIRSTNAME' => $this->anonymized ? 'John' : $user->getFirstname(), 'USER_LASTNAME' => $this->anonymized ? 'Doe' : $user->getLastname(), 'USER_BIRTHDAY' => $user->getBirthday(), 'USER_INSTITUTION' => $user->getInstitution(), 'USER_DEPARTMENT' => $user->getDepartment(), 'USER_STREET' => $this->anonymized ? 'Manhattan Street' : $user->getStreet(), 'USER_CITY' => $this->anonymized ? 'New York' : $user->getCity(), 'USER_ZIPCODE' => $this->anonymized ? 10026 : $user->getZipcode(), 'USER_COUNTRY' => $this->anonymized ? 'USA' : $user->getCountry());
 }
Exemplo n.º 3
0
 /**
  * Get HTML
  */
 function getHtml()
 {
     global $tpl;
     $this->tpl = new ilTemplate("tpl.google_map.html", true, true, "Services/GoogleMaps");
     $tpl->addJavaScript("//maps.google.com/maps/api/js?sensor=false", false);
     $tpl->addJavaScript("Services/GoogleMaps/js/ServiceGoogleMaps.js");
     // add user markers
     $cnt = 0;
     foreach ($this->user_marker as $user_id) {
         if (ilObject::_exists($user_id)) {
             $user = new ilObjUser($user_id);
             if ($user->getLatitude() != 0 && $user->getLongitude() != 0 && $user->getPref("public_location") == "y") {
                 $this->tpl->setCurrentBlock("user_marker");
                 $this->tpl->setVariable("UMAP_ID", $this->getMapId());
                 $this->tpl->setVariable("CNT", $cnt);
                 $this->tpl->setVariable("ULAT", htmlspecialchars($user->getLatitude()));
                 $this->tpl->setVariable("ULONG", htmlspecialchars($user->getLongitude()));
                 $info = htmlspecialchars($user->getFirstName() . " " . $user->getLastName());
                 $delim = "<br \\/>";
                 if ($user->getPref("public_institution") == "y") {
                     $info .= $delim . htmlspecialchars($user->getInstitution());
                     $delim = ", ";
                 }
                 if ($user->getPref("public_department") == "y") {
                     $info .= $delim . htmlspecialchars($user->getDepartment());
                 }
                 $delim = "<br \\/>";
                 if ($user->getPref("public_street") == "y") {
                     $info .= $delim . htmlspecialchars($user->getStreet());
                 }
                 if ($user->getPref("public_zip") == "y") {
                     $info .= $delim . htmlspecialchars($user->getZipcode());
                     $delim = " ";
                 }
                 if ($user->getPref("public_city") == "y") {
                     $info .= $delim . htmlspecialchars($user->getCity());
                 }
                 $delim = "<br \\/>";
                 if ($user->getPref("public_country") == "y") {
                     $info .= $delim . htmlspecialchars($user->getCountry());
                 }
                 $this->tpl->setVariable("USER_INFO", $info);
                 $this->tpl->setVariable("IMG_USER", $user->getPersonalPicturePath("xsmall"));
                 $this->tpl->parseCurrentBlock();
                 $cnt++;
             }
         }
     }
     $this->tpl->setVariable("MAP_ID", $this->getMapId());
     $this->tpl->setVariable("WIDTH", $this->getWidth());
     $this->tpl->setVariable("HEIGHT", $this->getHeight());
     $this->tpl->setVariable("LAT", $this->getLatitude());
     $this->tpl->setVariable("LONG", $this->getLongitude());
     $this->tpl->setVariable("ZOOM", (int) $this->getZoom());
     $type_control = $this->getEnableTypeControl() ? "true" : "false";
     $this->tpl->setVariable("TYPE_CONTROL", $type_control);
     $nav_control = $this->getEnableNavigationControl() ? "true" : "false";
     $this->tpl->setVariable("NAV_CONTROL", $nav_control);
     $update_listener = $this->getEnableUpdateListener() ? "true" : "false";
     $this->tpl->setVariable("UPDATE_LISTENER", $update_listener);
     $large_map_control = $this->getEnableLargeMapControl() ? "true" : "false";
     $this->tpl->setVariable("LARGE_CONTROL", $large_map_control);
     $central_marker = $this->getEnableCentralMarker() ? "true" : "false";
     $this->tpl->setVariable("CENTRAL_MARKER", $central_marker);
     return $this->tpl->get();
 }
 /**
  * Load user data from ilias user object
  * @param stdclass $user
  * @param ilObjUser $iu
  */
 private function loadFromUser($user, ilObjUser $iu)
 {
     $prefix = ilViteroSettings::getInstance()->getUserPrefix();
     $user->username = $prefix . $iu->getLogin();
     $user->surname = $iu->getLastname();
     $user->firstname = $iu->getFirstname();
     $user->email = $iu->getEmail();
     $user->company = $iu->getInstitution();
     $user->locale = in_array($iu->getLanguage(), $this->available_locales) ? $iu->getLanguage() : "en";
     #$user->timezone = trim($iu->getTimeZone());
     $GLOBALS['ilLog']->write(__METHOD__ . ': Time zone is ' . $iu->getTimeZone());
     $user->phone = $iu->getPhoneOffice();
     $user->fax = $iu->getFax();
     $user->mobile = $iu->getPhoneMobile();
     $user->country = $iu->getCountry();
     $user->zip = $iu->getZipcode();
     $user->city = $iu->getCity();
     $user->street = $iu->getStreet();
 }