2017 © Pedro Peláez
 

library ged-bundle

Symfony GedBundle

image

aamant/ged-bundle

Symfony GedBundle

  • Thursday, December 21, 2017
  • by aamant
  • Repository
  • 1 Watchers
  • 0 Stars
  • 28 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 4 % Grown

The README.md

GED

Require

Bootstrap ~4 (asset)
Dropzonejs (asset)
Font Awesome
knplabs Gaufrette

install

``` json "require": { ... "knplabs/knp-gaufrette-bundle": "~0.3" },, (*1)


## Register the bundle You must register the bundle in your kernel: ``` php <?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(), new Aamant\GedBundle\AamantGedBundle() ); // ... }

Configure Gaufrette

knp_gaufrette:
    adapters:
        ged_local:
            local:
                directory: "%file_directory%/ged"
                create:     true
    filesystems:
        ged:
            adapter: ged_local

publish asset

php app/console assets:install

Modify your layout

<link rel="stylesheet" href="{{ asset('bundles/aamantged/css/dropzone.min.css') }}">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/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>

Create a root directory

$manager = $this->container->get('aamant_ged.manager');
$ged = $manager->createRoot('myName', 'my title');

/**
 * Associed roles
 *
 *   
 *  ROLE_GED_ROOT_{ID}_READ 
 */

Check ROLE

GED Access, (*2)

ROLE_GED_ACCESS, (*3)

For specific GED, (*4)

ROLE_GED_ROOT_{NAME}_READ
ROLE_GED_ROOT_{NAME}_WRITE
ROLE_GED_ROOT_{ID}_READ 
ROLE_GED_ROOT_{ID}_WRITE

For all GED, (*5)

ROLE_GED_ROOT_ALL_READ
ROLE_GED_ROOT_ALL_WRITE

Include GED in your template

All authorized GED for current user, (*6)

{% 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 WIDGET, (*7)

"domain" is a gaufrette filesystem and "directory" is my ged, (*8)

{{ render(controller('AamantGedBundle:Default:index', {'domain': 'ged', 'directory': myGed})) }}

The Versions