<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Dateclass
{
	function __construct()
	{
        $this->date->year = date('Y');
        $this->date->month = date('n');
        $this->date->daynum = date('j');
        $this->date->weekday = date('N');
	}

    function getDateString($timestamp = false)
    {
    	$CI =& get_instance();
		$this->months = $CI->lang->line('months');
		$this->days = $CI->lang->line('days');

		$dateStr = '';
        
        if($timestamp){
            $this->date->year = date('Y', $timestamp);
            $this->date->month = date('n', $timestamp);
            $this->date->daynum = date('j', $timestamp);
            $this->date->weekday = date('N', $timestamp);
        }

		if(hun())
		{
			$dateStr .= $this->date->year;
			$dateStr .= '. ';
            $dateStr .= $this->months[($this->date->month - 1)];
            $dateStr .= ' ';
            $dateStr .= $this->date->daynum;
            $dateStr .= '., ';
            $dateStr .= $this->days[($this->date->weekday - 1)];
		}
		elseif(eng())
		{
            $dateStr .= $this->days[($this->date->weekday - 1)];
            $dateStr .= ' ';
			$dateStr .= $this->months[($this->date->month - 1)];
            $dateStr .= ' ';
            $dateStr .= $this->date->daynum;
            $dateStr .= '., ';
            $dateStr .= $this->date->year;
		}
		else
		{
            $dateStr .= $this->days[($this->date->weekday - 1)];
            $dateStr .= ' ';
			$dateStr .= $this->months[($this->date->month - 1)];
            $dateStr .= ' ';
            $dateStr .= $this->date->daynum;
            $dateStr .= '., ';
            $dateStr .= $this->date->year;
		}
		
		return $dateStr;
    }
}

?>