public function execute(\FrameResponseObject $frameResponseObject) { $current_user = \lms_steam::get_current_user(); $login = $current_user->get_name(); //$path = $request->getPath(); if (isset($this->id)) { $userName = $this->id; $user = \steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $userName); } else { $user = $current_user; } //$portal=\lms_portal::get_instance(); $cache = get_cache_function($login, 86400); // $portal->set_page_title( $login ); $html_handler_profile = new \koala_html_profile($user); $html_handler_profile->set_context("groups"); $content = \Profile::getInstance()->loadTemplate("list_groups.template.html"); //$content = new HTML_TEMPLATE_IT(); //$content->loadTemplateFile( PATH_TEMPLATES . "list_groups.template.html" ); if ($this->viewer_authorized($current_user, $user)) { $public = $user->get_id() != $current_user->get_id() ? TRUE : FALSE; $groups = $cache->call("lms_steam::user_get_groups", $login, $public); usort($groups, "sort_objects"); $no_groups = count($groups); if ($no_groups > 0) { $content->setCurrentBlock("BLOCK_GROUP_LIST"); $pageIterator = \lms_portal::get_paginator(10, $no_groups, "(" . gettext("%TOTAL groups in list") . ")"); $content->setVariable("PAGEITERATOR", $pageIterator["html"]); $start = $pageIterator["startIndex"]; $end = $start + 10 > $no_groups ? $no_groups : $start + 10; if ($current_user->get_id() == $user->get_id()) { $content->setVariable("LABEL_GROUPS", gettext("Your groups") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_groups), gettext("%a-%z out of %s")) . ")"); } else { $content->setVariable("LABEL_GROUPS", str_replace("%NAME", $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), gettext("%NAME's groups")) . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_groups), gettext("%a-%z out of %s")) . ")"); } // GROUPS $content->setVariable("LABEL_NAME_DESCRIPTION", gettext("Name, description")); $content->setVariable("LABEL_MEMBERS", gettext("Members list")); $content->setVariable("LABEL_COMMUNICATION", gettext("Communication")); if ($user->get_id() == $current_user->get_id()) { $content->setVariable("TH_MANAGE_GROUP", gettext("Manage membership")); } for ($i = $start; $i < $end; $i++) { $group = $groups[$i]; $content->setCurrentBlock("BLOCK_GROUP"); $content->setVariable("GROUP_LINK", PATH_URL . "groups/" . $group["OBJ_ID"] . "/"); $content->setVariable("GROUP_NAME", h($group["OBJ_NAME"])); $content->setVariable("MEMBER_LINK", PATH_URL . "groups/" . $group["OBJ_ID"] . "/members/"); $content->setVariable("GROUP_MEMBERS", h($group["GROUP_NO_MEMBERS"])); $content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?group=" . $group["OBJ_ID"]); $content->setVariable("LABEL_MESSAGE", gettext("Message")); $content->setVariable("LABEL_SEND", gettext("Send")); if ($user->get_id() == $current_user->get_id()) { $content->setVariable("TD_MANAGE_GROUP", "<a href=\"" . PATH_URL . "group_cancel.php?group=" . $group["OBJ_ID"] . "\">" . gettext("Resign") . "</a>"); } $content->setVariable("OBJ_DESC", h($group["OBJ_DESC"])); $content->parse("BLOCK_GROUP"); } $content->parse("BLOCK_GROUP_LIST"); } else { $content->setVariable("LABEL_GROUPS", gettext("No memberships found.")); } } else { $messagebox = "<div class=\"infoBar\"><h2>" . gettext("The user has restricted the display of this information.") . "</h2></div>"; $content->setVariable("LABEL_PRIVACY_DENY_PARTICIPANTS", $messagebox); } $frameResponseObject->setHeadline($html_handler_profile->get_headline()); $html_handler_profile->set_html_left($content->get()); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($html_handler_profile->get_html()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; //$portal->set_page_main( $html_handler_profile->get_headline(), $html_handler_profile->get_html()); //return $portal->get_html(); }
public function execute(\FrameResponseObject $frameResponseObject) { $user = \lms_steam::get_current_user(); $cache = get_cache_function($user->get_name(), 86400); $user_profile = $cache->call("lms_steam::user_get_profile", $user->get_name()); if ($_SERVER["REQUEST_METHOD"] == "POST") { $values = $_POST["values"]; foreach ($values as $i => $val) { $values[$i] = htmlspecialchars($val); } if (!empty($values["USER_PROFILE_WEBSITE_URI"]) && substr($values["USER_PROFILE_WEBSITE_URI"], 0, 7) != "http://") { $values["USER_PROFILE_WEBSITE_URI"] = "http://" . $values["USER_PROFILE_WEBSITE_URI"]; } $user->set_attributes($values); if (!empty($values["USER_PROFILE_FACULTY"])) { $old_fac_id = $user_profile["USER_PROFILE_FACULTY"]; $new_fac_id = $values["USER_PROFILE_FACULTY"]; if ($new_fac_id != $old_fac_id) { if ($old_fac_id > 0) { $old_faculty = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $old_fac_id, CLASS_GROUP); $old_faculty->remove_member($user); } if ($new_fac_id > 0) { $new_faculty = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $new_fac_id, CLASS_GROUP); $new_faculty->add_member($user); } } } /* require_once( "Cache/Lite.php" ); $cache = new Cache_Lite( array( "cacheDir" => PATH_CACHE ) ); $cache->clean( $user->get_name() ); $cache->clean( $user->get_id() );*/ if (!empty($values["USER_LANGUAGE"])) { //var_dump($values["USER_LANGUAGE"]);die; $lang_index = \language_support::get_language_index(); \language_support::choose_language($lang_index[$values["USER_LANGUAGE"]]); } $cache = get_cache_function(\lms_steam::get_current_user()->get_name()); $cache->drop("lms_portal::get_menu_html", \lms_steam::get_current_user()->get_name(), TRUE); $cache = get_cache_function($user->get_name()); $cache->drop("lms_steam::user_get_profile", $user->get_name()); $_SESSION["confirmation"] = gettext("Your profile data has been saved."); header("Location: " . PATH_URL . "profile/edit"); } $content = \Profile::getInstance()->loadTemplate("profile_edit.template.html"); //$content = new \HTML_TEMPLATE_IT(); //$content->loadTemplateFile( PATH_TEMPLATES . "profile_edit.template.html" ); if (PLATFORM_ID == "bid") { $content->setVariable("LABEL_INFO", "Hier können Sie Ihre persönlichen Kontaktdaten einrichten. Bis auf Ihren Namen sind alle Angaben freiwillig und können von Ihnen geändert werden. Klicken Sie auf den Button <b><i>Profil-Privatsphäre</i></b> um festzulegen, wem welche Informationen angezeigt werden sollen."); } else { $content->setVariable("LABEL_INFO", gettext("Please complete your profile. None of the fields are mandatory. Some of the fields can not be changed due to central identity management at the IMT.<br/><b>Note: With the button <i>Profile Privacy</i> you can control which information can be seen by other users.</b>")); } if (ENABLED_PROFILE_TITLE) { $content->setVariable("LABEL_PROFILE", gettext("General Information")); } $content->setVariable("LABEL_LOOKING", gettext("Your buddy icon")); $content->setVariable("LABEL_MAIL_PREFS", gettext("Your mail preferences")); $content->setVariable("LABEL_PROFILE_PRIVACY", gettext("Profile Privacy")); $content->setVariable("LINK_BUDDY_ICON", PATH_URL . "profile/image"); $content->setVariable("LINK_MAIL_PREFS", PATH_URL . "messages_prefs.php"); $content->setVariable("LINK_PROFILE_PRIVACY", PATH_URL . "profile/privacy"); if (ENABLED_FIRST_NAME) { $content->setVariable("LABEL_FIRST_NAME", gettext("First name")); } if (ENABLED_FULL_NAME) { $content->setVariable("LABEL_LAST_NAME", gettext("Last name")); } if (ENABLED_DEGREE) { $content->setVariable("LABEL_TITLE", gettext("Academic title")); $content->setVariable("LABEL_DEGREE", gettext("Academic degree")); $content->setVariable("LABEL_IF_AVAILABLE", gettext("only if available")); $academicTitle = (string) $user_profile["USER_ACADEMIC_TITLE"]; switch ($academicTitle) { case "Dr.": $content->setVariable("TITLE_DR_SELECTED", 'selected="selected"'); break; case "PD Dr.": $content->setVariable("TITLE_PRIVDOZDR_SELECTED", 'selected="selected"'); break; case "Prof.": $content->setVariable("TITLE_PROF_SELECTED", 'selected="selected"'); break; case "Prof. Dr.": $content->setVariable("TITLE_PROFDR_SELECTED", 'selected="selected"'); break; default: $content->setVariable("TITLE_NULL_SELECTED", 'selected="selected"'); break; } $content->setVariable("VALUE_ACADEMIC_DEGREE", $this->safe_string($user_profile["USER_ACADEMIC_DEGREE"])); } if (ENABLED_BID_DESCIPTION) { $content->setVariable("LABEL_STATUS_BID", gettext("Description")); } if (ENABLED_STATUS) { $content->setVariable("LABEL_STATUS", gettext("Status")); } if (ENABLED_GENDER) { $content->setVariable("LABEL_GENDER", gettext("Gender")); $content->setVariable("LABEL_FEMALE", gettext("female")); $content->setVariable("LABEL_MALE", gettext("male")); $content->setVariable("LABEL_NOT_SAY", gettext("rather not say")); } if (ENABLED_FACULTY) { $content->setVariable("LABEL_FACULTY", gettext("Origin")); } if (ENABLED_MAIN_FOCUS) { $content->setVariable("LABEL_MAIN_FOCUS", gettext("Main focus")); } if (ENABLED_HOMETOWN) { $content->setVariable("LABEL_HOMETOWN", gettext("Hometown")); } if (ENABLED_WANTS) { $content->setVariable("LABEL_WANTS", gettext("Wants")); } if (ENABLED_HAVES) { $content->setVariable("LABEL_HAVES", gettext("Haves")); } if (ENABLED_OTHER_INTERESTS) { $content->setVariable("LABEL_OTHER_INTERESTS", gettext("Other interests")); } if (ENABLED_ORGANIZATIONS) { $content->setVariable("LABEL_ORGANIZATIONS", gettext("Organizations")); } if (ENABLED_USER_DESC) { $content->setVariable("LABEL_DESCRIBE_YOURSELF", gettext("Describe yourself")); } if (ENABLED_CONTACTS_TITLE) { $content->setVariable("LABEL_CONTACT_DATA", gettext("Contact Data")); } if (ENABLED_EMAIL) { $content->setVariable("LABEL_EMAIL", gettext("E-mail")); $content->setVariable("LABEL_EMAIL_PREFERENCES", gettext("Looking for your e-mail preferences?")); //$content->setVariable( "LINK_EMAIL_PREFERENCES", PATH_URL . "messages_prefs.php" ); } if (ENABLED_TELEPHONE) { //$content->setVariable( "LABEL_TELEPHONE", gettext( "Phone" ) ); $content->setVariable("LABEL_TELEPHONE", "Telefon"); } $content->setVariable("LABEL_MOBILE", gettext("Phone, mobile")); if (ENABLED_ADDRESS) { $content->setVariable("LABEL_ADDRESS", gettext("Address")); } if (ENABLED_PHONE_MOBILE) { $content->setVariable("LABEL_PHONE_MOBILE", gettext("Phone, mobile")); } if (ENABLED_WEBSITE) { $content->setVariable("LABEL_WEBSITE", gettext("Website")); $content->setVariable("LABEL_WEBSITE_NAME", gettext("Website name")); } //TODO: IM-Speichern dementsprechend anpassen if (ENABLED_ICQ_NUMBER || ENABLED_BID_IM) { $content->setVariable("LABEL_ICQ_NUMBER", gettext("ICQ number")); } if (ENABLED_MSN_IDENTIFICATION || ENABLED_BID_IM) { $content->setVariable("LABEL_MSN_IDENTIFICATION", gettext("MSN identification")); } if (ENABLED_AIM_ALIAS || ENABLED_BID_IM) { $content->setVariable("LABEL_AIM_ALIAS", gettext("AIM-alias")); } if (ENABLED_YAHOO_ID || ENABLED_BID_IM) { $content->setVariable("LABEL_YAHOO_ID", gettext("Yahoo-ID")); } if (ENABLED_SKYPE_NAME || ENABLED_BID_IM) { $content->setVariable("LABEL_SKYPE_NAME", gettext("Skype name")); } $content->setVariable("INFO_INCLUDE_HTTP", gettext("Please include the 'http://'")); $content->setVariable("LABEL_SAVE_IT", gettext("Save changes")); $content->setVariable("BACK_LINK", PATH_URL . "profile/index/" . $user->get_name() . "/"); $content->setVariable("LABEL_GOTO_HOMEPAGE", "<a href=\"" . PATH_URL . "profile/index/" . $user->get_name() . "/\">" . gettext("back") . "</a>"); if (ENABLED_USER_DESC) { $content->setVariable("LABEL_BB_BOLD", gettext("B")); $content->setVariable("HINT_BB_BOLD", gettext("boldface")); $content->setVariable("LABEL_BB_ITALIC", gettext("I")); $content->setVariable("HINT_BB_ITALIC", gettext("italic")); $content->setVariable("LABEL_BB_UNDERLINE", gettext("U")); $content->setVariable("HINT_BB_UNDERLINE", gettext("underline")); $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S")); $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough")); $content->setVariable("LABEL_BB_IMAGE", gettext("IMG")); $content->setVariable("HINT_BB_IMAGE", gettext("image")); $content->setVariable("LABEL_BB_URL", gettext("URL")); $content->setVariable("HINT_BB_URL", gettext("web link")); $content->setVariable("LABEL_BB_MAIL", gettext("MAIL")); $content->setVariable("HINT_BB_MAIL", gettext("email link")); } // PROFILE VALUES if (ENABLED_FIRST_NAME) { $content->setVariable("VALUE_USER_FIRSTNAME", $this->safe_string($user_profile["USER_FIRSTNAME"])); } if (ENABLED_FULL_NAME) { $content->setVariable("VALUE_USER_FULLNAME", $this->safe_string($user_profile["USER_FULLNAME"])); } /* * Assure translations for statuses are available via gettext */ //var_dump($user_profile);die; gettext("student"); gettext("staff member"); gettext("guest"); gettext("alumni"); if (ENABLED_BID_DESCIPTION) { $content->setVariable("VALUE_STATUS_BID", $this->safe_string($user_profile["OBJ_DESC"])); } if (ENABLED_STATUS) { $stati = array("student", "staff member", "guest", "alumni"); foreach ($stati as $status) { $content->setCurrentBlock("BLOCK_STATUS"); $content->setVariable("VALUE_STATUS", $status); if ($status === $user_profile["OBJ_DESC"]) { $content->setVariable("STATUS_SELECTED", 'selected="selected"'); } $content->setVariable("VALUE_STATUS_TRANSLATED", secure_gettext($status)); $content->parse("BLOCK_STATUS"); } } //TODO: TEMPLATE EDITIEREN if (ENABLED_GENDER) { $content->setVariable("GENDER_" . $this->safe_string($user_profile["USER_PROFILE_GENDER"], "X") . "_CHECKED", 'checked="checked"'); } $cache = get_cache_function("ORGANIZATION", 86400); if (ENABLED_FACULTY) { $faculties = $cache->call("lms_steam::get_faculties_asc"); $content->setVariable("LABEL_MISCELLANEOUS", gettext("miscellaneous")); foreach ($faculties as $faculty) { $content->setCurrentBlock("BLOCK_FACULTY"); $content->setVariable("FACULTY_ID", $faculty["OBJ_ID"]); if ($user_profile["USER_PROFILE_FACULTY"] == $faculty["OBJ_ID"]) { $content->setVariable("FACULTY_SELECTED", 'selected="selected"'); } $content->setVariable("FACULTY_NAME", $faculty["OBJ_NAME"]); $content->parse("BLOCK_FACULTY"); } } if (ENABLED_MAIN_FOCUS) { $content->setVariable("VALUE_FOCUS", $this->safe_string($user_profile["USER_PROFILE_FOCUS"])); } if (ENABLED_HOMETOWN) { $content->setVariable("VALUE_HOMETOWN", $this->safe_string($user_profile["USER_PROFILE_HOMETOWN"])); } if (ENABLED_WANTS) { $content->setVariable("VALUE_WANTS", $this->safe_string($user_profile["USER_PROFILE_WANTS"])); } if (ENABLED_HAVES) { $content->setVariable("VALUE_HAVES", $this->safe_string($user_profile["USER_PROFILE_HAVES"])); } if (ENABLED_OTHER_INTERESTS) { $content->setVariable("VALUE_OTHER_INTERESTS", $this->safe_string($user_profile["USER_PROFILE_OTHER_INTERESTS"])); } if (ENABLED_ORGANIZATIONS) { $content->setVariable("VALUE_ORGANIZATIONS", $this->safe_string($user_profile["USER_PROFILE_ORGANIZATIONS"])); } if (ENABLED_USER_DESC) { $content->setVariable("VALUE_USER_PROFILE_DSC", $this->safe_string($user_profile["USER_PROFILE_DSC"])); } if (ENABLED_EMAIL) { $content->setVariable("VALUE_EMAIL", $this->safe_string($user_profile["USER_EMAIL"])); } if (ENABLED_ADDRESS) { $content->setVariable("VALUE_ADDRESS", $this->safe_string($user_profile["USER_PROFILE_ADDRESS"])); } if (ENABLED_TELEPHONE) { $content->setVariable("VALUE_TELEPHONE", $this->safe_string($user_profile["USER_PROFILE_TELEPHONE"])); } if (ENABLED_PHONE_MOBILE) { $content->setVariable("VALUE_PHONE_MOBILE", $this->safe_string($user_profile["USER_PROFILE_PHONE_MOBILE"])); } if (ENABLED_WEBSITE) { $content->setVariable("VALUE_WEBSITE", $this->safe_string($user_profile["USER_PROFILE_WEBSITE_URI"])); $content->setVariable("VALUE_WEBSITE_NAME", $this->safe_string($user_profile["USER_PROFILE_WEBSITE_NAME"])); } if (ENABLED_ICQ_NUMBER || ENABLED_BID_IM) { $content->setVariable("VALUE_IM_ICQ", $this->safe_string($user_profile["USER_PROFILE_IM_ICQ"])); } if (ENABLED_SKYPE_NAME || ENABLED_BID_IM) { $content->setVariable("VALUE_IM_SKYPE", $this->safe_string($user_profile["USER_PROFILE_IM_SKYPE"])); } if (ENABLED_AIM_ALIAS || ENABLED_BID_IM) { $content->setVariable("VALUE_IM_AIM", $this->safe_string($user_profile["USER_PROFILE_IM_AIM"])); } if (ENABLED_MSN_IDENTIFICATION || ENABLED_BID_IM) { $content->setVariable("VALUE_IM_MSN", $this->safe_string($user_profile["USER_PROFILE_IM_MSN"])); } if (ENABLED_YAHOO_ID || ENABLED_BID_IM) { $content->setVariable("VALUE_IM_YAHOO", $this->safe_string($user_profile["USER_PROFILE_IM_YAHOO"])); } if (ENABLED_LANGUAGES) { // LANGUAGE if (TRUE) { // && !empty($user_profile["USER_LANGUAGE"]) ) { $ulang = $user_profile["USER_LANGUAGE"]; if (!is_string($ulang) || $ulang === "0") { $ulang = LANGUAGE_DEFAULT_STEAM; } $languages = array("english" => array("name" => gettext("English"), "icon" => "flag_gb.gif", "lang_key" => "en_US"), "german" => array("name" => gettext("German"), "icon" => "flag_de.gif", "lang_key" => "de_DE")); if (!array_key_exists($ulang, $languages)) { $ulang = LANGUAGE_DEFAULT_STEAM; } $content->setCurrentBlock("USER_LANGUAGE"); $content->setVariable("LABEL_LANGUAGES", gettext("Language")); foreach ($languages as $key => $language) { $content->setCurrentBlock("LANGUAGE"); $content->setVariable("LABEL_LANGUAGE_LABEL", "profile_language_" . $key); $content->setVariable("LANGUAGE_ICON", PATH_STYLE . "/images/" . $language["icon"]); $content->setVariable("LABEL_LANGUAGE", $language["name"]); $content->setVariable("LANGUAGE_VALUE", $key); if ($ulang == $key) { $content->setVariable("LANGUAGE_CHECKED", "checked=\"checked\""); } $content->parse("LANGUAGE"); } $content->parse("USER_LANGUAGE"); } } if (ENABLED_BID_LANGUAGE) { $content->setVariable("LABEL_LANGUAGES", gettext("Language")); if (trim($user_profile["USER_LANGUAGE"]) == trim("german")) { $content->setVariable("LANG1", "Deutsch"); $content->setVariable("LANG2", "English"); $content->setVariable("LANG3", "german"); $content->setVariable("LANG4", "english"); } else { $content->setVariable("LANG1", "English"); $content->setVariable("LANG2", "Deutsch"); $content->setVariable("LANG3", "english"); $content->setVariable("LANG4", "german"); } } if (ENABLED_BID_NAME) { $content->setVariable("LABEL_BID_NAME", gettext("name")); $completeName = $user_profile["USER_FIRSTNAME"] . " " . $user_profile["USER_FULLNAME"]; $content->setVariable("VALUE_USER_NAME_BID", $completeName); } if (ENABLED_BID_ADRESS) { $content->setVariable("LABEL_BID_ADDRESS", gettext("Address")); $content->setVariable("VALUE_BID_ADDRESS", $user->get_attribute("USER_ADRESS")); } if (ENABLED_BID_EMAIL) { $content->setVariable("LABEL_EMAIL_BID", gettext("E-Mail")); $content->setVariable("VALUE_EMAIL_BID", $user->get_attribute("USER_EMAIL")); } if (ENABLED_BID_PHONE) { $content->setVariable("LABEL_TELEPHONE_BID", "Telefon"); $content->setVariable("VALUE_TELEPHONE_BID", $user->get_attribute("bid:user_callto")); } //var_dump($user_profile);die; if (PLATFORM_ID == "bid") { $frameResponseObject->setHeadline(array(array("link" => PATH_URL . "home/", "name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME")), array("link" => PATH_URL . "profile/", "name" => gettext("Profile")), array("link" => "", "name" => "Profil ändern"))); } else { $frameResponseObject->setHeadline(array(array("link" => PATH_URL . "profile/index/" . $user->get_name() . "/", "name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME")), array("link" => "", "name" => gettext("Profile")))); } $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($rawHtml); /*$portal->set_page_main( array( array( "link" => PATH_URL . "profile/index/" . $user->get_name() . "/", "name" => $user->get_attribute( "USER_FIRSTNAME" ) . " " . $user->get_attribute( "USER_FULLNAME" ) ), array( "link" => "", "name" => gettext( "Profile" ) ) ), $content->get(), "" );*/ return $frameResponseObject; }
public static function UserProfile() { $xtpl = self::$xtpl; $cy = Country::getInstance(); $user = User::getInstance(); $profile = Profile::getInstance(); $xtpl->assign('SETCURR', 'current'); $xtpl->assign('CURRPROFILE', 'current'); if (self::$userid == NULL) { $xtpl->assign('ATTENTIONMSG', 'User ID is not set'); $xtpl->parse('main.attention'); } else { if ($profid = $profile->GetID(self::$userid, 'userid')) { $pe = $profile->FetchData($profid); $xtpl->assign('PROFILE', $pe); $xtpl->assign('DEFAULTS' . @$pe['sex'], 'selected="selected"'); } foreach ($cy->Listing() as $key => $value) { if (@$pe['country'] == $key) { $xtpl->assign('DEFAULT', 'selected="selected"'); } else { $xtpl->assign('DEFAULT', ''); } $xtpl->assign('ID', $key); $xtpl->assign('COUNTRYNAME', $value); $xtpl->parse('main.editprofile.countrylist'); } $xtpl->parse('main.editprofile'); } $xtpl->parse('main'); $xtpl->out('main'); }
/** * Get common groups between two users * * @param string $uid * @param string $pid * @return boolean */ public static function getCommonGroups($uid, $pid) { $uprofile = Profile::getInstance($uid); // Get the groups the visiting user $xgroups = is_object($uprofile) ? $uprofile->getGroups('all') : array(); $usersgroups = array(); if (!empty($xgroups)) { foreach ($xgroups as $group) { if ($group->regconfirmed) { $usersgroups[] = $group->cn; } } } // Get the groups of the profile $pprofile = Profile::getInstance($pid); $pgroups = is_object($pprofile) ? $pprofile->getGroups('all') : array(); // Get the groups the user has access to $profilesgroups = array(); if (!empty($pgroups)) { foreach ($pgroups as $group) { if ($group->regconfirmed) { $profilesgroups[] = $group->cn; } } } // Find the common groups $common = array_intersect($usersgroups, $profilesgroups); //return common groups return $common; }
/** * Handles downloaded data. * The function name is a bit of a misnomer, as it does not actually fetch the contents when using api_multi. This has been done ahead of time (unless we're using the old api() calls). * This function writes the downloaded content (json-ified, if it's not a Picture) into its respective output file, causes the new object to create its connections and add them to the queue. * @param $facebook A Facebook instance to use for fetching data. */ public function fetch($facebook) { // If the folder for our output files doesn't exist yet, create it if (!is_dir("../tmp/" . $facebook->getUnique())) { mkdir("../tmp/" . $facebook->getUnique()); } // Create a safe file name. Simply replaces all slashes, actually. //TODO: Write this platform-independent-safe $fname = Connection::createSafeName($facebook, $this->url); //$fname = $facebook->getUnique() . "/" .strtr($this->url, "/", "~") . ".request"; // Is this a Picture? If so, we don't process the content but simply write it into a file that has base64($url) as its filename. if ($this->type == 'Picture') { fprintf($facebook->getLogFd(), "Writing picture with filesize " . strlen($this->json) . "\n"); if (!file_exists("../tmp/" . $facebook->getUnique() . "/" . base64_encode($this->url))) { file_put_contents("../tmp/" . $facebook->getUnique() . "/" . base64_encode($this->url), $this->json); } return new Picture("", 0); } try { // Check if the file already exists; if so, throw an exception if (file_exists($fname)) { throw new Exception("File " . $fname . " already exists."); } // If json is empty, we haven't fetched any content yet, which means that we're using the old API. // So let's just use the old api() call. This one also does an implicit json_decode(), so we don't have to perform that anymore. if (strlen($this->json) < 1) { $this->json = $facebook->api($this->url); } else { $facebook->log("[RESPONSE] Response's json is larger than 0"); $this->json = json_decode($this->json, true); } // Check if the Graph API returned an error. if (isset($this->json['error'])) { //echo "fetch() FB Error:<br />"; //print_r($this->json); throw new Exception("fb error: " . json_encode($this->json['error'])); } } catch (Exception $e) { //echo "fetch() Exception occurred (" . $e->getMessage() . "), continuing anyway, handling as empty Picture"; //ob_flush(); //flush() $facebook->log("[ERROR] fetch() Exception occurred (" . $e->getMessage() . "), continuing anyway, handling as empty Picture"); // This "empty picture" is nearly an empty object. It has no connections and should therefore be completely neutral to the rest of the process. return new Picture("", 0); } // Open the output file for writing $facebook->log("[FILE] Creating file " . $fname); $fp = fopen($fname, "w"); // Write the json data - in text form - to the file //fwrite($fp, print_r($this->json, TRUE)); fwrite($fp, json_encode($this->json)); // Close the output file again. fclose($fp); if (isset($this->json['paging']) && isset($this->json['paging']['next'])) { $queue = new PriorityQueue(); $url = substr($this->json['paging']['next'], strpos($this->json['paging']['next'], "com/") + 4); $facebook->log("[DEBUG] Adding paging URL " . $url); $queue->unshift(new Connection($url, $this->depth, $this->type, true), 100); Facebook::getQueue()->merge($queue); } else { $facebook->log("[DEBUG] No paging or next"); } // If the data is not "right there" at the topmost level but nested in the data part, replace our internal variable with the actual payload. if (isset($this->json['data'])) { $this->json = $this->json['data']; } // Check if there are multiple objects stored in the received json if ($this->multiplicity) { $retval = array(); // Handle each object in json foreach ($this->json as $item) { // First, the two "meta-types" Profile and Taggable; they're not actual types, but they can determine which of their subtypes is the appropriate one with their static getInstance() method. if ($this->type == 'Profile') { array_push($retval, Profile::getInstance($item, $this->depth)); } else { if ($this->type == 'Taggable') { array_push($retval, Taggable::getInstance($item, $this->depth)); } else { // Slight PHP magic: $this->type is a string that contains a class name, i.e. we construct an object whose class name is specified by that field. array_push($retval, new $this->type($item, $this->depth)); } } if ($this->type == 'User') { $facebook->log('Created a user.'); } //$facebook->log(print_r($item)); } $fullnull = true; //Performing getConnections() now, adding everything into the big static queue // Also, we check if all getConnections() return NULL foreach ($retval as $item) { if (NULL != $item->getConnections()) { $fullnull = false; } } // All getConnections() have returned NULL, which means that the depth is too high (or deep?). So it's time for us to return NULL, too, in order to let the recursion end at this point (actually, it doesn't end, it just switches to a different part of the recursion tree). if ($fullnull) { return NULL; } // Return the array with all parsed objects return $retval; } else { // Same as before: Call getInstance for the meta-types, otherwise create an object with the type $this->type. if ($this->type == 'Profile') { $retval = Profile::getInstance($this->json, $this->depth); } else { if ($this->type == 'Taggable') { $retval = Taggable::getInstance($this->json, $this->depth); } else { $retval = new $this->type($this->json, $this->depth); } } //Performing getConnections() now, adding this element's connection into the big static queue if (NULL == $retval->getConnections()) { return NULL; } // Return the parsed object return $retval; } }
public function execute(\FrameResponseObject $frameResponseObject) { //var_dump($request); $current_user = \lms_steam::get_current_user(); //var_dump($current_user);die; $name = $this->id; if ($name != "") { //$userName = $path[2]; $user = \steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $name); } else { $user = $current_user; } $login = $user->get_name(); $cache = get_cache_function($login, 3600); //$portal = \lms_portal::get_instance(); //$portal->set_page_title( $login ); $user_profile = $cache->call("lms_steam::user_get_profile", $login); $html_handler_profile = new \koala_html_profile($user); $html_handler_profile->set_context("profile"); $GLOBALS["content"] = \Profile::getInstance()->loadTemplate("profile_display.template.html"); //$content = new HTML_TEMPLATE_IT(); //$content->loadTemplateFile( PATH_TEMPLATES . "profile_display.template.html" ); if (!empty($user_profile["USER_PROFILE_DSC"])) { $GLOBALS["content"]->setVariable("HTML_CODE_DESCRIPTION", "<p>" . get_formatted_output($user_profile["USER_PROFILE_DSC"]) . "</p>"); } if (!empty($user_profile["USER_PROFILE_WEBSITE_URI"])) { $website_name = h(empty($user_profile["USER_PROFILE_WEBSITE_NAME"]) ? $user_profile["USER_PROFILE_WEBSITE_URI"] : $user_profile["USER_PROFILE_WEBSITE_NAME"]); $GLOBALS["content"]->setVariable("HTML_CODE_PERSONAL_WEBSITE", "<br/><b>" . gettext("Website") . ":</b> <a href=\"" . h($user_profile["USER_PROFILE_WEBSITE_URI"]) . "\" target=\"_blank\">{$website_name}</a>"); } //get Buddys from user and put them into the $globals-Array for authorization-query $confirmed = $user->get_id() != $current_user->get_id() ? TRUE : FALSE; $contacts = $cache->call("lms_steam::user_get_buddies", $login, $confirmed); $tmp = array(); foreach ($contacts as $contact) { $tmp[] = $contact["OBJ_ID"]; } $GLOBALS["contact_ids"] = $tmp; //get Viewer-Authorization and put them into the $globals-Array for authorization-query $user_privacy = $cache->call("lms_steam::user_get_profile_privacy", $user->get_name()); $GLOBALS["authorizations"] = $user_privacy; $GLOBALS["current user"] = $current_user; //$GLOBALS["content"] = $content; /////////////////////////////////////////////////// ////////////// GENERAL INFORMATION ////////////// /////////////////////////////////////////////////// // Status if (ENABLED_BID_DESCIPTION) { $user_profile_desc = $user_profile["OBJ_DESC"]; $status = secure_gettext($user_profile_desc); if ($status != "" && !is_integer($status)) { $this->display("GENERAL", "Beschreibung", $status); } } if (ENABLED_STATUS) { $user_profile_desc = empty($user_profile["OBJ_DESC"]) ? "student" : $user_profile["OBJ_DESC"]; $status = secure_gettext($user_profile_desc); $this->display("GENERAL", "Status", $status); } if (ENABLED_EMAIL) { $user_email = empty($user_profile["USER_EMAIL"]) ? "keine E-Mail-Adresse gesetzt" : $user_profile["USER_EMAIL"]; $this->display("GENERAL", "E-Mail-Adresse", h($user_email)); } if (ENABLED_BID_EMAIL) { $helper = empty($user_profile["USER_EMAIL"]) ? true : false; $user_email = empty($user_profile["USER_EMAIL"]) ? "keine E-Mail-Adresse gesetzt" : $user_profile["USER_EMAIL"]; if ($helper) { $this->display("GENERAL", "E-Mail", h($user_email)); } else { $mail = h($user_profile["USER_EMAIL"]); $mail1 = '<a href="mailto:' . $mail . '">' . $mail . '</a>'; //var_dump($mail1);die; $this->display("GENERAL", "E-Mail", $mail1); } } // Gender if (ENABLED_GENDER) { switch (is_string($user_profile["USER_PROFILE_GENDER"]) ? $user_profile["USER_PROFILE_GENDER"] : "X") { case "F": $gender = gettext("female"); break; case "M": $gender = gettext("male"); break; default: $gender = gettext("rather not say"); break; } $this->display("GENERAL", "Gender", $gender); } // Origin - Faculty if (ENABLED_FACULTY) { $faculty = \lms_steam::get_faculty_name($user_profile["USER_PROFILE_FACULTY"]); $this->display("GENERAL", "Origin", $faculty); } if (ENABLED_WANTS) { $this->display("GENERAL", "Wants", h($user_profile["USER_PROFILE_WANTS"])); } if (ENABLED_HAVES) { $this->display("GENERAL", "Haves", h($user_profile["USER_PROFILE_HAVES"])); } if (ENABLED_ORGANIZATIONS) { $this->display("GENERAL", "Organizations", h($user_profile["USER_PROFILE_ORGANIZATIONS"])); } if (ENABLED_HOMETOWN) { $this->display("GENERAL", "Hometown", h($user_profile["USER_PROFILE_HOMETOWN"])); } if (ENABLED_MAIN_FOCUS) { $this->display("GENERAL", "Main focus", h($user_profile["USER_PROFILE_FOCUS"])); } if (ENABLED_OTHER_INTERESTS) { $this->display("GENERAL", "Other interests", h($user_profile["USER_PROFILE_OTHER_INTERESTS"])); } // LANGUAGE if (ENABLED_BID_LANGUAGE) { $this->display("GENERAL", "Language", $user_profile["USER_LANGUAGE"]); } if (ENABLED_LANGUAGES) { $languages = array("english" => array("name" => gettext("English"), "icon" => "flag_gb.gif", "lang_key" => "en_US"), "german" => array("name" => gettext("German"), "icon" => "flag_de.gif", "lang_key" => "de_DE")); $ulang = $user_profile["USER_LANGUAGE"]; if (!is_string($ulang) || $ulang === "0") { $ulang = LANGUAGE_DEFAULT_STEAM; } if (!array_key_exists($ulang, $languages)) { $ulang = LANGUAGE_DEFAULT_STEAM; } $language_string = ""; foreach ($languages as $key => $language) { if ($ulang == $key) { $language_string .= "<img class=\"flag\" src=\"" . PATH_EXTENSIONS . "/profile/asset/icons/images/" . $language["icon"] . "\" title=\"" . $language["name"] . "\" />"; } } $this->display("GENERAL", "Language", $language_string); } if ($this->GENERAL_displayed) { $GLOBALS["content"]->setVariable("HEADER_GENERAL_INFORMATION", gettext("General Information")); } /////////////////////////////////////////////////// /////////////// CONTACTS & GROUPS /////////////// /////////////////////////////////////////////////// // CONTACTS if (ENABLED_CONTACTS) { $html_code_contacts = ""; $max_contacts = $counter = 25; if (count($contacts) > 0) { foreach ($contacts as $id => $contact) { if ($counter > 0) { $title = !empty($contact["USER_ACADEMIC_TITLE"]) ? $contact["USER_ACADEMIC_TITLE"] . " " : ""; $html_code_contacts .= "<a href=\"" . PATH_URL . "profile/" . $contact["OBJ_NAME"] . "/\">" . $title . $contact["USER_FIRSTNAME"] . " " . $contact["USER_FULLNAME"] . "</a>"; $html_code_contacts .= $id == count($contacts) - 1 || $counter == 1 ? "" : ", "; $counter--; } else { $html_code_contacts .= " <a href=\"" . PATH_URL . "profile/{$login}/contacts/\">(" . gettext("more") . "...)</a>"; break; } } } else { $html_code_contacts = gettext("No contacts yet."); } $this->display("CONTACTS_AND_GROUPS", "Contacts", $html_code_contacts); } if (ENABLED_GROUPS) { // GROUPS $public = $user->get_id() != $current_user->get_id() ? TRUE : FALSE; $groups = $cache->call("lms_steam::user_get_groups", $login, $public); $html_code_groups = ""; $max_groups = $counter = 25; if (count($groups) > 0) { usort($groups, "sort_objects"); foreach ($groups as $id => $group) { if ($counter > 0) { $html_code_groups .= "<a href=\"" . PATH_URL . "groups/" . $group["OBJ_ID"] . "/\">" . h($group["OBJ_NAME"]) . "</a>"; $html_code_groups .= $id == count($groups) - 1 || $counter == 1 ? "" : ", "; $counter--; } else { $html_code_groups .= " <a href=\"" . PATH_URL . "profile/{$login}/groups/\">(" . gettext("more") . "...)</a>"; break; } } } else { $html_code_groups = gettext("No memberships yet."); } $this->display("CONTACTS_AND_GROUPS", "Groups", $html_code_groups); } if ($this->CONTACTS_AND_GROUPS_displayed) { $GLOBALS["content"]->setVariable("HEADER_CONTACTS_AND_GROUPS", gettext("Contacts and Groups")); } ///////////////////////////////////////////////////// /////////////// CONTACT INFORMATION /////////////// ///////////////////////////////////////////////////// $is_buddy = $user->is_buddy($current_user) || $user->get_id() == $current_user->get_id() ? TRUE : FALSE; if (ENABLED_EMAIL) { $mail = h($user_profile["USER_EMAIL"]); $mail1 = '<a href="mailto:"' . $mail . '">' . $mail . '</a>'; $this->display("CONTACT_DATA", "E-mail", $mail1, $is_buddy); } if (ENABLED_ADDRESS) { $adress = h($user_profile["USER_PROFILE_ADDRESS"]); $this->display("CONTACT_DATA", "Address", $adress, $is_buddy); } if (ENABLED_BID_ADRESS) { $adress = h($user_profile["USER_PROFILE_ADDRESS"]); if (isset($adress) && !is_integer($adress) && trim($adress) != "") { $this->display("GENERAL", "Address", h($user_profile["USER_ADRESS"]), $is_buddy); } } if (ENABLED_TELEPHONE) { $this->display("CONTACT_DATA", "Telephone", h($user_profile["USER_PROFILE_TELEPHONE"]), $is_buddy); } if (ENABLED_BID_PHONE) { $phone = h($user_profile["bid:user_callto"]); if (isset($phone) && $phone != 0 && $phone != "") { $phone1 = '<a href="callto:' . $phone . '">' . $phone . '</a>'; $this->display("GENERAL", "Telefon", $phone1, $is_buddy); } } if (ENABLED_PHONE_MOBILE) { $this->display("CONTACT_DATA", "Phone, mobile", h($user_profile["USER_PROFILE_PHONE_MOBILE"]), $is_buddy); } // Website $website_name = $user_profile["USER_PROFILE_WEBSITE_NAME"]; $website_uri = $user_profile["USER_PROFILE_WEBSITE_URI"]; if (empty($website_name)) { $website_name = $website_uri; } $website_link = empty($website_name) ? '' : '<a target="_blank" href="' . h($website_uri) . '">' . h($website_name) . '</a>'; if (ENABLED_WEBSITE) { $this->display("CONTACT_DATA", gettext("Website"), $website_link); } if (ENABLED_ICQ_NUMBER || ENABLED_BID_IM) { $icq = h($user_profile["USER_PROFILE_IM_ICQ"]); if (isset($icq) && $icq !== 0 && $icq != "") { $icq1 = '<a href="http://www.icq.com/whitepages/cmd.php?uin=' . $icq . '&action=add">' . $icq . '</a>'; $this->display("CONTACT_DATA", "ICQ number", $icq1); } } if (ENABLED_MSN_IDENTIFICATION || ENABLED_BID_IM) { $msn = h($user_profile["USER_PROFILE_IM_MSN"]); if (isset($msn) && $msn !== 0 && $msn != "") { $msn1 = '<a href="http://members.msn.com/' . $msn . '">' . $msn . '</a>'; $this->display("CONTACT_DATA", "MSN identification", $msn1); } } // AIM if (ENABLED_AIM_ALIAS || ENABLED_BID_IM) { if (!empty($user_profile["USER_PROFILE_IM_AIM"])) { $aim_alias = h($user_profile["USER_PROFILE_IM_AIM"]); if (isset($aim_alias) && $aim_alias !== 0 && $aim_alias != "") { $aim = "<a href=\"aim:" . $aim_alias . "\">" . $aim_alias . "</a>"; $this->display("CONTACT_DATA", "AIM-alias", $aim); } //$aim = "<span id=\"USER_PROFILE_IM_AIM\"><a href=\"{VALUE_AIM_LINK}\">{VALUE_AIM_ALIAS}</a></span>"; } } if (ENABLED_YAHOO_ID || ENABLED_BID_IM) { $yahoo = h($user_profile["USER_PROFILE_IM_YAHOO"]) !== 0 ? h($user_profile["USER_PROFILE_IM_YAHOO"]) : ""; if (isset($yahoo) && $yahoo !== 0 && $yahoo != "") { $this->display("CONTACT_DATA", "Yahoo-ID", $yahoo); } } // Skype if (ENABLED_SKYPE_NAME || ENABLED_BID_IM) { if (!empty($user_profile["USER_PROFILE_IM_SKYPE"])) { $skype_alias = h($user_profile["USER_PROFILE_IM_SKYPE"]); if (isset($skype_alias) && $skype_alias !== 0 && $skype_alias != "") { $skype = "<a href=\"skype:" . $skype_alias . "\">" . $skype_alias . "</a>"; } $this->display("CONTACT_DATA", "Skype name", $skype); } } $GLOBALS["content"] = $GLOBALS["content"]; if ($this->CONTACT_DATA_displayed) { $GLOBALS["content"]->setVariable("HEADER_CONTACT_DATA", gettext("Contact Data")); } $GLOBALS["content"]->setVariable("PATH_JAVASCRIPT", PATH_JAVASCRIPT); $GLOBALS["content"]->setVariable("KOALA_VERSION", KOALA_VERSION); $GLOBALS["content"]->setVariable("USER_LOGIN", $login); $html_handler_profile->set_html_left($GLOBALS["content"]->get()); $frameResponseObject->setHeadline($html_handler_profile->get_headline()); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($html_handler_profile->get_html()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; }
public function execute(\FrameResponseObject $frameResponseObject) { //$portal = \lms_portal::get_instance(); //$portal->initialize( GUEST_NOT_ALLOWED ); //$portal->set_page_title( gettext( "Buddy Icon" ) ); $user = \lms_steam::get_current_user(); $confirmText = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $problem = ""; $hint = ""; if (isset($_POST["action"]) && $_POST["action"] == "deleteicon") { // need to set OBJ_ICON to "0" and then to icons module to avoid weird // effects in icon handling (server side fix done but not testedyet) $old_icon = $user->get_attribute("OBJ_ICON"); $user->set_acquire_attribute("OBJ_ICON", 0); $user->set_attribute("OBJ_ICON", 0); // set the default user icon by acquiring OBJ_ICON from icons module $user->set_acquire_attribute("OBJ_ICON", $GLOBALS["STEAM"]->get_module("icons")); // delete previous user icon object if ($old_icon instanceof steam_document) { if ($old_icon->get_path() != "/images/doctypes/user_unknown.jpg" && $old_icon->check_access_write($user)) { $this->clean_iconcache($old_icon); $old_icon->delete(); } } $confirmText = gettext("Your profile icon has been deleted."); $this->clean_usericoncache($user); } else { // upload new icon if (count($_FILES) == 0) { $problem = gettext("No image specified.") . " "; $hint = gettext("Please choose an image on your local disk to upload.") . " "; } if (strpos($_FILES["icon"]["type"], "image") === FALSE) { $problem .= gettext("File is not an image.") . " "; $hint .= gettext("The icon has to be an image file (JPG, GIF or PNG)."); } if ((int) $_FILES["icon"]["size"] > 256000) { $problem .= gettext("File is larger than 250 KByte."); $hint .= gettext("It is only allowed to upload profile icons with file size smaller than 250 KByte."); } if (empty($problem)) { $user->set_acquire_attribute("OBJ_ICON", 0); $user->delete_value("OBJ_ICON"); $old_icon = $user->get_attribute("OBJ_ICON"); ob_start(); readfile($_FILES["icon"]["tmp_name"]); $content = ob_get_contents(); ob_end_clean(); $filename = str_replace(array("\\", "'"), array("", ""), $_FILES["icon"]["name"]); if ($old_icon instanceof steam_document && $old_icon->check_access_write($user)) { $new_icon = $old_icon; $new_icon->set_attribute("OBJ_NAME", $filename); $new_icon->set_content($content); $new_icon->set_attribute("DOC_MIME_TYPE", $_FILES["icon"]["type"]); } else { $new_icon = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $filename, $content, $_FILES["icon"]["type"], FALSE); $new_icon->set_attribute("OBJ_TYPE", "document_icon_usericon"); } $user->set_attribute("OBJ_ICON", $new_icon); $all_user = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "sTeam"); $new_icon->set_read_access($all_user); $GLOBALS["STEAM"]->buffer_flush(); // clean cache-related data $this->clean_usericoncache($user); $confirmText = gettext("Your profile icon has been changed."); } else { $frameResponseObject->setProblemDescription($problem); } } } $content = \Profile::getInstance()->loadTemplate("profile_icon.template.html"); //$content = new \HTML_TEMPLATE_IT(); //$content->loadTemplateFile( PATH_TEMPLATES . "profile_icon.template.html" ); //$content->setVariable( "INFO_TEXT", gettext( "Your buddy icon is what we use to represent you when you're in koaLA." ) ); if (PLATFORM_ID == "bid") { $content->setVariable("INFO_TEXT", "Hier können Sie ein Benutzerbild hinterlegen. Dieses wird beispielsweise an Ihren Dokumenten und Forenbeiträgen zusammen mit Ihrem Namen angezeigt."); } else { $content->setVariable("INFO_TEXT", "Das Benutzerbild wird Sie in " . PLATFORM_NAME . " repräsentieren"); } $content->setVariable("WINDOW_CONFIRM_TEXT", gettext("Are you sure you want to delete your current buddy icon?")); $content->setVariable("LABEL_DELETE", gettext("DELETE")); $user->delete_value("OBJ_ICON"); $icon = $user->get_attribute("OBJ_ICON"); if ($icon instanceof \steam_object) { $icon_id = $icon->get_id(); // if user icon is acquired (= default icon) hide the delete button if (is_object($user->get_acquire_attribute("OBJ_ICON"))) { $content->setVariable("HIDE_BUTTON", "style='display:none;'"); } } else { $icon_id = 0; $content->setVariable("HIDE_BUTTON", "style='display:none;'"); } // use it in 140x185 standard thumb size to optimize sharing of icon cache data $icon_link = $icon_id == 0 ? PATH_URL . "styles/standard/images/anonymous.jpg" : PATH_URL . "download/image/" . $icon_id . "/140/185"; $content->setVariable("USER_IMAGE", $icon_link); $content->setVariable("LABEL_YOUR_BUDDY_ICON", gettext("This is your buddy icon at the moment.")); $content->setVariable("LABEL_REPLACE", gettext("Replace with an image")); $content->setVariable("LABEL_UPLOAD_INFO", gettext("The uploaded file has to be an image file (JPG, GIF or PNG), should have the dimensions of 140 x 185 pixels and <b>may not be larger than 250 KByte</b>. ")); $content->setVariable("LABEL_UPLOAD", gettext("Upload")); if (PLATFORM_ID == "bid") { $breadcrumb = array(array("name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), "link" => PATH_URL . "home"), array("name" => gettext("Profile"), "link" => PATH_URL . "profile/"), array("name" => gettext("Your buddy icon"))); } else { $breadcrumb = array(array("name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), "link" => PATH_URL . "profile/" . "index/" . $user->get_name() . "/"), array("name" => gettext("Profile"), "link" => PATH_URL . "profile/index/" . $user->get_name() . "/"), array("name" => gettext("Your buddy icon"))); } $frameResponseObject->setHeadline($breadcrumb); $frameResponseObject->setConfirmText($confirmText); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; //$portal->set_page_main($breadcrumb, $content->get(), ""); //return $portal->get_html(); }
public function execute(\FrameResponseObject $frameResponseObject) { //$portal = \lms_portal::get_instance(); //$portal->initialize( GUEST_NOT_ALLOWED ); //$portal->set_page_title( gettext( "Profile Privacy" ) ); $user = \lms_steam::get_current_user(); $cache = get_cache_function($user->get_name(), 86400); $user_privacy = $cache->call("\\lms_steam::user_get_profile_privacy", $user->get_name(), TRUE); if ($_SERVER["REQUEST_METHOD"] == "POST") { $binary_values = array(); $binary_values["PRIVACY_STATUS"] = $this->state_to_binary($_POST["status"]); $binary_values["PRIVACY_GENDER"] = $this->state_to_binary($_POST["gender"]); $binary_values["PRIVACY_FACULTY"] = $this->state_to_binary($_POST["faculty"]); $binary_values["PRIVACY_MAIN_FOCUS"] = $this->state_to_binary($_POST["main_focus"]); $binary_values["PRIVACY_WANTS"] = $this->state_to_binary($_POST["wants"]); $binary_values["PRIVACY_HAVES"] = $this->state_to_binary($_POST["haves"]); $binary_values["PRIVACY_ORGANIZATIONS"] = $this->state_to_binary($_POST["organizations"]); $binary_values["PRIVACY_HOMETOWN"] = $this->state_to_binary($_POST["hometown"]); $binary_values["PRIVACY_OTHER_INTERESTS"] = $this->state_to_binary($_POST["other_interests"]); $binary_values["PRIVACY_LANGUAGES"] = $this->state_to_binary($_POST["languages"]); $binary_values["PRIVACY_CONTACTS"] = $this->state_to_binary($_POST["contacts"]); $binary_values["PRIVACY_GROUPS"] = $this->state_to_binary($_POST["groups"]); $binary_values["PRIVACY_EMAIL"] = $this->state_to_binary($_POST["email"]); $binary_values["PRIVACY_ADDRESS"] = $this->state_to_binary($_POST["address"]); $binary_values["PRIVACY_TELEPHONE"] = $this->state_to_binary($_POST["telephone"]); $binary_values["PRIVACY_PHONE_MOBILE"] = $this->state_to_binary($_POST["phone_mobile"]); $binary_values["PRIVACY_WEBSITE"] = $this->state_to_binary($_POST["website"]); $binary_values["PRIVACY_ICQ_NUMBER"] = $this->state_to_binary($_POST["icq_number"]); $binary_values["PRIVACY_MSN_IDENTIFICATION"] = $this->state_to_binary($_POST["msn_identification"]); $binary_values["PRIVACY_AIM_ALIAS"] = $this->state_to_binary($_POST["aim_alias"]); $binary_values["PRIVACY_YAHOO_ID"] = $this->state_to_binary($_POST["yahoo_id"]); $binary_values["PRIVACY_SKYPE_NAME"] = $this->state_to_binary($_POST["skype_name"]); $privacy_object = $user->get_attribute("KOALA_PRIVACY"); if (!$privacy_object instanceof \steam_object) { $privacy_object = \steam_factory::create_object($GLOBALS["STEAM"]->get_id(), "privacy profile", CLASS_OBJECT); if (!$privacy_object instanceof \steam_object) { throw new \Exception("Error creating Privacy-Proxy-Object", E_USER_NO_PRIVACYPROFILE); } $user->set_attribute("KOALA_PRIVACY", $privacy_object); $privacy_object->set_acquire($user); } $privacy_object->set_attributes($binary_values); /* require_once( "Cache/Lite.php" ); $cache = new Cache_Lite( array( "cacheDir" => PATH_CACHE ) ); $cache->clean( $user->get_name() ); $cache->clean( $user->get_id() ); */ $cache = get_cache_function(\lms_steam::get_current_user()->get_name()); $cache->drop("\\lms_portal::get_menu_html", \lms_steam::get_current_user()->get_name(), TRUE); $cache = get_cache_function($user->get_name()); $cache->drop("\\lms_steam::user_get_profile_privacy", $user->get_name(), TRUE); $_SESSION["confirmation"] = gettext("Your profile data has been saved."); header("Location: " . PATH_URL . "profile/privacy/" . $user->get_name()); } $content = \Profile::getInstance()->loadTemplate("profile_privacy.template.html"); //$content = new HTML_TEMPLATE_IT(); //$content->loadTemplateFile( PATH_TEMPLATES . "profile_privacy.template.html" ); if (ENABLED_CONTACTS_GROUPS_TITLE) { $content->setVariable("HEADER_CONTACTS_AND_GROUPS", gettext("Contacts and Groups")); } if (ENABLED_CONTACTS_TITLE) { $content->setVariable("HEADER_CONTACT_DATA", gettext("Contact Data")); } $content->setVariable("INFO_TEXT", gettext("Here you can set which persons can see what information on your profile page.")); $content->setVariable("LABEL_ALLUSERS", gettext("All Users")); if (PLATFORM_ID == "bid") { $content->setVariable("LABEL_CONTACTS", "Favoriten"); } if (ENABLED_CONTACTS) { //$labelContacts = gettext( "Contacts" ); if (ENABLED_PROFILE_TITLE) { $content->setVariable("LABEL_CONTACTS", gettext("Contacts")); } } //$content->setVariable( "LABEL_COURSEMATES", gettext( "Course Mates" ) ); //$content->setVariable( "LABEL_GROUPMATES", gettext( "Group Mates" ) ); if (ENABLED_STATUS) { //$labelStatus = gettext("Status"); $content->setVariable("LABEL_STATUS", gettext("Status")); } if (ENABLED_BID_DESCIPTION) { $content->setVariable("LABEL_STATUS", "Beschreibung"); } if (ENABLED_GENDER) { //$labelGender = gettext( "Gender" ); $content->setVariable("LABEL_GENDER", gettext("Gender")); } if (ENABLED_FACULTY) { //$labelFaculty = gettext( "Origin" ); $content->setVariable("LABEL_FACULTY", gettext("Origin")); } if (ENABLED_MAIN_FOCUS) { //$labelMainFocus = gettext( "Main focus" ); $content->setVariable("LABEL_MAIN_FOCUS", gettext("Main focus")); } if (ENABLED_WANTS) { //$labelWants = gettext( "Wants" ); $content->setVariable("LABEL_WANTS", gettext("Wants")); } if (ENABLED_HAVES) { //$labelHaves = gettext("Haves"); $content->setVariable("LABEL_HAVES", gettext("Haves")); } if (ENABLED_ORGANIZATIONS) { //$labelOrganizations = gettext( "Organizations" ); $content->setVariable("LABEL_ORGANIZATIONS", gettext("Organizations")); } if (ENABLED_HOMETOWN) { //$labelHometown = gettext( "Hometown" ); $content->setVariable("LABEL_HOMETOWN", gettext("Hometown")); } if (ENABLED_OTHER_INTERESTS) { //$labelOtherInterests = gettext( "Other interests" ); $content->setVariable("LABEL_OTHER_INTERESTS", gettext("Other interests")); } if (ENABLED_LANGUAGES) { //$labelLanguages = gettext( "Language" ); $content->setVariable("LABEL_LANGUAGES", gettext("Language")); } //$content->setVariable( "LABEL_CONTACTS", gettext( "Contacts" ) ); -> siehe oben if (ENABLED_GROUPS) { //$labelGroups = gettext( "Groups" ); $content->setVariable("LABEL_GROUPS", gettext("Groups")); } if (ENABLED_EMAIL || ENABLED_BID_EMAIL) { //$labelMail = gettext( "E-mail" ); $content->setVariable("LABEL_EMAIL", gettext("E-mail")); } if (ENABLED_ADDRESS || ENABLED_BID_ADRESS) { //$labelAdress = gettext( "Address" ); $content->setVariable("LABEL_ADDRESS", gettext("Address")); } if (ENABLED_TELEPHONE || ENABLED_BID_PHONE) { //$labelTelephone = gettext( "Phone" ); $content->setVariable("LABEL_TELEPHONE", gettext("Phone")); } if (ENABLED_PHONE_MOBILE) { //$labelPhoneMobile = gettext( "Phone, mobile" ); $content->setVariable("LABEL_PHONE_MOBILE", gettext("Phone, mobile")); } if (ENABLED_WEBSITE) { //$labelWebsite = gettext( "Website" ); $content->setVariable("LABEL_WEBSITE", gettext("Website")); } if (ENABLED_ICQ_NUMBER || ENABLED_BID_IM) { //$labelIcqNumber = gettext( "ICQ number" ); $content->setVariable("LABEL_ICQ_NUMBER", gettext("ICQ number")); } if (ENABLED_MSN_IDENTIFICATION || ENABLED_BID_IM) { //$labelMsnIdentification = gettext( "MSN identification" ); $content->setVariable("LABEL_MSN_IDENTIFICATION", gettext("MSN identification")); } if (ENABLED_AIM_ALIAS || ENABLED_BID_IM) { //$labelAimAlias = gettext( "AIM-alias" ); $content->setVariable("LABEL_AIM_ALIAS", gettext("AIM-alias")); } if (ENABLED_YAHOO_ID || ENABLED_BID_IM) { //$labelYahooId = gettext( "Yahoo-ID" ); $content->setVariable("LABEL_YAHOO_ID", gettext("Yahoo-ID")); } if (ENABLED_SKYPE_NAME || ENABLED_BID_IM) { //$labelSkypeName = gettext( "Skype name" ); $content->setVariable("LABEL_SKYPE_NAME", gettext("Skype name")); } $content->setVariable("LABEL_SAVE_IT", gettext("Save changes")); //TODO: Bei Bedarf wieder einbauen! //$content->setVariable( "BACK_LINK", "<a href=\"" . PATH_URL . "profile/index/" . $user->get_name() . "/\">" . gettext( "back to your user profile" ) . "</a>" ); $deny_all = PROFILE_DENY_ALLUSERS + PROFILE_DENY_CONTACTS; if (ENABLED_STATUS || ENABLED_BID_DESCIPTION) { isset($user_privacy["PRIVACY_STATUS"]) ? $this->set_checkbox("STATUS", $user_privacy["PRIVACY_STATUS"], $content) : $this->set_checkbox("STATUS", $deny_all, $content); } if (ENABLED_GENDER) { isset($user_privacy["PRIVACY_GENDER"]) ? $this->set_checkbox("GENDER", $user_privacy["PRIVACY_GENDER"], $content) : $this->set_checkbox("GENDER", $deny_all, $content); } if (ENABLED_FACULTY) { isset($user_privacy["PRIVACY_FACULTY"]) ? $this->set_checkbox("FACULTY", $user_privacy["PRIVACY_FACULTY"], $content) : $this->set_checkbox("FACULTY", $deny_all, $content); } if (ENABLED_MAIN_FOCUS) { isset($user_privacy["PRIVACY_MAIN_FOCUS"]) ? $this->set_checkbox("MAIN_FOCUS", $user_privacy["PRIVACY_MAIN_FOCUS"], $content) : $this->set_checkbox("MAIN_FOCUS", $deny_all, $content); } if (ENABLED_WANTS) { isset($user_privacy["PRIVACY_WANTS"]) ? $this->set_checkbox("WANTS", $user_privacy["PRIVACY_WANTS"], $content) : $this->set_checkbox("WANTS", $deny_all, $content); } if (ENABLED_HAVES) { isset($user_privacy["PRIVACY_HAVES"]) ? $this->set_checkbox("HAVES", $user_privacy["PRIVACY_HAVES"], $content) : $this->set_checkbox("HAVES", $deny_all, $content); } if (ENABLED_ORGANIZATIONS) { isset($user_privacy["PRIVACY_ORGANIZATIONS"]) ? $this->set_checkbox("ORGANIZATIONS", $user_privacy["PRIVACY_ORGANIZATIONS"], $content) : $this->set_checkbox("ORGANIZATIONS", $deny_all, $content); } if (ENABLED_HOMETOWN) { isset($user_privacy["PRIVACY_HOMETOWN"]) ? $this->set_checkbox("HOMETOWN", $user_privacy["PRIVACY_HOMETOWN"], $content) : $this->set_checkbox("HOMETOWN", $deny_all, $content); } if (ENABLED_OTHER_INTERESTS) { isset($user_privacy["PRIVACY_OTHER_INTERESTS"]) ? $this->set_checkbox("OTHER_INTERESTS", $user_privacy["PRIVACY_OTHER_INTERESTS"], $content) : $this->set_checkbox("OTHER_INTERESTS", $deny_all, $content); } if (ENABLED_LANGUAGES) { isset($user_privacy["PRIVACY_LANGUAGES"]) ? $this->set_checkbox("LANGUAGES", $user_privacy["PRIVACY_LANGUAGES"], $content) : $this->set_checkbox("LANGUAGES", $deny_all, $content); } if (ENABLED_CONTACTS) { isset($user_privacy["PRIVACY_CONTACTS"]) ? $this->set_checkbox("CONTACTS", $user_privacy["PRIVACY_CONTACTS"], $content) : $this->set_checkbox("CONTACTS", $deny_all, $content); } if (ENABLED_GROUPS) { isset($user_privacy["PRIVACY_GROUPS"]) ? $this->set_checkbox("GROUPS", $user_privacy["PRIVACY_GROUPS"], $content) : $this->set_checkbox("GROUPS", $deny_all, $content); } if (ENABLED_EMAIL || ENABLED_BID_EMAIL) { isset($user_privacy["PRIVACY_EMAIL"]) ? $this->set_checkbox("EMAIL", $user_privacy["PRIVACY_EMAIL"], $content) : $this->set_checkbox("EMAIL", $deny_all, $content); } if (ENABLED_ADDRESS || ENABLED_BID_ADRESS) { isset($user_privacy["PRIVACY_ADDRESS"]) ? $this->set_checkbox("ADDRESS", $user_privacy["PRIVACY_ADDRESS"], $content) : $this->set_checkbox("ADDRESS", $deny_all, $content); } if (ENABLED_TELEPHONE || ENABLED_BID_PHONE) { isset($user_privacy["PRIVACY_TELEPHONE"]) ? $this->set_checkbox("TELEPHONE", $user_privacy["PRIVACY_TELEPHONE"], $content) : $this->set_checkbox("TELEPHONE", $deny_all, $content); } if (ENABLED_PHONE_MOBILE) { isset($user_privacy["PRIVACY_PHONE_MOBILE"]) ? $this->set_checkbox("PHONE_MOBILE", $user_privacy["PRIVACY_PHONE_MOBILE"], $content) : $this->set_checkbox("PHONE_MOBILE", $deny_all, $content); } if (ENABLED_WEBSITE) { isset($user_privacy["PRIVACY_WEBSITE"]) ? $this->set_checkbox("WEBSITE", $user_privacy["PRIVACY_WEBSITE"], $content) : $this->set_checkbox("WEBSITE", $deny_all, $content); } if (ENABLED_ICQ_NUMBER || ENABLED_BID_IM) { isset($user_privacy["PRIVACY_ICQ_NUMBER"]) ? $this->set_checkbox("ICQ_NUMBER", $user_privacy["PRIVACY_ICQ_NUMBER"], $content) : $this->set_checkbox("ICQ_NUMBER", $deny_all, $content); } if (ENABLED_MSN_IDENTIFICATION || ENABLED_BID_IM) { isset($user_privacy["PRIVACY_MSN_IDENTIFICATION"]) ? $this->set_checkbox("MSN_IDENTIFICATION", $user_privacy["PRIVACY_MSN_IDENTIFICATION"], $content) : $this->set_checkbox("MSN_IDENTIFICATION", $deny_all, $content); } if (ENABLED_AIM_ALIAS || ENABLED_BID_IM) { isset($user_privacy["PRIVACY_AIM_ALIAS"]) ? $this->set_checkbox("AIM_ALIAS", $user_privacy["PRIVACY_AIM_ALIAS"], $content) : $this->set_checkbox("AIM_ALIAS", $deny_all, $content); } if (ENABLED_YAHOO_ID || ENABLED_BID_IM) { isset($user_privacy["PRIVACY_YAHOO_ID"]) ? $this->set_checkbox("YAHOO_ID", $user_privacy["PRIVACY_YAHOO_ID"], $content) : $this->set_checkbox("YAHOO_ID", $deny_all, $content); } if (ENABLED_SKYPE_NAME || ENABLED_BID_IM) { isset($user_privacy["PRIVACY_SKYPE_NAME"]) ? $this->set_checkbox("SKYPE_NAME", $user_privacy["PRIVACY_SKYPE_NAME"], $content) : $this->set_checkbox("SKYPE_NAME", $deny_all, $content); } if (PLATFORM_ID == "bid") { $frameResponseObject->setHeadline(array(array("link" => PATH_URL . "home/", "name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME")), array("link" => PATH_URL . "profile/index/" . $user->get_name() . "/", "name" => gettext("Profile")), array("link" => "", "name" => gettext("Privacy")))); } else { $frameResponseObject->setHeadline(array(array("link" => PATH_URL . "profile/index/" . $user->get_name() . "/", "name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME")), array("link" => PATH_URL . "profile/index/" . $user->get_name() . "/", "name" => gettext("Profile")), array("link" => "", "name" => gettext("Privacy")))); } $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; }
<?php Profile::getInstance()->init(); ?> <div class="col-md-15 well"> <form class="form-horizontal"> <fieldset> <legend>Настройки</legend> <div class="form-group"> <input type="text" id="email" placeholder="Email" class="form-control" autocomplete="off" value="<?php echo Auth::getInstance()->getUser()->email; ?> " name='<?php echo Profile::GET_CHANGE_MAIL; ?> '> </div> <div class="form-group"> <div id="mypass-wrap" class="control-group"> <input type="password" id="mypass" placeholder="Новый пароль" class="form-control" autocomplete="off" name='<?php echo Profile::GET_CHANGE_PASSWORD; ?> '> </div> </div> <div class="form-group"> <button type="submit" id="submit" name="<?php
Page::$messages[] = array('type' => 'attention', nl2br("Fatal error catched: " . $e)); Page::message(); } Page::EditOrder($_POST['id']); break; default: var_dump($_POST); } } elseif ($action != '' && $auth->check_auth() && $auth->get_rights() == 'Active') { //Page::$userid = $userinstance->GetID(); Page::init('user'); //Take action and show user object switch ($action) { case 'editprofile': $user = User::getInstance(); $profile = Profile::getInstance(); $userid = Page::$userid; $data = $_POST; $data['userid'] = $userid; if (!($profid = $profile->GetID($userid, 'userid'))) { $profile->Create($data); } else { $profile->BatchUpdate($data, $profid); } /* if(count($user->FetchProfile($userid)) < 1){ $user->CreateProfile($userid,$_POST['name'],$_POST['surname'],$_POST['sex'],$_POST['phone'],$_POST['country'],$_POST['address'],$_POST['city'],$_POST['postcode'],$_POST['company'],$_POST['icq'],$_POST['jabber']); } else { $user->UpdateProfile('name', $_POST['name'],$userinstance->GetID()); $user->UpdateProfile('surname', $_POST['surname'],$userinstance->GetID()); $user->UpdateProfile('company', $_POST['company'],$userinstance->GetID());
public function execute(\FrameResponseObject $frameResponseObject) { $current_user = \lms_steam::get_current_user(); //$path = $request->getPath(); if ($this->id != "") { $userName = $this->id; $user = \steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $userName); } else { $user = $current_user; } $login = $current_user->get_name(); $cache = get_cache_function($login, 86400); //$portal = \lms_portal::get_instance(); //$portal->set_page_title( $login ); $html_handler_profile = new \koala_html_profile($user); $html_handler_profile->set_context("contacts"); if ($this->viewer_authorized($current_user, $user)) { // Display Contacts $unconfirmed_html = ""; // Contacts to confirm (visible only for the user himself) if ($current_user->get_id() == $user->get_id()) { $content = \Profile::getInstance()->loadTemplate("list_users.template.html"); //$content = new HTML_TEMPLATE_IT(); //$content->loadTemplateFile( PATH_TEMPLATES . "list_users.template.html" ); $contacts = $cache->call("lms_steam::user_get_contacts_to_confirm", $login); $no_contacts = count($contacts); if ($no_contacts > 0) { $content->setCurrentBlock("BLOCK_CONTACT_LIST"); $result = \lms_portal::get_paginator($content, 10, $no_contacts, "(" . gettext("%TOTAL contact requests in list") . ")"); $content->setVariable("PAGEITERATOR", $result["html"]); $start = $result["start"]; $end = $start + 10 > $no_contacts ? $no_contacts : $start + 10; if ($current_user->get_id() == $user->get_id()) { $content->setVariable("LABEL_CONTACTS", gettext("Contact requests") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_contacts), gettext("%a-%z out of %s")) . ")"); } else { $content->setVariable("LABEL_CONTACTS", str_replace("%NAME", h($user->get_attribute("USER_FIRSTNAME")) . " " . h($user->get_attribute("USER_FULLNAME")), gettext("%NAME's contacts")) . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_contacts), gettext("%a-%z out of %s")) . ")"); } // CONTACTS $content->setVariable("LABEL_NAME_POSITION", gettext("Name, position")); $content->setVariable("LABEL_SUBJECT_AREA", gettext("Origin/Focus")); $content->setVariable("LABEL_COMMUNICATION", gettext("Communication")); if ($user->get_id() == $current_user->get_id()) { $content->setVariable("TH_MANAGE_CONTACT", gettext("Manage request")); } for ($i = $start; $i < $end; $i++) { $contact = $contacts[$i]; $content->setCurrentBlock("BLOCK_CONTACT"); $content->setVariable("CONTACT_LINK", PATH_URL . "profile/" . h($contact["OBJ_NAME"]) . "/"); $icon_link = $contact["OBJ_ICON"] == 0 ? PATH_STYLE . "images/anonymous.jpg" : PATH_URL . "cached/get_document.php?id=" . h($contact["OBJ_ICON"]) . "&type=usericon&width=30&height=40"; $content->setVariable("CONTACT_IMAGE", $icon_link); $title = !empty($contact["USER_ACADEMIC_TITLE"]) ? h($contact["USER_ACADEMIC_TITLE"]) . " " : ""; $content->setVariable("CONTACT_NAME", $title . h($contact["USER_FIRSTNAME"]) . " " . h($contact["USER_FULLNAME"])); $faf = \lms_steam::get_faculty_name($contact["USER_PROFILE_FACULTY"]); $faf .= empty($contact["USER_PROFILE_FOCUS"]) ? "" : ": " . h($contact["USER_PROFILE_FOCUS"]); $content->setVariable("FACULTY_AND_FOCUS", $faf); $content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . h($contact["OBJ_NAME"])); $content->setVariable("LABEL_MESSAGE", gettext("Message")); $content->setVariable("LABEL_SEND", gettext("Send")); if ($user->get_id() == $current_user->get_id()) { $content->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><a href=\"" . PATH_URL . "contact_confirm.php?id=" . h($contact["OBJ_ID"]) . "\">" . gettext("Confirm") . " / " . gettext("Deny") . "</a></td>"); } $contact_desc = empty($contact["OBJ_DESC"]) ? "student" : $contact["OBJ_DESC"]; $status = secure_gettext($contact_desc); $content->setVariable("OBJ_DESC", h($status)); $content->parse("BLOCK_CONTACT"); } $content->parse("BLOCK_CONTACT_LIST"); } $unconfirmed_html = $content->get(); } $content = \Profile::getInstance()->loadTemplate("list_users.template.html"); //$content = new HTML_TEMPLATE_IT(); //$content->loadTemplateFile( PATH_TEMPLATES . "list_users.template.html" ); // Contact list $confirmed = $user->get_id() != $current_user->get_id() ? TRUE : FALSE; $contacts = $cache->call("lms_steam::user_get_buddies", $login, $confirmed); // If user views his own contact list, get information about the confirmed contacts too //HACK START DOMINIK FRAGEN! $confirmed_contacts = ""; //HACK END if (!$confirmed) { $confirmed_contacts = $user->get_attribute("USER_CONTACTS_CONFIRMED"); } if (!is_array($confirmed_contacts)) { $confirmed_contacts = array(); } $no_contacts = count($contacts); if ($no_contacts > 0) { $content->setCurrentBlock("BLOCK_CONTACT_LIST"); $start = $portal->set_paginator($content, 10, $no_contacts, "(" . gettext("%TOTAL contacts in list") . ")"); $end = $start + 10 > $no_contacts ? $no_contacts : $start + 10; if ($current_user->get_id() == $user->get_id()) { $content->setVariable("LABEL_CONTACTS", gettext("Your contacts") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_contacts), gettext("%a-%z out of %s")) . ")"); } else { $content->setVariable("LABEL_CONTACTS", str_replace("%NAME", h($user->get_attribute("USER_FIRSTNAME")) . " " . h($user->get_attribute("USER_FULLNAME")), gettext("%NAME's contacts")) . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_contacts), gettext("%a-%z out of %s")) . ")"); } // CONTACTS $content->setVariable("LABEL_NAME_POSITION", gettext("Name, position")); $content->setVariable("LABEL_SUBJECT_AREA", gettext("Origin/Focus")); $content->setVariable("LABEL_COMMUNICATION", gettext("Communication")); if ($user->get_id() == $current_user->get_id()) { $content->setVariable("TH_MANAGE_CONTACT", gettext("Manage contact")); } for ($i = $start; $i < $end; $i++) { $contact = $contacts[$i]; $content->setCurrentBlock("BLOCK_CONTACT"); $content->setVariable("CONTACT_LINK", PATH_URL . "profile/" . h($contact["OBJ_NAME"]) . "/"); $icon_link = $contact["OBJ_ICON"] == 0 ? PATH_STYLE . "images/anonymous.jpg" : PATH_URL . "cached/get_document.php?id=" . h($contact["OBJ_ICON"]) . "&type=usericon&width=30&height=40"; $content->setVariable("CONTACT_IMAGE", $icon_link); $title = !empty($contact["USER_ACADEMIC_TITLE"]) ? h($contact["USER_ACADEMIC_TITLE"]) . " " : ""; $content->setVariable("CONTACT_NAME", $title . h($contact["USER_FIRSTNAME"]) . " " . h($contact["USER_FULLNAME"])); $faf = lms_steam::get_faculty_name($contact["USER_PROFILE_FACULTY"]); $faf .= empty($contact["USER_PROFILE_FOCUS"]) ? "" : ": " . h($contact["USER_PROFILE_FOCUS"]); $content->setVariable("FACULTY_AND_FOCUS", $faf); $content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . h($contact["OBJ_NAME"])); $content->setVariable("LABEL_MESSAGE", gettext("Message")); $content->setVariable("LABEL_SEND", gettext("Send")); $cmessage = ""; if ($user->get_id() == $current_user->get_id()) { if (isset($confirmed_contacts[$contact["OBJ_ID"]]) && $confirmed_contacts[$contact["OBJ_ID"]]) { $cmessage .= "(" . gettext("Confirmed") . ")"; } else { $cmessage .= "(" . gettext("Unconfirmed") . ")"; } $content->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><a href=\"" . PATH_URL . "contact_delete.php?id=" . h($contact["OBJ_ID"]) . "\">" . gettext("Delete") . "</a></td>"); } $contact_desc = empty($contact["OBJ_DESC"]) ? "student" : $contact["OBJ_DESC"]; $status = secure_gettext($contact_desc); $content->setVariable("OBJ_DESC", h($status) . (strlen($cmessage) > 0 ? "<br />" . $cmessage : "")); $content->parse("BLOCK_CONTACT"); } $content->parse("BLOCK_CONTACT_LIST"); } else { $content->setVariable("LABEL_CONTACTS", gettext("No contacts yet.")); } } else { $messagebox = "<div class=\"infoBar\"><h2>" . gettext("The user has restricted the display of this information.") . "</h2></div>"; $content = \Profile::getInstance()->loadTemplate("list_users.template.html"); //$content = new \HTML_TEMPLATE_IT(); //$content->loadTemplateFile( PATH_TEMPLATES . "list_users.template.html" ); $content->setVariable("LABEL_PRIVACY_DENY_PARTICIPANTS", $messagebox); } $html_handler_profile->set_html_left($unconfirmed_html . $content->get()); $frameResponseObject->setHeadline($html_handler_profile->get_headline()); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($html_handler_profile->get_html()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; //$portal->set_page_main( $html_handler_profile->get_headline(), $html_handler_profile->get_html(), "vcard" ); //return $portal->get_html(); }