本文整理汇总了PHP中CFileInput::arInputs方法的典型用法代码示例。如果您正苦于以下问题:PHP CFileInput::arInputs方法的具体用法?PHP CFileInput::arInputs怎么用?PHP CFileInput::arInputs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileInput
的用法示例。
在下文中一共展示了CFileInput::arInputs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Show
/**
* @param $strInputName
* @param string $strFileId
* @param bool|array $showInfo
* @param array $inputs
* @return string
*/
public static function Show($strInputName, $strFileId = "", $showInfo = false, $inputs = array())
{
global $USER;
CJSCore::Init('file_input');
ob_start();
$uploadInput = $inputs['upload'] === true ? array() : $inputs['upload'];
$medialibInput = $inputs['medialib'] === true ? array() : $inputs['medialib'];
$fileDialogInput = $inputs['file_dialog'] === true ? array() : $inputs['file_dialog'];
$cloudInput = $inputs['cloud'] === true ? array() : $inputs['cloud'];
self::Init($showInfo, $strInputName);
//1. Upload from PC
if (is_array($uploadInput)) {
self::$bUseUpload = true;
if (!array_key_exists("NAME", $uploadInput)) {
$uploadInput["NAME"] = $strInputName;
}
}
//2. Select file from medialib
if (COption::GetOptionString('fileman', "use_medialib", "Y") != "N" && is_array($medialibInput)) {
self::$bUseMedialib = true;
if (!array_key_exists("NAME", $medialibInput)) {
$medialibInput["NAME"] = $strInputName;
}
}
//3. Select file from file dialog
if (is_array($fileDialogInput)) {
self::$bUseFileDialog = true;
if (!array_key_exists("NAME", $fileDialogInput)) {
$fileDialogInput["NAME"] = $strInputName;
}
}
//4. Select file from cloud
if (is_array($cloudInput) && $USER->CanDoOperation("clouds_browse") && CModule::IncludeModule("clouds") && CCloudStorage::HasActiveBuckets()) {
self::$bUseCloud = true;
if (!array_key_exists("NAME", $cloudInput)) {
$cloudInput["NAME"] = $strInputName;
}
}
if ($inputs['description'] !== false) {
self::$bShowDescInput = true;
self::$descInputName = isset($inputs['description']["NAME"]) ? $inputs['description']["NAME"] : self::GetInputName($strInputName, "_descr");
}
if ($inputs['del'] !== false) {
self::$bShowDelInput = true;
self::$delInputName = isset($inputs['del']["NAME"]) ? $inputs['del']["NAME"] : self::GetInputName($strInputName, "_del");
}
// $arFile - Array with current file or false if it's empty
self::$curFileIds = is_array($strFileId) && !array_key_exists("tmp_name", $strFileId) ? $strFileId : array($strFileId);
self::$curFiles = array();
self::$bFileExists = false;
foreach (self::$curFileIds as $fileId) {
if (is_array($fileId)) {
continue;
}
if (strlen($fileId) <= 1 && intVal($fileId) === 0) {
continue;
}
self::$bFileExists = true;
if ($arFile = self::GetFile($fileId)) {
$arFile['FILE_NOT_FOUND'] = false;
if (self::$bShowDescInput && isset($inputs['description']['VALUE'])) {
$arFile['DESCRIPTION'] = $inputs['description']['VALUE'];
}
} else {
$arFile = array('FILE_NOT_FOUND' => true, 'DEL_NAME' => self::$delInputName);
}
self::$curFiles[] = $arFile;
}
self::$bViewMode = self::IsViewMode();
if (self::$bViewMode) {
self::$bShowDelInput = false;
}
if (!self::$bViewMode || self::$bFileExists) {
$inputs = array('upload' => self::$bUseUpload, 'medialib' => self::$bUseMedialib, 'file_dialog' => self::$bUseFileDialog, 'cloud' => self::$bUseCloud, 'del' => self::$bShowDelInput, 'description' => self::$bShowDescInput);
self::$arInputs = array('upload' => $uploadInput, 'medialib' => $medialibInput, 'file_dialog' => $fileDialogInput, 'cloud' => $cloudInput);
self::DisplayControl($inputs);
}
$result = ob_get_contents();
ob_end_clean();
return $result;
}