Changeset 639
- Timestamp:
- 07/10/08 18:56:32 (3 months ago)
- Location:
- trunk/app
- Files:
-
- 2 modified
-
controllers/messages_controller.php (modified) (7 diffs)
-
views/messages/admin_listing.ctp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/messages_controller.php
r614 r639 13 13 14 14 public $components = array('Portal', 'Email', 'Session', 'Edublog'); 15 16 public $paginate = array('limit' => 20, 'page' => 1); 15 17 16 18 public function beforeFilter() … … 130 132 public function add() 131 133 { 132 $this->layout = 'ajax';133 134 if (!empty($this->data['Message']))135 { 134 $this->layout = 'ajax'; 135 136 if (!empty($this->data['Message'])): 137 136 138 $this->Sanitize = new Sanitize; 137 139 … … 146 148 $this->Message->create(); 147 149 148 if ($this->Message->save($this->data ['Message'])):150 if ($this->Message->save($this->data)): 149 151 $this->__sendMail($this->data['Message']['user_id']); 150 152 $this->render('sent','ajax'); … … 152 154 die('Error on database'); 153 155 endif; 154 }156 endif; 155 157 } 156 158 … … 231 233 public function admin_general() // send a general message to all commnunity 232 234 { 233 if ($this->Auth->user('group_id') != 1) 234 { 235 if ($this->Auth->user('group_id') != 1): 235 236 $this->redirect('/admin/messages/listing'); 236 }237 endif; 237 238 238 239 $this->layout = 'admin'; … … 246 247 $this->Sanitize->html($this->data['Message']["body"]); 247 248 248 $this->Message->User->unbindModel( 249 array( 250 "hasMany"=>array( 251 "Entry", "News", "Category", "Lesson", "Podcast", "Bookmark"))); 252 253 $conditions = array("active"=>1); 254 255 $fields = array("id"); 256 257 $data = $this->User->findAll($conditions, $fields); 249 $this->Message->User->unbindAll(); 250 251 $conditions = array("active"=>1); 252 253 $fields = array("id"); 254 255 $data = $this->User->findAll($conditions, $fields); 258 256 259 257 $j = 0; //counter … … 331 329 public function admin_listing() 332 330 { 333 $this->layout = 'admin'; 334 335 $this->pageTitle = 'Messages'; 336 337 $conditions = array("Message.user_id" => $this->Auth->user('id')); 338 $fields = array("Message.id", "Message.title", "Message.body", "Message.created", "Message.sender", "Message.status", "User.username"); 339 $order = "Message.id DESC"; 340 $limit = 20; 341 342 $this->set('data', $this->Message->findAll($conditions, $fields, $order, $limit)); 331 $this->layout = 'admin'; 332 333 $this->pageTitle = __('Messages', true); 334 335 $this->paginate['conditions'] = array('Message.user_id' => $this->Auth->user('id')); 336 $this->paginate['fields'] = array("Message.id", "Message.title", "Message.body", "Message.created", "Message.sender", "Message.status", "User.username"); 337 $this->paginate['order'] = 'Message.id DESC'; 338 $this->paginate['limit'] = 20; 339 340 $data = $this->paginate('Entry', $conditions); 341 342 $this->set(compact('data')); 343 343 } 344 344 -
trunk/app/views/messages/admin_listing.ctp
r544 r639 1 1 <?php 2 echo $html->addCrumb('Control Tools', '/admin/entries/start');2 echo $html->addCrumb('Control Panel', '/admin/entries/start'); 3 3 echo $html->getCrumbs(' / '); 4 4 5 echo $html-> link($html->image('admin/compose_on.gif', array("alt"=>"Compose New Message", "title"=>"Compose New Message")), '/admin/messages/add', null, false, false);5 echo $html->div(null,$html->link($html->image('admin/compose_on.gif', array("alt"=>"Compose New Message", "title"=>"Compose New Message")), '/admin/messages/add', null, false, false)); 6 6 7 7 if ( $session->read('Auth.User.group_id') == 1): // if user belongs to admin group … … 53 53 echo '<tr><td colspan="5" style="text-align:right">'; 54 54 55 if ( count($data) > 0 ) 56 { 55 if ( count($data) > 0 ): 57 56 echo $html->link('Mark all', "javascript:select_switch(true)", array("style"=>"font-size:7pt")) . ' '; 58 57 echo $html->link('Unmark all', "javascript:select_switch(false)", array("style"=>"font-size:7pt")) . '<br />'; 59 58 60 echo $form->end( 'Deleted marked');61 }59 echo $form->end(__('Deleted marked', true)); 60 endif; 62 61 ?> 63 62 </form>
