getUI();
if ( !$searchForm )
{
$searchForm = $form . 'Search';
}
if ( ( strlen( $function ) == 0 ) || ( $function == 'search' ) || ( $function == 'detail' ) || ($function == 'execute'))
{
$content = $ui->getForm($module,$searchForm);
}
else
{
$content = $ui->getForm( $module, $form );
}
//tenta verificar as permissões, pode retornar erro caso não exista transação
try
{
if ( $content->checkAccess() )
{
$content->setIcon($ui->getImage($module, $img ));
$theme->setContent($content);
}
else
{
// Testar se existe sessão e o usuário não tem acesso, mostra mensagem de falta de acesso.
if ( $MIOLO->getLogin()->id )
{
GForm::error(USUARIO_SEM_PERMISSAO);
}
else
{
$loginUrl = $MIOLO->getConf('home.url').'/index.php?module=gnuteca3&action=main:login' ;
$page->redirect( $loginUrl );
}
}
createBreadCrumb();
}
catch (Exception $ex)
{
GForm::error( $ex->getMessage() );
}
}
function createBreadCrumb()
{
global $navbar;
global $action;
$handlers = explode(':', $action);
if ( $handlers[count($handlers) - 2] == 'search' )
{
$navbar->addOption('
' . _M('Pesquisa') . '
', $module);
return;
}
$options = array();
foreach ( $handlers as $h )
{
if ( $h == 'adminReport' )
{
$menuItem = MIOLO::_REQUEST('menuItem');
$h .= '&menuItem=' . $menuItem;
}
$pai = $_SESSION['menuItems'][$h]['pai'];
if ( $handlers[1] == 'catalogue' && $h != 'marc21import' )
{
$pai = '';
}
if ( strlen($pai) > 0 )
{
$descricao = $_SESSION['menuItems'][$pai]['descricao'];
$icone = $_SESSION['menuItems'][$pai]['icone'];
if ( strlen($descricao) > 0 && !in_array($descricao, $options) )
{
$options[] = $descricao;
$navbar->addOption('' . $descricao . '
', $module);
}
}
if ( $h == 'dictionarycontent' )
{
$options[] = _M('Dicionário');
$navbar->addOption('' . _M('Dicionário') . '
', $module);
}
$descricao = $_SESSION['menuItems'][$h]['descricao'];
$icone = $_SESSION['menuItems'][$h]['icone'];
if ( strlen($descricao) > 0 && !in_array($descricao, $options) )
{
$options[] = $descricao;
$navbar->addOption('' . $descricao . '
', $module);
}
if ( $h == 'dictionary' )
{
$options[] = _M('Cadastro');
$navbar->addOption('' . _M('Cadastro') . '
', $module);
}
}
if ( $handlers[2] == 'iso2709' )
{
$navbar->addOption('ISO2709
', $module);
}
if ( $handlers[2] == 'libraryPreference' )
{
$navbar->addOption('' . $_REQUEST['tabName'] . '
', $module);
}
}
?>