Changeset 753 for trunk/app/controllers

Show
Ignore:
Timestamp:
09/03/08 21:34:40 (3 months ago)
Author:
aarkerio
Message:

New layout

Files:
1 modified

Legend:

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

    r745 r753  
    4343 } 
    4444   
    45  public function savemessage()  
    46  { 
    47   if ($this->data['Chat']): 
    48     $this->Sanitize = new Sanitize; 
    49     $this->Sanitize->clear($this->data['Chat']); 
    50     $this->save($this->data); 
    51     $this->render('oldmessages', 'ajax'); 
    52   endif;  
    53  } 
    5445 public function chat($user_id, $vclassroom_id)  
    5546 { 
     
    7667 
    7768   $conditions = array('Vclassroom.id'=>$vclassroom_id, 'Vclassroom.user_id'=>$user_id, 'Vclassroom.status'=>1); 
    78    $fields     = array('id', 'name', 'user_id');    
     69   $fields     = array('id', 'name', 'user_id');  
    7970   $this->set('data', $this->Vclassroom->find($conditions, $fields)); 
     71 
     72   $conditions = array('Chat.vclassroom_id'=>$vclassroom_id); 
     73   $fields = array('Chat.message', 'Chat.created', 'User.username');; 
     74   $order = 'Chat.id DESC'; 
     75   $limit = 15; 
     76   $this->set('msgs', $this->Vclassroom->Chat->findAll($conditions, $fields, $order, $limit)); 
     77 } 
     78  public function savemessage() 
     79 { 
     80   $this->layout = 'ajax'; 
     81 
     82   if ( !empty($this->data['Chat'])): 
     83     $this->Sanitize = new Sanitize;    
     84     $this->Sanitize->clean($this->data['Chat']);  
     85       
     86     $this->Vclassroom->Chat->save($this->data); 
     87 
     88     $conditions = array('Chat.vclassroom_id'=>$this->data['Chat']['vclassroom_id']); 
     89     $fields = array('Chat.message', 'Chat.created', 'User.username');; 
     90     $order = 'Chat.id DESC'; 
     91     $limit = 15; 
     92      
     93     $this->set('data', $this->Vclassroom->Chat->findAll($conditions, $fields, $order, $limit)); 
     94     $this->render('messages', 'ajax'); 
     95   endif; 
    8096 } 
    8197 
     
    103119 public function show($user_id, $vclassroom_id)  
    104120 { 
    105    $this->pageTitle = 'Virtual Group'; 
     121   $this->pageTitle = __('Virtual Class', true); 
    106122   $this->layout    = $this->Edublog->layout($user_id); 
    107123   $this->Edublog->blog($user_id); 
     
    116132   $this->set('data', $this->Vclassroom->classElements($vclassroom_id)); 
    117133 } 
    118  
     134  
    119135 public function participation() 
    120136 { 
     
    227243 public function admin_linktest() 
    228244 { 
    229    if (!empty($this->data["TestsVclassroom"])): 
     245   if (!empty($this->data['TestsVclassroom'])): 
    230246        $this->Sanitize = new Sanitize; 
    231247         
    232         $this->Sanitize->clean($this->data["TestsVclassroom"]);  
    233          
    234         $this->Vclassroom->TestsVclassroom->create(); 
     248        $this->Sanitize->clean($this->data['TestsVclassroom']);  
    235249         
    236250        unset($this->Vclassroom->TestsVclassroom->id); 
    237251 
    238         if ( $this->Vclassroom->TestsVclassroom->save($this->data["TestsVclassroom"])): 
    239                $this->msgFlash('Test linked', '/admin/vclassrooms/tests/'.$this->data["TestsVclassroom"]["vclassroom_id"]); 
     252        if ( $this->Vclassroom->TestsVclassroom->save($this->data['TestsVclassroom'])): 
     253               $this->msgFlash(__('Test linked', true), '/admin/vclassrooms/tests/'.$this->data["TestsVclassroom"]["vclassroom_id"]); 
    240254    endif; 
    241255    endif;