本文整理匯總了PHP中CIntranetUtils::getAbsenceData方法的典型用法代碼示例。如果您正苦於以下問題:PHP CIntranetUtils::getAbsenceData方法的具體用法?PHP CIntranetUtils::getAbsenceData怎麽用?PHP CIntranetUtils::getAbsenceData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CIntranetUtils
的用法示例。
在下文中一共展示了CIntranetUtils::getAbsenceData方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getActivityInfo
protected static function getActivityInfo()
{
// real active users
$allTodayActiveUsers = array();
$result = UserDayTable::getList(array('filter' => array('=DAY' => \ConvertTimeStamp(time(), "SHORT"))));
while ($row = $result->fetch()) {
$allTodayActiveUsers[$row['USER_ID']] = true;
}
// absence data from calendar
$allAbsenceData = \CIntranetUtils::getAbsenceData(array('DATE_START' => ConvertTimeStamp(mktime(0, 0, 0), 'FULL'), 'DATE_FINISH' => ConvertTimeStamp(mktime(23, 59, 59), 'FULL'), 'PER_USER' => true));
// departments and its' employees
$allDepartments = array();
// userid -> true (working) | false (absent)
$allUsers = array();
$companyStructure = \CIntranetUtils::getStructure();
foreach ($companyStructure['DATA'] as $departmentData) {
// base structure
$department = array('EMPLOYEES' => array_filter(array_unique(array_merge($departmentData['EMPLOYEES'], array($departmentData['UF_HEAD'])))), 'ACTIVE_USERS' => 0);
foreach ($department['EMPLOYEES'] as $employeeId) {
$allUsers[$employeeId]['DEPARTMENTS'][] = $departmentData['ID'];
// skip absentee
if (isset($allUsers[$employeeId]['ABSENT']) && $allUsers[$employeeId]['ABSENT'] === true) {
continue;
}
if (!isset($allUsers[$employeeId]['ABSENT']) && isset($allAbsenceData[$employeeId]) && static::checkTodayAbsence($allAbsenceData[$employeeId])) {
// but only if they are really not active today
if (!isset($allTodayActiveUsers[$employeeId])) {
$allUsers[$employeeId]['ABSENT'] = true;
continue;
}
}
// remember supposed & really active users
++$department['ACTIVE_USERS'];
$allUsers[$employeeId]['ABSENT'] = false;
}
$allDepartments[$departmentData['ID']] = $department;
}
return array($allDepartments, $allUsers);
}