Changeset 699 for trunk/app/controllers
- Timestamp:
- 08/06/08 17:10:36 (4 months ago)
- Location:
- trunk/app/controllers
- Files:
-
- 2 modified
-
catglossaries_controller.php (modified) (1 diff)
-
messages_controller.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/catglossaries_controller.php
r698 r699 48 48 public function view($username, $catglossary_id) 49 49 { 50 $this->pageTitle = 'Glossary';50 $this->pageTitle = __('Glossary', true); 51 51 52 52 $user_id = $this->Catglossary->User->field('id', array("User.username"=>$username)); -
trunk/app/controllers/messages_controller.php
r696 r699 23 23 $this->Auth->allow(array('message','deliver','listing','compose','display','add','send','autocomplete','sentmessages','delete')); 24 24 else: 25 $this->redirect('/users/login'); 26 return false; 25 $this->Auth->allow(array('message', 'fromoutside')); 27 26 endif; 28 27 } … … 30 29 public function message($username) // show form to send message to teacher 31 30 { 32 $this->pageTitle = 'Contact';33 34 $user_id = $this->Message->User->field('id', array('username'=>$username));31 $this->pageTitle = __('Contact', true); 32 33 $user_id = $this->Message->User->field('id', array('username'=>$username)); 35 34 36 $this->layout = $this->Edublog->layout($user_id);37 38 $this->Edublog->blog($user_id);35 $this->layout = $this->Edublog->layout($user_id); 36 37 $this->Edublog->blog($user_id); 39 38 } 40 39 … … 64 63 65 64 $this->set('nick', $nick); 65 } 66 67 public function fromoutside() 68 { 69 if (!empty($this->data['Message'])): 70 71 $this->Sanitize = new Sanitize; 72 73 $this->Sanitize->clean($this->data['Message']); 74 75 $msg = (string) $this->data['Message']['title'] ."\n"; 76 $msg .= $this->data['Message']['body'] ."\n"; 77 $msg .= __('Email', true).': '.$this->data['Message']['email']; 78 79 if ($this->__sendOutside($this->data['Message']['user_id'], $msg)): 80 $this->render('sent', 'ajax'); 81 else: 82 $this->getSupport(); 83 endif; 84 endif; 66 85 } 67 86 /* … … 71 90 public function deliver() 72 91 { 73 if (!empty($this->data['Message'])):92 if (!empty($this->data['Message'])): 74 93 75 94 $this->Sanitize = new Sanitize; … … 195 214 196 215 /* == PRIVATE == **/ 197 private function __sendMail($user_id)198 {199 $email = $this->Message->User->field('User.email', array('User.id'=>$user_id)); 216 private function __sendMail($user_id) 217 { 218 $email = $this->Message->User->field('User.email', array('User.id'=>$user_id)); 200 219 $this->layout = 'default'; 201 220 $this->Email->to = $email; … … 209 228 //Do not pass any args to send() 210 229 if ( $this->Email->send() ): 211 return true;230 return true; 212 231 else: 213 return false;232 return false; 214 233 endif; 215 234 } 216 235 217 private function __sendAll($user_id, $vclassroom_id, $blogger_id) 218 { 236 private function __sendOutside($user_id, $msg) 237 { 238 $this->Message->User->unbindAll(); 239 $email = $this->Message->User->field('User.email', array('User.id'=>$user_id)); 240 $this->layout = 'default'; 241 $this->Email->to = $email; 242 243 // this could be just a string too 244 $this->Email->subject = 'Karamelo e-Learning:: New message from anonymous'; 245 $this->Email->replyTo = 'support@karamelo.org'; 246 $this->Email->from = 'Chipotle-software.com'; 247 $this->Email->template = 'anonymous'; 248 $this->Email->sendAs = 'text'; // because we like to send pretty mail 249 //Do not pass any args to send() 250 $this->set('msg', $msg); 251 252 if ( $this->Email->send() ): 253 return true; 254 else: 255 return false; 256 endif; 257 } 258 259 private function __sendAll($user_id, $vclassroom_id, $blogger_id) 260 { 219 261 $email = $this->Message->User->field('User.email', array('User.id'=>$user_id)); 220 262
