<commit_before><?php
/**
 * Tatoeba Project, free collaborative creation of multilingual corpuses project
 * Copyright (C) 2010  <NAME> <<EMAIL>>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * PHP version 5
 *
 * @category PHP
 * @package  Tatoeba
 * @author   <NAME> <<EMAIL>>
 * @license  Affero General Public License
 * @link     http://tatoeba.org
 */

/**
 * Helper for members.
 *
 * @category Utilities
 * @package  Helpers
 * @author   <NAME> <<EMAIL>>
 * @license  Affero General Public License
 * @link     http://tatoeba.org
 */

class MembersHelper extends AppHelper
{
    public $helpers = array('Html');

    /**
     * To display the names of the people listed in Team & Credits.
     *
     * @param string $username    Username of the member.
     * @param string $realName    Real name of the member.
     * @param string $description Description of the member's participation.
     *
     * @return void
     */
    public function creditsToUser($realName, $username = null, $description = null)
    {
        $realName = Sanitize::html($realName);
        ?>
        <div class="person">
            <div class="realName">
            <?php
            echo $realName;
            ?>
            </div>

            <div class="description">
            <?php echo $description; ?>
            </div>

            <?php
            if (!empty($username)) {
                ?>
                <div class="username">
                <?php
                $profileIcon = $this->Html->image(
                    IMG_PATH . 'profile.png',
                    array(
                        "alt" => __('Profile'),
                        "width" => 14,
                        "height" => 14
                    )
                );
                echo $this->Html->link(
                    $profileIcon.' '.$username,
                    array(
                        'controller' => 'user',
                        'action' => 'profile',
                        $username
                    ),
                    array(
                        'escape' => false
                    )
                );
                ?>
                </div>
                <?php
            }
            ?>

        </div>
        <?php
    }


    /**
     *
     */
    public function image($username, $imageName = null, $options = array())
    {
        $options = $options + array(
            'width' => 36,
            'height' => 36,
            'alt' => $username,
            'url' => array(
                'controller' => 'user',
                'action' => 'profile',
                $username
            ),
        );
        return $this->Html->image(
            $this->imageUrl($imageName),
            $options
        );
    }

    /**
     *
     */
    public function imageUrl($imageName)
    {
        if (empty($imageName)) {
            $imageName = 'unknown-avatar.png';
        }

        return $this->assetUrl('/img/profiles_36/'.$imageName);
    }


    /**
     * Display "Edit" button in the profile.
     *
     * @param array  $linkPath Path to the edit page.
     * @param String $label    Label of the button. If null, it displays "Edit".
     *
     * @return void
     */
    public function displayEditButton($linkPath, $label = null)
    {
        if (empty($label)) {
            $label = __('Edit');
        }
        ?>
        <div class="editOption">
        <?php<commit_msg>Remove now unused MembersHelper::imageUrl()<commit_after><?php
/**
 * Tatoeba Project, free collaborative creation of multilingual corpuses project
 * Copyright (C) 2010  <NAME> <<EMAIL>>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * PHP version 5
 *
 * @category PHP
 * @package  Tatoeba
 * @author   <NAME> <<EMAIL>>
 * @license  Affero General Public License
 * @link     http://tatoeba.org
 */

/**
 * Helper for members.
 *
 * @category Utilities
 * @package  Helpers
 * @author   <NAME> <<EMAIL>>
 * @license  Affero General Public License
 * @link     http://tatoeba.org
 */

class MembersHelper extends AppHelper
{
    public $helpers = array('Html');

    /**
     * To display the names of the people listed in Team & Credits.
     *
     * @param string $username    Username of the member.
     * @param string $realName    Real name of the member.
     * @param string $description Description of the member's participation.
     *
     * @return void
     */
    public function creditsToUser($realName, $username = null, $description = null)
    {
        $realName = Sanitize::html($realName);
        ?>
        <div class="person">
            <div class="realName">
            <?php
            echo $realName;
            ?>
            </div>

            <div class="description">
            <?php echo $description; ?>
            </div>

            <?php
            if (!empty($username)) {
                ?>
                <div class="username">
                <?php
                $profileIcon = $this->Html->image(
                    IMG_PATH . 'profile.png',
                    array(
                        "alt" => __('Profile'),
                        "width" => 14,
                        "height" => 14
                    )
                );
                echo $this->Html->link(
                    $profileIcon.' '.$username,
                    array(
                        'controller' => 'user',
                        'action' => 'profile',
                        $username
                    ),
                    array(
                        'escape' => false
                    )
                );
                ?>
                </div>
                <?php
            }
            ?>

        </div>
        <?php
    }


    /**
     *
     */
    public function image($username, $imageName = null, $options = array())
    {
        if (empty($imageName)) {
            $imageName = 'unknown-avatar.png';
        }
        $options = $options + array(
            'width' => 36,
            'height' => 36,
            'alt' => $username,
            'url' => array(
                'controller' => 'user',
                'action' => 'profile',
                $username
            ),
        );
        return $this->Html->image(
            '/img/profiles_36/'.$imageName,
            $options
        );
    }

    /**
     * Display "Edit" button in the profile.
     *
     * @param array  $linkPath Path to the edit page.
     * @param String $label    Label of the button. If null, it displays "Edit".
     *
     * @return void
     */
    public function displayEditButton($linkPath, $label = null)
    {
        if (empty($label)) {
            $label = __('Edit');
        }
        ?>
        <div class="editOption">
        <?php
{'fraction_non_alphanumeric': 0.11614271457085829, 'fraction_numerical': 0.003992015968063872, 'mean_word_length': 1.4569414649095924, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 93, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4647990', 'n_tokens_mistral': 2152, 'n_tokens_neox': 2034, 'n_words': 651}