Location: PHPKode > projects > Anahita Social Engine > admin/elements/date.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 JElementDate extends JElement
{
	function fetchElement($name, $value, &$node, $control_name)
	{
		$date	 = $value;		
		$month   = !$value ? 0 : $date->month;
		$year	 = !$value ? 0 : $date->year;
		$day	 = !$value ? 0 : $date->day;		
		$months  = array(
			0 => 'Select Month',
			1 => JText::_('JANUARY') ,
			2 => JText::_('FEBRUARY') ,
			3 => JText::_('MARCH')  ,
			4 => JText::_('APRIL')  ,
			5 => JText::_('MAY')    ,
			6 => JText::_('JUNE')   ,
			7 => JText::_('JULY') 	,
			8 => JText::_('AUGUST') ,
			9 => JText::_('SEPTEMBER') ,
			10 => JText::_('OCTOBER') ,
			11 => JText::_('NOVEMBER') ,
			12 => JText::_('DECEMBER') ,												
		);
		
		$days  = array(0=>'Select Day');
		$years = array(0=>'Select Year');
		
		foreach(range(1,31) as $i=>$num) $days[$i+1] = $num;
		
		$current  = new KDate();

		foreach(range(0,100) as $i) {
			$years[$current->year - $i] = $current->year - $i;
		}
		
		$month   =   AnUikitHtmlTag::select($name.'[month]', AnUikitHtmlTag::selectOptions($months, $month));
		$day	 =   AnUikitHtmlTag::select($name.'[day]', AnUikitHtmlTag::selectOptions($days, $day));
		$year 	 =   AnUikitHtmlTag::select($name.'[year]', AnUikitHtmlTag::selectOptions($years, $year));
		
		return $month.' '.$day.' '.$year;
	}
}
Return current item: Anahita Social Engine