Location: PHPKode > projects > Anahita Social Engine > dependencies/plg_system_socialengine/socialengine/uikit/actor/actor.php
<?php

class AnUikitActor extends KObject
{
	/**
	 * 
	 * @return 
	 * @param $actor Object
	 */
	public function toJson($actors)
	{
		if ( !$actors instanceof Iterator )
			return json_encode($this->_toArray($actors));
		
		$array = array();
		
		foreach($actors as $actor) {
			$array[$actor->id] = $this->_toArray($actor);
		}
		
		return json_encode($array);
	}
	
	/**
	 * 
	 * @return 
	 * @param $actor Object
	 */
	protected function _toArray($actor)
	{
		$array = array();
		$array['id']     = $actor->id;
		$array['name']   = $actor->name;
		$array['avatar'] = array();
		$array['profileURL'] = $actor->profileURL;
		$array['status']	 = $actor->status;
		$array['statusUpdatedTime'] = array('string'=>(string) $actor->statusUpdatedTime,'timestamp'=>$actor->statusUpdatedTime->getDate(DATE_FORMAT_UNIXTIME));
		$array['hasDefaultAvatar']	= $actor->avatar->isDefault();
		foreach(AnModelAvatar::getSizes() as $size => $dim ) {
			$array['avatar'][$size] = $actor->avatar->getURL($size);
		}
		return $array;
	}
}
Return current item: Anahita Social Engine