HomeHelpTrac

Changeset 15934 for trunk/templates


Ignore:
Timestamp:
01/30/12 01:29:27 (4 months ago)
Author:
Alexander Trofimov
Message:

Code cleaning

Location:
trunk/templates
Files:
1 added
466 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/templates/base/scripts/BxBaseFunctions.php

    r15931 r15934  
    4242 
    4343        return $GLOBALS['bxDolClasses']['BxTemplFunctions']; 
    44     } 
    45  
    46     function getProfileMatch( $memberID, $profileID ) { 
    47         $match_n = getProfilesMatch($memberID, $profileID); // impl 
    48  
    49         bx_import('BxTemplConfig'); 
    50         return DesignProgressPos ( _t("_XX match", $match_n), BxTemplConfig::getInstance()->iProfileViewProgressBar, 100, $match_n );; 
    51     } 
    52  
    53     function getProfileZodiac( $profileDate ) { 
    54         return ShowZodiacSign( $profileDate ); 
    5544    } 
    5645 
     
    224213    } 
    225214 
    226     /** 
    227     * @description : function will generate the sex icon ; 
    228     * @param         : $sSex (string) - sex name ; 
    229     * @return         : (text) - path to image ; 
    230     */ 
    231     function genSexIcon($sSex) { 
    232         switch( $sSex ) { 
    233             case 'male'    : 
    234                 return getTemplateIcon( 'male.png' ); 
    235             case 'female' : 
    236                 return getTemplateIcon( 'female.png' ); 
    237             case 'men'    : 
    238                 return getTemplateIcon( 'male.png' ); 
    239             default : 
    240                 return getTemplateIcon( 'tux.png' ); 
    241         } 
    242     } 
    243  
    244     function getSexPic($sSex, $sType = 'medium') { 
    245         $aGenders = array ( 
    246             'female' => 'woman_', 
    247             'Female' => 'woman_', 
    248             'male' => 'man_', 
    249             'Male' => 'man_', 
    250         ); 
    251         return getTemplateIcon(isset($aGenders[$sSex]) ? $aGenders[$sSex] . $sType . '.gif' : 'visitor_' . $sType . '.gif'); 
    252     } 
    253  
    254     function getMemberAvatar($iId, $sType = 'medium') { 
    255         $aProfile = getProfileInfo($iId); 
    256         if (!$aProfile || !@include_once (BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php')) 
    257             return false; 
    258         return $aProfile['Avatar'] ? BX_AVA_URL_USER_AVATARS . $aProfile['Avatar'] . ($sType == 'small' ? 'i' : '') . BX_AVA_EXT : $this->getSexPic($aProfile['Sex'], $sType); 
    259     } 
    260  
    261     function getMemberThumbnail($iId, $sFloat = 'none', $bGenProfLink = false, $sForceSex = 'visitor', $isAutoCouple = true, $sType = 'medium', $aOnline = array()) { 
    262  
    263         $aProfile = getProfileInfo($iId); 
    264         if (!$aProfile) 
    265             return ''; 
    266  
    267         $bCouple = ((int)$aProfile['Couple'] > 0) && $isAutoCouple ? true : false; 
    268  
    269         $bOnline = 0; 
    270  
    271         if (!@include_once (BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php')) 
    272             return ''; 
    273  
    274         $sLink = ''; 
    275         $sNick = ''; 
    276  
    277         bx_import('BxDolUserStatusView'); 
    278         $oUserStatusView = bx_instance('BxDolUserStatusView'); // TODO: need singlton here 
    279         $sStatusIcon = '';//$oUserStatusView->getStatusIcon($iId, 'icon8'); 
    280  
    281         if ($iId > 0) { 
    282             $sLink = getProfileLink($iId); 
    283             $sNick = getNickname($iId); 
    284             if (! empty($aOnline) && (int)$aOnline['is_online']==0) { 
    285             } else { 
    286  
    287                 $bOnline = 1; 
    288             } 
    289         } 
    290         if (!$bGenProfLink) { 
    291             if ($sForceSex != 'visitor') { 
    292                 $sNick = _t('_Vacant'); 
    293                 $sLink = 'javascript:void(0)'; 
    294             } 
    295         } 
    296  
    297         $w = $sType == 'medium' ? BX_AVA_W : BX_AVA_ICON_W; 
    298         $h = $sType == 'medium' ? BX_AVA_H : BX_AVA_ICON_H; 
    299  
    300         if ($bCouple) 
    301             $sType = 'small'; 
    302  
    303         $aVariables = array( 
    304             'iProfId' => $iId, 
    305             'sys_thb_float' => $sFloat, 
    306             'sys_thb_width' => $w + 6, 
    307             'sys_thb_height' => $h + 6, 
    308             'sys_img_width' => $w, 
    309             'sys_img_height' => $h, 
    310             'sys_img_width1' => $w + 4, 
    311             'sys_img_height1' => $h + 4, 
    312             'sys_cpl_img_width' => BX_AVA_ICON_W, 
    313             'sys_cpl_img_height' => BX_AVA_ICON_H, 
    314             'sys_status_url' => getTemplateIcon($sStatusIcon), 
    315             'sys_status_title' => $oUserStatusView->getStatus($iId), 
    316             'usr_profile_url' => $sLink, 
    317             'usr_thumb_url0' => $aProfile['Avatar'] ? BX_AVA_URL_USER_AVATARS . $aProfile['Avatar'] . ($sType == 'small' ? 'i' : '') . BX_AVA_EXT : $this->getSexPic($aProfile['Sex'], $sType), 
    318             'usr_thumb_title0' => $sNick, 
    319             'bx_if:profileLink' => array( 
    320               'condition' => $bGenProfLink, 
    321               'content' => array( 
    322                   'picWidth' => $w + 6, 
    323                   'nickName' => $sNick, 
    324                   'usr_profile_url' => $sLink 
    325               ) 
    326              ), 
    327             'sys_status_img_width'  => 12, 
    328             'sys_status_img_height' => 12, 
    329         ); 
    330  
    331         if ($bCouple) { 
    332             $aProfileCouple = getProfileInfo($aProfile['Couple']); 
    333             $sNickCouple = getNickname($aProfile['Couple']); 
    334             $aVariables['usr_thumb_url1'] = $aProfileCouple['Avatar'] ? BX_AVA_URL_USER_AVATARS . $aProfileCouple['Avatar'] . 'i' . BX_AVA_EXT : $this->getSexPic($aProfileCouple['Sex'], 'small'); 
    335             $aVariables['usr_thumb_title1'] = $sNickCouple; 
    336         } 
    337  
    338         return $this->_oTemplate->parseHtmlByName($bCouple ? "thumbnail_couple.html" : "thumbnail_single.html", $aVariables); 
    339     } 
    340  
    341     function getMemberIcon($iId, $sFloat = 'none', $bGenProfLink = false) { 
    342         return $this->getMemberThumbnail($iId, $sFloat, $bGenProfLink, 'visitor', false, 'small'); 
    343     } 
    344  
    345     /** 
    346      * Get image of the specified type by image id 
    347      * @param $aImageInfo image info array with the following info 
    348      *          $aImageInfo['Avatar'] - photo id, NOTE: it not relatyed to profiles avataras module at all 
    349      * @param $sImgType image type 
    350      */ 
    351     function _getImageShared($aImageInfo, $sType = 'thumb') { 
    352         return BxDolService::call('photos', 'get_image', array($aImageInfo, $sType), 'Search'); 
    353     } 
    354  
    355215    function getTemplateIcon($sName) {             
    356216        $sUrl = $this->_oTemplate->getIconUrl($sName); 
Note: See TracChangeset for help on using the changeset viewer.