Skip to content

Instantly share code, notes, and snippets.

@maykelsb
Last active December 17, 2015 04:09

Revisions

  1. maykelsb revised this gist May 9, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions acl_linha_a_linha.php
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    <?php
    foreach ($rowset['rs'] as $item) {

    $acoes = array('acoes' => '');
  2. maykelsb created this gist May 9, 2013.
    21 changes: 21 additions & 0 deletions acl_linha_a_linha.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    foreach ($rowset['rs'] as $item) {

    $acoes = array('acoes' => '');
    $acl = Zend_Registry::get('acl');

    $resource = $acl->formatNameResource(array('module' => 'unidade', 'controller' => 'index'));
    if ($acl->isAllowed(null, $resource, 'get')) {
    $acoes['acoes'] .= $this->view->open('Unidade', $item->id_unidade_prisional, 'Abrir Unidade Prisional');
    }

    if ($acl->isAllowed(null, $resource, 'deletar')) {
    $acoes['acoes'] .= $this->view->delete('Unidade', $item->id_unidade_prisional, 'Deletar Unidade Prisional');
    }

    if ($acl->isAllowed(null, $acl->formatNameResource(array('controller' => 'localizar', 'module' => 'rastreamento')), 'zona')) {
    $acoes['acoes'] .= $this->view->zone($item->id_zona);
    }

    $data[] = array('id' => $item->id_unidade_prisional,
    'cell' => array_values(array_merge($item->toArray(), $acoes)));
    }