本文整理汇总了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);
}