Changeset 463


Ignore:
Timestamp:
06/23/10 17:08:34 (20 months ago)
Author:
aarkerio
Message:

Update users

Location:
trunk
Files:
1 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/controllers/podcasts_controller.php

    r461 r463  
    2929 * @var array 
    3030 */ 
    31  public $components = array('RequestHandler'); 
     31 public $components = array('RequestHandler', 'Blog'); 
    3232 
    3333/** 
     
    3939 { 
    4040   parent::beforeFilter(); 
    41    $this->Auth->allow(array('display', 'vote')); 
     41   $this->Auth->allow(array('all', 'view', 'rss')); 
    4242 } 
    4343 
     
    4949 public function view($username, $podcast_id) 
    5050 {    
    51    $this->layout    = $this->blog->layout($username); 
    52    $this->set('blog', $this->blog->blog($user_id)); 
    53    $params = array( 
    54                    'conditions' => array('Podcast.id'=>$podcast_id, 'Podcast.status'=>1), 
    55                    'fields'     => array('id', 'title', 'description', 'created', 'filename', 'length', 'size', 'duration') 
    56                    );         
     51  $this->layout    = 'blog'; 
     52  $this->Blog->setUserId($username);   # set blog sidebars 
     53  $user_id = $this->Blog->getUserId(); 
     54  $params = array( 
     55                 'conditions' => array('Podcast.id'=>$podcast_id, 'Podcast.status'=>1), 
     56                 'fields'     => array('id', 'title', 'description', 'created', 'filename', 'length') 
     57                   ); 
    5758   $this->set('data', $this->Podcast->find('first', $params)); 
    5859  } 
    5960 
    6061/** 
    61  *  
     62 * View all podcast 
    6263 * @access public 
    6364 * @var array 
     
    9091                  'contain'    => False, 
    9192                  'fields'     => array('User.id', 'User.username','User.name','User.email', 'User.avatar')); 
    92   $User = $this->Podcast->User->find('first', $params); 
     93  $user = $this->Podcast->User->find('first', $params); 
    9394   
    94   $this->set('User', $User); 
    95   $params = array('conditions' => array('Podcast.status'=>1, 'Podcast.user_id'=>$User['User']['id']), 
     95  $this->set('user', $user); 
     96  $params = array('conditions' => array('Podcast.status'=>1, 'Podcast.user_id'=>$user['User']['id']), 
    9697                  'fields'     => array('Podcast.id', 'Podcast.title', 'Podcast.filename', 'Podcast.description', 'Podcast.created', 'Podcast.duration',  
    9798                                        'Podcast.title', 'Podcast.length'), 
  • trunk/views/layouts/rss/rss.ctp

    r461 r463  
    1313endif; 
    1414$channel = $this->Rss->channel(array(), $channelData, $content_for_layout); 
     15#die(debug($channel)); 
    1516echo $this->Rss->document($documentData,$channel); 
     17 
     18#echo  $content_for_layout; 
    1619# ? >  EOF 
  • trunk/views/podcasts/rss.ctp

    r461 r463  
    11<?php 
    2 # die(debug($podcasts)); 
     2#die(debug($user)); 
    33# You should import Sanitize 
    44App::import('Sanitize'); 
    55 
    66$this->set('documentData', array( 
    7                                  'xmlns:dc' => 'http://purl.org/dc/elements/1.1/')); 
     7                               'xmlns:pod' => 'http://sw.deri.org/2005/07/podcast#', 
     8                               'xmlns:dc'  => 'http://purl.org/dc/elements/1.1/')); 
    89 
    910$this->set('channelData', array( 
     
    1415foreach ($podcasts as $pod): 
    1516    $postTime = strtotime($pod['Podcast']['created']); 
    16     $postLink = array( 
    17                       'controller' => 'podcasts', 
    18                       'action'     => 'view', 
    19                       'year'       => date('Y', $postTime), 
    20                       'month'      => date('m', $postTime), 
    21                       'day'        => date('d', $postTime), 
    22                       $pod['Podcast']['id']); 
     17    $postLink = array('controller' => 'podcasts', 'action' => 'view', $user['User']['username'].'/'.$pod['Podcast']['id']); 
    2318    # This is the part where we clean the body text for output as the description  
    2419    # of the rss item, this needs to have only text to make sure the feed validates 
    25     $bodyText = preg_replace('=\(.*?\)=is', '', $pod['Podcast']['description']); 
    26     $bodyText = $this->Text->stripLinks($bodyText); 
    27     $bodyText = Sanitize::stripAll($bodyText); 
    28     $bodyText = $this->Text->truncate($bodyText, 400, '...', True, True); 
     20    $bodyText = str_replace('nbsp', ' ', $pod['Podcast']['description']); 
     21    #$bodyText = preg_replace('=\(.*?\)=is', '', $bodyText); 
     22    #$bodyText = $this->Text->stripLinks($bodyText); 
     23    #$bodyText = Sanitize::stripAll($bodyText); 
     24    #$bodyText = $this->Text->truncate($bodyText, 400, '...', True, True); 
    2925  
    3026    echo $this->Rss->item(array(), array( 
     
    3329                                    'guid'        => array('url' => $postLink, 'isPermaLink' => True), 
    3430                                    'description' => $bodyText, 
    35                                     'dc:creator'  => 'username', 
     31                                    'dc:creator'  => $user['User']['username'], 
    3632                                    'pubDate'     => $pod['Podcast']['created'])); 
    3733endforeach; 
Note: See TracChangeset for help on using the changeset viewer.