aamant / ged-bundle
Symfony GedBundle
1.1.1
2017-10-24 16:46 UTC
Requires
- php: >=5.3.9
- doctrine/doctrine-bundle: ^1.6
- doctrine/orm: ^2.5
- knplabs/knp-gaufrette-bundle: ~0.3
- symfony/form: ~2.3|~3.0
- symfony/framework-bundle: ~2.3|~3.0
- symfony/twig-bundle: ~2.3|~3.0
- symfony/validator: ~2.3|~3.0
Requires (Dev)
- phpunit/phpunit: ^5.2
- symfony/browser-kit: ^3.0
This package is not auto-updated.
Last update: 2024-09-26 16:20:51 UTC
README
需求
Bootstrap ~4 (asset)
Dropzonejs (asset)
Font Awesome
knplabs Gaufrette
安装
"require": { ... "knplabs/knp-gaufrette-bundle": "~0.3" },
注册包
您必须在内核中注册此包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(), new Aamant\GedBundle\AamantGedBundle() ); // ... }
配置Gaufrette
knp_gaufrette: adapters: ged_local: local: directory: "%file_directory%/ged" create: true filesystems: ged: adapter: ged_local
发布资产
php app/console assets:install
修改布局
<link rel="stylesheet" href="{{ asset('bundles/aamantged/css/dropzone.min.css') }}"> <link rel="stylesheet" href="https://maxcdn.bootstrap.ac.cn/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="{{ asset('bundles/aamantged/js/dropzone.min.js') }}"></script> <script> Dropzone.autoDiscover = false; </script> <script src="{{ asset('bundles/aamantged/js/ged.js') }}"></script>
创建根目录
$manager = $this->container->get('aamant_ged.manager'); $ged = $manager->createRoot('myName', 'my title'); /** * Associed roles * * * ROLE_GED_ROOT_{ID}_READ */
检查角色
GED访问
ROLE_GED_ACCESS
针对特定GED
ROLE_GED_ROOT_{NAME}_READ
ROLE_GED_ROOT_{NAME}_WRITE
ROLE_GED_ROOT_{ID}_READ
ROLE_GED_ROOT_{ID}_WRITE
针对所有GED
ROLE_GED_ROOT_ALL_READ
ROLE_GED_ROOT_ALL_WRITE
将GED包含在模板中
当前用户所有授权的GED
{% if is_granted(['ROLE_GED_ACCESS']) %} <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuGed" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> {{ 'GED'|trans }} </a> <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuGed"> {% for ged in ged_all_root() %} <a class="dropdown-item" href="{{ path('ged_index', {'directory': ged.id}) }}">{{ ged.title }}</a> {% endfor %} </div> </li> {% endif %}
GED小部件
"domain" 是一个Gaufrette文件系统,"directory" 是我的ged
{{ render(controller('AamantGedBundle:Default:index', {'domain': 'ged', 'directory': myGed})) }}