/**
  * 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();
 }
 /**
  * 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");
     $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;
             }
         }
     }
     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(utf8_decode($vcard->buildVCard()), $vcard->getFilename(), $vcard->getMimetype());
 }
 /**
  * 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();
 }
 /**
  * @param integer $obj_id
  * @param string $title
  * @param string $description
  * @param ilDateTime $start_date
  * @param ilDateTime $end_date
  * @param string $instructions
  * @param string $contact_info
  * @param integer $permanent_room
  * @param string $access_level
  * @param integer $read_contents
  * @param integer $read_records
  * @param integer $folder_id
  * @throws ilException
  */
 public function publishCreationAC($obj_id, $title, $description, $start_date, $end_date, $instructions, $contact_info, $permanent_room, $access_level = self::ACCESS_LEVEL_PROTECTED, $read_contents, $read_records, $folder_id)
 {
     /**
      * @var $ilDB   ilDB
      * */
     global $ilDB;
     $owner_id = ilObject::_lookupOwner($obj_id);
     $ownerObj = new ilObjUser($owner_id);
     // receive breeze session
     $session = $this->xmlApi->getBreezeSession();
     if (!$session) {
         throw new ilException('xavc_connection_error');
     }
     // access check
     if (!$this->xmlApi->login($this->adminLogin, $this->adminPass, $session)) {
         throw new ilException('xavc_authentication_error');
     }
     // receive folder id
     $this->externalLogin = $this->checkExternalUser($ownerObj->getId());
     $folder_id = $this->getFolderIdByLogin($this->externalLogin);
     if (!$folder_id) {
         throw new ilException('xavc_folder_not_available');
     }
     $obj_title_suffix_enabled = ilAdobeConnectServer::getSetting('obj_title_suffix');
     if ($obj_title_suffix_enabled) {
         $title = $title . '_' . CLIENT_ID . '_' . $obj_id;
     }
     // create meeting room
     $arr_meeting = $this->xmlApi->addMeeting($title, $description, date('Y-m-d', $start_date->getUnixTime()), date('H:i', $start_date->getUnixTime()), date('Y-m-d', $end_date->getUnixTime()), date('H:i', $end_date->getUnixTime()), $folder_id, $session);
     $meeting_id = $arr_meeting['meeting_id'];
     $meeting_url = $arr_meeting['meeting_url'];
     if (!$meeting_id) {
         throw new ilException('xavc_meeting_creation_error');
     }
     if (ilAdobeConnectServer::getSetting('user_assignment_mode') != ilAdobeConnectServer::ASSIGN_USER_SWITCH) {
         //Normal Case (not SWITCH aai)
         if ($this->externalLogin == NULL) {
             throw new ilException('xavc_external_login_error');
         } else {
             $this->xmlApi->addUser($this->externalLogin, $ownerObj->getEmail(), $ownerObj->getPasswd(), $ownerObj->getFirstName(), $ownerObj->getLastName(), $session);
         }
         $this->xmlApi->updateMeetingParticipant($meeting_id, $this->externalLogin, $session, 'host');
     } else {
         //In the SWITCH aai case, every user already exists thanks to "cave"
         //Add ILIAS-user himself
         $this->xmlApi->addMeetingHost($meeting_id, $ownerObj->getEmail(), $session);
         //Add technical user
         $this->xmlApi->updateMeetingParticipant($meeting_id, ilAdobeConnectServer::getSetting('login'), $session, 'host');
     }
     $this->xmlApi->updatePermission($meeting_id, $session, $access_level);
     $ilDB->insert('rep_robj_xavc_data', array('id' => array('integer', $obj_id), 'sco_id' => array('integer', $meeting_id), 'start_date' => array('integer', $start_date->getUnixTime()), 'end_date' => array('integer', $end_date->getUnixTime()), 'instructions' => array('text', $instructions), 'contact_info' => array('text', $contact_info), 'permanent_room' => array('integer', (int) $permanent_room), 'perm_read_contents' => array('integer', (int) $this->getReadContents()), 'perm_read_records' => array('integer', (int) $this->getReadRecords()), 'folder_id' => array('integer', $folder_id), 'url_path' => array('text', $meeting_url)));
 }
 function getTrackingReportHtml($regId, $showDetails = true, $showTitle = true)
 {
     global $tpl, $ScormCloudService;
     $sr = $ScormCloudService->CreateNewRequest();
     $parameterMap = array('regid' => $regId);
     $parameterMap['resultsformat'] = "full";
     $parameterMap['format'] = "json";
     $parameterMap['jsoncallback'] = "getRegistrationResultCallback";
     $sr->setMethodParams($parameterMap);
     $dataUrl = $sr->ConstructUrl("rustici.registration.getRegistrationResult");
     // Need jquery and the regreport.js
     $tpl->addJavaScript("./Customizing/global/plugins/Services/Repository/RepositoryObject/ScormCloud/tracking/jquery.js");
     //$tpl->addJavaScript("./Customizing/global/plugins/Services/Repository/RepositoryObject/ScormCloud/tracking/jquery-ui.js");
     $tpl->addJavaScript("./Customizing/global/plugins/Services/Repository/RepositoryObject/ScormCloud/tracking/regreport.js");
     $removeMe = strstr($currentUrl, "ilias.php");
     $baseUrl = str_replace($removeMe, "", $currentUrl);
     $stylesheet = $baseUrl . "Customizing/global/plugins/Services/Repository/RepositoryObject/ScormCloud/tracking/regreport.css";
     //$stylesheet = $baseUrl."Customizing/global/plugins/Services/Repository/RepositoryObject/ScormCloud/tracking/css/ui-lightness/jquery-ui-1.7.2.custom.css";
     $stylesheetLink = '<link rel="stylesheet" type="text/css" href="' . $stylesheet . '" />';
     $regParts = split("-", $regId);
     $userObj = new ilObjUser((int) $regParts[1]);
     if ($showTitle) {
         $tableHeader = '<table style="width: 100%" class="fullwidth">' . '<tr class="tbltitle">' . '<th class="std">Course Report for ' . $this->object->getTitle() . '</th>' . '<th align="right" style="text-align: right" class="std">' . $userObj->getFirstName() . ' ' . $userObj->getLastName() . '</th>' . '</tr></table>';
     } else {
         $tableHeader = '';
     }
     // The javascript report will render all activities
     return $stylesheetLink . $tableHeader . '<div showDetails="' . $showDetails . '" dataUrl="' . $dataUrl . '" id="report"/>';
 }