Fabrice
4/7/2014 - 7:53 AM

Bool des jours de semaine et week-end pour CodeIgniter Helper

Bool des jours de semaine et week-end pour CodeIgniter Helper

<?php
if ( ! function_exists('isLundi'))
{
	function isLundi($date = FALSE) {
	    if($date === FALSE)
		{
			return (date('N', strtotime(date("Y-m-d H:i:s"))) == 1);
		}
		return (date('N', strtotime($date)) == 1);
	}
}

if ( ! function_exists('isMardi'))
{
	function isMardi($date = FALSE) {
	    if($date === FALSE)
		{
			return (date('N', strtotime(date("Y-m-d H:i:s"))) == 2);
		}
		return (date('N', strtotime($date)) == 1);
	}
}

if ( ! function_exists('isMercredi'))
{
	function isMercredi($date = FALSE) {
	    if($date === FALSE)
		{
			return (date('N', strtotime(date("Y-m-d H:i:s"))) == 3);
		}
		return (date('N', strtotime($date)) == 1);
	}
}

if ( ! function_exists('isJeudi'))
{
	function isJeudi($date = FALSE) {
	    if($date === FALSE)
		{
			return (date('N', strtotime(date("Y-m-d H:i:s"))) == 4);
		}
		return (date('N', strtotime($date)) == 1);
	}
}

if ( ! function_exists('isVendredi'))
{
	function isVendredi($date = FALSE) {
	    if($date === FALSE)
		{
			return (date('N', strtotime(date("Y-m-d H:i:s"))) == 5);
		}
		return (date('N', strtotime($date)) == 1);
	}
}

if ( ! function_exists('isSamedi'))
{
	function isSamedi($date = FALSE) {
	    if($date === FALSE)
		{
			return (date('N', strtotime(date("Y-m-d H:i:s"))) == 6);
		}
		return (date('N', strtotime($date)) == 1);
	}
}

if ( ! function_exists('isDimanche'))
{
	function isDimanche($date = FALSE) {
	    if($date === FALSE)
		{
			return (date('N', strtotime(date("Y-m-d H:i:s"))) == 7);
		}
		return (date('N', strtotime($date)) == 1);
	}
}

if ( ! function_exists('isWeekend'))
{
	function isWeekend($date = FALSE) {
		if($date === FALSE)
		{
	    	return (date('N', strtotime(date("Y-m-d H:i:s"))) >= 6);	
		}
	    return (date('N', strtotime($date)) >= 6);
	}
}
?>