Location: PHPKode > projects > Anahita Social Engine > dependencies/plg_system_socialengine/socialengine/uikit/gadget/gadget.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 AnUikitGadget extends AnUikitViewUikit
{				
	protected $_gadgets 	 = array();
	
	/**
	 * 
	 * @return 
	 * @param $type Object
	 * @param $applications Object
	 */	
	public function addGadgets($gadgets)
	{
		foreach($gadgets as $gadget) {
			$this->_gadgets[$gadget->getComponent()][$gadget->getName()] = $gadget;
		}
		
		return $this;
	}

	/**
	 * 
	 * @return 
	 * @param $component Object[optional]
	 * @param $name Object[optional]
	 */
	public function render($component = null, $name = null)
	{
		$gadgets = null;
		
		if ( $component && $name ) { 
			$gadget = $this->_gadgets[$component][$name];
			unset($this->_gadgets[$component][$name]);
			return print $this->assign('gadget', $gadget);
		} else if ( $component ) {
			foreach($this->_gadgets[$component] as $name=>$gadget) {
				$this->render($component, $name);
			}
		} else {			
			foreach($this->_gadgets as $component=>$gadgets) {
				$this->render($component);
			}
		}
	}	
}
Return current item: Anahita Social Engine