Location: PHPKode > projects > Anahita Social Engine > admin/elements/storage.php
<?php
/**
 * @version		1.0.0
 * @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 JElementStorage extends JElement
{
	function fetchElement($name, $value, &$node, $control_name)
	{
		$options = array();
		
		print  "
			<script>
				storage = {};
				function setParams() {
					\$H(params).each(function(value, key) {
						selector = 'params' + key;
						e = \$(selector);
						if ( e ) {
							e.value = value;	
						}
					});
				}
				window.addEvent('domready', function() {
					\$('storage-params').innerHTML = storage['$value'];
					setParams();
					\$('storage-selection').addEvent('change', function(){
						$('storage-params').innerHTML = storage[this.value];
						setParams();						
					});
				})
			</script>
		";
		foreach($node->children() as $child) {
			
			$name = $child->attributes('value');
			$options[$name] = $child->attributes('label');
			
			$jparam = new JParameter('');
			
			foreach($child->params as $param) {
				$jparam->setXML($param);
			}
			
			$str		   = $jparam->render();
			$str		   = preg_replace('/\n|\r|\r\n/mis', '', $str);
			$storag_params = "<script>storage['$name'] = '$str'; </script>";
			print $storag_params;
		}
		
		return 	AnUikitHtmlTag::select('params[storage]', AnUikitHtmlTag::selectOptions($options, $value), array('id'=>'storage-selection')).
			'<div id="storage-params">asdfasdfasdfasdf</div>'
			
			;
		;

				
	}
}
Return current item: Anahita Social Engine