- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/classes/general/taskplannermaintance.php
- Класс: CTaskPlannerMaintance
- Вызов: CTaskPlannerMaintance::getCurrentTasksList
static function getCurrentTasksList()
{
static $checked;
$list = CUserOptions::GetOption(
'tasks',
self::PLANNER_OPTION_CURRENT_TASKS,
null
);
// current user hasn't already used tasks list or has list in timeman
if ($list === null)
{
$list = [];
if (CModule::IncludeModule('timeman') && $timeManUser = CTimeManUser::instance())
{
$info = $timeManUser->GetCurrentInfo();
if (isset($info['TASKS']) && is_array($info['TASKS']))
{
$list = $info['TASKS'];
}
elseif (!isset($info['TASKS']))
{
$list = null;
}
}
if ($list !== null)
{
self::setCurrentTasksList($list);
}
}
if (!is_array($list))
{
$list = [];
}
$list = array_unique(array_filter($list, 'intval'));
if (!empty($list) && !$checked)
{
$items = [];
$res = TaskTable::getList([
'select' => ['ID'],
'filter' => [
'ID' => array_slice($list, 0, self::PLANNER_MAX_TASKS_COUNT),
],
]);
while ($item = $res->fetch())
{
$items[] = (int)$item['ID'];
}
$newList = array_intersect($list, $items);
if (count($list) !== count($newList))
{
self::setCurrentTasksList($newList);
$list = $newList;
}
$checked = true;
}
return $list;
}