Changeset 459
- Timestamp:
- 06/14/10 16:31:44 (20 months ago)
- Location:
- trunk
- Files:
-
- 3 added
- 3 edited
-
controllers/podcasts_controller.php (modified) (3 diffs)
-
models/podcast.php (modified) (1 diff)
-
views/layouts/rss/rss.ctp (added)
-
views/podcasts/rss (added)
-
views/podcasts/rss.ctp (modified) (1 diff)
-
views/podcasts/rss/rss.ctp (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/controllers/podcasts_controller.php
r443 r459 16 16 17 17 public $name = 'Podcasts'; 18 19 public $helpers = array('Rss'); 20 21 public $components = array('RequestHandler'); 18 22 19 23 public function beforeFilter() … … 65 69 $this->set('data', $this->Podcast->find('all', $params)); 66 70 } 71 72 /** 73 * 74 * 75 */ 76 public function rss($username) 77 { 78 $this->layout = 'rss'; 79 $params = array('conditions' => array('username'=>$username), 80 'fields' => array('User.id', 'User.username','User.name','User.email', 'User.avatar')); 81 $User = $this->Podcast->User->find('first', $params); 82 83 $channelData = array('title' => $username.' Podcasts', 84 'link' => array('controller' => 'blog', 'action' => $username), 85 'description' => 'Audio from '. $username .' edublog', 86 'itunes:summary' => 'Audio from '. $username .' edublog', 87 'language' => 'en-us', 88 'copyright' => 'Chipotle Software, 2008', 89 'generator' => 'Karamelo Platform', 90 'managingEditor' => 'podcasts@chipotle-software.com', 91 'itunes:owner' => $username, 92 'itunes:image' => '/images/avatars/'.$User['User']['avatar'], 93 'itunes:author' => $User['User']['name'] 94 ); 95 96 $params = array('conditions' => array('Podcast.status'=>1, 'Podcast.user_id'=>$User['User']['id']), 97 'fields' => array('Podcast.id', 'Podcast.title', 'Podcast.filename', 'Podcast.description', 'Podcast.created', 'Podcast.duration', 98 'Podcast.title', 'Podcast.length'), 99 'order' => 'Podcast.created DESC', 100 'contain' => False, 101 'limit' => 12); 102 $podcasts = $this->Podcast->find('all', $params); 103 $this->set(compact('channelData', 'podcasts')); 104 } 67 105 68 106 /***********====ADMIN SECTION====***/ … … 247 285 } 248 286 249 public function rss($user)250 {251 $this->layout = 'rss';252 253 if ($user == Null):254 $this->redirect('/');255 return False;256 endif;257 $user_id = $Podcast->User->field('id', array('username'=>$user));258 259 $params = array(260 'conditions' => array('status'=>1, 'user_id'=>$user_id),261 'fields' => array('id', 'title', 'description', 'created', 'duration', 'title', 'description'),262 'order' => 'Podcast.created DESC');263 $this->set('data', $this->Podcast->find('all', $params));264 }265 287 } 266 # ? > 288 # ? > EOF -
trunk/models/podcast.php
r382 r459 31 31 32 32 } 33 # ? > 33 # ? > EOF -
trunk/views/podcasts/rss.ctp
r130 r459 1 1 <?php 2 /** 3 * 2002-2007- MonoNeuorna.org 4 * Manuel Monotya <manuel_ARRROBA_mononeurona_PUNTO_org 5 * GPLv3 6 **/ 7 8 //exit(print_r( $data )); 9 ?> 10 11 <!-- generator="Centauro 0.5" --> 12 <rss version="2.0" 13 xmlns:content="http://purl.org/rss/1.0/modules/content/" 14 xmlns:wfw="http://wellformedweb.org/CommentAPI/" 15 xmlns:dc="http://purl.org/dc/elements/1.1/" 16 xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" 17 xmlns:dtvmedia="http://participatoryculture.org/RSSModules/dtv/1.0" 18 xmlns:media="http://search.yahoo.com/mrss/" 19 > 20 21 <channel> 22 <title><?php echo $data["User"]["username"]; ?> podcast</title> 23 <link>>http://<?php echo $_SERVER['SERVER_NAME'] ?>/blog/<?php echo $data["User"]["username"];?></link> 24 <description><?php echo $data["User"]["tags"]; ?></description> 25 <generator>Jedit.org</generator> 26 <docs>http://blogs.law.harvard.edu/tech/rss</docs> 27 <language>es-mx</language> 28 <copyright><?php echo $data["User"]; ?></copyright> 29 <webMaster><?php echo $data["User"]["email"];?></webMaster> 30 <pubDate><?php echo $created; ?></pubDate> 31 <lastBuildDate><?php echo $last_episode; ?></lastBuildDate> 32 33 <itunes:author><?php echo $data["User"]["username"];?></itunes:author> 34 <itunes:subtitle><?php echo $subtitle;?></itunes:subtitle> 35 <itunes:keywords><?php echo $data["User"]["tags"];?></itunes:keywords> 36 <itunes:category text="Freedom"> 37 <itunes:category text="Freedom" /> 38 </itunes:category> 39 <itunes:owner> 40 <itunes:name><?php echo $data["User"]["name_blog"]; ?></itunes:name> 41 <itunes:email><?php echo $data["User"]["email"];?></itunes:email> 42 </itunes:owner> 43 <itunes:image href="http://<?php echo $_SERVER['SERVER_NAME'] ?>/img/avatars/<?php echo $data["User"]["name_blog"]["avatar"]; ?>" /> 44 <image> 45 <url>http://<?php echo $_SERVER['SERVER_NAME'] ?>/img/avatars/<?php echo $data["User"]["name_blog"]["avatar"]; ?></url> 46 <title><?php echo $data["User"]["name_blog"];?> podcast</title> 47 <link>http://<?php echo $_SERVER['SERVER_NAME'] ?>/blog/<?php echo $data["User"]["username"];?></link> 48 </image> 49 50 <itunes:explicit><?php echo 'no'; ?></itunes:explicit> 51 <?php 52 // Podcasts episodies 53 foreach ($data as $v) 54 { 55 echo '<item>' . "\n"; 56 echo '<title>'.$v["Podcast"]['title'].'</title>' . "\n"; 57 echo ' <link>http://'. $_SERVER['SERVER_NAME'] .'/archivos/podcast/'.$v["Podcast"]["filename"].'</link>' . "\n"; 58 echo ' <description>' . "\n"; 59 echo ' <![CDATA['.$v["Podcast"]["description"].']]>'; 60 echo ' </description>'; 61 echo ' <author>'.$v["Podcast"]["email"].'</author>' . "\n"; 62 echo ' <pubDate>'.$v["Podcast"]["created"].'</pubDate>' . "\n"; 63 echo ' <category>'.$v["Podcast"]["category"].'</category>' . "\n"; 64 echo ' <enclosure url="http://'. $v_SERVER['SERVER_NAME'] .'/archivos/podcast/'.$v["Podcast"]["filename"].'" length="'.$v["Podcast"]["length"].'" type="audio/mpeg"/>' . "\n"; 65 echo ' <guid>http://' . $_SERVER['SERVER_NAME'] .'/archivos/podcast/'.$v["Podcast"]["filename"] . '</guid>' . "\n"; 66 echo ' <itunes:author>' . $v["Podcast"]["username"] .'</itunes:author>' . "\n"; 67 echo ' <itunes:duration>' . $v["Podcast"]["duration"] .'</itunes:duration>' . "\n"; 68 echo ' <itunes:keywords>' . $v["Podcast"]["keywords"] .'</itunes:keywords>' . "\n"; 69 echo '</item>' . "\n"; 70 } 71 ?> 72 </channel> 73 </rss> 2 #debug($podcasts); 3 function rss_transform($item) 4 { 5 return array( 6 'title' => $item['Podcast']['title'], 7 'guid' => '/files/podcasts/'. $item['Podcast']['filename'], 8 'enclosure' => array('url'=>'/files/podcasts/'. $item['Podcast']['filename'], 'length'=> $item['Podcast']['length']), 9 'description' => strip_tags($item['Podcast']['description']), 10 'pubDate' => $item['Podcast']['created'], 11 'itunes:author' => 'Centauro', 12 'itunes:summary' => strip_tags($item['Podcast']['description']) 13 ); 14 } 15 $this->Rss->addNs('itunes'); 16 $this->set('items', $this->Rss->items($podcasts, 'rss_transform')); 17 # ? > EOF
Note: See TracChangeset
for help on using the changeset viewer.
