Changeset 739

Show
Ignore:
Timestamp:
08/26/08 00:41:38 (3 months ago)
Author:
aarkerio
Message:

CHate

Location:
trunk/app
Files:
3 added
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/config/sql/postgresql/vclassrooms.sql

    r624 r739  
    1010    "sdate" date NOT NULL DEFAULT now(), --starting date 
    1111    "fdate" date NOT NULL DEFAULT now(), -- finish date 
    12     "access" smallint NOT NULL DEFAULT 0 -- public / only with code 
     12    "access" smallint NOT NULL DEFAULT 0, -- public / only with code 
     13    "chat" smallint NOT NULL DEFAULT 0 -- active / desactive chat 
    1314); 
    1415 
  • trunk/app/controllers/vclassrooms_controller.php

    r730 r739  
    2121 { 
    2222   parent::beforeFilter(); 
    23    $this->Auth->allow(array('show', 'jointoclass', 'aboutme', 'display', 'participation', 'upload', 'description')); 
     23   $this->Auth->allow(array('show', 'jointoclass', 'aboutme', 'display', 'participation', 'upload', 'description', 'chat', 'savemessage')); 
    2424 } 
    2525 
     
    4141           $this->Edublog->setSession($user_id); 
    4242      endif; 
     43 } 
     44   
     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 } 
     54 public function chat($user_id, $vclassroom_id)  
     55 { 
     56   $this->pageTitle = 'Virtual Group Chat'; 
     57   $this->layout    = 'popup'; 
     58   $this->Edublog->blog($user_id); 
     59    
     60   // student belongs to this class? 
     61   if ( $this->Auth->user()): 
     62             $this->set('belongs', $this->Vclassroom->belongs($this->Auth->user('id'), $vclassroom_id)); 
     63   else: 
     64             $this->set('belongs', false); 
     65   endif; 
     66   $this->Vclassroom->unbindAll(); 
     67 
     68   $this->Vclassroom->bindModel(array('hasMany'=>array( 
     69                              'Chat' => 
     70               array('className'     => 'Chat', 
     71                 'conditions'    => null, 
     72                 'order'         => null, 
     73                 'limit'         => 15, 
     74                 'foreignKey'    => 'vclassroom_id' 
     75                 )))); 
     76 
     77   $conditions = array('Vclassroom.id'=>$vclassroom_id, 'Vclassroom.user_id'=>$user_id, 'Vclassroom.status'=>1); 
     78   $fields     = array('id', 'name', 'user_id');    
     79   $this->set('data', $this->Vclassroom->find($conditions, $fields)); 
    4380 } 
    4481 
     
    329366    endif; 
    330367 } 
     368 
     369 public function admin_chat($vclassroom_id, $chat) 
     370 { 
     371    $this->data['Vclassroom']['chat']   = ($chat == 0 ) ? 1 : 0; 
     372    
     373    $this->data['Vclassroom']['id']     = (int) $vclassroom_id; 
     374      
     375    if ($this->Vclassroom->save($this->data, array('validate'=>false))): 
     376          $this->msgFlash(__('Status modified', true), '/admin/vclassrooms/members/'.$vclassroom_id); 
     377    endif; 
     378 } 
    331379  
    332380 public function admin_delete($vclassroom_id, $ecourse_id) 
  • trunk/app/views/entries/admin_start.ctp

    r738 r739  
    6969 echo $html->div('main-item', $tmp, array('title'=>__('Tests', true), 'onclick'=>"document.location.href='/admin/tests/listing'")); 
    7070 
    71  $tmp  = $html->link($html->image('static/chat_icon.png',array('title'=>'Chats','alt'=>'Chats')),'/admin/chats/listing',null,null,false);  
    72  $tmp .= $html->link('Chats','/admin/chats/listing', array('title'=>'Chats', 'class'=>'main-item-caption')); 
    73  echo $html->div('main-item', $tmp, array('title'=>'Chats', 'onclick'=>"document.location.href='/admin/chats/listing'")); 
     71// $tmp  = $html->link($html->image('static/chat_icon.png',array('title'=>'Chats','alt'=>'Chats')),'/admin/chats/listing',null,null,false);  
     72// $tmp .= $html->link('Chats','/admin/chats/listing', array('title'=>'Chats', 'class'=>'main-item-caption')); 
     73// echo $html->div('main-item', $tmp, array('title'=>'Chats', 'onclick'=>"document.location.href='/admin/chats/listing'")); 
    7474?> 
    7575</div> 
  • trunk/app/views/layouts/popup.ctp

    r682 r739  
    4343 
    4444<div id="container"> 
    45                              <?php echo $content_for_layout; ?> 
     45         <?php echo $content_for_layout; ?> 
    4646</div> 
    4747 
     
    4949 
    5050<div id="footer">Powered by <a href="http://www.chipotle-software.com/" rel="external">Karamelo Project</a></div> 
    51  
    5251 </body> 
    5352</html> 
  • trunk/app/views/vclassrooms/admin_members.ctp

    r729 r739  
    3434        $html->image('static/feedback_icon.png', array('alt'=>__('Ask for feedback', true), 'title'=>__('Ask for feedback', true), "style"=>"margin-right:12px") 
    3535        ), '/admin/vclassrooms/export/'.$data['Vclassroom']['id'], null, null, false); */ 
     36 
     37 if ($data['Vclassroom']['chat'] == 1): 
     38   $img  = 'static/chat_ena.png';  
     39   $tit  = __('Disable chat', true); 
     40 else: 
     41    $img = 'static/chat_dis.png'; 
     42    $tit = __('Active chat', true); 
     43 endif; 
     44 
     45 echo $html->link( 
     46         $html->image($img, array('alt'=>$tit, 'title'=>$tit, 'style'=>'margin-right:12px')), '/admin/vclassrooms/chat/'.$data['Vclassroom']['id'].'/'.$data['Vclassroom']['chat'], null, null, false); 
    3647 
    3748 echo $html->link( 
  • trunk/app/views/vclassrooms/show.ctp

    r729 r739  
    1515  echo $ajax->div('qn', array("style"=>"padding:3px")).$ajax->divEnd('qn'); 
    1616 
     17  if ( $data['Vclassroom']['chat'] == 1 ): 
     18   //popup window for chat 
     19   $t="javascript:window.open('/vclassrooms/chat/".$blog['User']['id']."/".$data['Vclassroom']['id']."', 'blank', 'toolbar=no, scrollbars=yes,width=700,height=400')";  
     20      echo $html->link( 
     21         $html->image('static/icon_webquest.jpg', array('alt'=>'Chat','title'=>'Chat','style'=>'margin-right:12px') 
     22     ), '#', array("onclick"=>$t), null, null, false); 
     23 
     24     
     25  endif; 
    1726  //  Forums 
    1827  if ( isset($data['Forum']) && count($data['Forum']) > 0):