Changeset 652

Show
Ignore:
Timestamp:
07/15/08 01:53:54 (3 months ago)
Author:
aarkerio
Message:

Messages

Location:
trunk/app
Files:
2 added
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/components/portal.php

    r494 r652  
    1515App::import('Model', 'User'); 
    1616App::import('Model', 'Vclassroom');  
     17App::import('Model', 'Message'); 
    1718 
    1819class PortalComponent extends Object { 
     
    3233     $Element['Poll']         = $this->poll(); 
    3334     $Element['Vclassrooms']  = $this->vclassrooms(); 
    34  
     35     $Element['Message']     = $this->chkMessage(); 
    3536     $this->controller->set('Element', $Element); 
    3637 
     
    4748   endif; 
    4849 } 
    49  
     50  
     51 private function chkMessage()                                                         
     52 {                                                                                                                        
     53    if ($this->controller->Auth->user()):  
     54         $this->Message = new Message; 
     55         $conditions = array('Message.user_id'=>$this->controller->Auth->user('id'), 'Message.status'=>0);      
     56         return $this->Message->field('Message.id', $conditions, 'Message.id DESC');   
     57    else:     
     58         return false;  
     59    endif;  
     60 } 
     61                  
    5062 private function lastEntries() { 
    5163    
  • trunk/app/controllers/messages_controller.php

    r639 r652  
    8080           $this->data['Message']['username'] = $this->Auth->user('username'); 
    8181 
    82            $user_id = $this->Message->User->field('User.id', array('User.username'=>trim($this->data['Message']['sendern']))); 
    83             
    84            $this->data['Message']['user_id'] = $user_id; 
    85   
    86            //die(debug($this->data['Message']));      
    87  
    88            $this->Message->create(); 
    89             
    90            if ( $this->Message->save($this->data['Message']) ): 
    91                 $this->__sendMail($user_id); 
    92             $this->msgFlash('Message sent', '/messages/listing'); 
     82           if ( $this->Message->save($this->data) ): 
     83                $this->__sendMail($this->data['Message']['user_id']); 
     84            $this->msgFlash(__('Message sent', true), '/messages/listing'); 
    9385           endif; 
    9486   endif; 
     
    338330  $this->paginate['limit']      = 20; 
    339331   
    340   $data = $this->paginate('Entry', $conditions); 
     332  $data = $this->paginate('Message'); 
    341333      
    342334  $this->set(compact('data')); 
  • trunk/app/locale/spa/LC_MESSAGES/default.po

    r651 r652  
    44msgid  "View all Lessons" 
    55msgstr "Todas las lecciones" 
     6 
     7msgid  "Your current groups" 
     8msgstr "Tus grupos" 
    69 
    710msgid  "View all podcasts" 
  • trunk/app/models/message.php

    r535 r652  
    1212    public $belongsTo = 'User'; 
    1313     
    14     public $validate = array( 
     14    public $validate = array( 
    1515      'title' => VALID_NOT_EMPTY, 
    1616      'body' => VALID_NOT_EMPTY, 
    1717      'user_id' => VALID_NOT_EMPTY, 
    18       'sender_id' => VALID_NOT_EMPTY 
     18      'sender' => VALID_NOT_EMPTY 
    1919      ); 
    2020/* 
  • trunk/app/views/elements/studentclass.ctp

    r608 r652  
    22<form style="font-size:6pt;"> 
    33<select style="font-size:6pt;" onchange="window.location=this.options[this.selectedIndex].value;"> 
    4 <option value="#">Your current groups</option> 
     4<option value="#"><?php __('Your current groups'); ?></option> 
    55<?php 
    66foreach ($Element['Vclassrooms'] as $v): 
  • trunk/app/views/layouts/portal.ctp

    r647 r652  
    3333           echo $html->link(__("cPanel", true), '/admin/entries/start') . ' | '; 
    3434   endif; 
    35  
     35    
    3636   if (  $session->read('Auth.User.group_id') == 3 ): // the logged user is student 
    37      echo $html->link(__('My profile', true), '/users/edit'). ' | '.$html->link( 
    38                                                                         $html->image('static/mailgray.png',  
    39                                                                                   array('alt'=>'Messages', 'title'=>'Messages')),  
    40                                                                           '/messages/listing', null, null, false) . ' | '; 
     37     echo $html->link(__('My profile', true), '/users/edit'). ' | '; 
    4138 
    4239   endif; 
     40 
     41   $img = ($Element['Message'] != false) ?  'static/mail.png' : 'static/mailgray.png'; 
     42    
     43   $url = ( $session->read('Auth.User.group_id') > 2 ) ?  '/messages/listing':  '/admin/messages/listing'; 
     44 
     45   echo $html->link($html->image($img, array('alt'=>'Messages', 'title'=>'Messages')), $url, null, null, false) . ' | '; 
    4346 
    4447 else: 
     
    5861<div id="page"> 
    5962    <div id="content"> 
    60                        <?php echo $content_for_layout; ?> 
     63                     <?php echo $content_for_layout; ?> 
    6164    </div> 
    6265    <!-- end content --> 
  • trunk/app/views/messages/admin_listing.ctp

    r639 r652  
    6363</td></tr> 
    6464</table> 
     65<?php 
     66$t  = $html->div(null,$paginator->prev('« '.__('Previous', true),null,null,array('class'=>'disabled')),array('style'=>'width:100px;float:left')); 
     67$t .= $html->div(null,$paginator->next(__('Next', true).' »', null, null, array('class' => 'disabled')),array('style'=>'width:100px;float:right')); 
     68$t .= $html->div(null,$paginator->counter(), array('style'=>'width:200px;float:center')); 
     69 echo  $html->div(null,$t, array('style'=>'font-size:9pt;width:400px;margin:15px auto;')); 
     70?> 
    6571<script language="Javascript" type="text/javascript"> 
    6672    // 
  • trunk/app/views/messages/message.ctp

    r541 r652  
    1414<?php  
    1515  echo $ajax->form(); 
    16   echo $form->hidden('Message.user_id', $blog["User"]["id"]); 
     16  echo $form->hidden('Message.user_id', array('value'=>$blog['User']['id'])); 
    1717?> 
    1818<fieldset> 
     
    2222        echo $form->error('Message.title', 'Title is required.');  
    2323         
    24         echo $form->textarea('Message.body', array("cols"=>30, "rows"=>35)); 
     24        echo $form->textarea('Message.body', array('cols'=>30, 'rows'=>35)); 
    2525        echo $fck->load('MessageBody', 'Basic', 350, 150);  
    2626        echo $form->error('Message.body', 'Body is required.');  
    27             echo $ajax->submit('Send', array("url" => "/messages/deliver/",  
     27            echo $ajax->submit(__('Send', true), array("url" => "/messages/deliver/",  
    2828                                         "update"=>"updater", 
    2929                                         "before" => "MyFCKObject.UpdateEditorFormValue();",