Skip to content

Instantly share code, notes, and snippets.

@maykelsb
Last active December 17, 2015 04:09
Show Gist options
  • Save maykelsb/5548847 to your computer and use it in GitHub Desktop.
Save maykelsb/5548847 to your computer and use it in GitHub Desktop.
<?php
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)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment