当前位置: 首页>>代码示例>>PHP>>正文


PHP Profile::getInstance方法代码示例

本文整理汇总了PHP中Profile::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::getInstance方法的具体用法?PHP Profile::getInstance怎么用?PHP Profile::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Profile的用法示例。


在下文中一共展示了Profile::getInstance方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 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();
 }
开发者ID:rolwi,项目名称:koala,代码行数:75,代码来源:Groups.class.php

示例2: execute

 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"));
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Edit.class.php

示例3: UserProfile

 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');
 }
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:32,代码来源:class.Page.php

示例4: getCommonGroups

 /**
  * 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;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:37,代码来源:Helper.php

示例5: fetch

 /**
  * 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;
             }
//.........这里部分代码省略.........
开发者ID:257naba,项目名称:social-snapshot-tool,代码行数:101,代码来源:Connection.php

示例6: execute

 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"]));
     }
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Index.class.php

示例7: execute

 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>. "));
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Image.class.php

示例8: execute

 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"));
     }
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Privacy.class.php

示例9:

<?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 
开发者ID:smilexx,项目名称:quest.dev,代码行数:31,代码来源:setting.php

示例10: array

                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());
开发者ID:carriercomm,项目名称:Multicabinet,代码行数:31,代码来源:index.php

示例11: execute

 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"));
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Contacts.class.php


注:本文中的Profile::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。