- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/util/userfield.php
- Класс: BitrixTasksUtilUserField
- Вызов: UserField::getScheme
static function getScheme($entityId = 0, $userId = 0, $languageId = LANGUAGE_ID)
{
$userId = intval($userId);
if(!$userId)
{
$userId = User::getId();
}
$ufs = static::getUserFields($entityId, $userId, $languageId);
// restore system fields for this entity
if(User::isSuper($userId)) // only admin is allowed to create user fields
{
$reFetch = false;
$scheme = static::getSysScheme();
foreach($scheme as $field)
{
if(!array_key_exists($field['FIELD_NAME'], $ufs))
{
if(static::add(array_merge(array('ENTITY_ID' => static::getEntityCode()), $field)))
{
$reFetch = true;
}
}
}
if($reFetch)
{
$ufs = static::getUserFields($entityId, $userId, $languageId);
}
}
/*
// todo: restricted completely or restricted by the current project plan? you must now both ways!
// determine what we can do here
$canSortAndFilter = UtilUserFieldRestriction::canManage(static::getEntityCode());
foreach($ufs as $code => $desc)
{
$ufs[$code]['TASKS_RESTRICTION'] = array(
'SORT' => $canSortAndFilter, // whether we can sort by this field or not
'FILTER' => $canSortAndFilter, // whether we can filter by this field or not
);
}
*/
return $ufs;
}