<table class='widefat'>
        <thead>
            <tr>
                <th>evento</th>
                <th>produtor</th>
                <th>inscrição</th>
                <th>data</th>
                <th>vagas</th>
                <th style='width:50px; text-align:center'>valor</th>
                <th style='width:30px;'>&nbsp</th>
            </tr>
        </thead>
        <tbody>
        <?php 
foreach ($eventos as $evento) {
    $edata = get_oportunidades_data($evento->ID);
    ?>
            <tr>
                <td><a href='<?php 
    echo get_permalink($evento->ID);
    ?>
'><?php 
    echo $evento->post_title;
    ?>
</a></td>
                <td><a href='<?php 
    echo get_author_posts_url($evento->post_author);
    ?>
'><?php 
    echo $evento->produtor;
    ?>
<?php

global $oportunidade_item, $current_user;
$data = get_oportunidades_data($oportunidade_item->ID);
extract($data);
$can_join = tnb_artista_can_join($oportunidade_item->ID);
?>

<?php 
if (is_produtor() && $superevento && strtotime($inscricao_fim) >= strtotime(date('Y-m-d'))) {
    ?>
    <p class="novo-subevento quero-tocar text-right">
        <a href="<?php 
    echo get_author_posts_url($current_user->ID);
    ?>
/editar/oportunidades/?superevento=no&post_parent=<?php 
    echo $oportunidade_item->ID;
    ?>
" class="btn-green">Inscrever meu evento</a>
    </p>
<?php 
} elseif (is_artista() && in_postmeta(get_post_meta($oportunidade_item->ID, 'selecionado'), $current_user->ID)) {
    ?>
    <p class="quero-tocar iam-selected text-right">
        <a class="btn-green"><?php 
    _e('Já fui selecionado!', 'tnb');
    ?>
</a>
    </p>
<?php 
} elseif (is_artista() && in_postmeta(get_post_meta($oportunidade_item->ID, 'inscrito'), $current_user->ID) && strtotime($inscricao_inicio) <= strtotime(date('Y-m-d')) && strtotime($inscricao_fim) >= strtotime(date('Y-m-d'))) {
<?php

global $evento_list_item_id;
if (!$evento_list_item_id) {
    $evento_list_item_id = get_the_ID();
}
$data = get_oportunidades_data($evento_list_item_id);
$local = '';
$local = $data['cidade'];
if (strlen($local) > 0 && $data['estado']) {
    $local .= ' - ';
}
if ($data['estado']) {
    $local .= $data['estado'];
}
if ($data['sigla_pais']) {
    $paises = get_paises();
    if (strlen($local) > 0) {
        $local .= ', ' . $paises[$data['sigla_pais']];
    } else {
        $local .= $paises[$data['sigla_pais']];
    }
}
?>

<div id="<?php 
echo basename(get_permalink($evento_list_item_id));
?>
" class="opportunity clearfix">
    <div class="avatar alignleft">
        <?php 
<h2 class="section-title">
    <span class="bg-blue"><?php 
_e("Minhas Oportunidades", "tnb");
?>
</span>
</h2>

<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>

    <?php 
        $data = get_oportunidades_data(get_the_ID());
        ?>

    <div id="<?php 
        echo $post->post_name;
        ?>
" class="opportunity clearfix">
        <div class="grid_3 alpha">
        <?php 
        if (has_post_thumbnail($evento_list_item_id)) {
            ?>
            <?php 
            echo get_the_post_thumbnail($evento_list_item_id, array(160, 160));
            ?>
        <?php 
        } else {
Пример #5
0
function pagamento_substitui_substituicoes($texto, $evento_id, $valor = null, $porcentagem = null, $artista = null)
{
    $evento = get_post($evento_id);
    $edata = get_oportunidades_data($evento_id);
    $produtor = get_user_by('id', $evento->post_author);
    $paises = get_paises();
    $estados = get_estados();
    $edata = (object) $edata;
    if (is_null($valor) || is_null($porcentagem)) {
        $contrato = get_contrato_inscricao($evento_id);
        if (is_null($valor)) {
            $valor = $contrato['valor'];
        }
        if (is_null($porcentagem)) {
            $porcentagem = $contrato['porcentagem'];
        }
    }
    $substituicoes = array('{produtor-cadastro-id}' => $produtor->ID, '{produtor-cadastro-data}' => $produtor->user_registered, '{produtor-nome}' => $produtor->display_name, '{produtor-documento}' => $produtor->cnpj ? $produtor->cnpj : $produtor->cpf, '{produtor-email}' => $produtor->user_email, '{produtor-telefone}' => $produtor->telefone, '{produtor-pais}' => $paises[$produtor->origem_pais], '{produtor-estado}' => $produtor->origem_pais == 'BR' ? $estados[strtolower($produtor->origem_estado)] : $produtor->origem_estado, '{produtor-cidade}' => $produtor->origem_cidade, '{produtor-url}' => get_author_posts_url($evento->post_author), '{produtor-link}' => '<a href="' . get_author_posts_url($evento->post_author) . '">' . $produtor->display_name . '</a>', '{evento-nome}' => $evento->post_title, '{evento-descricao}' => $evento->post_content, '{evento-inicio}' => $edata->br_inicio, '{evento-fim}' => $edata->br_fim, '{evento-inscricao-inicio}' => $edata->br_insc_inicio, '{evento-inscricao-fim}' => $edata->br_insc_fim, '{evento-estabelecimento}' => $edata->local, '{evento-pais}' => $paises[$edata->sigla_pais], '{evento-estado}' => $edata->sigla_pais == 'BR' ? $estados[strtolower($edata->estado)] : $edata->estado, '{evento-cidade}' => $edata->cidade, '{evento-url}' => get_permalink($evento_id), '{evento-link}' => '<a href="' . get_permalink($evento_id) . '">' . $evento->post_title . '</a>', '{contrato-valor}' => get_valor_monetario($valor), '{contrato-porcentagem}' => $porcentagem . '%', '{contrato-porcentagem-produtor}' => 100 - $porcentagem . '%', '{contrato-valor-tnb}' => get_valor_monetario($valor * $porcentagem / 100));
    if ($artista) {
        $substituicoes += array('{artista-nome}' => $artista->display_name, '{artista-url}' => get_author_posts_url($artista->ID), '{artista-link}' => '<a href="' . get_author_posts_url($artista->ID) . '">' . $artista->display_name . '</a>');
    } else {
        $substituicoes += array('{artista-nome}' => '', '{artista-url}' => '', '{artista-link}' => '');
    }
    foreach ($substituicoes as $de => $para) {
        $texto = str_replace($de, $para, $texto);
    }
    return $texto;
}