Changeset 728 for trunk/app/controllers
- Timestamp:
- 08/19/08 19:50:28 (3 months ago)
- Location:
- trunk/app/controllers
- Files:
-
- 4 modified
-
tests_controller.php (modified) (2 diffs)
-
treasures_controller.php (modified) (2 diffs)
-
vclassrooms_controller.php (modified) (2 diffs)
-
webquests_controller.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/tests_controller.php
r696 r728 78 78 79 79 $this->Edublog->blog($this->data['Test']['blogger_id']); // set edublog components 80 80 81 81 $this->Sanitize = new sanitize; 82 82 … … 224 224 $this->Sanitize->clean($this->data['TestsVclassroom']); 225 225 226 $this->Test->TestsVclassroom->create();227 228 226 if ( $this->Test->TestsVclassroom->save($this->data['TestsVclassroom'])): 229 227 $this->msgFlash(__('Test assigned', true), '/admin/tests/vclassrooms/'.$this->data['TestsVclassroom']['test_id']); 230 else:231 die('Something is wrong, please report this bug');232 228 endif; 233 229 endif; -
trunk/app/controllers/treasures_controller.php
r693 r728 24 24 /* 25 25 * chksw() 26 * check if tresure string is OK, if so, save student data on ResultTreasure model26 * check if tresure string (final code) is OK, if so, save student data on ResultTreasure model 27 27 * 28 28 */ … … 143 143 } 144 144 145 public function admin_link2class() 146 { 147 $this->layout = 'admin'; 148 // add to database 149 if ( !empty($this->data['TreasuresVclassroom']) ) 150 { 151 $this->Sanitize = new Sanitize; 152 153 $this->Sanitize->clean($this->data['TreasuresVclassroom']); 154 155 $this->Treasure->TreasuresVclassroom->create(); 156 157 if ( $this->Treasure->TreasuresVclassroom->save($this->data['TreasuresVclassroom']) ): 158 $this->msgFlash('Treasure assigned', '/admin/treasures/vclassrooms/'.$this->data['TreasuresVclassroom']['treasure_id']); 159 else: 160 die('Something is wrong, please report this bug'); 161 endif; 162 } 163 } 164 165 public function admin_unlink2class() 145 public function admin_link2class() 146 { 147 $this->layout = 'admin'; 148 // add to database 149 if ( !empty($this->data['TreasuresVclassroom']) ): 150 $this->Sanitize = new Sanitize; 151 $this->Sanitize->clean($this->data['TreasuresVclassroom']); 152 if ($this->Treasure->TreasuresVclassroom->save($this->data['TreasuresVclassroom']) ): 153 $this->msgFlash(__('Treasure assigned', true),'/admin/treasures/vclassrooms/'.$this->data['TreasuresVclassroom']['treasure_id']); 154 endif; 155 endif; 156 } 157 158 public function admin_unlink2class() 166 159 { 167 160 $this->layout = 'admin'; 168 161 // add to database 169 162 if ( !empty($this->data['TreasuresVclassroom']) ): 170 $this->Sanitize = new Sanitize;171 172 $this->Sanitize->clean($this->data['TreasuresVclassroom']);163 $this->Sanitize = new Sanitize; 164 165 $this->Sanitize->clean($this->data['TreasuresVclassroom']); 173 166 174 if ( $this->Treasures->TreasuresVclassroom->delete($this->data['TreasuresVclassroom']['id'])): 175 $this->msgFlash('Test unlinked', '/admin/tests/vclassrooms/'.$this->data['TreasuresVclassroom']['treasure_id']); 176 else: 177 die('Something is wrong, please report this bug'); 178 endif; 167 if ( $this->Treasure->TreasuresVclassroom->delete($this->data['TreasuresVclassroom']['id'])): 168 $this->msgFlash(__('Scavenger unlinked',true),'/admin/treasures/vclassrooms/'.$this->data['TreasuresVclassroom']['treasure_id']); 169 endif; 179 170 endif; 180 171 } -
trunk/app/controllers/vclassrooms_controller.php
r696 r728 104 104 public function jointoclass() 105 105 { 106 if (!empty($this->data['UsersVclassroom'])) 107 { 108 // get the secret code by this classroom 109 $code = $this->Vclassroom->field('secret', array("Vclassroom.id"=>$this->data['UsersVclassroom']['vclassroom_id'])); 110 111 if ($code != $this->data['UsersVclassroom']['code'] || $code == null) //code is correct ? 112 { 106 if (!empty($this->data['UsersVclassroom'])): 107 // get the secret code by this classroom 108 $code = $this->Vclassroom->field('secret', array("Vclassroom.id"=>$this->data['UsersVclassroom']['vclassroom_id'])); 109 110 if ($code != $this->data['UsersVclassroom']['code'] || $code == null): //code is correct ? 113 111 $this->set('msg', 'Code is incorrect'); 114 112 $this->render('jointoclass', 'ajax'); 115 } 116 elseif($this->Vclassroom->chkMember($this->data['UsersVclassroom']['vclassroom_id'], $this->Auth->user('id'))) // the student is already member in this class? 117 { 118 $this->set('msg', 'You are already member of this class!'); 113 elseif($this->Vclassroom->chkMember($this->data['UsersVclassroom']['vclassroom_id'], $this->Auth->user('id'))): 114 // the student is already member in this class? 115 $this->set('msg', __('You are already member of this class', true)); 119 116 $this->render('jointoclass', 'ajax'); 120 } 121 else 122 { 123 $this->data['UsersVclassroom']['user_id'] = $this->Auth->user('id'); 117 else: 118 $this->data['UsersVclassroom']['user_id'] = $this->Auth->user('id'); 124 119 125 120 $this->Vclassroom->UsersVclassroom->create(); 126 121 127 if ($this->Vclassroom->UsersVclassroom->save($this->data['UsersVclassroom'])) 128 { 129 $this->set('msg', 'You have joined to this class succesfully!'); 122 if ($this->Vclassroom->UsersVclassroom->save($this->data['UsersVclassroom'])): 123 $this->set('msg', __('You have joined to this class succesfully', true)); 130 124 $this->render('jointoclass', 'ajax'); 131 } 132 }133 }125 endif; 126 endif; 127 endif; 134 128 } 135 129 … … 292 286 $this->layout = 'admin'; 293 287 294 $this->pageTitle = 'Student Record';288 $this->pageTitle = __('Student record', true); 295 289 296 290 $this->set('data', $this->Vclassroom->studentRecord($student_id, $vclassroom_id)); -
trunk/app/controllers/webquests_controller.php
r696 r728 306 306 $this->layout = 'admin'; 307 307 // add to database 308 if ( !empty($this->data['VclassroomsWebquest']) ) 309 { 308 if ( !empty($this->data['VclassroomsWebquest']) ): 310 309 $this->Sanitize = new Sanitize; 311 310 312 311 $this->Sanitize->clean($this->data['VclassroomsWebquest']); 313 312 314 $this->Webquest->VclassroomsWebquest->create();315 316 313 if ( $this->Webquest->VclassroomsWebquest->save($this->data['VclassroomsWebquest'])): 317 $this->msgFlash('Webquest assigned', '/admin/webquests/vclassrooms/'.$this->data['VclassroomsWebquest']['webquest_id']); 318 else: 319 die('Something is wrong, please report this bug'); 314 $this->msgFlash(__('Webquest assigned', true),'/admin/webquests/vclassrooms/'.$this->data['VclassroomsWebquest']['webquest_id']); 320 315 endif; 321 } 322 } 323 324 public function admin_unlink2class() 325 { 326 $this->layout = 'admin'; 327 // add to database 328 if ( !empty($this->data['VclassroomsWebquest']) ) 329 { 316 endif; 317 } 318 319 public function admin_unlink2class() 320 { 321 $this->layout = 'admin'; 322 // add to database 323 if ( !empty($this->data['VclassroomsWebquest']) ): 330 324 $this->Sanitize = new Sanitize; 331 325 332 326 $this->Sanitize->clean($this->data['VclassroomsWebquest']); 333 327 334 if ( $this->Webquest->VclassroomsWebquest->delete($this->data['VclassroomsWebquest']['id'])) 335 { 328 if ( $this->Webquest->VclassroomsWebquest->delete($this->data['VclassroomsWebquest']['id'])): 336 329 $this->msgFlash('Webquest unlinked', '/admin/webquests/vclassrooms/'.$this->data['VclassroomsWebquest']['webquest_id']); 337 } 338 else 339 { 340 die('Something is wrong, please report this bug'); 341 } 342 } 343 } 344 345 public function admin_delete($id) 346 { 347 $this->Webquest->del($id); 348 349 $this->msgFlash('Webquest deleted', '/admin/webquests/listing/'); 330 endif; 331 endif; 332 } 333 334 public function admin_delete($webquest_id) 335 { 336 if ($this->Webquest->del($webquest_id)): 337 $this->msgFlash(__('Data removed', true), '/admin/webquests/listing/'); 338 endif; 350 339 } 351 340 }
