Show
Ignore:
Timestamp:
05/13/08 00:50:52 (8 months ago)
Author:
aarkerio
Message:

Messages to all class

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/messages_controller.php

    r477 r480  
    1414 public $components    = array('Portal', 'Security', 'Email', 'Session', 'Edublog'); 
    1515  
    16   public function beforeFilter()  
    17  { 
    18     $this->Auth->allow(array('message', 'deliver')); 
     16 public function beforeFilter()  
     17 { 
     18    $this->Auth->allow(array('message', 'deliver', 'listing', 'compose')); 
    1919    parent::beforeFilter(); 
    2020 } 
     
    100100 } 
    101101 
     102 public function listing() 
     103 { 
     104   if ( !$this->Auth->user() ): 
     105         $this->redirect('/users/login'); 
     106         return false;         
     107   endif; 
     108 
     109   $this->layout    = 'portal'; 
     110       
     111   $this->pageTitle = 'Messages'; 
     112       
     113   $conditions      = array("Message.user_id" => $this->Auth->user('id')); 
     114   fields          = array("Message.id", "Message.title", "Message.body", "Message.created", "Message.sender", "Message.status", "User.username"); 
     115      $order           = "Message.id DESC"; 
     116      $limit           = 20; 
     117       
     118      $this->set('data', $this->Message->findAll($conditions, $fields, $order, $limit)); 
     119 
     120      $this->Portal->statics(); // Charge Portal components aka Sidebars 
     121 } 
     122 
     123 
    102124  /* == PRIVATE == **/ 
    103125  private function __sendMail($email) 
     
    113135    $this->Email->sendAs   = 'text'; // because we like to send pretty mail 
    114136    //Do not pass any args to send() 
    115     if ( $this->Email->send() ) 
    116     { 
     137    if ( $this->Email->send() ): 
    117138              return true; 
    118     } 
    119     else 
    120     { 
    121                 return false; 
    122     } 
     139    else: 
     140                  return false; 
     141    endif; 
    123142 } 
    124143