Ejemplo n.º 1
0
 public static function form($idConteudoPai)
 {
     $xhtml = '';
     if (Auth_Session_User::getInstance()->authenticated()) {
         $_comentarForm = new Cms_Form_Conteudo_Edit();
         $_comentarForm->loadElements("", "comment");
         $_profile = ZendT_Profile::get('Cms_Form_Conteudo_Edit', '', 'comentario');
         $_comentarForm->loadProfile($_profile);
         $_comentarForm->getElement('corpo')->editorHtml('comment')->setLabel('');
         $_comentarForm->populate(array('id_conteudo_pai' => $idConteudoPai));
         $_comentarForm->loadButtons();
         $nomeUsuario = Auth_Session_User::getInstance()->getName();
         $avatarUsuario = Auth_Session_User::getInstance()->getAvatar();
         $xhtml = '
             <li class="ui-helper-clearfix" id="comment-text">&nbsp;
                 <div class="header ui-helper-clearfix">&nbsp;
                     <span class="name">' . $nomeUsuario . '</span>
                 </div>
                 <div class="content ui-helper-clearfix">&nbsp;
                     <span class="avatar">
                         <img src="' . $avatarUsuario . '">
                     </span>
                     <span class="message comment" calc-width-parent="" calc-width="-100">
                         ' . $_comentarForm . '
                     </span>
                 </div>
             </li>';
     }
     return $xhtml;
 }
