本文整理汇总了PHP中TTDate::inWindow方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::inWindow方法的具体用法?PHP TTDate::inWindow怎么用?PHP TTDate::inWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTDate
的用法示例。
在下文中一共展示了TTDate::inWindow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calcExceptions
//.........这里部分代码省略.........
//Ignore punches that have the exact same timestamp, as they are likely transfer punches.
if ($prev_punch_time_stamp != $p_obj->getTimeStamp() and $p_obj->getType() == 10 and $p_obj->getStatus() == 10) {
//Normal In
if (!isset($scheduled_id_cache[$p_obj->getID()])) {
$scheduled_id_cache[$p_obj->getID()] = $p_obj->findScheduleID(NULL, $user_date_obj->getUser());
}
//Check if no schedule exists, or an absent schedule exists. If they work when not scheduled (no schedule) or schedule absent, both should trigger this.
if ($p_obj->setScheduleID($scheduled_id_cache[$p_obj->getID()]) == FALSE or is_object($p_obj->getScheduleObject()) and $p_obj->getScheduleObject()->getStatus() == 20) {
//Debug::text(' Worked when wasnt scheduled', __FILE__, __LINE__, __METHOD__,10);
$current_exceptions[] = array('user_date_id' => $user_date_id, 'exception_policy_id' => $ep_obj->getId(), 'type_id' => $type_id, 'punch_id' => $p_obj->getID(), 'punch_control_id' => FALSE);
} else {
Debug::text(' Schedule Found', __FILE__, __LINE__, __METHOD__, 10);
}
}
$prev_punch_time_stamp = $p_obj->getTimeStamp();
}
}
unset($scheduled_id_cache, $prev_punch_time_stamp, $p_obj);
break;
case 's3':
//In Early
if ($plf->getRecordCount() > 0) {
//Loop through each punch, find out if they are scheduled, and if they are in early
$prev_punch_time_stamp = FALSE;
foreach ($plf as $p_obj) {
//Ignore punches that have the exact same timestamp, as they are likely transfer punches.
if ($prev_punch_time_stamp != $p_obj->getTimeStamp() and $p_obj->getType() == 10 and $p_obj->getStatus() == 10) {
//Normal In
if (!isset($scheduled_id_cache[$p_obj->getID()])) {
$scheduled_id_cache[$p_obj->getID()] = $p_obj->findScheduleID(NULL, $user_date_obj->getUser());
}
if ($p_obj->setScheduleID($scheduled_id_cache[$p_obj->getID()]) == TRUE) {
if ($p_obj->getTimeStamp() < $p_obj->getScheduleObject()->getStartTime()) {
if (TTDate::inWindow($p_obj->getTimeStamp(), $p_obj->getScheduleObject()->getStartTime(), $ep_obj->getGrace()) == TRUE) {
Debug::text(' Within Grace time, IGNORE EXCEPTION: ', __FILE__, __LINE__, __METHOD__, 10);
} elseif (TTDate::inWindow($p_obj->getTimeStamp(), $p_obj->getScheduleObject()->getStartTime(), $ep_obj->getWatchWindow()) == TRUE) {
Debug::text(' NOT Within Grace time, SET EXCEPTION: ', __FILE__, __LINE__, __METHOD__, 10);
$current_exceptions[] = array('user_date_id' => $user_date_id, 'exception_policy_id' => $ep_obj->getId(), 'type_id' => $type_id, 'punch_id' => $p_obj->getID(), 'punch_control_id' => FALSE, 'punch_obj' => $p_obj, 'schedule_obj' => $p_obj->getScheduleObject());
}
}
} else {
Debug::text(' NO Schedule Found', __FILE__, __LINE__, __METHOD__, 10);
}
}
$prev_punch_time_stamp = $p_obj->getTimeStamp();
}
}
break;
case 's4':
//In Late
if ($plf->getRecordCount() > 0) {
$prev_punch_time_stamp = FALSE;
foreach ($plf as $p_obj) {
Debug::text(' In Late. Punch: ' . TTDate::getDate('DATE+TIME', $p_obj->getTimeStamp()), __FILE__, __LINE__, __METHOD__, 10);
//Ignore punches that have the exact same timestamp and/or punches with the transfer flag, as they are likely transfer punches.
if ($prev_punch_time_stamp != $p_obj->getTimeStamp() and $p_obj->getTransfer() == FALSE and $p_obj->getType() == 10 and $p_obj->getStatus() == 10) {
//Normal In
if (!isset($scheduled_id_cache[$p_obj->getID()])) {
$scheduled_id_cache[$p_obj->getID()] = $p_obj->findScheduleID(NULL, $user_date_obj->getUser());
}
if ($p_obj->setScheduleID($scheduled_id_cache[$p_obj->getID()]) == TRUE) {
if ($p_obj->getTimeStamp() > $p_obj->getScheduleObject()->getStartTime()) {
if (TTDate::inWindow($p_obj->getTimeStamp(), $p_obj->getScheduleObject()->getStartTime(), $ep_obj->getGrace()) == TRUE) {
Debug::text(' Within Grace time, IGNORE EXCEPTION: ', __FILE__, __LINE__, __METHOD__, 10);
} elseif (TTDate::inWindow($p_obj->getTimeStamp(), $p_obj->getScheduleObject()->getStartTime(), $ep_obj->getWatchWindow()) == TRUE) {
Debug::text(' NOT Within Grace time, SET EXCEPTION: ', __FILE__, __LINE__, __METHOD__, 10);
示例2: calcExceptions
//.........这里部分代码省略.........
//Not Scheduled
$schedule_total_time = 0;
if ($slf->getRecordCount() == 0) {
if ($plf->getRecordCount() > 0) {
Debug::text(' Worked when wasnt scheduled', __FILE__, __LINE__, __METHOD__, 10);
$ef = new ExceptionFactory();
$ef->setUserDateID($user_date_id);
$ef->setExceptionPolicyID($ep_obj->getId());
$ef->setType($type_id);
$ef->setEnableDemerits(TRUE);
if ($ef->isValid()) {
if ($enable_premature_exceptions == TRUE) {
$ef->emailException($user_date_obj->getUserObject(), $user_date_obj, $ep_obj);
}
$ef->Save();
}
}
} else {
Debug::text(' IS Scheduled', __FILE__, __LINE__, __METHOD__, 10);
}
break;
case 's3':
//In Early
if ($plf->getRecordCount() > 0) {
//Loop through each punch, find out if they are scheduled, and if they are in early
foreach ($plf as $p_obj) {
if ($p_obj->getType() == 10 and $p_obj->getStatus() == 10) {
//Normal In
if (!isset($scheduled_id_cache[$p_obj->getID()])) {
$scheduled_id_cache[$p_obj->getID()] = $p_obj->findScheduleID(NULL, $user_date_obj->getUser());
}
if ($p_obj->setScheduleID($scheduled_id_cache[$p_obj->getID()]) == TRUE) {
if ($p_obj->getTimeStamp() < $p_obj->getScheduleObject()->getStartTime()) {
if (TTDate::inWindow($p_obj->getTimeStamp(), $p_obj->getScheduleObject()->getStartTime(), $ep_obj->getGrace()) == TRUE) {
Debug::text(' Within Grace time, IGNORE EXCEPTION: ', __FILE__, __LINE__, __METHOD__, 10);
} elseif (TTDate::inWindow($p_obj->getTimeStamp(), $p_obj->getScheduleObject()->getStartTime(), $ep_obj->getWatchWindow()) == TRUE) {
Debug::text(' NOT Within Grace time, SET EXCEPTION: ', __FILE__, __LINE__, __METHOD__, 10);
$ef = new ExceptionFactory();
$ef->setUserDateID($user_date_id);
$ef->setExceptionPolicyID($ep_obj->getId());
$ef->setPunchID($p_obj->getID());
$ef->setType($type_id);
$ef->setEnableDemerits(TRUE);
if ($ef->isValid()) {
if ($enable_premature_exceptions == TRUE) {
$ef->emailException($user_date_obj->getUserObject(), $user_date_obj, $ep_obj);
}
$ef->Save();
}
}
}
} else {
Debug::text(' NO Schedule Found', __FILE__, __LINE__, __METHOD__, 10);
}
}
}
}
break;
case 's4':
//In Late
if ($plf->getRecordCount() > 0) {
foreach ($plf as $p_obj) {
if ($p_obj->getType() == 10 and $p_obj->getStatus() == 10) {
//Normal In
if (!isset($scheduled_id_cache[$p_obj->getID()])) {
$scheduled_id_cache[$p_obj->getID()] = $p_obj->findScheduleID(NULL, $user_date_obj->getUser());