public function addToForm()
 {
     global $lng;
     $adt = $this->getADT();
     $default = false;
     if ($adt->isNull()) {
         // see ilPersonalProfileGUI::addLocationToForm()
         // use installation default
         include_once "./Services/Maps/classes/class.ilMapUtil.php";
         $def = ilMapUtil::getDefaultSettings();
         $adt->setLatitude($def["latitude"]);
         $adt->setLongitude($def["longitude"]);
         $adt->setZoom($def["zoom"]);
         $default = true;
     }
     // :TODO: title?
     $title = $this->isRequired() ? $this->getTitle() : $lng->txt("location");
     $loc = new ilLocationInputGUI($title, $this->getElementId());
     $loc->setLongitude($adt->getLongitude());
     $loc->setLatitude($adt->getLatitude());
     $loc->setZoom($adt->getZoom());
     $this->addBasicFieldProperties($loc, $adt->getCopyOfDefinition());
     if (!$this->isRequired()) {
         $optional = new ilCheckboxInputGUI($this->getTitle(), $this->getElementId() . "_tgl");
         $optional->addSubItem($loc);
         $this->addToParentElement($optional);
         if (!$default && !$adt->isNull()) {
             $optional->setChecked(true);
         }
     } else {
         $this->addToParentElement($loc);
     }
 }
Exemple #2
0
 static function settings()
 {
     if (self::$_settings === null) {
         self::$_settings = new ilSetting("maps");
     }
     return self::$_settings;
 }
 public function addToForm()
 {
     global $lng;
     $adt = $this->getADT();
     $default = false;
     if ($adt->isNull()) {
         // see ilPersonalProfileGUI::addLocationToForm()
         // use installation default
         include_once "./Services/Maps/classes/class.ilMapUtil.php";
         $def = ilMapUtil::getDefaultSettings();
         $adt->setLatitude($def["latitude"]);
         $adt->setLongitude($def["longitude"]);
         $adt->setZoom($def["zoom"]);
         $default = true;
     }
     $optional = new ilCheckboxInputGUI($this->getTitle(), $this->addToElementId("tgl"));
     if (!$default && !$adt->isNull()) {
         $optional->setChecked(true);
     }
     $loc = new ilLocationInputGUI($lng->txt("location"), $this->getElementId());
     $loc->setLongitude($adt->getLongitude());
     $loc->setLatitude($adt->getLatitude());
     $loc->setZoom($adt->getZoom());
     $optional->addSubItem($loc);
     $rad = new ilNumberInputGUI($lng->txt("form_location_radius"), $this->addToElementId("rad"));
     $rad->setSize(4);
     $rad->setSuffix($lng->txt("form_location_radius_km"));
     $rad->setValue($this->radius);
     $rad->setRequired(true);
     $optional->addSubItem($rad);
     $this->addToParentElement($optional);
 }
 public function getHTML()
 {
     if (!$this->getADT()->isNull()) {
         include_once "./Services/Maps/classes/class.ilMapUtil.php";
         $map_gui = ilMapUtil::getMapGUI();
         $map_gui->setMapId("map_" . uniqid())->setLatitude($this->getADT()->getLatitude())->setLongitude($this->getADT()->getLongitude())->setZoom($this->getADT()->getZoom())->setEnableTypeControl(true)->setEnableLargeMapControl(true)->setEnableUpdateListener(false)->setEnableCentralMarker(true);
         if ($this->width) {
             $map_gui->setWidth($this->width);
         }
         if ($this->height) {
             $map_gui->setHeight($this->height);
         }
         return $map_gui->getHtml();
     }
 }
