Location: PHPKode > projects > Anahita Social Engine > site/views/socialgraph/html.php
<?php
/**
 * @category	Anahita Social Engine™
 * @copyright	Copyright (C) 2008 - 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 ComSocialengineViewSocialgraphHtml extends ComSocialengineViewHtml
{	
	public function __construct(array $options=array())
	{
		parent::__construct($options);
		$this->filter = KRequest::get('get.graph', 'cmd', 'all');
	}
	
	protected function prepareDefaultLayout()
	{
		$this->assign('socialgraph', $this->owner->getSocialGraph());
		
		$owner = $this->owner;
		
		$title = $owner->name;
		
		$header = KFactory::get('lib.anahita.uikit.header.media')
					->setActor($owner)
					->setTitle(JText::sprintf('AN-SE-SOCIALGRAPH-X-GRAPH', $title ))
					->setActions($this->getActions())
					;						

		$pathway = KFactory::get('lib.joomla.application')->getPathway();
		
		if($owner !== $this->getViewer())
			$pathway->addItem(JText::_('AN-SE-SOCIALGRAPH'), JRoute::_('index.php?option=com_socialengine&view=socialgraph'));
		
		$pathway->addItem(JText::sprintf('AN-SE-SOCIALGRAPH-X-GRAPH', $title ));			
					
		$this->assign('search_action', 'view=people&layout=list&graph='.$this->filter);			
		$this->assign('owner', $owner);
		$this->assign('header', $header);
	}
	
	protected function prepareListLayout()
	{
		$methodName = 'get'.ucfirst($this->filter);
		
		$this->assign('people', $this->owner->socialgraph->$methodName());
		$this->assign('query', array('layout'=>'list', 'graph'=>$this->filter));
	}
	
	protected function prepareProfileLayout()
	{
		$this->assign('socialgraph', $this->owner->getSocialGraph());
		
		$this->socialgraph->owner2 = $this->getViewer();
		
		$this->socialgraph->query()->order('lastvisitDate', 'DESC')->limit(8);
		
		$this->assign('owner',		$this->socialgraph->owner);
		$this->assign('commons',	$this->socialgraph->getCommonMutual());
		$this->assign('mutuals',	$this->socialgraph->getMutual());
		$this->assign('leaders',	$this->socialgraph->getLeaders());
		$this->assign('followers',	$this->socialgraph->getFollowers());
	}
		
	private function getActions()
	{
		$actions = array();
		
		$owner 	= $this->socialgraph->getOwner();
		$viewer	= AnModelAnahita::getSessionViewer();
		
		$actions[] = '<a id="an-se-socialgraph-all"       class="an-se-socialgraph-layout selected" href="'.JRoute::_('index.php?option=com_socialengine&view=socialgraph&graph=all&oid='.$owner->id).'">'. JText::_(('ALL')) .'</a>';
		$actions[] = '<a id="an-se-socialgraph-mutual"    class="an-se-socialgraph-layout" href="'.JRoute::_('index.php?option=com_socialengine&view=socialgraph&graph=mutual&oid='.$owner->id).'">'. JText::_(('AN-SE-SOCIALGRAPH-MUTUAL')) .'</a>';
		$actions[] = '<a id="an-se-socialgraph-leaders"   class="an-se-socialgraph-layout" href="'.JRoute::_('index.php?option=com_socialengine&view=socialgraph&graph=leaders&oid='.$owner->id).'">'. JText::_(('AN-SE-SOCIALGRAPH-LEADERS')) .'</a>';
		$actions[] = '<a id="an-se-socialgraph-followers" class="an-se-socialgraph-layout" href="'.JRoute::_('index.php?option=com_socialengine&view=socialgraph&graph=followers&oid='.$owner->id).'">'. JText::_(('AN-SE-SOCIALGRAPH-FOLLOWERS')) .'</a>';
		
		if($owner === $viewer)
			$actions[] = '<a id="an-se-socialgraph-blocked" class="an-se-socialgraph-layout" href="'.JRoute::_('index.php?option=com_socialengine&view=socialgraph&graph=blocked&oid='.$owner->id).'">'. JText::_(('AN-SE-SOCIALGRAPH-BLOCKED')) .'</a>';
		
		return $actions;
	}

//end class
}
Return current item: Anahita Social Engine