<commit_before><?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Displays the user's profile information.
 *
 * @package    blocks
 * @copyright  2010 Remote-Learner.net
 * @author     <NAME> <<EMAIL>>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

/**
 * Displays the user's profile information.
 *
 * @copyright  2010 Remote-Learner.net
 * @author     <NAME> <<EMAIL>>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class block_myprofile extends block_base {
    /**
     * block initializations
     */
    public function init() {
        $this->title   = get_string('pluginname', 'block_myprofile');
        $this->version = 2009123100;
    }

    /**
     * block contents
     *
     * @return object
     */
    public function get_content() {
        global $CFG, $USER, $DB, $OUTPUT, $PAGE;

        if ($this->content !== NULL) {
            return $this->content;
        }

        if (!isloggedin()){
            return '';      // Never useful unless you are logged in
        }

        $this->content = new stdClass;
        $this->content->text = '';
        $this->content->footer = '';

        $course = $this->page->course;
        if ($PAGE->context->contextlevel == CONTEXT_USER) {
            $user = $DB->get_record('user', array('id' => $PAGE->context->instanceid));
        } else {
            $user = $USER;
        }

        if ($course->id == SITEID) {
            $coursecontext = get_context_instance(CONTEXT_SYSTEM);
        } else {
            $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);   // Course context
            // Make sure they can view the course
            if (!is_viewing($coursecontext)) {
                return '';
            }
        }


        // TODO: clean up the following even more

        if (!isset($this->config->display_picture) || $this->config->display_picture == 1) {
            $this->content->text .= '<div class="myprofileitem picture">';
            $this->content->text = $OUTPUT->user_picture($user, array('courseid'=>$course->id, 'size'=>'100', 'class'=>'profilepicture'));  // The new class makes CSS easier
            $this->content->text .= '</div>';
        }

        $this->content->text .= '<div class="myprofileitem fullname">'.fullname($user).'</div>';

        if(!isset($this->config->display_country) || $this->config->display_country == 1) {
            $countries = get_string_manager()->get_list_of_countries();
            $this->content->text .= '<div class="myprofileitem country">';
            $this->content->text .= get_string('country') . ': ' . $countries[$user->country];
            $this->content->text .= '</div>';
        }

        if(!isset($this->config->display_city) || $this->config->display_city == 1) {
            $this->content->text .= '<div class="myprofileitem city">';
            $this->content->text .= get_string('city') . ': ' . $user->city;
            $this->content->text .= '</div>';
        }

        if(!isset($this->config->display_email) || $this->config->display_email == 1) {
            $this->content->text .= '<div class="myprofileitem email">';
            $this->content->text .= obfuscate_mailto($user->email, '', $user->emailstop);
            $this->content->text .= '</div>';
        }

        if(!empty($this->config->display_icq) && !empty($user->icq)) {
            $this->content->text .= '<div class="myprofileitem icq">';<commit_msg>profile block MDL-22480 fixed missing div<commit_after><?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Displays the user's profile information.
 *
 * @package    blocks
 * @copyright  2010 Remote-Learner.net
 * @author     <NAME> <<EMAIL>>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

/**
 * Displays the user's profile information.
 *
 * @copyright  2010 Remote-Learner.net
 * @author     <NAME> <<EMAIL>>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class block_myprofile extends block_base {
    /**
     * block initializations
     */
    public function init() {
        $this->title   = get_string('pluginname', 'block_myprofile');
        $this->version = 2009123100;
    }

    /**
     * block contents
     *
     * @return object
     */
    public function get_content() {
        global $CFG, $USER, $DB, $OUTPUT, $PAGE;

        if ($this->content !== NULL) {
            return $this->content;
        }

        if (!isloggedin()){
            return '';      // Never useful unless you are logged in
        }

        $this->content = new stdClass;
        $this->content->text = '';
        $this->content->footer = '';

        $course = $this->page->course;
        if ($PAGE->context->contextlevel == CONTEXT_USER) {
            $user = $DB->get_record('user', array('id' => $PAGE->context->instanceid));
        } else {
            $user = $USER;
        }

        if ($course->id == SITEID) {
            $coursecontext = get_context_instance(CONTEXT_SYSTEM);
        } else {
            $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);   // Course context
            // Make sure they can view the course
            if (!is_viewing($coursecontext)) {
                return '';
            }
        }


        // TODO: clean up the following even more

        if (!isset($this->config->display_picture) || $this->config->display_picture == 1) {
            $this->content->text .= '<div class="myprofileitem picture">';
            $this->content->text .= $OUTPUT->user_picture($user, array('courseid'=>$course->id, 'size'=>'100', 'class'=>'profilepicture'));  // The new class makes CSS easier
            $this->content->text .= '</div>';
        }

        $this->content->text .= '<div class="myprofileitem fullname">'.fullname($user).'</div>';

        if(!isset($this->config->display_country) || $this->config->display_country == 1) {
            $countries = get_string_manager()->get_list_of_countries();
            $this->content->text .= '<div class="myprofileitem country">';
            $this->content->text .= get_string('country') . ': ' . $countries[$user->country];
            $this->content->text .= '</div>';
        }

        if(!isset($this->config->display_city) || $this->config->display_city == 1) {
            $this->content->text .= '<div class="myprofileitem city">';
            $this->content->text .= get_string('city') . ': ' . $user->city;
            $this->content->text .= '</div>';
        }

        if(!isset($this->config->display_email) || $this->config->display_email == 1) {
            $this->content->text .= '<div class="myprofileitem email">';
            $this->content->text .= obfuscate_mailto($user->email, '', $user->emailstop);
            $this->content->text .= '</div>';
        }

        if(!empty($this->config->display_icq) && !empty($user->icq)) {
            $this->content->text .= '<div class="myprofileitem icq">';
{'fraction_non_alphanumeric': 0.16499334704245797, 'fraction_numerical': 0.007378734728438369, 'mean_word_length': 2.36919315403423, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 191, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1541040', 'n_tokens_mistral': 2423, 'n_tokens_neox': 2323, 'n_words': 600}