Exemple #5
0
 /**
  * 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/Maps/classes/class.ilMapUtil.php";
             $map_gui = ilMapUtil::getMapGUI();
             $map_gui->setMapId("map_" . $i)->setLatitude($param[0])->setLongitude($param[1])->setZoom($param[2])->setWidth($param[3] . "px")->setHeight($param[4] . "px")->setEnableTypeControl(true)->setEnableNavigationControl(true)->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;
 }
 /**
  * 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"));
     }
     $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->offline) {
         $imagefile = basename($imagefile);
     }
     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", "getGeneralInterestsAsText" => "interests_general", "getOfferingHelpAsText" => "interests_help_offered", "getLookingForHelpAsText" => "interests_help_looking", "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/Maps/classes/class.ilMapUtil.php";
     if (ilMapUtil::isActivated() && $this->getPublicPref($user, "public_location") == "y" && $user->getLatitude() != "") {
         $tpl->setVariable("TXT_LOCATION", $lng->txt("location"));
         $map_gui = ilMapUtil::getMapGUI();
         $map_gui->setMapId("user_map")->setWidth("350px")->setHeight("230px")->setLatitude($user->getLatitude())->setLongitude($user->getLongitude())->setZoom($user->getLocationZoom())->setEnableNavigationControl(true)->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;
 }
 /**
  * Save Maps Setttings
  */
 function saveMapsObject()
 {
     require_once "Services/Maps/classes/class.ilMapUtil.php";
     global $ilCtrl;
     ilMapUtil::setActivated(ilUtil::stripSlashes($_POST["enable"]) == "1");
     ilMapUtil::setType(ilUtil::stripSlashes($_POST["type"]));
     ilMapUtil::setStdLatitude(ilUtil::stripSlashes($_POST["std_location"]["latitude"]));
     ilMapUtil::setStdLongitude(ilUtil::stripSlashes($_POST["std_location"]["longitude"]));
     ilMapUtil::setStdZoom(ilUtil::stripSlashes($_POST["std_location"]["zoom"]));
     $ilCtrl->redirect($this, "editMaps");
 }
 /**
  * display content of page
  */
 function showPage()
 {
     global $tree, $ilUser, $lng, $ilCtrl, $ilSetting, $ilTabs;
     // jquery and jquery ui are always provided for components
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     iljQueryUtil::initjQuery();
     iljQueryUtil::initjQueryUI();
     //		$this->initSelfAssessmentRendering();
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
     ilObjMediaObjectGUI::includePresentationJS($GLOBALS["tpl"]);
     $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
     // needed for overlays in iim
     include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     ilOverlayGUI::initJavascript();
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     ilPlayerUtil::initMediaElementJs($GLOBALS["tpl"]);
     // init template
     //if($this->outputToTemplate())
     //{
     if ($this->getOutputMode() == "edit") {
         //echo ":".$this->getTemplateTargetVar().":";
         $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage");
         //$this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage");
         // to do: status dependent class
         $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
         // user comment
         if ($this->isEnabledChangeComments()) {
             $tpl->setCurrentBlock("change_comment");
             $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
             $tpl->parseCurrentBlock();
         }
         $tpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormActionByClass("ilpageeditorgui", "", "", true));
         // determine media, html and javascript mode
         $sel_media_mode = $ilUser->getPref("ilPageEditor_MediaMode") == "disable" ? "disable" : "enable";
         $sel_html_mode = $ilUser->getPref("ilPageEditor_HTMLMode") == "disable" ? "disable" : "enable";
         $sel_js_mode = "disable";
         //if($ilSetting->get("enable_js_edit", 1))
         //{
         $sel_js_mode = ilPageEditorGUI::_doJSEditing() ? "enable" : "disable";
         //}
         // show prepending html
         $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
         $tpl->setVariable("TXT_CONFIRM_DELETE", $lng->txt("cont_confirm_delete"));
         // presentation view
         if ($this->getViewPageLink() != "") {
             $ilTabs->addNonTabbedLink("pres_view", $this->lng->txt("cont_presentation_view"), $this->getViewPageLink(), $this->getViewPageTarget());
         }
         // show actions drop down
         $this->addActionsMenu($tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode);
         // get js files for JS enabled editing
         if ($sel_js_mode == "enable") {
             $this->insertHelp($tpl);
             include_once "./Services/YUI/classes/class.ilYuiUtil.php";
             ilYuiUtil::initDragDrop();
             ilYuiUtil::initConnection();
             ilYuiUtil::initPanel(false);
             $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
             $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
             include_once './Services/Style/classes/class.ilObjStyleSheet.php';
             $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();\n\t\t\t\t\t\tpreloader.src = './templates/default/images/loader.svg';\n\t\t\t\t\t\tilCOPage.setContentCss('" . ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()) . ", " . ilUtil::getStyleSheetLocation() . ", ./Services/COPage/css/tiny_extra.css" . "')");
             //$GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js");
             $GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_1_5/tinymce.js");
             $tpl->touchBlock("init_dragging");
             $cfg = $this->getPageConfig();
             $tpl->setVariable("IL_TINY_MENU", self::getTinyMenu($this->getPageObject()->getParentType(), $cfg->getEnableInternalLinks(), $cfg->getEnableWikiLinks(), $cfg->getEnableKeywords(), $this->getStyleId(), true, true, $cfg->getEnableAnchors()));
             // add int link parts
             include_once "./Services/Link/classes/class.ilInternalLinkGUI.php";
             $tpl->setCurrentBlock("int_link_prep");
             $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML($ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"), "", false, true, false)));
             $tpl->parseCurrentBlock();
             include_once "./Services/YUI/classes/class.ilYuiUtil.php";
             ilYuiUtil::initConnection();
             $GLOBALS["tpl"]->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
         }
         // multiple actions
         $cnt_pcs = $this->getPageObject()->countPageContents();
         if ($cnt_pcs > 1 || $this->getPageObject()->getParentType() != "qpl" && $cnt_pcs > 0) {
             $tpl->setCurrentBlock("multi_actions");
             if ($sel_js_mode == "enable") {
                 $tpl->setVariable("ONCLICK_DE_ACTIVATE_SELECTED", 'onclick="return ilEditMultiAction(\'activateSelected\');"');
                 $tpl->setVariable("ONCLICK_DELETE_SELECTED", 'onclick="return ilEditMultiAction(\'deleteSelected\');"');
                 $tpl->setVariable("ONCLICK_ASSIGN_CHARACTERISTIC", 'onclick="return ilEditMultiAction(\'assignCharacteristicForm\');"');
                 $tpl->setVariable("ONCLICK_COPY_SELECTED", 'onclick="return ilEditMultiAction(\'copySelected\');"');
                 $tpl->setVariable("ONCLICK_CUT_SELECTED", 'onclick="return ilEditMultiAction(\'cutSelected\');"');
                 $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
                 $tpl->setVariable("ONCLICK_SELECT_ALL", 'onclick="return ilEditMultiAction(\'selectAll\');"');
             }
             $tpl->setVariable("TXT_DE_ACTIVATE_SELECTED", $this->lng->txt("cont_ed_enable"));
             $tpl->setVariable("TXT_ASSIGN_CHARACTERISTIC", $this->lng->txt("cont_assign_characteristic"));
             $tpl->setVariable("TXT_DELETE_SELECTED", $this->lng->txt("cont_delete_selected"));
             $tpl->setVariable("TXT_COPY_SELECTED", $this->lng->txt("copy"));
             $tpl->setVariable("TXT_CUT_SELECTED", $this->lng->txt("cut"));
             $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
             $tpl->parseCurrentBlock();
         }
     } else {
         // presentation or preview here
         $tpl = new ilTemplate("tpl.page.html", true, true, "Services/COPage");
         if ($this->getEnabledPageFocus()) {
             $tpl->touchBlock("page_focus");
         }
         include_once "./Services/User/classes/class.ilUserUtil.php";
         // presentation
         if ($this->isPageContainerToBeRendered()) {
             $tpl->touchBlock("page_container_1");
             $tpl->touchBlock("page_container_2");
             $tpl->touchBlock("page_container_3");
         }
         // history
         $c_old_nr = $this->getPageObject()->old_nr;
         if ($c_old_nr > 0 || $this->getCompareMode() || $_GET["history_mode"] == 1) {
             $hist_info = $this->getPageObject()->getHistoryInfo($c_old_nr);
             if (!$this->getCompareMode()) {
                 $ilCtrl->setParameter($this, "history_mode", "1");
                 // previous revision
                 if (is_array($hist_info["previous"])) {
                     $tpl->setCurrentBlock("previous_rev");
                     $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
                     $ilCtrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
                     $tpl->setVariable("HREF_PREV", $ilCtrl->getLinkTarget($this, "preview"));
                     $tpl->parseCurrentBlock();
                 } else {
                     $tpl->setCurrentBlock("previous_rev_disabled");
                     $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
                     $tpl->parseCurrentBlock();
                 }
                 // next revision
                 if ($c_old_nr > 0) {
                     $tpl->setCurrentBlock("next_rev");
                     $tpl->setVariable("TXT_NEXT_REV", $lng->txt("cont_next_rev"));
                     $ilCtrl->setParameter($this, "old_nr", $hist_info["next"]["nr"]);
                     $tpl->setVariable("HREF_NEXT", $ilCtrl->getLinkTarget($this, "preview"));
                     $tpl->parseCurrentBlock();
                     // latest revision
                     $tpl->setCurrentBlock("latest_rev");
                     $tpl->setVariable("TXT_LATEST_REV", $lng->txt("cont_latest_rev"));
                     $ilCtrl->setParameter($this, "old_nr", "");
                     $tpl->setVariable("HREF_LATEST", $ilCtrl->getLinkTarget($this, "preview"));
                     $tpl->parseCurrentBlock();
                 }
                 $ilCtrl->setParameter($this, "history_mode", "");
                 // rollback
                 if ($c_old_nr > 0 && $ilUser->getId() != ANONYMOUS_USER_ID) {
                     $tpl->setCurrentBlock("rollback");
                     $ilCtrl->setParameter($this, "old_nr", $c_old_nr);
                     $tpl->setVariable("HREF_ROLLBACK", $ilCtrl->getLinkTarget($this, "rollbackConfirmation"));
                     $ilCtrl->setParameter($this, "old_nr", "");
                     $tpl->setVariable("TXT_ROLLBACK", $lng->txt("cont_rollback"));
                     $tpl->parseCurrentBlock();
                 }
             }
             $tpl->setCurrentBlock("hist_nav");
             $tpl->setVariable("TXT_REVISION", $lng->txt("cont_revision"));
             $tpl->setVariable("VAL_REVISION_DATE", ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME)));
             $tpl->setVariable("VAL_REV_USER", ilUserUtil::getNamePresentation($hist_info["current"]["user_id"]));
             $tpl->parseCurrentBlock();
         }
     }
     if ($this->getOutputMode() != IL_PAGE_PRESENTATION && $this->getOutputMode() != IL_PAGE_OFFLINE && $this->getOutputMode() != IL_PAGE_PREVIEW && $this->getOutputMode() != IL_PAGE_PRINT) {
         $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
     }
     // output media object edit list (of media links)
     if ($this->getOutputMode() == "edit") {
         $links = ilInternalLink::_getTargetsOfSource($this->obj->getParentType() . ":pg", $this->obj->getId(), $this->obj->getLanguage());
         $mob_links = array();
         foreach ($links as $link) {
             if ($link["type"] == "mob") {
                 if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob") {
                     $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"]) . " [" . $link["id"] . "]";
                 }
             }
         }
         // linked media objects
         if (count($mob_links) > 0) {
             $tpl->setCurrentBlock("med_link");
             $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
             $tpl->setVariable("SEL_MED_LINKS", ilUtil::formSelect(0, "mob_id", $mob_links, false, true));
             $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
             $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
             //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
             $tpl->parseCurrentBlock();
         }
         // content snippets used
         include_once "./Services/COPage/classes/class.ilPCContentInclude.php";
         $snippets = ilPCContentInclude::collectContentIncludes($this->getPageObject(), $this->getPageObject()->getDomDoc());
         if (count($snippets) > 0) {
             foreach ($snippets as $s) {
                 include_once "./Modules/MediaPool/classes/class.ilMediaPoolPage.php";
                 $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
             }
             $tpl->setCurrentBlock("med_link");
             $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
             $tpl->setVariable("SEL_SNIPPETS", ilUtil::formSelect(0, "ci_id", $sn_arr, false, true));
             $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
             $tpl->parseCurrentBlock();
         }
         // scheduled activation?
         if (!$this->getPageObject()->getActive() && $this->getPageObject()->getActivationStart() != "" && $this->getPageConfig()->getEnableScheduledActivation()) {
             $tpl->setCurrentBlock("activation_txt");
             $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $lng->txt("cont_scheduled_activation"));
             $tpl->setVariable("SA_FROM", ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getActivationStart(), IL_CAL_DATETIME)));
             $tpl->setVariable("SA_TO", ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getActivationEnd(), IL_CAL_DATETIME)));
             $tpl->parseCurrentBlock();
         }
     }
     if ($_GET["reloadTree"] == "y") {
         $tpl->setCurrentBlock("reload_tree");
         if ($this->obj->getParentType() == "dbk") {
             $tpl->setVariable("LINK_TREE", $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "explorer", "", false, false));
         } else {
             $tpl->setVariable("LINK_TREE", $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false));
         }
         $tpl->parseCurrentBlock();
     }
     //		}
     // get content
     $builded = $this->obj->buildDom();
     // manage hierarchical ids
     if ($this->getOutputMode() == "edit") {
         // add pc ids, if necessary
         if (!$this->obj->checkPCIds()) {
             $this->obj->insertPCIds();
             $this->obj->update(true, true);
         }
         $this->obj->addFileSizes();
         $this->obj->addHierIDs();
         $hids = $this->obj->getHierIds();
         $row1_ids = $this->obj->getFirstRowIds();
         $col1_ids = $this->obj->getFirstColumnIds();
         $litem_ids = $this->obj->getListItemIds();
         $fitem_ids = $this->obj->getFileItemIds();
         // standard menues
         $hids = $this->obj->getHierIds();
         foreach ($hids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_" . $hid);
             $tpl->parseCurrentBlock();
         }
         // column menues for tables
         foreach ($col1_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_r" . $hid);
             $tpl->parseCurrentBlock();
         }
         // row menues for tables
         foreach ($row1_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_c" . $hid);
             $tpl->parseCurrentBlock();
         }
         // list item menues
         foreach ($litem_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
             $tpl->parseCurrentBlock();
         }
         // file item menues
         foreach ($fitem_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
             $tpl->parseCurrentBlock();
         }
     } else {
         $this->obj->addFileSizes();
     }
     //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>";
     //echo "<br>-".htmlentities($this->getLinkXML())."-";
     // set default link xml, if nothing was set yet
     if (!$this->link_xml_set) {
         $this->setDefaultLinkXml();
     }
     //$content = $this->obj->getXMLFromDom(false, true, true,
     //	$this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML());
     $link_xml = $this->getLinkXML();
     // disable/enable auto margins
     if ($this->getStyleId() > 0) {
         if (ilObject::_lookupType($this->getStyleId()) == "sty") {
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $style = new ilObjStyleSheet($this->getStyleId());
             $template_xml = $style->getTemplateXML();
             $disable_auto_margins = "n";
             if ($style->lookupStyleSetting("disable_auto_margins")) {
                 $disable_auto_margins = "y";
             }
         }
     }
     if ($this->getAbstractOnly()) {
         $content = "<dummy><PageObject><PageContent><Paragraph>" . $this->obj->getFirstParagraphText() . $link_xml . "</Paragraph></PageContent></PageObject></dummy>";
     } else {
         $content = $this->obj->getXMLFromDom(false, true, true, $link_xml . $this->getQuestionXML() . $template_xml . $this->getComponentPluginsXML());
     }
     // check validation errors
     if ($builded !== true) {
         $this->displayValidationError($builded);
     } else {
         $this->displayValidationError($_SESSION["il_pg_error"]);
     }
     unset($_SESSION["il_pg_error"]);
     if (isset($_SESSION["citation_error"])) {
         ilUtil::sendFailure($this->lng->txt("cont_citation_selection_not_valid"));
         ilSession::clear("citation_error");
     }
     // get title
     $pg_title = $this->getPresentationTitle();
     $col_path = ilUtil::getImagePath("col.svg");
     $row_path = ilUtil::getImagePath("row.svg");
     $item_path = ilUtil::getImagePath("item.svg");
     if ($this->getOutputMode() != "offline") {
         $enlarge_path = ilUtil::getImagePath("enlarge.svg");
         $wb_path = ilUtil::getWebspaceDir("output") . "/";
     } else {
         $enlarge_path = "images/enlarge.svg";
         $wb_path = "";
     }
     $pg_title_class = $this->getOutputMode() == "print" ? "ilc_PrintPageTitle" : "";
     // page splitting only for learning modules and
     // digital books
     $enable_split_new = $this->obj->getParentType() == "lm" || $this->obj->getParentType() == "dbk" ? "y" : "n";
     // page splitting to next page only for learning modules and
     // digital books if next page exists in tree
     if (($this->obj->getParentType() == "lm" || $this->obj->getParentType() == "dbk") && ilObjContentObject::hasSuccessorPage($this->obj->getParentId(), $this->obj->getId())) {
         $enable_split_next = "y";
     } else {
         $enable_split_next = "n";
     }
     $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
     if ($this->getPageConfig()->getEnablePCType("Tabs")) {
         //include_once("./Services/YUI/classes/class.ilYuiUtil.php");
         //ilYuiUtil::initTabView();
         include_once "./Services/Accordion/classes/class.ilAccordionGUI.php";
         ilAccordionGUI::addJavaScript();
         ilAccordionGUI::addCss();
     }
     $file_download_link = $this->determineFileDownloadLink();
     $fullscreen_link = $this->determineFullscreenLink();
     $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
     // default values for various parameters (should be used by
     // all instances in the future)
     $media_mode = $this->getOutputMode() == "edit" ? $ilUser->getPref("ilPageEditor_MediaMode") : "enable";
     include_once "./Modules/LearningModule/classes/class.ilEditClipboard.php";
     $paste = ilEditClipboard::getAction() == "copy" && $this->getOutputMode() == "edit";
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     $flv_video_player = $this->getOutputMode() != "offline" ? ilPlayerUtil::getFlashVideoPlayerFilename(true) : ilPlayerUtil::getFlashVideoPlayerFilename(true);
     $cfg = $this->getPageConfig();
     // added UTF-8 encoding otherwise umlaute are converted too
     include_once "./Services/Maps/classes/class.ilMapUtil.php";
     $params = array('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title, ENT_QUOTES, "UTF-8"), 'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n", 'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class, 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path, 'img_col' => $col_path, 'img_row' => $row_path, 'img_item' => $item_path, 'enable_split_new' => $enable_split_new, 'enable_split_next' => $enable_split_next, 'link_params' => $this->link_params, 'file_download_link' => $file_download_link, 'fullscreen_link' => $fullscreen_link, 'img_path' => $img_path, 'parent_id' => $this->obj->getParentId(), 'download_script' => $this->sourcecode_download_script, 'encoded_download_script' => urlencode($this->sourcecode_download_script), 'bib_id' => $this->getBibId(), 'citation' => (int) $this->isEnabledCitation(), 'pagebreak' => $this->lng->txt('dgl_pagebreak'), 'page' => $this->lng->txt('page'), 'citate_page' => $this->lng->txt('citate_page'), 'citate_from' => $this->lng->txt('citate_from'), 'citate_to' => $this->lng->txt('citate_to'), 'citate' => $this->lng->txt('citate'), 'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n", 'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n", 'enable_map' => $cfg->getEnablePCType("Map") && ilMapUtil::isActivated() ? "y" : "n", 'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n", 'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n", 'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n", 'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n", 'enable_content_templates' => count($this->getPageObject()->getContentTemplates()) > 0 ? "y" : "n", 'paste' => $paste ? "y" : "n", 'media_mode' => $media_mode, 'javascript' => $sel_js_mode, 'paragraph_plugins' => $paragraph_plugin_string, 'disable_auto_margins' => $disable_auto_margins, 'page_toc' => $cfg->getEnablePageToc() ? "y" : "n", 'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n", 'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n", 'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n", 'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n", 'enable_qover' => $cfg->getEnablePCType("QuestionOverview") ? "y" : "n", 'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n", 'enable_my_courses' => $cfg->getEnablePCType("MyCourses") ? "y" : "n", 'enable_amd_page_list' => $cfg->getEnablePCType("AMDPageList") ? "y" : "n", 'flv_video_player' => $flv_video_player);
     if ($this->link_frame != "") {
         // todo other link types
         $params["pg_frame"] = $this->link_frame;
     }
     //$content = str_replace("&nbsp;", "", $content);
     // this ensures that cache is emptied with every update
     $params["version"] = ILIAS_VERSION;
     // ensure no cache hit, if included files/media objects have been changed
     $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
     // run xslt
     $md5 = md5(serialize($params) . $link_xml . $template_xml);
     //$a = microtime();
     // check cache (same parameters, non-edit mode and rendered time
     // > last change
     if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") && !$this->getCompareMode() && !$this->getAbstractOnly() && $md5 == $this->obj->getRenderMd5() && $this->obj->getLastChange() < $this->obj->getRenderedTime() && $this->obj->getRenderedTime() != "" && $this->obj->old_nr == 0) {
         // cache hit
         $output = $this->obj->getRenderedContent();
     } else {
         $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
         $args = array('/_xml' => $content, '/_xsl' => $xsl);
         $xh = xslt_create();
         //		echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
         //		echo "mode:".$this->getOutputMode().":<br>";
         $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
         if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview") && !$this->getAbstractOnly() && $this->obj->old_nr == 0) {
             //echo "writerenderedcontent";
             $this->obj->writeRenderedContent($output, $md5);
         }
         //echo xslt_error($xh);
         xslt_free($xh);
     }
     //$b = microtime();
     //echo "$a - $b";
     //echo "<pre>".htmlentities($output)."</pre>";
     // unmask user html
     if (($this->getOutputMode() != "edit" || $ilUser->getPref("ilPageEditor_HTMLMode") != "disable") && !$this->getPageConfig()->getPreventHTMLUnmasking()) {
         $output = str_replace("&lt;", "<", $output);
         $output = str_replace("&gt;", ">", $output);
     }
     $output = str_replace("&amp;", "&", $output);
     $output = ilUtil::insertLatexImages($output);
     // insert page snippets
     $output = $this->insertContentIncludes($output);
     // insert resource blocks
     $output = $this->insertResources($output);
     // insert page toc
     if ($this->getPageConfig()->getEnablePageToc()) {
         $output = $this->insertPageToc($output);
     }
     // insert advanced output trigger
     $output = $this->insertAdvTrigger($output);
     // workaround for preventing template engine
     // from hiding paragraph text that is enclosed
     // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
     $output = $this->replaceCurlyBrackets($output);
     // remove all newlines (important for code / pre output)
     $output = str_replace("\n", "", $output);
     //echo htmlentities($output);
     $output = $this->postOutputProcessing($output);
     //echo htmlentities($output);
     if ($this->getOutputMode() == "edit" && !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation())) {
         $output = '<div class="il_editarea_disabled">' . $output . '</div>';
     }
     // for all page components...
     include_once "./Services/COPage/classes/class.ilCOPagePCDef.php";
     $defs = ilCOPagePCDef::getPCDefinitions();
     foreach ($defs as $def) {
         ilCOPagePCDef::requirePCClassByName($def["name"]);
         $pc_class = $def["pc_class"];
         $pc_obj = new $pc_class($this->getPageObject());
         // post xsl page content modification by pc elements
         $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode());
         // javascript files
         $js_files = $pc_obj->getJavascriptFiles($this->getOutputMode());
         foreach ($js_files as $js) {
             $GLOBALS["tpl"]->addJavascript($js);
         }
         // css files
         $css_files = $pc_obj->getCssFiles($this->getOutputMode());
         foreach ($css_files as $css) {
             $GLOBALS["tpl"]->addCss($css);
         }
         // onload code
         $onload_code = $pc_obj->getOnloadCode($this->getOutputMode());
         foreach ($onload_code as $code) {
             $GLOBALS["tpl"]->addOnloadCode($code);
         }
     }
     //		$output = $this->selfAssessmentRendering($output);
     // output
     if ($ilCtrl->isAsynch() && !$this->getRawPageContent() && $this->getOutputMode() == "edit") {
         // e.g. ###3:110dad8bad6df8620071a0a693a2d328###
         if ($_GET["updated_pc_id_str"] != "") {
             echo $_GET["updated_pc_id_str"];
         }
         $tpl->setVariable($this->getTemplateOutputVar(), $output);
         $tpl->setCurrentBlock("edit_page");
         $tpl->parseCurrentBlock();
         echo $tpl->get("edit_page");
         exit;
     }
     if ($this->outputToTemplate()) {
         $tpl->setVariable($this->getTemplateOutputVar(), $output);
         $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get());
         return $output;
     } else {
         if ($this->getRawPageContent()) {
             return $output;
         } else {
             $tpl->setVariable($this->getTemplateOutputVar(), $output);
             return $tpl->get();
         }
     }
 }
 /**
  * Add fields to form
  *
  * @param ilPropertyformGUI $form
  * @param array $prefs
  * @param object $parent
  * @param bool $a_anonymized
  */
 public function showPublicProfileFields(ilPropertyformGUI $form, array $prefs, $parent = null, $anonymized = false)
 {
     global $ilUser;
     $birthday = $ilUser->getBirthday();
     if ($birthday) {
         $birthday = ilDatePresentation::formatDate(new ilDate($birthday, IL_CAL_DATE));
     }
     $gender = $ilUser->getGender();
     if ($gender) {
         $gender = $this->lng->txt("gender_" . $gender);
     }
     if ($ilUser->getSelectedCountry() != "") {
         $this->lng->loadLanguageModule("meta");
         $txt_sel_country = $this->lng->txt("meta_c_" . $ilUser->getSelectedCountry());
     }
     // profile picture
     $pic = ilObjUser::_getPersonalPicturePath($ilUser->getId(), "xsmall", true, true);
     if ($pic) {
         $pic = "<img src=\"" . $pic . "\" />";
     }
     // personal data
     $val_array = array("title" => $ilUser->getUTitle(), "birthday" => $birthday, "gender" => $gender, "upload" => $pic, "interests_general" => $ilUser->getGeneralInterestsAsText(), "interests_help_offered" => $ilUser->getOfferingHelpAsText(), "interests_help_looking" => $ilUser->getLookingForHelpAsText(), "institution" => $ilUser->getInstitution(), "department" => $ilUser->getDepartment(), "street" => $ilUser->getStreet(), "zipcode" => $ilUser->getZipcode(), "city" => $ilUser->getCity(), "country" => $ilUser->getCountry(), "sel_country" => $txt_sel_country, "phone_office" => $ilUser->getPhoneOffice(), "phone_home" => $ilUser->getPhoneHome(), "phone_mobile" => $ilUser->getPhoneMobile(), "fax" => $ilUser->getFax(), "email" => $ilUser->getEmail(), "hobby" => $ilUser->getHobby(), "matriculation" => $ilUser->getMatriculation(), "delicious" => $ilUser->getDelicious());
     // location
     include_once "./Services/Maps/classes/class.ilMapUtil.php";
     if (ilMapUtil::isActivated()) {
         $val_array["location"] = "";
     }
     foreach ($val_array as $key => $value) {
         if ($anonymized) {
             $value = null;
         }
         if ($this->userSettingVisible($key)) {
             // public setting
             if ($key == "upload") {
                 $cb = new ilCheckboxInputGUI($this->lng->txt("personal_picture"), "chk_" . $key);
             } else {
                 $cb = new ilCheckboxInputGUI($this->lng->txt($key), "chk_" . $key);
             }
             if ($prefs["public_" . $key] == "y") {
                 $cb->setChecked(true);
             }
             //$cb->setInfo($value);
             $cb->setOptionTitle($value);
             if (!$parent) {
                 $form->addItem($cb);
             } else {
                 $parent->addSubItem($cb);
             }
         }
     }
     $im_arr = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip");
     if ($this->userSettingVisible("instant_messengers")) {
         foreach ($im_arr as $im) {
             // public setting
             $cb = new ilCheckboxInputGUI($this->lng->txt("im_" . $im), "chk_im_" . $im);
             //$cb->setInfo($ilUser->getInstantMessengerId($im));
             $cb->setOptionTitle($ilUser->getInstantMessengerId($im));
             if ($prefs["public_im_" . $im] != "n") {
                 $cb->setChecked(true);
             }
             if (!$parent) {
                 $form->addItem($cb);
             } else {
                 $parent->addSubItem($cb);
             }
         }
     }
     // additional defined user data fields
     $user_defined_data = array();
     if (!$anonymized) {
         $user_defined_data = $ilUser->getUserDefinedData();
     }
     foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
         // public setting
         $cb = new ilCheckboxInputGUI($definition["field_name"], "chk_udf_" . $definition["field_id"]);
         $cb->setOptionTitle($user_defined_data["f_" . $definition["field_id"]]);
         if ($prefs["public_udf_" . $definition["field_id"]] == "y") {
             $cb->setChecked(true);
         }
         if (!$parent) {
             $form->addItem($cb);
         } else {
             $parent->addSubItem($cb);
         }
     }
 }
 /**
  * Members map
  */
 function membersMapObject()
 {
     global $tpl;
     $this->tabs_gui->setTabActive("members");
     $this->setSubTabs('members');
     $this->tabs_gui->setSubTabActive("crs_members_map");
     include_once "./Services/Maps/classes/class.ilMapUtil.php";
     if (!ilMapUtil::isActivated() || !$this->object->getEnableCourseMap()) {
         return;
     }
     $map = ilMapUtil::getMapGUI();
     $map->setMapId("course_map")->setWidth("700px")->setHeight("500px")->setLatitude($this->object->getLatitude())->setLongitude($this->object->getLongitude())->setZoom($this->object->getLocationZoom())->setEnableTypeControl(true)->setEnableNavigationControl(true)->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("maps");
     $tpl = new ilTemplate("tpl.prop_location.html", true, true, "Services/Form");
     $tpl->setVariable("POST_VAR", $this->getPostVar());
     $tpl->setVariable("TXT_ZOOM", $lng->txt("maps_zoom_level"));
     $tpl->setVariable("TXT_LATITUDE", $lng->txt("maps_latitude"));
     $tpl->setVariable("TXT_LONGITUDE", $lng->txt("maps_longitude"));
     $tpl->setVariable("TXT_ADDR", $lng->txt("address"));
     $tpl->setVariable("LOC_DESCRIPTION", $lng->txt("maps_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("maps_lookup_address"));
     $tpl->setVariable("TXT_ADDRESS", $this->getAddress());
     include_once "./Services/Maps/classes/class.ilMapUtil.php";
     $map_gui = ilMapUtil::getMapGUI();
     $map_gui->setMapId("map_" . $this->getPostVar())->setLatitude($lat)->setLongitude($long)->setZoom($this->getZoom())->setEnableTypeControl(true)->setEnableLargeMapControl(true)->setEnableUpdateListener(true)->setEnableCentralMarker(true);
     $tpl->setVariable("MAP", $map_gui->getHtml());
     $a_tpl->setCurrentBlock("prop_generic");
     $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
     $a_tpl->parseCurrentBlock();
 }
 /**
  * set sub tabs
  *
  * @access protected
  * @param
  * @return
  */
 protected function setSubTabs($a_tab)
 {
     global $rbacsystem, $ilUser, $ilAccess;
     switch ($a_tab) {
         case 'members':
             // for admins
             if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
                 $this->tabs_gui->addSubTabTarget("grp_edit_members", $this->ctrl->getLinkTarget($this, 'members'), "members", get_class($this));
             }
             // for all
             $this->tabs_gui->addSubTabTarget("grp_members_gallery", $this->ctrl->getLinkTarget($this, 'membersGallery'), "membersGallery", get_class($this));
             // members map
             include_once "./Services/Maps/classes/class.ilMapUtil.php";
             if (ilMapUtil::isActivated() && $this->object->getEnableGroupMap()) {
                 $this->tabs_gui->addSubTabTarget("grp_members_map", $this->ctrl->getLinkTarget($this, 'membersMap'), "membersMap", get_class($this));
             }
             if ($ilAccess->checkAccess('write', '', $this->object->getRefId()) or $this->object->getMailToMembersType() == ilObjGroup::MAIL_ALLOWED_ALL) {
                 $this->tabs_gui->addSubTabTarget("mail_members", $this->ctrl->getLinkTarget($this, 'mailMembers'), "mailMembers", get_class($this));
             }
             if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
                 $this->tabs_gui->addSubTabTarget("events", $this->ctrl->getLinkTargetByClass('ilsessionoverviewgui', 'listSessions'), "", 'ilsessionoverviewgui');
             }
             include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
             if (ilPrivacySettings::_getInstance()->checkExportAccess($this->object->getRefId())) {
                 $this->tabs_gui->addSubTabTarget('grp_export_members', $this->ctrl->getLinkTargetByClass('ilmemberexportgui', 'show'), "", 'ilmemberexportgui');
             }
             break;
         case 'settings':
             $this->tabs_gui->addSubTabTarget("grp_settings", $this->ctrl->getLinkTarget($this, 'edit'), "edit", get_class($this));
             $this->tabs_gui->addSubTabTarget("grp_info_settings", $this->ctrl->getLinkTarget($this, 'editInfo'), "editInfo", get_class($this));
             // custom icon
             if ($this->ilias->getSetting("custom_icons")) {
                 $this->tabs_gui->addSubTabTarget("grp_icon_settings", $this->ctrl->getLinkTarget($this, 'editGroupIcons'), "editGroupIcons", get_class($this));
             }
             include_once "./Services/Maps/classes/class.ilMapUtil.php";
             if (ilMapUtil::isActivated()) {
                 $this->tabs_gui->addSubTabTarget("grp_map_settings", $this->ctrl->getLinkTarget($this, 'editMapSettings'), "editMapSettings", get_class($this));
             }
             $this->tabs_gui->addSubTabTarget('groupings', $this->ctrl->getLinkTargetByClass('ilobjcoursegroupinggui', 'listGroupings'), 'listGroupings', get_class($this));
             include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
             include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
             // only show if export permission is granted
             if (ilPrivacySettings::_getInstance()->checkExportAccess($this->object->getRefId()) or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId())) {
                 $this->tabs_gui->addSubTabTarget('grp_custom_user_fields', $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui'), '', 'ilobjectcustomuserfieldsgui');
             }
             break;
     }
 }