atm / boardbundle
2.27
2021-06-11 08:08 UTC
Requires (Dev)
- atm/commentbundle: ~1.0
- atm/emojisbundle: ~1.0
- doctrine/doctrine-bundle: ~1.4
- doctrine/orm: ^2.4.8
- dyninc/dyn-php: ^0.9.0
- friendsofsymfony/jsrouting-bundle: ^1.6
- qencode/api-client: 1.03.*
- xlabs/likebundle: ^1.0
- xlabs/resultcachebundle: ^1.0
Suggests
- symfony/asset: For using the AssetExtension
- symfony/expression-language: For using the ExpressionExtension
- symfony/finder: For using the finder
- symfony/form: For using the FormExtension
- symfony/http-kernel: For using the HttpKernelExtension
- symfony/routing: For using the RoutingExtension
- symfony/security: For using the SecurityExtension
- symfony/stopwatch: For using the StopwatchExtension
- symfony/templating: For using the TwigEngine
- symfony/translation: For using the TranslationExtension
- symfony/var-dumper: For using the DumpExtension
- symfony/yaml: For using the YamlExtension
README
通过composer安装
php -d memory_limit=-1 composer.phar require atm/boardbundle
在你的AppKernel中
public function registerbundles()
{
return [
...
...
new ATM\BoardBundle\ATMBoardBundle(),
];
}
配置示例
# app/config/config.yml
atm_board:
media_folder: Media folder.
user: Your user namespace.
image_width: width of the post image.
image_height: height of the post image.
watermark_image_small: small watermark path.
watermark_image_medium: medium watermark path.
watermark_image_big: big watermark path.
encoder_api_key: encoder api key from qencode.
encoder_profile_id: encoder profile id from qencode.
encoder_transfer_method_id: encoder profile id from qencode.
not_access_redirect_route: Redirect route when a user has no access to the board.
after_request_access_redirect_route: Redirect route after a request has sent to a user.
added_to_acl_redirect_route: Redirect route after a user is added to the acl.
removed_to_acl_redirect_route: Redirect route after a user is removed to the acl.
路由
追加到主路由文件
# app/config/routing.yml
atm_board:
resource: "@ATMBoardBundle/Controller/BoardController.php"
type: annotation
prefix: /
atm_board_admin:
resource: "@ATMBoardBundle/Controller/AdminController.php"
type: annotation
prefix: /
使用方法
首先使用以下路由创建一个板
{{ path('atm_board_create')
一旦你的板创建成功,你可以添加帖子图片、视频和文本。对于视频,你需要在控制台中启动rabbitMQ队列
- atm_board_encode_video:execute
访问控制列表(ACL)
板系统还允许给板的所有者想要给予访问权限的用户。首先,想要访问你的板的人必须使用此路由向你发送请求
{{ path('atm_board_request_access') }}
此路由的操作将触发以下事件
atm_board_request_access.event
在该事件中,你可以自定义板所有者获取添加想要查看板的人的链接的方式。这是将用户添加到板的ACL的路由
{{ path('atm_board_add_user_acl',{ 'boardId':board.id, 'userId':user.id }) }}
将用户添加到板的ACL后,将触发以下事件,其中板ID和添加到板ACL的用户ID作为参数
atm_board_added_acl.event
如果板所有者想要从其板上移除用户,这是进行此操作的路径
{{ path('atm_board_remove_user_acl',{ 'boardId':board.id, 'userId':user.id }) }}
此操作将触发以下事件,其中板ID和从板ACL中移除的用户ID作为参数
atm_board_deleted_acl.event
管理员
此bundle有自己的管理面板,可以查看所有用户及其板链接,这是管理面板的路径
{{ path('atm_board_admin_index')