示例#1
0
            <div class="well">
                <h3><?php 
echo JText::_('COM_CHPANEL_ANY_FIELDSET_IMAGE');
?>
</h3>
                <div class="control-group muted">
					<?php 
echo JText::sprintf('COM_CHPANEL_ANY_IMAGE_DESC', $this->params->get('img_upload', 1500));
?>
                </div>
				<?php 
if ($this->image) {
    ?>
					<div class="control-group">
						<?php 
    echo Jhtml::image(JURI::root() . 'images/chpanel/images/' . $this->item->id . '-small.jpg?rand=' . rand(1, 999), $this->item->title, 'class="thumbnail"');
    ?>
					</div>
					<div class="control-group">
						<label class="checkbox hasTooltip" title="<?php 
    echo JText::_('COM_CHPANEL_ANY_IMAGE_DELETE');
    ?>
::<?php 
    echo JText::_('COM_CHPANEL_ANY_IMAGE_DELETE_DESC');
    ?>
">
							<input type="checkbox" name="image_delete" value="1"><?php 
    echo JText::_('COM_CHPANEL_ANY_IMAGE_DELETE');
    ?>
						</label>
					</div>
示例#2
0
 /**
  * Gets the user avatar image without any link
  * 
  * @param unknown $system
  * @param unknown $userid
  * @param unknown $alt
  * @param number $height
  * @param string $email
  * @param string $path_only
  * @param unknown $attribs
  * @return void|Ambigous <string, unknown, NULL, string>
  */
 public static function get_user_avatar_image($system, $userid, $alt, $height = 48, $email = null, $path_only = true, $attribs = array())
 {
     $db = JFactory::getDBO();
     $avatar = '';
     $userid = !empty($userid) ? $userid : 0;
     switch ($system) {
         case 'cjforum':
             $api = JPATH_ROOT . '/components/com_cjforum/helpers/api.php';
             if (file_exists($api)) {
                 require_once $api;
                 $avatar = CjForumApi::get_user_avatar_image($userid, $height);
                 if ($path_only == false) {
                     $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
                 }
             }
             break;
         case 'cjblog':
             $api = JPATH_ROOT . DS . 'components' . DS . 'com_cjblog' . DS . 'api.php';
             if (file_exists($api)) {
                 include_once $api;
                 $avatar = CjBlogApi::get_user_avatar_image($userid, $height);
                 if ($path_only == false) {
                     $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
                 }
             }
             break;
         case 'jomsocial':
             include_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'defines.community.php';
             require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
             require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'helpers' . DS . 'string.php';
             $user = CFactory::getUser($userid);
             $avatar = $user->getThumbAvatar();
             if ($path_only == false) {
                 $attribs['height'] = $height . 'px';
                 $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
             }
             break;
         case 'cb':
             global $_CB_framework, $_CB_database, $ueConfig, $mainframe;
             $api = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
             if (!is_file($api)) {
                 return;
             }
             require_once $api;
             cbimport('cb.database');
             cbimport('cb.tables');
             cbimport('cb.field');
             cbimport('language.front');
             outputCbTemplate($_CB_framework->getUi());
             //TODO: Here
             $img_attribs['height'] = $height . 'px';
             if ($userid > 0) {
                 $cbUser = CBuser::getInstance($userid);
                 if ($cbUser !== null) {
                     $avatar = $cbUser->getField('avatar', null, 'php', 'profile', 'list');
                     $name = $cbUser->getField('name');
                     $avatar = $avatar['avatar'];
                     if ($path_only == false) {
                         $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
                     }
                 }
             } else {
                 if ($height <= 90) {
                     $avatar = $path_only ? selectTemplate() . 'images/avatar/tnnophoto_n.png' : Jhtml::image(selectTemplate() . 'images/avatar/tnnophoto_n.png', '', $img_attribs);
                 } else {
                     $avatar = $path_only ? selectTemplate() . 'images/avatar/nophoto_n.png' : Jhtml::image(selectTemplate() . 'images/avatar/nophoto_n.png', '', $img_attribs);
                 }
             }
             break;
         case 'touch':
             $avatarLoc = JURI::base(true) . '/index2.php?option=com_community&amp;controller=profile&amp;task=avatar&amp;width=' . $height . '&amp;height=' . $height . '&amp;user_id=' . $userid . '&amp;no_ajax=1';
             $attribs[] = array('style' => 'height: ' . $height . 'px');
             $avatar = $path_only ? $avatarLoc : JHtml::image($avatarLoc, $alt, $attribs);
             break;
         case 'gravatar':
             if (null == $email && $userid > 0) {
                 $strSql = 'SELECT email FROM #__users WHERE id=' . $userid;
                 $db->setQuery($strSql);
                 $email = $db->loadResult();
             }
             $avatar = 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . '?s=' . $height . '&d=mm&r=g';
             if ($path_only == false) {
                 $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
             }
             break;
         case 'kunena':
             if (CJFunctions::_initialize_kunena()) {
                 $class = 'avatar';
                 $user = KunenaFactory::getUser($userid);
                 $avatar = $user->getAvatarImage($class, $height, $height);
                 if ($path_only) {
                     preg_match_all('/<img .*src=["|\']([^"|\']+)/i', $avatar, $matches);
                     foreach ($matches[1] as $key => $value) {
                         $avatar = $value;
                         break;
                     }
                 }
             }
             break;
         case 'aup':
             $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
             if (file_exists($api_AUP)) {
                 require_once $api_AUP;
                 if ($path_only) {
                     $avatar = AlphaUserPointsHelper::getAvatarPath($userid);
                 } else {
                     $avatar = AlphaUserPointsHelper::getAupAvatar($userid, 0, $height, $height);
                 }
             }
             break;
         case 'easysocial':
             $api = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_easysocial' . DS . 'includes' . DS . 'foundry.php';
             if (file_exists($api)) {
                 require_once $api;
                 $my = Foundry::user();
                 $avatar = $my->getAvatar($height < 64 ? SOCIAL_AVATAR_SMALL : ($height < 128 ? SOCIAL_AVATAR_MEDIUM : SOCIAL_AVATAR_LARGE));
                 $attribs[] = array('style' => 'height: ' . $height . 'px');
                 if ($path_only == false) {
                     $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
                 }
             }
             break;
     }
     return $avatar;
 }