public static function dispatcher() { Eventos::getInstance()->init(); $action = $_GET['action']; $id = $_GET['id']; $registro = null; if ($id != null) { $registro = Pessoas::getInstance()->getById($id); } if ($action == null) { self::showList(); } if ($action == 'add-new' || $action == 'edit') { self::showForm($action, $registro); } if ($action == 'add-extra') { self::showFormAddExtra($registro); } if ($action == 'delete') { self::delete($registro); } if ($action == 'view') { self::view($registro); } if ($action == 'extras') { self::extras(); } if ($action == 'genderize') { self::genderize(); } }
/** * Porção visível do widget * Exibir eventos atuais e numeros */ public static function widget() { $eventos = Eventos::getInstance()->getFuturos(); foreach ($eventos as $evento) { /* @var $evento Evento */ echo "<span style='font-size: 15px;'><a href='admin.php?page=Eventos&action=view&id={$evento->id}'>{$evento->titulo}</a></span><br>"; if ($evento->data) { echo "<span style='font-size: 11px;'><i>" . PLib::days_between_dates($evento->data) . " dias para o evento</i></span><br>"; } // Pré-inscritos $pre = $evento->qtdPreInscritos(); // Inscritos $ins = $evento->qtdInscritos(); // Confirmados $con = $evento->qtdConfirmados(); if ($con != null && $con > 0) { echo "<b>Confirmados: {$con} - {$evento->conversaoInscritosConfirmados}</b><br>"; } if ($ins != null && $ins > 0) { echo "Inscritos: {$ins} - {$evento->conversaoVisitantesInscritos}<br>"; } if ($pre != null && $pre > 0) { echo "Pré-inscritos: {$pre}<br>"; } echo "<br>"; } }
public static function dispatcher() { $action = $_GET['action']; $desconto = null; if (isset($_GET['id'])) { $desconto = Descontos::getInstance()->getById($_GET['id']); } $evento = null; if (isset($_GET['id_evento'])) { $id_evento = $_GET['id_evento']; } if (isset($_POST['id_evento'])) { $id_evento = $_POST['id_evento']; } if ($id_evento != null) { $evento = Eventos::getInstance()->getById($id_evento); } if ($action == null && $evento != null) { self::showListEvento($evento); } if ($action == null && $evento == null) { self::showListGeral(); } if ($action == 'add-new' || $action == 'edit') { self::showForm($action, $desconto, $evento); } if ($action == 'delete') { self::delete($evento); } if ($action == 'view') { self::view($evento); } }
public static function import() { die("Ops! Apagar tudo?"); try { $gamification = Gamification::getInstance(); echo "<H1>Importando dados...</H1>"; // Resetar Gamification $gamification->clearAllData(); // Modelo GDG // Obter todos usuários // Obter eventos de 1 de agosto em diante $eventos = Eventos::getInstance()->getPassados(); foreach ($eventos as $evento) { if (strtotime($evento->data) < strtotime('2015-08-01')) { continue; } // Obter todas presenças - pontuar echo "Evento {$evento->id} - {$evento->titulo} - {$evento->data} - "; $inscricoes = Inscricoes::getInstance()->getPresentes($evento->id); echo count($inscricoes) . " presentes <br>"; foreach ($inscricoes as $inscricao) { // if ($inscricao->id_pessoa!=23) continue; /* @var @inscricao Inscricao */ $gamification->setUserId($inscricao->id_pessoa); $dino = false; $inicio = $evento->data . ($evento->hora ? " " . $evento->hora : ''); // Clean Code if ($evento->id == 1065) { // var_dump("dino?"); // Dino? if ($inscricao->pessoa()->getCountConfirmadoAntesCleanCode() > 0) { $gamification->executeEvent('before_gamification', $inscricao, $inicio); $dino = true; } } // Primeira presença? if (!$dino && $inscricao->pessoa()->getCountPresentes() == 1 && $inscricao->pessoa()->getCountConfirmados() <= 2) { $gamification->executeEvent('first_presence', $inscricao, $inicio); } else { // Só esteve presente, pontuar $gamification->executeEvent('event_presence', $inscricao, $inicio); } // Se respondeu pesquisa, pontuar if ($inscricao->hasAvaliacao()) { $gamification->executeEvent('event_feedback', $inscricao, $inscricao->getAvaliacaoResposta(1)->dat_resposta); } } } // The End echo "<br>Gamification points fully updated!<br>"; self::showLevelRanking(); } catch (Exception $e) { echo "Exception: " . $e->getMessage(); } }
public static function dispatcher() { $action = $_GET['action']; $evento = null; $inscricao = null; if (isset($_GET['id_evento'])) { $evento = Eventos::getInstance()->getById($_GET['id_evento']); } if (isset($_GET['id'])) { $inscricao = Inscricoes::getInstance()->getById($_GET['id']); } $filter = null; if (isset($_GET['filter'])) { $filter = $_GET['filter']; } if ($action == null) { self::showList($evento, $filter); } if ($action == 'delete') { self::delete($inscricao, $evento); } if ($action == 'extras') { self::extras($evento); } if ($action == 'inscricao-confirmar') { self::confirmar($inscricao); } if ($action == 'inscricao-cancelar') { self::cancelar($inscricao); } if ($action == 'inscricao-informar-valor') { self::informarValor($inscricao); } if ($action == 'inscricao-presenca') { self::presenca($inscricao); } if ($action == 'exportarCsv') { self::exportarCsv($evento, $filter); } if ($action == 'exportarCsvFullContacts') { self::exportarCsvFullContacts($evento, $filter); } if ($action == 'importarCsv') { self::importarCsv($evento); } if ($action == 'cancelarNaoConfirmados') { self::cancelarNaoConfirmados($evento); } if ($action == 'add') { self::add($evento); } }
/** * http://url/crontab/hora/ */ public static function hora() { require 'wp-includes/pluggable.php'; // Eventos futuros $eventos = Eventos::getInstance()->getFuturos(); /* @var $evento Evento */ foreach ($eventos as $evento) { // Apenas eventos pagos if ($evento->pago != 'pago' || $evento->preInscricao()) { continue; } echo "<h1>{$evento->titulo}</h1>"; // Notificar inscrições ainda não pagas $inscricoesVencer = Inscricoes::getInstance()->getPagueAgora($evento->id); // var_dump($inscricoesVencer); // \TiagoGouvea\PLib::var_dump($inscricoesVencer); if (count($inscricoesVencer) > 0) { /* @var $inscricao Inscricao */ foreach ($inscricoesVencer as $inscricao) { if ($inscricao->pre_inscricao) { continue; } echo "Pedir que confirme agora " . $inscricao->id . "<br>"; $inscricao->confirmeAgora(); } } // Notificar inscrições vencidas por hora $inscricoesVencer = Inscricoes::getInstance()->getVencerHora($evento->id); // var_dump($inscricoesVencer); // \TiagoGouvea\PLib::var_dump($inscricoesVencer); if (count($inscricoesVencer) > 0) { /* @var $inscricao Inscricao */ foreach ($inscricoesVencer as $inscricao) { if ($inscricao->pre_inscricao) { continue; } echo "Vencer " . $inscricao->id . "<br>"; $inscricao->vencer(); } } } }
private static function showForm($action, $categoria, $evento) { // Postando? if (count($_POST) > 0) { // Validar $categoria = Categorias::getInstance()->populate($_POST); // Salvar ou incluir? if ($_POST['id'] == null) { $categoria = Categorias::getInstance()->insert($categoria); } else { $categoria = Categorias::getInstance()->save($_POST['id'], $categoria); } if ($evento == null) { $evento = Eventos::getInstance()->getById($categoria->id_evento); } self::showList($evento); } else { require_once PLUGINPATH . '/view/categorias/form.php'; } }
public static function dispatcher() { $action = $_GET['action']; $filter = $_GET['filter']; $evento = null; if (isset($_GET['id_evento'])) { $id_evento = $_GET['id_evento']; } if (isset($_POST['id_evento'])) { $id_evento = $_POST['id_evento']; } if ($id_evento != null) { $evento = Eventos::getInstance()->getById($id_evento); } if ($action == 'email') { self::showForm($action, $filter, $evento); } if ($action == 'sms') { self::showFormSms($filter, $evento); } }
/** * Save the meta when the post is saved. * * @param int $post_id The ID of the post being saved. */ public function save($post_id) { // If this is an autosave, our form has not been submitted, // so we don't want to do anything. if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } // Check the user's permissions. if ('page' == $_POST['post_type']) { if (!current_user_can('edit_page', $post_id)) { return $post_id; } } else { if (!current_user_can('edit_post', $post_id)) { return $post_id; } } if ($post_id != null) { $this->evento = Eventos::getInstance()->getById($post_id); } /* OK, its safe for us to save the data now. */ meta_update($post_id, 'id_evento_pai'); meta_update($post_id, 'descricao_1', false); // Descricao2 meta_update($post_id, 'descricao_2', false); // Descricao3 meta_update($post_id, 'descricao_3', false); // Publico Alvo meta_update($post_id, 'publico_alvo'); // Instrutor meta_update($post_id, 'id_instrutor', false); // Local meta_update($post_id, 'id_local', false); // Organizador if (get_option('singleOrganizer', true) && get_option('idSingleOrganizer', null) != null) { update_post_meta($post_id, 'id_organizador', get_option('idSingleOrganizer')); } else { meta_update($post_id, 'id_organizador', false); } // Topicos meta_update($post_id, 'topicos', false); // FAQ meta_update($post_id, 'faq', false); // Data meta_update($post_id, 'data'); // Hora meta_update($post_id, 'hora'); // Data meta_update($post_id, 'data_fim'); // Hora meta_update($post_id, 'hora_fim'); // dataInicioInscricoes meta_update($post_id, 'data_inicio_inscricoes'); // data_fimInscricoes meta_update($post_id, 'data_fim_inscricoes'); // vagas meta_update($post_id, 'vagas'); // pago meta_update($post_id, 'pago'); meta_update($post_id, 'pago_dinheiro'); meta_update($post_id, 'pago_pagseguro'); meta_update($post_id, 'pago_cielo'); meta_update($post_id, 'pago_deposito'); meta_update($post_id, 'fb_conversion_track'); // Integração de Pagamento meta_update($post_id, 'id_integracao_pagseguro', false); meta_update($post_id, 'id_integracao_cielo', false); // Local pagamento meta_update($post_id, 'id_local_pagamento', false); // Fila de espera meta_update($post_id, 'fila_espera'); // beta meta_update($post_id, 'beta'); // Campos extras meta_update($post_id, 'campos_extras', false); // Id Questionário meta_update($post_id, 'id_questionario', false); // Duração meta_update($post_id, 'duracao'); meta_update($post_id, 'horarios'); meta_update($post_id, 'requisitos'); // Valor meta_update($post_id, 'valor'); // Material Didático meta_update($post_id, 'material'); // Certificado meta_update($post_id, 'certificado'); // confirmacao meta_update($post_id, 'confirmacao'); // validacaoPessoa meta_update($post_id, 'validacao_pessoa', false, 'email'); //die(); // Release meta_update($post_id, 'release', false); // Campos extras meta_update($post_id, 'secoes_extras', false); // Cada seção if ($this->evento) { $secoes = $this->evento->getSecoesExtras(); if ($secoes != null) { foreach ($secoes as $secao => $titulo) { meta_update($post_id, 'secao_' . $secao, false); } } } // Mensagens if ($post_id) { Mensagens::getInstance()->savePost($_POST); } // echo "<br>FIM DE POSTANDO<br>"; }
function get_post_type_link($link, $post = 0) { if (get_post_type($post) == 'tgo_evento') { $link = Eventos::getInstance()->getUrl($post); } return $link; }
public static function getEventoAtual() { $eventos = Eventos::getInstance()->getAcontecendoFuturos(true); if ($eventos) { return $eventos[0]; } return null; }
/** * @param bool|true $ordenar * @param null $limit * @param null $where * @return array|null */ public function getAcontecendoFuturos($ordenar = true, $limit = null, $where = null) { $eventos = Eventos::getInstance()->getAll(); if ($eventos == null) { return null; } $return = array(); foreach ($eventos as $evento) { if ($evento->publicado && ($evento->acontecendo() || $evento->noFuturo())) { $return[] = $evento; } } // Ordenar $return = self::ordenar($return, $ordenar); return $return; }
private static function delete($evento) { Eventos::getInstance()->delete($evento->id); self::showList(); }
/** * @return Evento */ public function evento() { return Eventos::getInstance()->getById($this->id_evento); }
function add_menus() { // Se for author, deixo apenas confirmar inscrições if (get_user_role() == 'author') { add_menu_page('Inscrições', 'Inscrições', 'read', 'Inscricoes', array('ControllerEventos', 'inscricoes'), 'dashicons-index-card', 6); } else { add_menu_page('Eventos', 'Eventos', 'edit_pages', 'Eventos', array('ControllerEventos', 'dispatcher'), 'dashicons-calendar-alt', 5); // Incluir já eventos no menu $eventos = Eventos::getInstance()->getAtuaisERecentes(); if ($eventos) { foreach ($eventos as $evento) { add_submenu_page('Eventos', PLib::date_relative($evento->data) . ' - ' . $evento->titulo, PLib::date_relative($evento->data) . ' - ' . $evento->titulo, 'edit_pages', 'Eventos&action=view&id=' . $evento->id, 'AdminPresenca'); } } add_menu_page('Inscrições', 'Inscrições', 'read', 'Inscricoes', array('ControllerEventos', 'inscricoes'), 'dashicons-index-card', 6); add_menu_page('Pessoas', 'Pessoas', 'edit_pages', 'Pessoas', array('ControllerPessoas', 'dispatcher'), 'dashicons-groups', 7); if (TGO_EVENTO_GAMIFICATION === true) { add_menu_page('Gamification', 'Gamification', 'edit_pages', 'Gamification', array('ControllerGamification', 'dispatcher'), 'dashicons-smiley', 8); add_submenu_page('Gamification', 'Importar Eventos', 'Importar Eventos', 'edit_pages', 'GamificationGDGJF', array('ControllerGamification', 'import')); add_submenu_page('Gamification', 'Badges', 'Badges', 'edit_pages', 'badges', array('ControllerGamification', 'dispatcher')); add_submenu_page('Gamification', 'Eventos', 'Eventos', 'edit_pages', 'eventos', array('ControllerGamification', 'dispatcher')); } add_menu_page('Apoio', 'Apoio', 'edit_pages', 'AdminApoio', 'AdminApoio', 'dashicons-nametag', 9); add_submenu_page('AdminApoio', 'Tickets de Desconto', 'Tickets de Desconto', 'edit_pages', 'TicketsDesconto', array('ControllerDescontos', 'dispatcher')); add_submenu_page('AdminApoio', 'Locais', 'Locais', 'edit_pages', 'Locais', array('ControllerLocais', 'dispatcher')); add_submenu_page('AdminApoio', 'Organizadores', 'Organizadores', 'manage_options', 'Organizadores', array('ControllerOrganizadores', 'dispatcher')); add_submenu_page('AdminApoio', 'Templates', 'Templates', 'manage_options', 'edit.php?post_type=tgo_template'); add_submenu_page('AdminApoio', 'Mensagens', 'Mensagens', 'manage_options', 'Mensagens', array('ControllerMensagens', 'dispatcher')); add_submenu_page('AdminApoio', 'Integrações', 'Integrações', 'manage_options', 'Integracoes', array('ControllerIntegracoes', 'dispatcher')); // add_submenu_page('AdminApoio', 'Migrar Dados', 'Migrar Dados', 'manage_options', 'MenuConfig', array('AdminConfig', 'adminConfigHome')); add_submenu_page('AdminApoio', 'Sincronizar Gateways', 'Sincronizar Gateways', 'manage_options', 'Sincronizar', array('ControllerInscricoes', 'sincronizarGateways')); } // Actions sem menu add_submenu_page(null, 'Categorias', 'Categorias', 'read', 'Categorias', array('ControllerCategorias', 'dispatcher')); add_submenu_page(null, 'Inscrições', 'Inscrições', 'read', 'Inscricoes', array('ControllerInscricoes', 'dispatcher')); add_submenu_page(null, 'Comunicação', 'Comunicação', 'read', 'Comunicacao', array('ControllerComunicacao', 'dispatcher')); add_submenu_page(null, 'Preços', 'Preços', 'read', 'Precos', array('ControllerPrecos', 'dispatcher')); add_submenu_page(null, 'Descontos', 'Descontos', 'read', 'Descontos', array('ControllerDescontos', 'dispatcher')); add_submenu_page(null, 'Pessoas', 'Pessoas', 'read', 'Pessoas', array('ControllerPessoas', 'dispatcher')); }