当前位置: 首页>>代码示例>>PHP>>正文


PHP DateModules::GetWeekDay方法代码示例

本文整理汇总了PHP中DateModules::GetWeekDay方法的典型用法代码示例。如果您正苦于以下问题:PHP DateModules::GetWeekDay方法的具体用法?PHP DateModules::GetWeekDay怎么用?PHP DateModules::GetWeekDay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateModules的用法示例。


在下文中一共展示了DateModules::GetWeekDay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ShowReport

function ShowReport($admin){
	
	if($_POST["FromDate"] == "")
	{
		$StartDate = DateModules::shamsi_to_miladi($_POST["year"] . "-" . $_POST["month"] . "-01", "-");
		$EndDate = DateModules::shamsi_to_miladi($_POST["year"] . "-" . $_POST["month"] ."-" . DateModules::DaysOfMonth($_POST["year"] ,$_POST["month"]), "-");
	}
	else
	{
		$StartDate = DateModules::shamsi_to_miladi($_POST["FromDate"], "-");
		$EndDate = DateModules::shamsi_to_miladi($_POST["ToDate"], "-");
	}
	$holidays = ATN_holidays::Get(" AND TheDate between ? AND ? order by TheDate", array($StartDate, $EndDate));
	$holidayRecord = $holidays->fetch();
	
	$PersonID = $_SESSION["USER"]["PersonID"];
	$PersonID = !empty($_POST["PersonID"]) ? $_POST["PersonID"] : $PersonID;
	
	
	$query = "select * from (
		
			select 'normal' RecordType,'' ReqType, TrafficDate,TrafficTime,s.ShiftTitle,s.FromTime,s.ToTime
				,ExceptFromTime,ExceptToTime
			from ATN_traffic t
			left join ATN_PersonShifts ps on(ps.IsActive='YES' AND t.PersonID=ps.PersonID AND TrafficDate between FromDate AND ToDate)
			left join ATN_shifts s on(ps.ShiftID=s.ShiftID)
			where t.IsActive='YES' AND t.PersonID=:p AND TrafficDate>= :sd AND TrafficDate <= :ed 
			
			union All
			
			select 'start' RecordType,t.ReqType, t.FromDate,StartTime,s.ShiftTitle,s.FromTime,s.ToTime
				,ExceptFromTime,ExceptToTime
			from ATN_requests t
			left join ATN_PersonShifts ps on(ps.IsActive='YES' AND t.PersonID=ps.PersonID AND t.FromDate between ps.FromDate AND ps.ToDate)
			left join ATN_shifts s on(ps.ShiftID=s.ShiftID)
			where t.PersonID=:p AND t.ToDate is null AND ReqStatus=2 AND t.FromDate>= :sd
			
			union all
			
			select 'end' RecordType,t.ReqType, t.FromDate,EndTime,s.ShiftTitle,s.FromTime,s.ToTime
				,ExceptFromTime,ExceptToTime
			from ATN_requests t
			left join ATN_PersonShifts ps on(ps.IsActive='YES' AND t.PersonID=ps.PersonID AND t.FromDate between ps.FromDate AND ps.ToDate)
			left join ATN_shifts s on(ps.ShiftID=s.ShiftID)
			where t.PersonID=:p AND t.ToDate is null AND ReqStatus=2 AND t.FromDate>= :sd
				AND EndTime is not null
		)t2
		order by  TrafficDate,TrafficTime";
	$dt = PdoDataAccess::runquery($query, array(":p" => $PersonID, ":sd" => $StartDate, ":ed" => $EndDate));
	/*if($_SESSION["USER"]["UserName"] == "admin")
	{
	print_r(ExceptionHandler::PopAllExceptions());
	echo PdoDataAccess::GetLatestQueryString();
	}*/
	//print_r($dt);
	//........................ create days array ..................
	
	$index = 0;
	$returnArr = array();
	while($StartDate <= $EndDate)
	{
		if($index < count($dt) && $StartDate == $dt[$index]["TrafficDate"])
		{
			while($index < count($dt) && $StartDate == $dt[$index]["TrafficDate"])
				$returnArr[] = $dt[$index++];
			
			$StartDate = DateModules::AddToGDate($StartDate, 1);	
			continue;
		}
		
		$shiftRecord = ATN_PersonShifts::GetShiftOfDate($PersonID, $StartDate);

		$returnArr[] = array(
			"RecordType" => "normal",
			"TrafficID" => "", 
			"TrafficDate" => $StartDate , 
			"ShiftTitle" => $shiftRecord["ShiftTitle"], 
			"FromTime" => $shiftRecord["FromTime"], 
			"ToTime" => $shiftRecord["ToTime"], 
			"ExceptFromTime" => $shiftRecord["ExceptFromTime"], 
			"ExceptToTime" => $shiftRecord["ExceptToTime"], 
			"TrafficTime" => "");
		$StartDate = DateModules::AddToGDate($StartDate, 1);
	}
	//------------ holidays ------------------
	for($i=0; $i<count($returnArr); $i++)
	{
		$holiday = false;
		$holidayTitle = "تعطیل";
		if(FridayIsHoliday && DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "N") == "5")
			$holiday = true;
		if(ThursdayIsHoliday && DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "N") == "4")
			$holiday = true;

		if($holidayRecord && $holidayRecord["TheDate"] == $returnArr[$i]["TrafficDate"])
		{
			$holidayTitle .= $holidayRecord["details"] != "" ? "(" . $holidayRecord["details"] . ")" : "";
			$holiday = true;
			$holidayRecord = $holidays->fetch();
		}
//.........这里部分代码省略.........
开发者ID:jafarkhani,项目名称:rtfund,代码行数:101,代码来源:TraceTraffic.php

示例2: ShowReport


//.........这里部分代码省略.........
		
		//........................ create days array ..................
		$index = 0;
		$returnArr = array();
		while($StartDate <= $EndDate)
		{
			if($index < count($dt) && $StartDate == $dt[$index]["TrafficDate"])
			{
				while($index < count($dt) && $StartDate == $dt[$index]["TrafficDate"])
					$returnArr[] = $dt[$index++];

				$StartDate = DateModules::AddToGDate($StartDate, 1);	
				continue;
			}

			$shiftRecord = ATN_PersonShifts::GetShiftOfDate($PersonID, $StartDate);

			$returnArr[] = array(
				"RecordType" => "normal",
				"TrafficID" => "", 
				"TrafficDate" => $StartDate , 
				"ShiftTitle" => $shiftRecord["ShiftTitle"], 
				"FromTime" => $shiftRecord["FromTime"], 
				"ToTime" => $shiftRecord["ToTime"], 
				"ExceptFromTime" => $shiftRecord["ExceptFromTime"], 
				"ExceptToTime" => $shiftRecord["ExceptToTime"], 
				"TrafficTime" => "");
			$StartDate = DateModules::AddToGDate($StartDate, 1);
		}
		//------------ holidays ------------------
		for($i=0; $i<count($returnArr); $i++)
		{
			$holiday = false;
			if(FridayIsHoliday && DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "N") == "5")
				$holiday = true;
			if(ThursdayIsHoliday && DateModules::GetWeekDay($returnArr[$i]["TrafficDate"], "N") == "4")
				$holiday = true;

			if($holidayRecord && $holidayRecord["TheDate"] == $returnArr[$i]["TrafficDate"])
			{
				$holiday = true;
				$holidayRecord = $holidayIndex < count($holidays) ? $holidays[$holidayIndex++] : null;
			}

			$returnArr[$i]["holiday"] = $holiday;
		}
		//...........................................................

		for($i=0; $i < count($returnArr); $i++)
		{
			if(!$returnArr[$i]["holiday"])
			{
				//........... Daily off and mission ...................
				$requests = PdoDataAccess::runquery("
					select t.*, InfoDesc OffTypeDesc from ATN_requests t
						left join BaseInfo on(TypeID=20 AND InfoID=OffType)
					where ReqStatus=2 AND PersonID=:p AND FromDate <= :td 
						AND if(ToDate is not null, ToDate >= :td, 1=1)
					order by ToDate desc,StartTime asc
				", array(
					":p" => $PersonID,
					":td" => $returnArr[$i]["TrafficDate"]
				));

				if(count($requests) > 0)
				{
开发者ID:jafarkhani,项目名称:rtfund,代码行数:67,代码来源:summary.php


注:本文中的DateModules::GetWeekDay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。