Пример #1
0
    function genLeaderPack($aMTypes, $sSex = 'male')
    {
        $sSLeaders = '';
        if (is_array($aMTypes) and count($aMTypes) > 0) {
            $sVacantC = _t('_Vacant');
            $sOfflineC = _t('_Offline');
            $sMaleIcon = getTemplateIcon('male.png');
            $sFemaleIcon = getTemplateIcon('female.png');
            $sSpacerIcon = getTemplateImage('spacer.gif');
            $sOfflineIcon = getTemplateIcon('sys_status_offline.png');
            $sSexIcon = $sThumbType = '';
            switch ($sSex) {
                case 'male':
                    $sSexIcon = $sMaleIcon;
                    $sThumbType = 'man';
                    break;
                case 'female':
                    $sSexIcon = $sFemaleIcon;
                    $sThumbType = 'woman';
                    break;
            }
            $sSexThumbIcon = getTemplateIcon($sThumbType . '_medium.gif');
            foreach ($aMTypes as $sTopType => $iMembID) {
                $sTypeName = $sTopType;
                $sTypeNameUcf = ucfirst($sTopType);
                $sLabel = _t('_' . $sTypeNameUcf);
                $oMembVoting = new BxTemplVotingView('profile', $iMembID);
                $sVotingVal = '<div class="rate_block_position">' . $oMembVoting->getJustVotingElement(0) . '</div>';
                $iVotesCnt = $oMembVoting->getVoteCount();
                $sMembThumb = $sProfileLink = '';
                if ($iMembID > 0) {
                    $sMembThumb = get_member_thumbnail($iMembID, 'none', false);
                    $sMemberName = getNickname($iMembID);
                    $sMemberLink = getProfileLink($iMembID);
                    $sProfileLink = <<<EOF
<a href="{$sMemberLink}">{$sMemberName}</a>
EOF;
                } else {
                    $sMembThumb = <<<EOF
<div class="thumbnail_image" style="width: 68px; height: 68px;">
    <a href="javascript:void(0)">
        <img title="{$sVacantC}" alt="{$sVacantC}" style="background-image: url({$sSexThumbIcon}); width: 64px; height: 64px;" src="{$sSpacerIcon}" />
        <img class="sys-online-offline" title="{$sOfflineC}" alt="{$sOfflineC}" src="{$sOfflineIcon}" />
    </a>
</div>
EOF;
                    $sProfileLink = <<<EOF
<a class="vacant" href="javascript: void(0);">{$sVacantC}</a>
EOF;
                }
                $sVotes = _t('_{0} votes', $iVotesCnt);
                $sSLeaders .= <<<EOF
<div id="prof_of_{$sTypeName}" class="featured_block_1">
\t<div class="top_rated_head">
\t\t<div class="sex_icon" style="background:url({$sSexIcon}) center 2px no-repeat;">&nbsp;</div>
\t\t<div class="type_vote">
\t\t\t{$sLabel}<br />
\t\t\t<font style="font-size:9px;color:#999;">{$sVotes}</font>
\t\t</div>
\t\t<div class="clear_both"></div>
\t</div>
\t{$sMembThumb}
\t{$sVotingVal}
\t<div class="thumb_username">{$sProfileLink}</div>
\t<div class="clear_both"></div>
</div>
EOF;
            }
            return $sSLeaders;
        }
    }