Changeset 639

Show
Ignore:
Timestamp:
07/10/08 18:56:32 (3 months ago)
Author:
aarkerio
Message:

Litle changes

Location:
trunk/app
Files:
2 modified

Legend:

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

    r614 r639  
    1313  
    1414 public $components    = array('Portal', 'Email', 'Session', 'Edublog'); 
     15 
     16 public $paginate = array('limit' => 20, 'page' => 1); 
    1517  
    1618 public function beforeFilter()  
     
    130132 public function add() 
    131133 {     
    132    $this->layout    = 'ajax'; 
    133          
    134    if (!empty($this->data['Message'])) 
    135    { 
     134  $this->layout    = 'ajax'; 
     135         
     136  if (!empty($this->data['Message'])): 
     137 
    136138     $this->Sanitize = new Sanitize; 
    137139           
     
    146148     $this->Message->create(); 
    147149           
    148      if ($this->Message->save($this->data['Message'])): 
     150     if ($this->Message->save($this->data)): 
    149151            $this->__sendMail($this->data['Message']['user_id']); 
    150152            $this->render('sent','ajax'); 
     
    152154           die('Error on database'); 
    153155     endif; 
    154    } 
     156  endif; 
    155157 } 
    156158 
     
    231233 public function admin_general()  // send a general message to all commnunity 
    232234 { 
    233    if ($this->Auth->user('group_id') != 1) 
    234    { 
     235   if ($this->Auth->user('group_id') != 1): 
    235236        $this->redirect('/admin/messages/listing'); 
    236    } 
     237   endif; 
    237238     
    238239   $this->layout = 'admin'; 
     
    246247     $this->Sanitize->html($this->data['Message']["body"]); 
    247248         
    248      $this->Message->User->unbindModel( 
    249                                  array( 
    250                                        "hasMany"=>array( 
    251                                                         "Entry", "News", "Category", "Lesson", "Podcast", "Bookmark"))); 
    252          
    253         $conditions = array("active"=>1); 
    254          
    255         $fields     = array("id"); 
    256          
    257         $data = $this->User->findAll($conditions, $fields); 
     249     $this->Message->User->unbindAll(); 
     250         
     251     $conditions = array("active"=>1); 
     252         
     253     $fields     = array("id"); 
     254         
     255     $data = $this->User->findAll($conditions, $fields); 
    258256         
    259257        $j = 0; //counter 
     
    331329 public function admin_listing() 
    332330 { 
    333       $this->layout    = 'admin'; 
    334        
    335       $this->pageTitle = 'Messages'; 
    336        
    337       $conditions      = array("Message.user_id" => $this->Auth->user('id')); 
    338       $fields          = array("Message.id", "Message.title", "Message.body", "Message.created", "Message.sender", "Message.status", "User.username"); 
    339       $order           = "Message.id DESC"; 
    340       $limit           = 20; 
    341        
    342       $this->set('data', $this->Message->findAll($conditions, $fields, $order, $limit)); 
     331  $this->layout    = 'admin'; 
     332       
     333  $this->pageTitle = __('Messages', true); 
     334       
     335  $this->paginate['conditions'] = array('Message.user_id' => $this->Auth->user('id')); 
     336  $this->paginate['fields']     = array("Message.id", "Message.title", "Message.body", "Message.created", "Message.sender", "Message.status", "User.username"); 
     337  $this->paginate['order']      = 'Message.id DESC'; 
     338  $this->paginate['limit']      = 20; 
     339   
     340  $data = $this->paginate('Entry', $conditions); 
     341      
     342  $this->set(compact('data')); 
    343343 } 
    344344 
  • trunk/app/views/messages/admin_listing.ctp

    r544 r639  
    11<?php  
    2  echo $html->addCrumb('Control Tools', '/admin/entries/start');   
     2 echo $html->addCrumb('Control Panel', '/admin/entries/start');   
    33 echo $html->getCrumbs(' / ');  
    44 
    5  echo $html->link($html->image('admin/compose_on.gif', array("alt"=>"Compose New Message", "title"=>"Compose New Message")), '/admin/messages/add', null, false, false); 
     5 echo $html->div(null,$html->link($html->image('admin/compose_on.gif', array("alt"=>"Compose New Message", "title"=>"Compose New Message")), '/admin/messages/add', null, false, false)); 
    66 
    77if ( $session->read('Auth.User.group_id') == 1): // if user belongs to admin group 
     
    5353 echo '<tr><td colspan="5" style="text-align:right">'; 
    5454  
    55  if ( count($data) > 0 ) 
    56  { 
     55 if ( count($data) > 0 ): 
    5756    echo $html->link('Mark all', "javascript:select_switch(true)", array("style"=>"font-size:7pt")) . ' '; 
    5857    echo $html->link('Unmark all', "javascript:select_switch(false)", array("style"=>"font-size:7pt")) . '<br />'; 
    5958     
    60     echo $form->end('Deleted marked'); 
    61  } 
     59    echo $form->end(__('Deleted marked', true)); 
     60 endif; 
    6261?> 
    6362</form>