Ejemplo n.º 2
0
 public function loadProfile($object)
 {
     /**
      * Consultar o Profile cadastrado pelo usuário e alterar o $profile Default
      */
     if (!strpos($this->_name, '_ObjectView_')) {
         $profileUser = ZendT_Profile::get($this->_name, 'G');
         if ($profileUser) {
             $fields = $profileUser['cols-detail']['fields'];
             if ($fields) {
                 $arrFields = array_keys($fields);
                 $hiddenFields = array_diff($this->_profileDefault['order'], $arrFields);
                 $this->_profileDefault['hidden'] = array();
                 $this->_profileDefault['order'] = array();
                 foreach ($hiddenFields as $field) {
                     $this->_profileDefault['hidden'][] = $field;
                 }
                 foreach ($fields as $field => $config) {
                     if (isset($config['width'])) {
                         $this->_profileDefault['width'][$field] = $config['width'];
                     }
                     if (isset($config['align'])) {
                         $this->_profileDefault['align'][$field] = $config['align'];
                     }
                     if (isset($config['label'])) {
                         $this->_profileDefault['label'][$field] = $config['label'];
                     }
                     if (isset($config['value']) && $config['value']) {
                         $this->_profileDefault['value'][$field] = $config['value'];
                     }
                     if (isset($config['subtotal'])) {
                         $this->_profileDefault['subtotal'][$field] = $config['subtotal'];
                     }
                     if (isset($config['hidden']) && $config['hidden']) {
                         $this->_profileDefault['hidden'][] = $field;
                     }
                     $this->_profileDefault['order'][] = $field;
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 public function runAction()
 {
     $_job = new Profile_Model_Job_Mapper();
     $_job->setId($this->getRequest()->getParam('id'))->retrive()->setDhUltExec("SYSDATE")->update();
     $_view = new Profile_DataView_Job_Users();
     $where = new ZendT_Db_Where();
     $where->addFilter('profile_job.id', $this->getRequest()->getParam('id'));
     $where->addFilter('usuario.email', "", "!NULL");
     $data = $_view->recordset($where);
     while ($row = $data->getRow()) {
         try {
             $uri = $row['uri']->get();
             if ($uri == '') {
                 $uri = ZendT_Lib::convertObjectToUri($row['objeto']->get());
             }
             $uriOriginal = $uri . '/dynamic/profile/' . $row['id_profile']->get();
             $uri .= '/found/profile/' . $row['id_profile']->get() . '/no_location/1?' . $row['uri_token']->get();
             $client = new Zend_Http_Client($uri, array('timeout' => '80'));
             $response = $client->request();
             if ($response->getBody() == 'OK') {
                 $mail = new ZendT_Mail();
                 $mail->addTo($row['email_usuario']->get(), $row['nome_usuario']->get());
                 $mail->addFrom('*****@*****.**', 'Transportadora Americana');
                 $mail->setTitle($row['nome']->get());
                 $mail->setSubject($row['nome']->get());
                 $comment = $row['observacao']->get();
                 if (!$comment) {
                     $comment = $row['nome']->get();
                 }
                 $comment .= '<br><br>Para acessar o relatório clique <a href = "' . str_replace(array('/found/', '/no_location/1'), array('/dynamic/', ''), $uri) . '">aqui</a>';
                 $mail->setComment($comment);
                 $body = '<br>';
                 $user = array();
                 $user['id'] = $row['id_usuario']->get();
                 $user['role'] = $row['nome_papel']->get();
                 $listProfile = ZendT_Profile::listProfile($row['objeto']->get(), '', $user);
                 if (count($listProfile) > 0) {
                     $body .= '<style type="text/css">';
                     $body .= '    <!--';
                     $body .= '    td {';
                     $body .= '            font-family: Arial, Helvetica, sans-serif;';
                     $body .= '            font-size: 12px;';
                     $body .= '    }';
                     $body .= '    .TitleTable {';
                     $body .= '            font-weight: bold;';
                     $body .= '            border-bottom: 0px;';
                     $body .= '    }';
                     $body .= '    .viewTitle {';
                     $body .= '            background-color: #F9F9F9;';
                     $body .= '            font-weight: bold;';
                     $body .= '    }';
                     $body .= '    .viewTable {';
                     $body .= '            border:1px solid #CCCCCC;';
                     $body .= '    }';
                     $body .= '    -->';
                     $body .= '</style>';
                     $body .= '<table width="100%" border="0" cellpadding="5" cellspacing="0" class="viewTable">';
                     $body .= '	<tr >';
                     $body .= '		<td class="viewTitle">Visões Disponíveis</td>';
                     $body .= '	</tr>';
                     $body .= '	<tr>';
                     $body .= '		<td>';
                     $body .= '			<table width="100%" border="0" cellpadding="5" cellspacing="0">';
                     $body .= '				<tr>';
                     $body .= '					<td class="TitleTable">Tipo</td>';
                     $body .= '					<td class="TitleTable">Visão</td>';
                     $body .= '					<td class="TitleTable">Observação</td>';
                     $body .= '				</tr>';
                     foreach ($listProfile as $profile => $detailProfile) {
                         $uri = ZendT_Lib::convertObjectToUri($row['objeto']->get()) . '/found/profile/' . $profile . '?' . $row['uri_token']->get();
                         $body .= '				<tr>';
                         $body .= '					<td>' . $detailProfile['tipoDescricao'] . '</td>';
                         $body .= '					<td><a href = "' . str_replace('/found/', '/dynamic/', $uri) . '">' . $detailProfile['nome'] . '</a></td>';
                         $body .= '					<td>' . $detailProfile['observacao'] . '</td>';
                         $body .= '				</tr>';
                     }
                     $body .= '			</table>';
                     $body .= '		</td>';
                     $body .= '	</tr>';
                     $body .= '</table>';
                 }
                 $mail->setBody($body);
                 $mail->save();
             }
         } catch (Exception $ex) {
             $mail = new ZendT_Mail();
             /* $mail->addTo("*****@*****.**"); */
             $mail->addTo("*****@*****.**");
             $mail->addFrom('*****@*****.**', 'Transportadora Americana');
             $mail->setTitle('Erro no envio de e-mail pelo agendamento de tarefa');
             $mail->setSubject($mail->getTitle());
             $comment = $row['nome']->get() . '<br><br>Para acessar o relatório clique <a href = "' . $uriOriginal . '">aqui</a>';
             $mail->setComment($comment);
             $mail->setBody($ex->getMessage());
             $mail->save();
             /*echo 'Erro';
               exit;*/
         }
     }
     echo 'Processado';
     exit;
 }
Ejemplo n.º 4
0
 /**
  * Aplica as configurações e gera o relatório
  *
  * @param string $type
  * @param array $options
  */
 public function configReport($type = 'pdf', $options = false)
 {
     set_time_limit(3200);
     $objectName = get_class($this->_mapper);
     if (ZendT_Acl::getInstance()->isAllowed('object-view', 'profile')) {
         $profile = ZendT_Profile::get($objectName, $type == 'pdf' ? 'P' : 'X');
         if ($profile) {
             $result = $this->configReportProfile($type, $options, $profile);
         } else {
             $result = $this->configReportSample($type, $options);
         }
     } else {
         $result = $this->configReportSample($type, $options);
     }
     return $result;
 }
Ejemplo n.º 5
0
 public function viewAction()
 {
     $this->_defineLayout();
     $id = $this->getRequest()->getParam('id');
     $key = $this->getRequest()->getParam('key');
     $list = $this->getRequest()->getParam('list');
     $chaveCategoria = $this->getRequest()->getParam('chave_categoria');
     $select = $this->getRequest()->getParam('select');
     $sub = $this->getRequest()->getParam('sub');
     $edit = $this->getRequest()->getParam('edit');
     $editDisabled = $this->getRequest()->getParam('edit_disabled');
     $conteudo = $this->getRequest()->getParam('conteudo');
     $categoria = $this->getRequest()->getParam('categoria');
     $restringirUsuario = $this->getRequest()->getParam('ru');
     if ($restringirUsuario) {
         $idUsuario = Zend_Auth::getInstance()->getStorage()->read()->getId();
         $this->getRequest()->setParam('cms_conteudo-id_usuario_inc', $idUsuario);
     }
     $_conteudo = $this->getMapper();
     if (!$id) {
         $id = $conteudo;
     }
     if ($id && !is_numeric($id)) {
         $id = $_conteudo->newRow()->setChave($id)->retrieve()->getId(true)->toPhp();
         $_conteudo->newRow();
     }
     if ($key && !$id) {
         $id = $_conteudo->newRow()->setChave($key)->retrieve()->getId(true)->toPhp();
         $_conteudo->newRow();
     }
     $idCategoriaAtual = "";
     $_where = new ZendT_Db_Where();
     $_where->addFilter("cms_conteudo.id", $id);
     $data = $_conteudo->findAll($_where)->fetch();
     if ($data) {
         $_conteudo->setId($id)->retrieve();
         $_fileSystem = new Ged_Model_Arquivo_FileSystem();
         $thumbnail = $_conteudo->getThumbnail()->toPhp();
         if ($thumbnail) {
             $imgUrl = $_fileSystem->getDirectoryAdress($thumbnail);
             $this->view->img = $imgUrl;
         }
         $this->view->banner = $_conteudo->getBanner()->toPhp();
         if ($this->view->banner) {
             $this->view->banner = $_fileSystem->getDirectoryAdress($this->view->banner);
         }
         $this->view->id = $id;
         $this->view->titulo = $_conteudo->getTitulo()->get();
         $this->view->subtitulo = $_conteudo->getSubtitulo()->get();
         $this->view->corpo = $_conteudo->getCorpo()->get();
         $this->view->corpoUrl = $_conteudo->getCorpoUrl()->get();
         $this->view->viewPdf = $this->getRequest()->getParam('pdf');
         $this->view->arquivo = $_conteudo->getArquivo(true)->toPhp();
         $_arquivo = $_conteudo->getArquivo(true);
         if ($_arquivo->toPhp() && !$this->view->viewPdf) {
             $name = $_arquivo->getFile()->getName();
             if (strpos(strtolower($name), '.pdf')) {
                 $this->view->viewPdf = 1;
             } else {
                 $this->view->urlDownload = $_arquivo->getFile()->toUrlDownload(false);
             }
         }
         $_categoria = new Cms_DataView_Categoria_MapperView();
         $_categoria->setId($_conteudo->getIdCategoria()->toPhp());
         $_categoria->retrieve();
         $idCategoriaPai = $_categoria->getIdCategoriaPai()->toPhp();
         if ($sub) {
             $_categoria = new Cms_DataView_Categoria_MapperView();
             $_categoria->setId($idCategoriaPai);
             $_categoria->retrieve();
             $idCategoriaPai = $_categoria->getIdCategoriaPai()->toPhp();
         }
         $idCategoriaAtual = $_conteudo->getIdCategoria()->toPhp();
         /* Painel da direita */
         $conteudosCategoria = $_conteudo->getContents($_conteudo->getIdCategoria()->toPhp());
         if ($conteudosCategoria) {
             foreach ($conteudosCategoria as $index => $conteudo) {
                 if ($conteudo['id'] == $id || !isset($conteudo['id'])) {
                     unset($conteudosCategoria[$index]);
                 }
             }
             $this->view->painelDireita = $conteudosCategoria;
         }
         /* Painel central */
         $this->view->painelCentral = '';
         $this->view->editPermissao = false;
         if (!$editDisabled) {
             $_conteudoMapperView = new Cms_DataView_Conteudo_MapperView();
             $this->view->editPermissao = $_conteudoMapperView->setId($id)->isEditEnabled();
             if ($edit) {
                 $this->getRequest()->setParam('edit', $this->view->editPermissao);
             }
             $edit = $this->getRequest()->getParam('edit');
         }
         if ($edit && $this->view->editPermissao) {
             $_conteudoForm = new Cms_Form_Conteudo_Edit();
             $_conteudoForm->loadElements();
             $_profile = ZendT_Profile::get('Cms_Form_Conteudo_Edit', '', 'analise');
             $_conteudoForm->loadProfile($_profile);
             $_conteudoForm->loadButtons();
             $_mapper = new Cms_DataView_Conteudo_MapperView();
             $row = $_mapper->setId($id)->getDataEdicao();
             if (count($row)) {
                 $_conteudoForm->populate($row);
                 $this->view->corpo = $_conteudoForm;
             }
         }
         $this->view->comments = Cms_Helper_Comments::comments($id);
         if (!$this->view->corpoUrl && !$edit) {
             $this->view->commentsForm = Cms_Helper_Comments::form($id);
         }
         $this->view->likes = Cms_Helper_Likes::button($id);
         $_notificacao = new Cms_Model_Notificacao_Mapper();
         $_notificacao->remove($id);
     } else {
         if ($list) {
             $this->gridAction();
             $this->getGrid()->setBeforeRequest("function(){\n                                                    \$.gridResize({\n                                                        idGrid: '" . $this->getGrid()->getID() . "'\n                                                       ,width: function(){ return calcWidthGrid(); }\n                                                     /*,height: function(){ return calcHeightGrid(); }*/\n                                                    });\n                                                    \$(window).resize(function(){\n                                                        \$.gridResize({\n                                                            idGrid: '" . $this->getGrid()->getID() . "'\n                                                           ,width: function(){ return calcWidthGrid(); }\n                                                         /*,height: function(){ return calcHeightGrid(); }*/\n                                                        });\n                                                    });\n                                                }");
         } else {
             $this->view->msg = "Conteúdo não disponível ou requer autenticação!";
         }
     }
     /* Painel da esquerda */
     $this->view->painelEsquerda = '';
     if ($categoria) {
         if (!is_numeric($categoria)) {
             $_categoria = new Cms_Model_Categoria_Mapper();
             $_categoria->setChave($categoria)->retrieve();
             $categoria = $_categoria->getId(true)->toPhp();
         }
         if ($chaveCategoria) {
             $_categoria = new Cms_Model_Categoria_Mapper();
             $_categoria->setChave($chaveCategoria)->retrieve();
             $idCategoriaAtual = $_categoria->getId(true)->toPhp();
         }
         if ($select) {
             $_categoria = new Cms_Model_Categoria_Mapper();
             $_categoria->setChave($select)->retrieve();
             $idCategoriaAtual = $_categoria->getId(true)->toPhp();
         }
         $_sideBar = new Cms_DataView_Sidebar_MapperView();
         //$_sideBarHelper = new Cms_Helper_Sidebar();
         //$html = $_sideBarHelper->sidebar($_sideBar->getSidebar($categoria), $idCategoriaAtual);
         $this->view->categoria = $categoria;
         $this->view->painelEsquerda = $this->view->sidebar($_sideBar->getSidebar($categoria), 'menu-' . $idCategoriaAtual);
     }
 }
Ejemplo n.º 6
0
 private function _getConfigDashboard($row)
 {
     //$_mapper = $this->_loadMapper($row['objeto']->get());
     $_profile = new ZendT_Profile();
     $profiles = $_profile->listProfile($row['objeto']->get());
     $columns = array();
     foreach ($profiles as $id => $profile) {
         $name = 'view-' . $id . '-' . str_replace(' ', '_', strtolower(removeAccent($profile['nome'])));
         if ($profile['tipo'] != 'B') {
             $columns[$name]['label'] = $profile['nome'];
             $columns[$name]['width'] = 300;
             $columns[$name]['order'] = null;
             $columns[$name]['align'] = 'left';
             $columns[$name]['column'] = $id;
             $columns[$name]['id'] = $id;
             $columns[$name]['type'] = null;
         }
     }
     $config = unserialize(html_entity_decode($row['config']->get()));
     /**
      * 
      */
     if (!isset($config['cols-panel'])) {
         $config = array('cols-panel' => array('name' => 'cols-panel', 'label' => 'Painel de Visões', 'draggable' => 0, 'fields' => array()), 'cols-filter' => array('name' => 'cols-filter', 'label' => 'Painel de Filtros', 'draggable' => 1, 'fields' => array()));
     }
     /**
      * Ordena as colunas 
      */
     if ($config) {
         foreach ($config as $key => $value) {
             unset($columns[$key]);
         }
     }
     /**
      * Adiciona as novas colunas ou as que não foram configuradas
      */
     foreach ($columns as $name => $column) {
         if ($columns[$name]['label']) {
             $column['hidden'] = 1;
             $config['ini']['fields'][$name] = $column;
         }
     }
     return $config;
 }
Ejemplo n.º 7
0
 /**
  * Pega o objeto grid pré-configurado para
  * manipulação.
  *
  * @return ZendT_Grid
  */
 public function configGrid()
 {
     $module = $this->getRequest()->getModuleName();
     $controller = $this->getRequest()->getControllerName();
     $params = $this->getRequest()->getParams();
     $profileKey = '';
     if (isset($params['profile_key'])) {
         $profileKey = $params['profile_key'];
     }
     $urlFilter = '?q=1';
     if (isset($params['filter_json'])) {
         $urlFilter .= '&filter_json=' . $params['filter_json'];
     }
     if (isset($params['mapper_view'])) {
         $urlFilter .= '&mapper_view=' . $params['mapper_view'];
     }
     if ($this->_mapper instanceof ZendT_Db_View) {
         $where = $this->getMapper()->getColumns()->getWhere($params);
         if ($where) {
             $params['postData'] = $where->toJsonPostData($params['postData']);
         }
     }
     if ($params['postData'] != '') {
         $autoFilter = true;
     } else {
         $autoFilter = false;
     }
     $type = 'G';
     #Grid
     $mapperName = get_class($this->_mapper);
     $profile = ZendT_Profile::get($mapperName, $type);
     $profileId = '';
     if (isset($profile['id'])) {
         $profileId = $profile['id'];
     }
     $profiles = ZendT_Profile::listProfile($mapperName, $type);
     $this->getGrid()->setUrl(ZendT_Url::getBaseUrl() . '/' . $module . '/' . $controller . '/grid-data/profile/' . $profileId . $urlFilter)->setDataType('json')->setMType('POST')->setRowNum(30)->setRowList(array(30, 60, 90))->setPager("#pager-" . $this->getGrid()->getID())->setViewRecords('true')->setToolbar(array('true', 'top'))->setMType('POST')->setWidth(960)->setAutoFilter($autoFilter)->setShrinkToFit(false)->setPostData(urldecode($params['postData']))->setBeforeRequest("function(){ gridResize('" . $this->getGrid()->getID() . "'); }")->setGridComplete(" function(){ jQuery.gridAtivaNavKey({ idGrid:'" . $this->getGrid()->getID() . "' }); }");
     /**
      * Analisa Parâmetros
      */
     $newPostData = array();
     foreach ($params as $name => $value) {
         $param = $this->getMapper()->paramName($name);
         if ($param) {
             $newPostData[$param] = $value;
         }
     }
     if (count($newPostData) > 0) {
         $this->getGrid()->setPostData($newPostData);
     }
     if ($this->getRequest()->getParam('seekerAjax')) {
         $objectRetrieve = 'TSeeker';
         if ($this->getRequest()->getParam('objectRetrive')) {
             $objectRetrieve = $this->getRequest()->getParam('objectRetrive');
         }
         $this->view->headScript()->appendFile(ZendT_Url::getBaseDiretoryPublic() . '/scripts/jquery/widget/' . $objectRetrieve . '.js');
         $seekerName = $this->getRequest()->getParam('seekerName');
         $seekerAccess = 'window.opener.jQuery';
         $seekerClose = 'window.close();';
         if ($params['typeModal'] == 'AJAX') {
             $seekerAccess = 'jQuery';
             $seekerClose = 'seeker.TSeeker(\'divClose\');';
             $functionResize = "function(){\n                                            var grid = jQuery('#" . $this->getGrid()->getID() . "');\n                                            var seeker = " . $seekerAccess . "('#" . $seekerName . "');\n                                            var div  = seeker.TSeeker('option','elements').div;\n                                            grid.setGridHeight(250);\n                                            grid.setGridWidth(700);\n                                        }";
         } else {
             $functionResize = "function(){\n                                            \$.gridResize({\n                                                idGrid: '" . $this->getGrid()->getID() . "'\n                                            });\n                                            \$(window).resize(function(){\n                                                \$.gridResize({\n                                                    idGrid: '" . $this->getGrid()->getID() . "'\n                                                });\n                                            });\n                                        }";
         }
         $functionRetorno = "function(){\n                                        var grid  = jQuery('#" . $this->getGrid()->getID() . "');\n                                        if( grid.jqGrid('getGridParam','multiselect') ){\n                                            var id = grid.jqGrid('getGridParam','selarrrow');\n                                        }else{\n                                            var id = grid.jqGrid('getGridParam','selrow');\n                                        }\n                                        var seeker = " . $seekerAccess . "('#" . $seekerName . "');\n                                        try{\n                                            seeker.{$objectRetrieve}('retrieve',{value: id});\n                                            {$seekerClose}\n                                        }catch(err){\n                                            {$seekerClose}\n                                        }\n                                    }";
         $this->getGrid()->setOndblClickRow($functionRetorno)->setBeforeRequest($functionResize)->setGridComplete("function(){\n                                                \$.gridAtivaNavKey({\n                                                    idGrid: '" . $this->getGrid()->getID() . "',\n                                                    functionEnter: " . $functionRetorno . "\n                                                });\n                                            }");
     }
     if ($params['callback']) {
         $functionCallback = base64_decode($params['callback']);
         $this->getGrid()->setOndblClickRow($functionCallback)->setGridComplete("function(){\n                                                \$.gridAtivaNavKey({\n                                                    idGrid: '" . $this->getGrid()->getID() . "',\n                                                    functionEnter: " . $functionCallback . "\n                                                });\n                                            }");
     }
     if ($params['multiple']) {
         $this->getGrid()->setMultiSelect(true);
         $idbt = 'selectGrid' . $this->getGrid()->getID();
         $multiSelect = new ZendT_Grid_Button($idbt);
         $multiSelect->setIdGrid($this->getGrid()->getID())->setButtonIcon("ui-icon-check")->setTitle("Selecionar")->setCaption("Selecionar")->setOnClick($functionRetorno);
         $this->view->hotkeys()->add('btMultiSelect', 'ctrl+s', '$("#' . $idbt . '").click();');
         $this->getGrid()->addToolbarButton("multiSel", $multiSelect);
     }
     $idbt = 'refreshGrid' . $this->getGrid()->getID();
     $refresh = new ZendT_Grid_Button_Refresh($idbt);
     $refresh->setIdGrid($this->getGrid()->getID())->setButtonIcon("ui-icon-refresh")->setTitle("Atualizar");
     $this->view->hotkeys()->add('btRefresh', 'ctrl+r', '$("#' . $idbt . '").click();');
     $this->getGrid()->addToolbarButton("refresh", $refresh, 'grid');
     /* $clearFiltro = new ZendT_Grid_Button();
        $clearFiltro->setIdGrid($this->getGrid()->getID())
        ->setButtonIcon('ui-icon ui-icon-arrowreturnthick-1-s')
        ->setOnClick('function(){$(\'#' . $this->getGrid()->getID() . '\')[0].clearToolbar();}')
        ->setTitle('Limpar Filtro');
        $this->getGrid()->addToolbarButton('clearFilter', $clearFiltro, 'grid'); */
     $autoFiltro = new ZendT_Grid_Button();
     $autoFiltro->setIdGrid($this->getGrid()->getID())->setButtonIcon('ui-icon  ui-icon-pin-s')->setOnClick('function(){$(\'#' . $this->getGrid()->getID() . '\')[0].toggleToolbar();}')->setTitle('Filtro');
     $this->getGrid()->addToolbarButton('autofiltro', $autoFiltro, 'grid');
     $_profile = new ZendT_View_Profile('selProfile', $profile['id'], $profiles, $type, $mapperName);
     $screenName = $this->view->screenName;
     $this->view->profileMenu = $_profile->render($screenName);
     $this->view->screenName = $screenName;
     $this->view->placeholder('title')->set($screenName);
     $navigator = '';
     if ($navigator) {
         $this->getGrid()->getNavigator()->addCommand('navigatorGrid', $navigator);
     }
     /**
      * Botão de adição de registro e
      * suas configurações vitais
      */
     if ($this instanceof ZendT_Controller_ActionCrud && ZendT_Acl::getInstance()->isAllowed('insert', $this->_resourceBase)) {
         $filterJson = $this->getRequest()->getParam('filter_json');
         $idbt = 'addGrid' . $this->getGrid()->getID();
         $add = new ZendT_Grid_Button_Add($idbt);
         $add->setIdGrid($this->getGrid()->getID())->setButtonIcon('ui-icon-plus')->setUrl(ZendT_Url::getBaseUrl() . '/' . $module . '/' . $controller . '/form?filter_json=' . $filterJson . '&profile_key=' . $profileKey)->setWindowWidth(860)->setWindowHeight(520)->setTitle('Adicionar');
         $this->view->hotkeys()->add('btInsert', 'ctrl+a', '$("#' . $idbt . '").click();');
         $this->getGrid()->addToolbarButton('add', $add, 'edit');
     }
     /**
      * Botão de edição de linha e
      * suas configurações vitais
      */
     if ($this instanceof ZendT_Controller_ActionCrud && ZendT_Acl::getInstance()->isAllowed('update', $this->_resourceBase)) {
         $idbt = 'editGrid' . $this->getGrid()->getID();
         $edit = new ZendT_Grid_Button_Edit($idbt);
         $edit->setIdGrid($this->getGrid()->getID())->setButtonIcon('ui-icon-pencil')->setUrl(ZendT_Url::getBaseUrl() . '/' . $module . '/' . $controller . '/form' . '?profile_key=' . $profileKey)->setUrlRetrieve(ZendT_Url::getBaseUrl() . '/' . $module . '/' . $controller . '/retrive')->setWindowWidth(860)->setWindowHeight(520)->setTitle('Editar');
         $this->view->hotkeys()->add('btEdit', 'ctrl+e', '$("#' . $idbt . '").click();');
         $this->getGrid()->addToolbarButton('edit', $edit, 'edit');
         if (!$this->getRequest()->getParam('seekerAjax')) {
             $this->getGrid()->setOndblClickRow("function(){jQuery('#" . $idbt . "').click();}");
         }
     }
     #Button - Delete
     if ($this instanceof ZendT_Controller_ActionCrud && ZendT_Acl::getInstance()->isAllowed('delete', $this->_resourceBase)) {
         $idbt = 'delGrid' . $this->getGrid()->getID();
         $del = new ZendT_Grid_Button_Delete($idbt);
         $del->setIdGrid($this->getGrid()->getID())->setButtonIcon('ui-icon-trash')->setUrl(ZendT_Url::getBaseUrl() . '/' . $module . '/' . $controller . '/delete')->setWindowWidth(800)->setWindowHeight(520)->setTitle('Excluir');
         $this->view->hotkeys()->add('btDelete', 'ctrl+d', '$("#' . $idbt . '").click();');
         $this->getGrid()->addToolbarButton('del', $del, 'edit');
     }
     if ($this instanceof ZendT_Controller_ActionCrud && ZendT_Acl::getInstance()->isAllowed('log', $this->_resourceBase) && method_exists($this->_mapper, 'isLogger') && $this->_mapper->isLogger()) {
         $log = new ZendT_Grid_Button_Window();
         $log->setIdGrid($this->getGrid()->getID())->setButtonIcon('ui-icon-info')->setUrl(ZendT_Url::getBaseUrl() . '/' . $module . '/' . $controller . '/log')->setWindowWidth(650)->setWindowHeight(450)->setTitle('Log');
         $this->getGrid()->addToolbarButton('Log', $log, 'edit');
     }
     $this->view->typeModal = $params['typeModal'];
     if ($params['typeModal'] == 'AJAX') {
         Zend_Layout::getMvcInstance()->setLayout('ajax');
     } else {
         if ($params['typeModal'] == 'WINDOW') {
             $this->view->onLoad = stripslashes(urldecode($params['afterLoad']));
             $this->view->onClose = stripslashes(urldecode($params['onClose']));
             Zend_Layout::getMvcInstance()->setLayout('window');
         }
     }
 }