Location: PHPKode > projects > Anahita Social Engine > dependencies/plg_system_socialengine/socialengine/uikit/actor/avatar.php
<?php
/**
 * @version		$Id: html.php 1286 2009-10-20 18:11:30Z rmdstudio $
 * @category	Anahita Social Engine™
 * @copyright	Copyright (C) 2007 - 2010 rmdStudio Inc. and Peerglobe Technology Inc. All rights reserved.
 * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.anahitapolis.com
 */

class AnUikitActorAvatar extends KViewHtml
{
	protected $_options = array();
	
	protected $_actor   = null;
	
	protected $_linked  = true;
	
	protected $_size    = AnModelAvatar::SizeSmall;
	
	public function setActor($actor)
	{
		$this->_actor  = $actor;
		$this->_linked = true;
		$this->_size   = AnModelAvatar::SizeSmall;
		return $this;
	}
	
	public function setSize($size = AnModelAvatar::SizeSmall)
	{
		$this->_size = $size;
		return $this;
	}
	
	public function setLinked($bool=true)
	{
		$this->_linked = $bool;
		return $this;
	}
	
	
	public function __toString()
	{
		if ( !isset($this->_actor) && !$this->_actor) {
			return "";
		}
		
		$src = $this->_actor->avatar->getURL($this->_size);

		$img = "<img  actorid=\"{$this->_actor->id}\" src=\"{$src}\"id=\"an-se-actor-avatar-{$this->_actor->id}\" size=\"{$this->_size}\"  class=\"an-se-actor-avatar an-se-actor-avatar-{$this->_actor->id}\"/>";
			
		if (!$this->_linked) 
			return $img;
			
		$application = KFactory::get('lib.joomla.application');
		
		if ( $application->getClientId() != 0 )
		{								
			static $base;
			
			if ( !$base ) 
			{
				$base = KFactory::get('lib.joomla.uri')->base();
				$base = preg_replace('/\w+\/$/', '', $base);
			} 
			$url    = $base.$this->_actor->profileURL;								
		} else $url = JRoute::_($this->_actor->profileURL);
				
		return "<a actorid=\"{$this->_actor->id}\" href=\"{$url}\">{$img}</a>";		
		
	}
}
Return current item: Anahita Social Engine