<?php

require_once('ErrorDebug.php');

class TimezoneController extends BaseController {

	public function doClass($funcType) {

		/*if(!Auth::check()) {
			return Response::json(array('result' => false, 'error' => 'not login'));
		}
		*/
		if(!$this->chkJWTToken($errMsg, $errNo)) {
			return Response::make($errMsg, $errNo);
		}

		if($funcType == 'list') {

			$tzData = DB::table('timezone')->select('id', 'name', 's_time', 'd_bias')->get();

			/*
			$tzData = DB::table('tz_timezone')->
				leftJoin('tz_zone', 'tz_timezone.zone_id', '=', 'tz_zone.zone_id')->
				orderBy('tz_timezone.time_start', 'desc')->
				where('tz_zone.zone_name', '=', 'America/New_York')->
				select('tz_zone.country_code', 'tz_zone.zone_name', 'tz_timezone.abbreviation', 
					'tz_timezone.gmt_offset', 'tz_timezone.dst', 'tz_timezone.time_start', UNIX_TIMESTAMP(UTC_TIMESTAMP()))->get();
					*/

			return Response::json(array('result' => true, 'data' => $tzData));
		}
	}
}