- <h2>Edit Podcasts</h2>
- <fieldset>
- <legend>Podcast List</legend>
- <p>Shown below is a complete list of existing podcasts. To edit one, click its title or click <em>Edit</em>. To edit the channel(s) a podcast belongs to, click the channel name. To remove a podcast, click <em>Delete</em>. It will be transferred into the recycle bin.</p>
- <form id='podcastList'>
- <p>
- Currently viewing <?=(int)$start + 1;?>-<?=(int)$start + $limit < $numPodcasts ? $start + $limit : $numPodcasts;?>
- of <?=(int)$numPodcasts;?> podcasts.
- <?php if((int)$start > 0): ?>
- <?php $newStart = $start - $limit; $newStart = $newStart < 0 ? 0 : $newStart; ?>
- <a href='<?=htmlentities($urlEditPodcast, ENT_QUOTES);?>/order=<?=$order;?>/dir=<?=$dir;?>/start=<?=(int)$newStart;?>/end=<?=(int)$newStart + $limit;?>'>« Previous Page</a>
- <?php endif;?>
- <?php if((int)$end < ($numPodcasts)): ?>
- <?php $newStart = $end; ?>
- <a href='<?=htmlentities($urlEditPodcast, ENT_QUOTES);?>/order=<?=$order;?>/dir=<?=$dir;?>/start=<?=(int)$newStart;?>/end=<?=(int)$newStart + $limit;?>'>Next Page »</a>
- <?php endif; ?>
- </p>
- <table class='podcastAdminList'>
- <?php
- $titleUrl = $urlEditPodcast."/order=title/".
- ($order == "title" && $dir == 0 ? "dir=1" : "dir=0");
- $pubUrl = $urlEditPodcast."/order=published/".
- ($order == "published" && $dir == 0 ? "dir=1" : "dir=0");
- ?>
- <thead>
- <tr>
- <th class='podcastTitle'><a href='<?=htmlentities($titleUrl, ENT_QUOTES);?>'>Podcast Title</a></th>
- <th class='podcastChannel'>Channels</th>
- <th class='podcastPublished'><a href='<?=htmlentities($pubUrl, ENT_QUOTES);?>'>Published</a></th>
- <th class='podcastDelete'>Delete</th>
- <th class='podcastEdit'>Edit</th>
- </tr>
- </thead>
- <tbody>
- <?php foreach($podcasts as $podcast): ?>
- <?php renderPodcastItem($podcast, $podcastChannels, $urlEditChannel,
- $urlEditPodcast, $urlDeletePodcast); ?>
- <?php endforeach; ?>
- </tbody>
- </table>
- <div style='clear: both;'></div>
- <p>
- Currently viewing <?=(int)$start + 1;?>-<?=(int)$start + $limit < $numPodcasts ? $start + $limit : $numPodcasts;?>
- of <?=(int)$numPodcasts;?> podcasts.
- <?php if((int)$start > 0): ?>
- <?php $newStart = $start - $limit; $newStart = $newStart < 0 ? 0 : $newStart; ?>
- <a href='<?=htmlentities($urlEditPodcast, ENT_QUOTES);?>/order=<?=$order;?>/dir=<?=$dir;?>/start=<?=(int)$newStart;?>/end=<?=(int)$newStart + $limit;?>'>« Previous Page</a>
- <?php endif;?>
- <?php if((int)$end < ($numPodcasts)): ?>
- <?php $newStart = $end; ?>
- <a href='<?=htmlentities($urlEditPodcast, ENT_QUOTES);?>/order=<?=$order;?>/dir=<?=$dir;?>/start=<?=(int)$newStart;?>/end=<?=(int)$newStart + $limit;?>'>Next Page »</a>
- <?php endif; ?>
- </p>
- </form>
- </fieldset>
- <?php
- function renderPodcastItem($podcast, $podcastChannels, $urlEditChannel,
- $urlEditPodcast, $urlDeletePodcast) {
- $podcastArray = $podcast->vars;
- ?>
- <tr class='podcastListItem'>
- <td class='podcastTitle'>
- <a href='<?=htmlentities($urlEditPodcast, ENT_QUOTES);?>/<?=htmlentities($podcastArray['id'], ENT_QUOTES);?>'><?=strlen($podcastArray['title']) > 35 ? htmlentities(substr($podcastArray['title'], 0, 35), ENT_QUOTES)."..." : (strlen($podcastArray['title']) > 0 ? htmlentities($podcastArray['title'], ENT_QUOTES) : "Untitled Podcast") ?></a>
- </td>
- <td class='podcastChannel'>
- <?php if($podcastChannels[$podcastArray['id']]): ?>
- <?php foreach($podcastChannels[$podcastArray['id']] as $row): ?> <a href='<?=$urlEditChannel;?>/<?=$row['id'];?>'><?=htmlentities($row['title'], ENT_QUOTES);?></a>
- <?php endforeach; ?>
- <?php else: ?>
- No Channels.
- <?php endif; ?>
- </td>
- <td class='podcastPublished'><?=date("d/m/Y H:i", strtotime($podcastArray['published']));?></td>
- <td class='podcastDeleteActions'>
- <a class='recycleBinBttn' onclick='return confirm("Are you sure you want to delete this podcast?\n\nThe podcast will be moved to the recycle\nbin temporarily, and will be removed after 30 days.");' href='<?=htmlentities($urlDeletePodcast, ENT_QUOTES);?>/<?=$podcastArray['id'];?>'>Delete</a></td>
- <td class='podcastEditActions'><a class='editPodcastBttn' href='<?=htmlentities($urlEditPodcast, ENT_QUOTES);?>/<?=$podcastArray['id'];?>'>Edit</a></td>
- </tr>
- <?php
- }
- ?>