Changeset 461


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

Update users

Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/config/core.php

    r460 r461  
    245245 * 
    246246 * Xcache (http://xcache.lighttpd.net/) */ 
    247  
     247/* 
    248248 Cache::config('default', array( 
    249249                                 'engine'      => 'Xcache',    # [required] 
     
    254254                                 'password'    => 'password',  # plaintext password (xcache.admin.pass) 
    255255                                 ));  
     256*/ 
    256257 /* 
    257258 * Memcache (http://www.danga.com/memcached/) 
     
    269270 * 
    270271 */ 
    271  #Cache::config('default', array('engine' => 'File')); 
     272Cache::config('default', array('engine' => 'File')); 
    272273# ? > EOF 
  • trunk/controllers/podcasts_controller.php

    r459 r461  
    1717 public $name       = 'Podcasts'; 
    1818 
    19  public $helpers    = array('Rss'); 
    20  
     19/** 
     20 * Load CakePHP helpers 
     21 * @access public 
     22 * @var array 
     23 */ 
     24 public $helpers    = array('Rss', 'Text'); 
     25 
     26/** 
     27 * Load CakePHP helpers 
     28 * @access public 
     29 * @var array 
     30 */ 
    2131 public $components = array('RequestHandler'); 
    2232 
     33/** 
     34 * Load CakePHP Acl-Auth 
     35 * @access public 
     36 * @var array 
     37 */ 
    2338 public function beforeFilter()  
    2439 { 
     
    2641   $this->Auth->allow(array('display', 'vote')); 
    2742 } 
    28     
    29  public function index($username=null, $entry_id=null) 
    30  {       
    31    $conditions      = array('status'=>1); # podcast must be actived   
    32    if ($username != null): 
    33        $user_id    = $this->User->field('id', array('username'=>$username));       
    34        $conditions['user_id'] = $user_id; 
    35        $this->set('username', $username); 
    36    endif; 
    37    $params = array( 
    38             'conditions' => $conditions, 
    39             'fields'     => array('id', 'title', 'description', 'created', 'lenght', 'user_id', 'filename'), 
    40             'order'      => 'id DESC', 
    41             'limit'      => 12); 
    42    $this->set('data', $this->Podcast->find('all', $params));  
    43  } 
    44      
    45  public function show($user_id, $id) 
     43 
     44/** 
     45 * View one podcast 
     46 * @access public 
     47 * @var array 
     48 */ 
     49 public function view($username, $podcast_id) 
    4650 {    
    47    $this->layout    = $this->blog->layout($user_id); 
     51   $this->layout    = $this->blog->layout($username); 
    4852   $this->set('blog', $this->blog->blog($user_id)); 
    4953   $params = array( 
    50                    'conditions' => array('Podcast.id'=>$id, 'Podcast.status'=>1), 
     54                   'conditions' => array('Podcast.id'=>$podcast_id, 'Podcast.status'=>1), 
    5155                   'fields'     => array('id', 'title', 'description', 'created', 'filename', 'length', 'size', 'duration') 
    5256                   );         
    53    $this->set('data', $this->Podcast->find('all', $params)); 
     57   $this->set('data', $this->Podcast->find('first', $params)); 
    5458  } 
    55    
    56  public function all($username=null, $entry_id=null)  
     59 
     60/** 
     61 *  
     62 * @access public 
     63 * @var array 
     64 */   
     65 public function all($username=null, $podcast_id=null)  
    5766 {  
    5867   $conditions      = array('status'=>1);         
     
    7180 
    7281/** 
    73  * 
    74  * 
     82 * RSS feeder 
     83 * @access public 
     84 * @return void 
    7585 */ 
    7686 public function rss($username)  
    7787 { 
    78   $this->layout = 'rss';  
     88  $this->layout = 'rss'; 
    7989  $params = array('conditions' => array('username'=>$username), 
     90                  'contain'    => False, 
    8091                  'fields'     => array('User.id', 'User.username','User.name','User.email', 'User.avatar')); 
    8192  $User = $this->Podcast->User->find('first', $params); 
    8293   
    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          
     94  $this->set('User', $User); 
    9695  $params = array('conditions' => array('Podcast.status'=>1, 'Podcast.user_id'=>$User['User']['id']), 
    9796                  'fields'     => array('Podcast.id', 'Podcast.title', 'Podcast.filename', 'Podcast.description', 'Podcast.created', 'Podcast.duration',  
     
    9998                  'order'      => 'Podcast.created DESC', 
    10099                  'contain'    => False, 
    101                   'limit'      => 12); 
     100                  'limit'      => 30); 
    102101  $podcasts = $this->Podcast->find('all', $params); 
    103   $this->set(compact('channelData', 'podcasts')); 
     102  $this->set(compact('podcasts')); 
    104103 } 
    105104     
     
    114113   $fields       = array('Podcast.id', 'Podcast.title', 'Podcast.description', 'Podcast.created', 'Podcast.length', 'Podcast.status', 'Podcast.filename'); 
    115114   $order        = 'Podcast.id DESC'; 
    116    $limit        = 12; 
     115   $limit        = 30; 
    117116         
    118117   $this->paginate = array('conditions'   => $conditions, 
  • trunk/controllers/users_controller.php

    r456 r461  
    2121 { 
    2222   parent::beforeFilter(); 
    23    $perms = array('bloggers', 'blogger', 'about', 'entry', 'register', 'insert', 'newMembers', 'topNews', 'topBloggers', 'topNews'); 
     23   $perms = array('bloggers', 'blogger', 'about', 'entry', 'register', 'insert', 'newMembers', 'topNews', 'topBloggers', 'topNews', 'listing'); 
    2424   $this->Auth->allow($perms); 
    2525    
     
    222222  $this->set(compact('data')); 
    223223 } 
     224 public function listing()  
     225 { 
     226  $this->layout     = 'portal'; 
     227  $this->pageTitle  = __('Users', True); 
     228  $this->paginate['conditions'] = array('User.id != 2'); 
     229  $this->paginate['fields']     = array('User.group_id','User.name','User.created','User.email','User.active','User.id','User.username'); 
     230  $this->paginate['order']      = 'User.created DESC'; 
     231  $this->paginate['limit']      = 40; 
     232  $this->paginate['contain']    = array('Group'); 
     233  $data = $this->paginate('User'); 
     234  #die(debug($data)); 
     235  $this->set(compact('data')); 
     236 } 
    224237 
    225238/** 
  • trunk/views/layouts/portal.ctp

    r458 r461  
    4545  endif; 
    4646  echo $this->Html->div('sidepanel', $this->element('lastentries')); 
     47  echo  $this->Html->div('sidepanel', $this->Html->image('admin/your-users.png', array('alt'=>'MN', 'title'=>'MN', 'height'=> '25px', 'width'=>'25px'))."".$this->Html->link('Mononeurones Registrados', '/u 
     48sers/listing')); 
     49 
     50   
    4751  echo  $this->element('adsense'); 
    4852  echo $this->Html->div('sidepanel', $this->element('lastdownloads'));/*, array('cache' => True));*/ 
  • trunk/views/layouts/rss/default.ctp

    r214 r461  
    11<?php 
    2 echo $rss->header(); 
    3  $channel = $rss->channel(array(), $channelData, $items); 
    4 echo $rss->document(array(), $channel); 
    5 ?> 
     2#echo $rss->header(); 
     3#$channel = $rss->channel(array(), $channelData, $items); 
     4#echo $rss->document(array(), $channel); 
     5# ? > EOF 
  • trunk/views/layouts/rss/rss.ctp

    r459 r461  
    11<?php 
    2 echo $rss->header(); 
    3  $channel = $rss->channel(array(), $channelData, $items); 
    4 echo $rss->document(array(), $channel); 
    5 ?> 
     2# Chipotle Software (c) 2006-2010 
     3# http://book.cakephp.org/view/1461/Creating-an-RSS-feed-with-the-RssHelper 
     4echo $this->Rss->header(); 
     5if (!isset($documentData)): 
     6    $documentData = array(); 
     7endif; 
     8if (!isset($channelData)): 
     9    $channelData = array(); 
     10endif; 
     11if (!isset($channelData['title'])): 
     12    $channelData['title'] = $title_for_layout; 
     13endif; 
     14$channel = $this->Rss->channel(array(), $channelData, $content_for_layout); 
     15echo $this->Rss->document($documentData,$channel); 
     16# ? >  EOF 
  • trunk/views/podcasts/rss.ctp

    r459 r461  
    11<?php 
    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')); 
     2# die(debug($podcasts)); 
     3# You should import Sanitize 
     4App::import('Sanitize'); 
     5 
     6$this->set('documentData', array( 
     7                                 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/')); 
     8 
     9$this->set('channelData', array( 
     10                                'title'       => __('Most Recent Posts', True), 
     11                                'link'        => $this->Html->url('/', True), 
     12                                'description' => __("Most recent posts.", True), 
     13                                'language'    => 'en-us')); 
     14foreach ($podcasts as $pod): 
     15    $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']); 
     23    # This is the part where we clean the body text for output as the description  
     24    # 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); 
     29  
     30    echo $this->Rss->item(array(), array( 
     31                                    'title'       => $pod['Podcast']['title'], 
     32                                    'link'        => $postLink, 
     33                                    'guid'        => array('url' => $postLink, 'isPermaLink' => True), 
     34                                    'description' => $bodyText, 
     35                                    'dc:creator'  => 'username', 
     36                                    'pubDate'     => $pod['Podcast']['created'])); 
     37endforeach; 
     38 
    1739# ? > EOF 
  • trunk/views/podcasts/rss/rss.ctp

    r459 r461  
    33{ 
    44 return array( 
    5       'title' => $item['Podcast']['title'], 
    6       'guid' => '/files/podcasts/'. $item['Podcast']['filename'], 
    7       'enclosure' => array('url'=>'/files/podcasts/'. $item['Podcast']['filename'], 'length'=> $item['Podcast']['length']), 
    8       'description' => strip_tags($item['Podcast']['description']), 
    9       'pubDate' => $item['Podcast']['created'], 
    10       'itunes:author' => 'Karamelo', 
     5      'title'          => $item['Podcast']['title'], 
     6      'guid'           => '/files/podcasts/'. $item['Podcast']['filename'], 
     7      'enclosure'      => array('url'=>'/files/podcasts/'. $item['Podcast']['filename'], 'length'=> $item['Podcast']['length']), 
     8      'description'    => Sanitize::stripAll($item['Podcast']['description']), 
     9      'pubDate'        => $item['Podcast']['created'], 
     10      'itunes:author'  => 'Karamelo', 
    1111      'itunes:summary' => strip_tags($item['Podcast']['description'])    
    1212     ); 
    1313}  
    14 $this->Rss->addNs('itunes'); 
     14$this->Rss->addNs('dc'); 
    1515$this->set('items', $this->Rss->items($podcasts, 'rss_transform')); 
    16 # ? > 
     16# ? > EOF 
Note: See TracChangeset for help on using the changeset viewer.