kuikui / qcubed-filefinder
QCubed v4 的 FileFinder 插件
dev-master
2024-09-13 10:46 UTC
Requires
- php: >=8.0
This package is auto-updated.
Last update: 2024-09-13 10:46:51 UTC
README
QCubed v4 的 FileFinder
简单示例:弹出窗口实现的选项
有时,您可能需要一个快速简便的方法,通过弹出窗口从其他PHP页面搜索和检索数据,以及其他功能。
这个简单的 Filefinder 插件恰好可以满足这个目的,并且可以重复使用。要实现这一点,您需要添加一个或多个按钮来根据您的需求触发弹出窗口。每个弹出窗口都可以根据各种数据集或其他内容进行定制。
以下是一个简单示例:首先指定数据弹出按钮:“一些名称标签”;在此阶段,需要进行配置
$button = new Bs\Button($this);
$button-> etc...
$button->setDataAttribute('popup', 'some name tag');
$object = new Q\Plugin\FileFinder($this);
$object->PopupUrl = "finder.php"; // Any php page
$object->TargetPopupName = 'some name tag';
弹出窗口的默认宽度和高度设置为 95%。您可以调整弹出窗口的大小,使其更小。为此,您可以使用以下语法
$object->PopupWidth = '...%';
$object->PopupHeight = '...%';
将“...%”替换为宽度和高度所需的百分比值。
在此示例中,我们使用 finder.php,它是基于 FileHandler 的:[https://github.com/kukrik/qcubed-filemanager](https://github.com/kukrik/qcubed-filemanager)
Finder 放置在弹出窗口中,您可以根据需要对其进行一些配置。
如果您想通过文件类型限制文件选择,可以在 finder.php 的第 168-169 行将 LockedDocuments 和 LockedImages 的默认值更改为 true。
此外,您还需要前往第 2659 行查看并配置它。请遵循那里提供的说明和建议。
// Here, the "files" table needs to be updated to indicate that the selected image(s) are now locked.
// If this is not done, the file manager will not provide accurate information about whether
// the files are free or not. This is to prevent accidentally deleting files that are in use by others.
$objFiles = Files::loadById($arrSome["data-id"]);
$objFiles->setLockedFile($objFiles->getLockedFile() + 1);
//$objFiles->save();
// First, you need to create your own table with your chosen name and define the necessary columns.
// However, here you must definitely add a column named "file_id", where you will pull the "id" value
// from the "files" table.
//
//This is necessary so that when you need to delete from your table, you can release the lock in
// the "files" table based on the "file_id". This ensures that FileHandler reflects the correct
// information to other users.
// $objSome = new Some();
// $objSome->setFileId($arrSome["data-id"]);
// $objSome->.... etc;
// $objSome->.... etc;
如果您尚未安装 QCubed Bootstrap 和 twitter bootstrap,请在主安装目录的命令行中通过 Composer 运行以下操作
composer require twbs/bootstrap v3.3.7
和
composer require kukrik/qcubed-filefinder
composer require kukrik/bootstrap