/**
  * Check if current profile portfolio is accessible
  * 
  * @return int
  */
 protected function getProfilePortfolio()
 {
     include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
     $portfolio_id = ilObjPortfolio::getDefaultPortfolio($this->getUserId());
     if ($portfolio_id) {
         include_once './Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php';
         $access_handler = new ilPortfolioAccessHandler();
         if ($access_handler->checkAccess("read", "", $portfolio_id)) {
             return $portfolio_id;
         }
     }
 }
 /**
  * get flat bookmark list for personal desktop
  */
 function fillRow($a_set)
 {
     global $ilUser, $ilCtrl, $lng, $ilSetting, $rbacsetting, $rbacsystem;
     // mail link
     $a_set["mail_to"] = "";
     if ($this->mail_allowed && $rbacsystem->checkAccessOfUser($a_set['id'], 'internal_mail', ilMailGlobalServices::getMailObjectRefId())) {
         $a_set['mail_url'] = ilMailFormCall::getLinkTarget($this->topGuiObj, '', array(), array('type' => 'new', 'rcp_to' => urlencode($a_set['login'])));
     }
     // check for profile
     $a_set["profile"] = in_array(ilObjUser::_lookupPref($a_set["id"], "public_profile"), array("y", "g"));
     // user image
     if ($this->getCurrentDetailLevel() > 2) {
         if ($a_set["mail_url"] != "") {
             $this->tpl->setCurrentBlock("mailto_link");
             $this->tpl->setVariable("TXT_MAIL", $lng->txt("mail"));
             $this->tpl->setVariable("MAIL_URL", $a_set["mail_url"]);
             $this->tpl->parseCurrentBlock();
         }
         $chatSettings = new ilSetting('chatroom');
         if ($chatSettings->get('chat_enabled')) {
             if (!$this->__showActiveChatsOfUser($a_set["id"])) {
                 // Show invite to chat
                 $this->__showChatInvitation($a_set["id"]);
             }
             global $rbacsystem;
             include_once './Modules/Chatroom/classes/class.ilObjChatroom.php';
             if ($a_set["id"] == $ilUser->getId() && $rbacsystem->checkAccess('read', ilObjChatroom::_getPublicRefId())) {
                 $this->tpl->setCurrentBlock('chat_link');
                 $this->tpl->setVariable('TXT_CHAT_INVITE', $lng->txt('chat_enter_public_room'));
                 $this->tpl->setVariable('TXT_CHAT_INVITE_TOOLTIP', $lng->txt('chat_enter_public_room_tooltip'));
                 //					$this->tpl->setVariable('CHAT_LINK','./ilias.php?baseClass=ilChatPresentationGUI&ref_id='.ilObjChat::_getPublicChatRefId());
                 $this->tpl->setVariable('CHAT_LINK', './ilias.php?baseClass=ilRepositoryGUI&cmd=view&ref_id=' . ilObjChatroom::_getPublicRefId());
                 $this->tpl->parseCurrentBlock();
             }
         }
         // user image
         $this->tpl->setCurrentBlock("usr_image");
         $this->tpl->setVariable("USR_IMAGE", ilObjUser::_getPersonalPicturePath($a_set["id"], "xxsmall"));
         $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
         $this->tpl->parseCurrentBlock();
         $this->tpl->touchBlock("usr_image_space");
         $pd_set = new ilSetting("pd");
         $osi_server = $pd_set->get("osi_host");
         //			if (trim($osi_server) != "")
         //			{
         // instant messengers
         // 1 indicates to use online status check
         $im_arr = array("icq" => 0, "yahoo" => 1, "msn" => 0, "aim" => 0, "skype" => 1, "jabber" => 0, "voip" => 0);
         // use onlinestatus.org
         // when enabled all instant messengers are checked online and ignores settings above
         if (trim($osi_server) != "") {
             $osi_enable = true;
         }
         // removed calls to external servers due to
         // bug 10583, alex 8 Mar 2013
         foreach ($im_arr as $im_name => $im_check) {
             if ($im_id = ilObjUser::_lookupIm($a_set["id"], $im_name)) {
                 $im_url = "";
                 switch ($im_name) {
                     case "icq":
                         $im_url = "http://http://www.icq.com/people/" . $im_id;
                         break;
                     case "yahoo":
                         $im_url = "http://edit.yahoo.com/config/send_webmesg?target=" . $im_id . "&src=pg";
                         break;
                     case "msn":
                         $im_url = "http://messenger.live.com";
                         break;
                     case "aim":
                         //$im_url = "aim:GoIM?screenname=".$im_id;
                         $im_url = "http://aimexpress.aim.com";
                         break;
                     case "skype":
                         $im_url = "skype:" . $im_id . "?call";
                         break;
                 }
                 $im_img = ilUtil::getImagePath($im_name . 'online.png');
                 if ($im_url != "") {
                     $this->tpl->setCurrentBlock("im_link_start");
                     $this->tpl->setVariable("URL_IM", $im_url);
                     $this->tpl->parseCurrentBlock();
                     $this->tpl->touchBlock("im_link_end");
                 }
                 $this->tpl->setCurrentBlock("instant_messengers");
                 $this->tpl->setVariable("IMG_IM_ICON", $im_img);
                 $this->tpl->setVariable("TXT_IM_ICON", $lng->txt("im_" . $im_name));
                 $icon_id = "im_" . $im_name . "_usr_" . $a_set["id"];
                 $this->tpl->setVariable("ICON_ID", $icon_id);
                 include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
                 ilTooltipGUI::addTooltip($icon_id, $lng->txt("im_" . $im_name) . ": " . $im_id, "", "top center", "bottom center");
                 $this->tpl->parseCurrentBlock();
             }
         }
         //			}
     }
     // username
     if (!$a_set["profile"]) {
         $this->tpl->setVariable("USR_LOGIN", $a_set["login"]);
     } else {
         if ($this->getCurrentDetailLevel() > 2) {
             $this->tpl->setVariable("USR_LOGIN", "<br />" . $a_set["login"]);
         } else {
             $this->tpl->setVariable("USR_LOGIN", " [" . $a_set["login"] . "]");
         }
     }
     // profile link
     if ($a_set["profile"]) {
         include_once "Services/User/classes/class.ilUserUtil.php";
         $user_name = ilUserUtil::getNamePresentation($a_set["id"], false, false, "", false, true, false);
         $this->tpl->setCurrentBlock("profile_link");
         $this->tpl->setVariable("TXT_VIEW", $lng->txt("profile"));
         // see ilPersonalProfileGUI::getProfilePortfolio()
         $has_prtf = false;
         if ($ilSetting->get('user_portfolios')) {
             include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
             $has_prtf = ilObjPortfolio::getDefaultPortfolio($a_set["id"]);
         }
         if (!$has_prtf) {
             // (simple) profile: center column
             $ilCtrl->setParameter($this, "user", $a_set["id"]);
             $this->tpl->setVariable("LINK_PROFILE", $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
         } else {
             // portfolio: fullscreen
             include_once "Services/Link/classes/class.ilLink.php";
             $this->tpl->setVariable("LINK_PROFILE", ilLink::_getLink($a_set["id"], "usr"));
             $this->tpl->setVariable("LINK_TARGET", "_blank");
         }
         $this->tpl->setVariable("USR_ID", $a_set["id"]);
         $this->tpl->setVariable("LINK_FULLNAME", $user_name);
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setVariable("USR_FULLNAME", "");
     }
 }
 /**
  * has profile set to a portfolio?
  * 
  * @return int
  */
 protected function getProfilePortfolio()
 {
     global $ilUser, $ilSetting;
     if ($ilSetting->get('user_portfolios')) {
         include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
         return ilObjPortfolio::getDefaultPortfolio($ilUser->getId());
     }
 }
 protected function syncProfile($a_node_id)
 {
     global $ilUser;
     // #12845
     include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
     if (ilObjPortfolio::getDefaultPortfolio($ilUser->getId()) == $a_node_id) {
         $has_registered = $this->hasRegisteredPermission($a_node_id);
         $has_global = $this->hasGlobalPermission($a_node_id);
         // not published anymore - remove portfolio as profile
         if (!$has_registered && !$has_global) {
             $ilUser->setPref("public_profile", "n");
             $ilUser->writePrefs();
             ilObjPortfolio::setUserDefault($ilUser->getId());
         } else {
             $new_pref = "y";
             if ($has_global) {
                 $new_pref = "g";
             }
             if ($ilUser->getPref("public_profile") != $new_pref) {
                 $ilUser->setPref("public_profile", $new_pref);
                 $ilUser->writePrefs();
             }
         }
     }
 }