<?php

$links = array();

$links[] = array(
    'url' => array('campanhasMarketing/clientes', array('id' => $model->MKT_ID)),
    'text' => 'Clientes',
    'active' => $this->action->id == 'clientes'
    );
$links[] = array(
    'url' => array('campanhasMarketing/ExportarEmails', array('id' => $model->MKT_ID, 'format' => 'csv')),
    'text' => 'Exportar E-mails em CSV',
    'target' => '_blank',
    'active' => $this->action->id == 'ExportarEmails'
    );
$links[] = array(
    'url' => array('campanhasMarketing/ExportarEmails', array('id' => $model->MKT_ID, 'format' => 'txt')),
    'text' => 'Exportar E-mails em TXT',
    'target' => '_blank',
    'active' => $this->action->id == 'ExportarEmails'
    );
if(in_array(User::getPrivilegio(), [1,7,11])) {
    $links[] = array(
        'url' => array('campanhasMarketing/update', array('id' => $model->MKT_ID)),
        'text' => 'Editar',
        'active' => $this->action->id == 'update'
        );
}

$links[] = array(
    'url' => array('campanhasMarketing/filtros', array('id' => $model->MKT_ID)),
    'text' => 'Filtros',
    'active' => $this->action->id == 'filtros'
    );
$links[] = array(
    'url' => array('campanhasMarketing/view', array('id' => $model->MKT_ID)),
    'text' => 'Visualizar',
    'active' => $this->action->id == 'view'
    );
echo "<ul id='menu-clientes' class='nav-pills nav navbar-nav navbar-fixed-top'>";
    foreach($links as $link) {
        $class = $link['active'] ? 'active' : 'regular';
        $url = Yii::app()->createUrl($link['url'][0], $link['url'][1]);
        $text = $link['text'];
        $target = isset($link['target']) ? " target='{$link['target']}' " : '';
        echo "<li class='{$class}'>";
        echo "<a href='{$url}' {$target}>{$text}</a>";
        echo "</li>";
    }

echo "</ul>";