Changeset 477
- Timestamp:
- 05/12/08 18:05:35 (8 months ago)
- Location:
- trunk/app
- Files:
-
- 5 modified
-
controllers/catfaqs_controller.php (modified) (1 diff)
-
controllers/messages_controller.php (modified) (4 diffs)
-
models/vclassroom.php (modified) (2 diffs)
-
views/catfaqs/admin_listing.ctp (modified) (1 diff)
-
webroot/img/imgusers/aarkerio_15.jpg (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/catfaqs_controller.php
r393 r477 119 119 } 120 120 } 121 } 121 } 122 // change status published/draft 123 public function admin_change($status, $catfaq_id) 124 { 125 $this->data['Catfaq']['status'] = ($status == 0 ) ? 1 : 0; 126 127 $this->data['Catfaq']['id'] = $catfaq_id; 128 129 if ($this->Test->save($this->data['Catfaq'])) 130 { 131 $this->msgFlash('Category status changed', '/admin/catfaqs/listing'); 132 } 133 } 122 134 123 135 public function admin_delete($id) 124 136 { 125 137 if ($this->Catfaq->del($id)) 126 {138 { 127 139 $this->msgFlash('FAQ category has been deleted.', '/admin/catfaqs/listing/'); 128 }140 } 129 141 } 130 142 } -
trunk/app/controllers/messages_controller.php
r472 r477 1 1 <?php 2 2 /** 3 * Chipotle Software TM4 * Manuel Montoya 2002-20085 * GPLv3 manuel<arroba>mononeurona<punto>org3 * @company: Chipotle Software TM 4 * @author: Manuel Montoya 2002-2008 5 * @license: GPLv3 manuel<arroba>mononeurona<punto>org 6 6 */ 7 7 … … 122 122 } 123 123 } 124 125 private function __sendAll($user_id, $vclassroom_id, $blogger_id) 126 { 127 $email = $this->Message->User->field('User.email', array('User.id'=>$user_id)); 128 129 $this->layout = 'default'; 130 $this->set('vclassroom_id', $vclassroom_id); 131 $this->set('blogger_id', $blogger_id); 132 $this->Email->to = $email; 133 134 // this could be just a string too 135 $this->Email->subject = 'Karamelo e-Learning:: New message'; 136 $this->Email->replyTo = 'support@karamelo.org'; 137 $this->Email->from = 'Chipotle-software.com'; 138 $this->Email->template = 'teacher'; 139 $this->Email->sendAs = 'text'; // because we like to send pretty mail 140 141 //Do not pass any args to send() 142 if ( $this->Email->send() ): 143 return true; 144 else: 145 return false; 146 endif; 147 } 124 148 125 149 /**=== ADMIN METHODS ===**/ … … 158 182 //exit(print_r($data)); 159 183 160 foreach($data as $val) 161 { 162 $this->Message->create(); 163 164 //exit(print_r($val)); 165 166 $this->data["Message"]["user_id"] = $val["User"]["id"]; 167 168 if ($this->Message->save($this->data["Message"])): 169 $j++; 170 else: 171 exit('error on save'); 172 endif; 173 } 184 foreach($data as $val): 185 $this->Message->create(); 186 187 //exit(print_r($val)); 188 189 $this->data["Message"]["user_id"] = $val["User"]["id"]; 190 191 if ($this->Message->save($this->data["Message"])): 192 $j++; 193 else: 194 exit('error on save'); 195 endif; 196 endforeach; 174 197 $this->msgFlash($j . ' messages sent', '/admin/messages/listing'); 175 198 } … … 208 231 209 232 if ($this->Message->save($this->data['Message'])): 210 $this->__sendMessage($this->data['Message']['user_id'], $this->data['Message']['vclassroom_id']);211 $messages++;233 $this->__sendAll($this->data['Message']['user_id'],$this->data['Message']['vclassroom_id'],$this->data['Message']['sender']); 234 $messages++; 212 235 endif; 213 236 endforeach; 214 237 215 $this->set('messages', $messages); 216 217 $this->msgFlash($messages . ' sent to group','/admin/vclassroom/members/'.$this->data['Message']['vclassroom_id']); 238 $this->msgFlash($messages . ' messages sent to group','/admin/vclassrooms/members/'.$this->data['Message']['vclassroom_id']); 218 239 } 219 240 -
trunk/app/models/vclassroom.php
r474 r477 374 374 } 375 375 /* 376 * check if studen already found treasure376 * check if student belongs to class group 377 377 * int treasure_id 378 * int user_id 378 * int user_id 379 * int group_id 379 380 * int vclassroom_id 380 381 * return boolean 381 382 */ 382 383 public function belongs($user_id, $vclassroom_id) 383 { 384 { 384 385 $conditions = array("UsersVclassroom.user_id"=>$user_id, "UsersVclassroom.vclassroom_id"=>$vclassroom_id); 385 386 … … 392 393 endif; 393 394 } 394 395 395 } 396 396 ?> -
trunk/app/views/catfaqs/admin_listing.ctp
r306 r477 7 7 echo $html->addCrumb('FAQs', '/admin/catfaqs/listing'); 8 8 echo $html->getCrumbs(' / '); 9 10 echo '<div id="loading" style="display: none;">'; 11 echo $html->image("static/loading.gif", array("alt"=>"Loading")); 12 echo '</div>'; 13 14 echo $html->para(null, $ajax->link($html->image('actions/new.png', array("alt"=>"Add new category", "title"=>"Add new category")), '/admin/catfaqs/add', 15 array("update" => "updater","loading"=>"Element.show('loading');Element.hide('updater');", "complete"=>"Element.hide('loading');Effect.Appear('updater')"), 16 null, false)); 17 18 echo $ajax->div('updater') . $ajax->divEnd('updater'); 19 20 //exit(print_r($data)); 21 foreach ($data as $val): 22 $tmp = $html->div('butonright', $gags->sendEdit($val['Catfaq']['id'], 'catfaqs')); 23 $tmp .= $html->link($val['Catfaq']['title'], '/admin/faqs/listing/'.$val['Catfaq']['id']); 24 $tmp .= $html->para(null, $val['Catfaq']['description']); 25 $tmp .= $html->link($gags->setStatus($val['Catfaq']['status']),'/admin/catfaqs/change/'.$val['Catfaq']['status'].'/'.$val['Catfaq']['id']); 26 $tmp .= $html->div('butonright', $gags->confirmDel($val['Catfaq']['id'], 'catfaqs')); 27 echo $html->div('grayblock', $tmp); 28 endforeach; 9 29 ?> 10 11 <p>12 <?php13 echo '<div id="loading" style="display: none;">';14 echo $html->image("static/loading.gif", array("alt"=>"Loading"));15 echo '</div>';16 17 echo $ajax->link($html->image('actions/new.png', array("alt"=>"Add new category", "title"=>"Add new category")), '/admin/catfaqs/add',18 array("update" => "updater","loading"=>"Element.show('loading');Element.hide('updater');", "complete"=>"Element.hide('loading');Effect.Appear('updater')"),19 null, false);20 21 echo $ajax->div('updater');22 echo $ajax->divEnd('updater');23 ?></p>24 25 <?php26 //exit(print_r($data));27 foreach ($data as $val)28 {29 echo '<div style="padding:6px 3px 28px 4px;margin:10px 0 5px 0;border:1px dotted gray;">';30 echo '<div class="butonright">' .$gags->sendEdit($val['Catfaq']['id'], 'catfaqs') . '</div>';31 echo $html->link($val['Catfaq']['title'], '/admin/faqs/listing/'.$val['Catfaq']['id']);32 echo '<p style="margin-left:15px;">'. $val['Catfaq']['description'] . '</p>';33 echo '<div class="butonright">'. $gags->confirmDel($val['Catfaq']['id'], 'catfaqs') .'</div>';34 echo '</div>';35 }36 ?>
