Skip to content

Instantly share code, notes, and snippets.

@almino
Created February 27, 2016 23:47
Show Gist options
  • Save almino/7a627c63395e07127121 to your computer and use it in GitHub Desktop.
Save almino/7a627c63395e07127121 to your computer and use it in GitHub Desktop.
Menu HTML usando classes personalizadas
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/* @var $this CI_Loader */
if ($this->session->has_userdata('event')) {
$this->model('evento_model', 'evento_model');
$this->helper(array('text'));
$container = new \OOBootstrap\Nav\StackedPillsContainer();
$pill = new stdClass();
$pill->admin = new stdClass();
$head = new stdClass();
$evento = get_instance()->evento_model->view(array('id_evento' => $this->session->event));
if ($evento->num_rows() == 1) {
$evento = $evento->row();
$admin = $this->perfil->administrador_evento($evento->id_evento);
$rh = $this->perfil->recursos_humanos($evento->id_evento);
$pill->evento = new \OOBootstrap\Nav\Pills();
$head->evento = strlen($evento->abreviatura) ? $evento->abreviatura : ellipsize($evento->titulo, 32, .5, '…');
$pill->evento->appendItem('Detalhes', site_url(array('evento', 'detalhes', $evento->id_evento)));
if ($rh AND !empty($evento->ini_insc_date)) {
$pill->evento->appendItem('Participantes', site_url(array('participante', 'evento', $evento->id_evento)));
}
if ($evento->trabalhos) {
$pill->evento->appendItem('Trabalhos submetidos', site_url(array('trabalho', 'evento', $evento->id_evento)));
}
if ($evento->pai) {
$pill->evento->appendItem('Macro evento', site_url(array('evento', 'detalhes', $evento->pai)));
}
if ($evento->filhos) {
$pill->evento->appendItem('Sub eventos', site_url(array('evento', 'sub', $evento->id_evento)));
}
$container->appendPills($pill->evento, $head->evento);
if ($admin) {
$pill->admin->evento = new \OOBootstrap\Nav\Pills();
$pill->admin->evento->appendItem('Informações básicas', site_url(array('evento', 'alterar', $evento->id_evento)));
$pill->admin->evento->appendItem('Período de inscrição e vagas', site_url(array('evento', 'inscricao', $evento->id_evento)));
$pill->admin->evento->appendItem('Perfis de participantes', site_url(array('evento', 'tipo', 'participante', $evento->id_evento)));
$pill->admin->evento->appendItem('Taxas e períodos de cobrança', site_url(array('evento', 'taxa', $evento->id_evento)));
if ($evento->financeiro) {
$pill->admin->evento->appendItem('Credenciais PagSeguro', site_url(array('evento', 'pagseguro', $evento->id_evento)));
}
$pill->admin->evento->appendItem('Submissão de trabalhos', site_url(array('evento', 'submissao', $evento->id_evento)));
if ($evento->trabalhos) {
$pill->admin->evento->appendItem('Áreas de conhecimento', site_url(array('area', 'evento', $evento->id_evento)));
}
if (!$evento->pai) {
$pill->admin->evento->appendItem('Cadastrar sub evento', site_url(array('evento', 'cadastrar', $evento->id_evento)));
}
$container->appendPills($pill->admin->evento, 'Alterar evento');
}
echo $container;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment