Esempio n. 1
0
 function AddFiles($ID, $arFiles = array(), $arParams = array())
 {
     $arFilesIds = array();
     $userId = null;
     $bCheckRightsOnFiles = false;
     if (is_array($arParams)) {
         if (isset($arParams['USER_ID']) && $arParams['USER_ID'] > 0) {
             $userId = (int) $arParams['USER_ID'];
         }
         if (isset($arParams['CHECK_RIGHTS_ON_FILES'])) {
             $bCheckRightsOnFiles = $arParams['CHECK_RIGHTS_ON_FILES'];
         }
     }
     if ($userId === null) {
         global $USER;
         $userId = is_object($USER) ? intval($USER->GetID()) : 1;
     }
     if ($arFiles) {
         foreach ($arFiles as $file) {
             $arFilesIds[] = (int) $file;
         }
         if (count($arFilesIds)) {
             CTaskFiles::AddMultiple($ID, $arFilesIds, array('USER_ID' => $userId, 'CHECK_RIGHTS_ON_FILES' => $bCheckRightsOnFiles));
         }
     }
 }