Exemple #1
0
/**
 * 
 * Filtro que retorna Comentário filtrados pela a situação da pauta
 * @param array $comments
 * @param int $postID
 * @return array Comentários filtrados
 */
function delibera_get_comments_filter($comments)
{
    global $delibera_comments_padrao;
    if ($delibera_comments_padrao === true) {
        return $comments;
    }
    $ret = array();
    if (count($comments) > 0) {
        if (get_post_type($comments[0]->comment_post_ID) == "pauta") {
            $situacao = delibera_get_situacao($comments[0]->comment_post_ID);
            switch ($situacao->slug) {
                case 'validacao':
                    $ret = delibera_comments_filter_portipo($comments, array('validacao'));
                    break;
                case 'discussao':
                    $ret = delibera_comments_filter_portipo($comments, array('discussao', 'encaminhamento'));
                    break;
                case 'relatoria':
                    $ret = delibera_comments_filter_portipo($comments, array('discussao', 'encaminhamento'));
                    break;
                case 'emvotacao':
                    $ret = delibera_comments_filter_portipo($comments, array('voto'));
                    break;
                case 'comresolucao':
                    $ret = delibera_comments_filter_portipo($comments, array('resolucao'));
                    break;
            }
            return $ret;
        }
    }
    return $comments;
}
        $comments_tmp = delibera_comments_filter_portipo($comments, array('discussao', 'encaminhamento', 'resolucao'));
        include 'print_comment_template.php';
    }
    if ($voto > 0) {
        ?>
<p id="CommentTitle"><?php 
        echo sprintf(_n('%s Voto', '%s Votos', $voto, 'delibera'), number_format_i18n($voto));
        ?>
</p><?php 
        $comments_tmp = delibera_comments_filter_portipo($comments, array('voto'));
        include 'print_comment_template.php';
    }
    if ($encaminhamento > 0) {
        define('RESOLUCOES', true);
        ?>
<p id="CommentTitle"><?php 
        echo 'Votação';
        ?>
</p><?php 
        $comments_tmp = delibera_comments_filter_portipo($comments, array('encaminhamento', 'resolucao'));
        include 'print_comment_template.php';
    }
    /*if($resolucao > 0)
    		{
    			?><p id="CommentTitle"><?php echo sprintf(_n('%s Resolução', '%s Resoluções', $resolucao, 'delibera'), number_format_i18n($resolucao)); ?></p><?php
    		}*/
    ?>
		<hr class="Divider" style="text-align: center;" />
	</div>
<?php 
}