/** * @param array $values * @param string $inputNameTemplate * @param bool|array $showInfo * @param bool $maxCount * @param array $inputs * @return string */ public static function ShowMultiple($values = array(), $inputNameTemplate = "", $showInfo = false, $maxCount = false, $inputs = array()) { CJSCore::Init('file_input'); ob_start(); global $USER; self::Init($showInfo, $inputNameTemplate, $maxCount); self::$bMultiple = true; $arDescInput = is_array($inputs['description']) && isset($inputs['description']['VALUES']) && isset($inputs['description']['NAME_TEMPLATE']) ? $inputs['description'] : false; $inputs = array('upload' => $inputs['upload'] === true, 'medialib' => $inputs['medialib'] === true && COption::GetOptionString('fileman', "use_medialib", "Y") != "N", 'file_dialog' => $inputs['file_dialog'] === true, 'cloud' => $inputs['cloud'] === true && $USER->CanDoOperation("clouds_browse") && CModule::IncludeModule("clouds") && CCloudStorage::HasActiveBuckets(), 'del' => $inputs['del'] !== false, 'description' => $inputs['description'] === true || $arDescInput); self::$bUseUpload = $inputs['upload']; self::$bUseMedialib = $inputs['medialib']; self::$bUseFileDialog = $inputs['file_dialog']; self::$bUseCloud = $inputs['cloud']; self::$bShowDelInput = $inputs['del']; self::$bShowDescInput = $inputs['description']; self::$inputNameTemplate = $inputNameTemplate; self::$bViewMode = self::IsViewMode(); if (self::$bViewMode) { self::$bShowDelInput = false; } if (self::$bShowDelInput) { self::$delInputName = self::GetInputName($inputNameTemplate, "_del"); } if (self::$bShowDescInput) { self::$descInputName = ''; if ($arDescInput) { self::$descInputName = $arDescInput['NAME_TEMPLATE']; } if (empty(self::$descInputName)) { self::$descInputName = self::GetInputName($inputNameTemplate, "_descr"); } } // $arFile - Array with current file or false if it's empty self::$curFiles = array(); self::$bFileExists = false; foreach ($values as $inputName => $fileId) { if (strlen($fileId) <= 1 && intVal($fileId) === 0) { continue; } self::$bFileExists = true; if ($arFile = self::GetFile($fileId)) { $arFile['FILE_NOT_FOUND'] = false; $arFile['INPUT_NAME'] = $inputName; $arFile['DEL_NAME'] = self::GetInputName($inputName, '_del'); $arFile['DESC_NAME'] = self::GetInputName($inputName, '_descr'); if ($arDescInput) { list($descName, $descVal) = each($arDescInput['VALUES']); $arFile['DESC_NAME'] = $descName; $arFile['DESCRIPTION'] = $descVal; } } else { $arFile = array('FILE_NOT_FOUND' => true, 'INPUT_NAME' => $inputName, 'DEL_NAME' => self::GetInputName($inputName, '_del'), 'DESC_NAME' => self::GetInputName($inputName, '_descr')); } self::$curFiles[] = $arFile; } self::DisplayControl($inputs); $result = ob_get_contents(); ob_end_clean(); return $result; }