Changeset 652
- Timestamp:
- 07/15/08 01:53:54 (3 months ago)
- Location:
- trunk/app
- Files:
-
- 2 added
- 8 modified
-
controllers/components/portal.php (modified) (3 diffs)
-
controllers/messages_controller.php (modified) (2 diffs)
-
locale/spa/LC_MESSAGES/default.po (modified) (1 diff)
-
models/message.php (modified) (1 diff)
-
views/elements/newmessage.ctp (added)
-
views/elements/studentclass.ctp (modified) (1 diff)
-
views/layouts/portal.ctp (modified) (2 diffs)
-
views/messages/admin_listing.ctp (modified) (1 diff)
-
views/messages/message.ctp (modified) (2 diffs)
-
webroot/img/static/mail.png (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/components/portal.php
r494 r652 15 15 App::import('Model', 'User'); 16 16 App::import('Model', 'Vclassroom'); 17 App::import('Model', 'Message'); 17 18 18 19 class PortalComponent extends Object { … … 32 33 $Element['Poll'] = $this->poll(); 33 34 $Element['Vclassrooms'] = $this->vclassrooms(); 34 35 $Element['Message'] = $this->chkMessage(); 35 36 $this->controller->set('Element', $Element); 36 37 … … 47 48 endif; 48 49 } 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 50 62 private function lastEntries() { 51 63 -
trunk/app/controllers/messages_controller.php
r639 r652 80 80 $this->data['Message']['username'] = $this->Auth->user('username'); 81 81 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'); 93 85 endif; 94 86 endif; … … 338 330 $this->paginate['limit'] = 20; 339 331 340 $data = $this->paginate(' Entry', $conditions);332 $data = $this->paginate('Message'); 341 333 342 334 $this->set(compact('data')); -
trunk/app/locale/spa/LC_MESSAGES/default.po
r651 r652 4 4 msgid "View all Lessons" 5 5 msgstr "Todas las lecciones" 6 7 msgid "Your current groups" 8 msgstr "Tus grupos" 6 9 7 10 msgid "View all podcasts" -
trunk/app/models/message.php
r535 r652 12 12 public $belongsTo = 'User'; 13 13 14 public $validate = array(14 public $validate = array( 15 15 'title' => VALID_NOT_EMPTY, 16 16 'body' => VALID_NOT_EMPTY, 17 17 'user_id' => VALID_NOT_EMPTY, 18 'sender _id' => VALID_NOT_EMPTY18 'sender' => VALID_NOT_EMPTY 19 19 ); 20 20 /* -
trunk/app/views/elements/studentclass.ctp
r608 r652 2 2 <form style="font-size:6pt;"> 3 3 <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> 5 5 <?php 6 6 foreach ($Element['Vclassrooms'] as $v): -
trunk/app/views/layouts/portal.ctp
r647 r652 33 33 echo $html->link(__("cPanel", true), '/admin/entries/start') . ' | '; 34 34 endif; 35 35 36 36 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'). ' | '; 41 38 42 39 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) . ' | '; 43 46 44 47 else: … … 58 61 <div id="page"> 59 62 <div id="content"> 60 <?php echo $content_for_layout; ?>63 <?php echo $content_for_layout; ?> 61 64 </div> 62 65 <!-- end content --> -
trunk/app/views/messages/admin_listing.ctp
r639 r652 63 63 </td></tr> 64 64 </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 ?> 65 71 <script language="Javascript" type="text/javascript"> 66 72 // -
trunk/app/views/messages/message.ctp
r541 r652 14 14 <?php 15 15 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'])); 17 17 ?> 18 18 <fieldset> … … 22 22 echo $form->error('Message.title', 'Title is required.'); 23 23 24 echo $form->textarea('Message.body', array( "cols"=>30, "rows"=>35));24 echo $form->textarea('Message.body', array('cols'=>30, 'rows'=>35)); 25 25 echo $fck->load('MessageBody', 'Basic', 350, 150); 26 26 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/", 28 28 "update"=>"updater", 29 29 "before" => "MyFCKObject.UpdateEditorFormValue();",
