Guest

Untitled

By: a guest on Jan 28th, 2012  |  syntax: None  |  size: 4.42 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. <h2>Edit Podcasts</h2>
  2. <fieldset>
  3.         <legend>Podcast List</legend>
  4.  
  5.         <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>
  6.  
  7.         <form id='podcastList'>
  8.                 <p>
  9.                         Currently viewing <?=(int)$start + 1;?>-<?=(int)$start  + $limit < $numPodcasts ? $start + $limit : $numPodcasts;?>
  10.                         of <?=(int)$numPodcasts;?> podcasts.&nbsp;
  11.                         <?php if((int)$start > 0): ?>
  12.                         <?php $newStart = $start - $limit; $newStart = $newStart < 0 ? 0 : $newStart; ?>
  13.                         <a href='<?=htmlentities($urlEditPodcast, ENT_QUOTES);?>/order=<?=$order;?>/dir=<?=$dir;?>/start=<?=(int)$newStart;?>/end=<?=(int)$newStart + $limit;?>'>&laquo; Previous Page</a>
  14.                         <?php endif;?>&nbsp;
  15.                         <?php if((int)$end < ($numPodcasts)): ?>
  16.                         <?php $newStart = $end; ?>
  17.                         <a href='<?=htmlentities($urlEditPodcast, ENT_QUOTES);?>/order=<?=$order;?>/dir=<?=$dir;?>/start=<?=(int)$newStart;?>/end=<?=(int)$newStart + $limit;?>'>Next Page &raquo;</a>
  18.                         <?php endif; ?>
  19.  
  20.                 </p>
  21.        
  22.        
  23.        
  24.         <table class='podcastAdminList'>
  25.        
  26.                 <?php
  27.                         $titleUrl = $urlEditPodcast."/order=title/".
  28.                                     ($order == "title" && $dir == 0 ? "dir=1" : "dir=0");
  29.                         $pubUrl = $urlEditPodcast."/order=published/".
  30.                                     ($order == "published" && $dir == 0 ? "dir=1" : "dir=0");
  31.                 ?>
  32.                
  33.                 <thead>
  34.                         <tr>
  35.                                 <th class='podcastTitle'><a href='<?=htmlentities($titleUrl, ENT_QUOTES);?>'>Podcast Title</a></th>
  36.                                 <th class='podcastChannel'>Channels</th>
  37.                                 <th class='podcastPublished'><a href='<?=htmlentities($pubUrl, ENT_QUOTES);?>'>Published</a></th>
  38.                                 <th class='podcastDelete'>Delete</th>
  39.                                 <th class='podcastEdit'>Edit</th>
  40.                         </tr>
  41.                 </thead>
  42.                 <tbody>
  43.                        
  44.                 <?php foreach($podcasts as $podcast): ?>
  45.                         <?php renderPodcastItem($podcast, $podcastChannels, $urlEditChannel,
  46.                                                  $urlEditPodcast, $urlDeletePodcast); ?>
  47.                 <?php endforeach; ?>
  48.                
  49.                 </tbody>
  50.                 </table>
  51.                
  52.                
  53.                
  54.                
  55.                         <div style='clear: both;'></div>
  56.        
  57.        
  58.        
  59.        
  60.        
  61.        
  62.        
  63.        
  64.                 <p>
  65.                         Currently viewing <?=(int)$start + 1;?>-<?=(int)$start  + $limit < $numPodcasts ? $start + $limit : $numPodcasts;?>
  66.                         of <?=(int)$numPodcasts;?> podcasts.&nbsp;
  67.                         <?php if((int)$start > 0): ?>
  68.                         <?php $newStart = $start - $limit; $newStart = $newStart < 0 ? 0 : $newStart; ?>
  69.                         <a href='<?=htmlentities($urlEditPodcast, ENT_QUOTES);?>/order=<?=$order;?>/dir=<?=$dir;?>/start=<?=(int)$newStart;?>/end=<?=(int)$newStart + $limit;?>'>&laquo; Previous Page</a>
  70.                         <?php endif;?>&nbsp;
  71.                         <?php if((int)$end < ($numPodcasts)): ?>
  72.                         <?php $newStart = $end; ?>
  73.                         <a href='<?=htmlentities($urlEditPodcast, ENT_QUOTES);?>/order=<?=$order;?>/dir=<?=$dir;?>/start=<?=(int)$newStart;?>/end=<?=(int)$newStart + $limit;?>'>Next Page &raquo;</a>
  74.                         <?php endif; ?>
  75.  
  76.                 </p>
  77.         </form>
  78. </fieldset>
  79.  
  80. <?php
  81.  
  82.         function renderPodcastItem($podcast, $podcastChannels, $urlEditChannel,
  83.                                         $urlEditPodcast, $urlDeletePodcast) {
  84.                 $podcastArray = $podcast->vars;
  85. ?>
  86.  
  87.                 <tr class='podcastListItem'>
  88.                         <td class='podcastTitle'>
  89.                                 <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>
  90.                         </td>
  91.                         <td class='podcastChannel'>
  92.                        
  93.                         <?php if($podcastChannels[$podcastArray['id']]): ?>
  94.                                         <?php foreach($podcastChannels[$podcastArray['id']] as $row): ?>                                                        <a href='<?=$urlEditChannel;?>/<?=$row['id'];?>'><?=htmlentities($row['title'], ENT_QUOTES);?></a>
  95.                                         <?php endforeach; ?>
  96.                                 <?php else: ?>
  97.                                 No Channels.
  98.                                 <?php endif; ?>
  99.                         </td>
  100.                         <td class='podcastPublished'><?=date("d/m/Y H:i", strtotime($podcastArray['published']));?></td>
  101.                         <td class='podcastDeleteActions'>
  102.                                 <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>
  103.                                 <td class='podcastEditActions'><a class='editPodcastBttn' href='<?=htmlentities($urlEditPodcast, ENT_QUOTES);?>/<?=$podcastArray['id'];?>'>Edit</a></td>
  104.                 </tr>
  105.  
  106. <?php
  107.         }
  108. ?>