<?php $tracks = $this->getTracks(); ?>
<?php $option = $this->getCurrentOption(); ?>
<?php $id = $this->getId() ? $this->getId() : $option->getId(); ?>

<?php foreach($tracks as $index => $track) : ?>
    <li class="<?php echo $option->getId() ?>_tracks types tracks clearfix">
        <a rel="<?php echo $index ?>" href="javascript:void(0)" onclick="loadPlaylist($('#playlists_list_<?php echo $id ?>'), this); return false;">
            <p class="clearfix">
                <span class="track_number"><?php echo $index++ < 10 ? '0'.$index++ : $index++ ?></span>
                <span class="track_name"><?php echo Core_Model_Lib_String::truncate($track->getName(), 30) ?></span>
                <?php if($track->getType() != 'podcast') : ?>
                    <span class="track_duration"><?php echo $track->getFormatedDuration() ?></span>
                <?php else : ?>
                    <span class="track_duration"><?php echo $track->getFormatedDuration($track->getDuration()) ?></span>
                <?php endif; ?>
            </p>
            <?php if($track->getArtistName()) : ?>
                <p>
                    <span class="track_artist"><?php echo $track->getArtistName(); ?></span>
                </p>
            <?php endif; ?>
            <span class="track_full_name" style="display:none"><?php echo $track->getName() ?></span>
            <span class="track_url" style="display:none"><?php echo $track->getStreamUrl() ?></span>
            <span class="track_buy_url" style="display:none"><?php echo $track->getPurchaseUrl() ?></span>
        </a>
    </li>
<?php endforeach; ?>