- Timestamp:
- 08/30/08 18:26:22 (3 months ago)
- Location:
- trunk/app
- Files:
-
- 1 added
- 1 removed
- 2 modified
-
controllers/participations_controller.php (modified) (2 diffs)
-
views/participations/admin_points.ctp (added)
-
views/participations/points.ctp (deleted)
-
views/vclassrooms/admin_record.ctp (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/participations_controller.php
r732 r744 46 46 public function admin_points($participation_id, $sense) 47 47 { 48 $points = $this->Participation->field('points', array('Participation.id'=>$participation_id));48 $points = (int) $this->Participation->field('points', array('Participation.id'=>$participation_id)); 49 49 50 50 $points = ($sense == 'up' ) ? ($points + 1) : ($points - 1); … … 54 54 $this->data['Participation']['points'] = $points; 55 55 56 if ($this->Participation->save($this->data )):57 $this->set('points', $points);58 $this->render('points', 'ajax');56 if ($this->Participation->save($this->data, false)): 57 $this->set('points', $points); 58 $this->render('admin_points', 'ajax'); 59 59 endif; 60 60 } -
trunk/app/views/vclassrooms/admin_record.ctp
r742 r744 31 31 // Tests 32 32 if ( count($data['tests']) > 0 ): 33 echo '<h1>'. __('Tests', true).'</h1>'; 34 foreach ($data['tests'] as $t): 35 36 $div_id = 'te'.$t['TestsVclassroom']['id']; 37 e('<div style="border:1px dotted gray;padding:4px;margin:2px;height:20px;">'); 38 39 if ($t['TestsVclassroom']['points'] === null): // not answered yet 40 e($html->div(null, __('Not answered this test yet', true), array('id'=>$div_id,'style'=>'width:220px;float:left;font-size:7pt;'))); 41 e($html->div(null, $t['TestsVclassroom']['title'], array('style'=>'width:350px;float:right;'))); 42 else: 43 e($html->div(null, $t['TestsVclassroom']['points'] .' '.__('points', true), array('id'=>$div_id, 'style'=>'width:180px;float:left;'))); 44 e('<div style="width:450px;float:right;">'); 33 echo '<h1>'. __('Tests', true).'</h1>'; 34 foreach ($data['tests'] as $t): 35 $div_id = 'te'.$t['TestsVclassroom']['id']; 36 e('<div style="border:1px dotted gray;padding:4px;margin:2px;height:20px;">'); 37 38 if ($t['TestsVclassroom']['points'] === null): // not answered yet 39 e($html->div(null, __('Not answered this test yet', true), array('id'=>$div_id,'style'=>'width:220px;float:left;font-size:7pt;'))); 40 e($html->div(null, $t['TestsVclassroom']['title'], array('style'=>'width:350px;float:right;'))); 41 else: 42 e($html->div(null, $t['TestsVclassroom']['points'].' '.__('points',true),array('id'=>$div_id,'style'=>'width:180px;float:left;'))); 43 e('<div style="width:450px;float:right;">'); 45 44 echo $html->link($t['TestsVclassroom']['title'], '#'.$div_id, array('title'=>'View test', 'onclick'=> 46 45 "window.open('/admin/tests/see/".$data['User']['id']."/".$t['TestsVclassroom']['test_id']."/".$data['Vclassroom']['id']."','mywin','left=20,top=10,width=700,height=700,scrollbars=1,toolbar=0,resizable=1')")) . ' '; … … 58 57 'loading '=>"Element.show('loadingre')", 59 58 'complete'=>"Element.hide('loadingre');Effect.Appear(".$div_id.")"),null,false); */ 60 e('</div>');59 e('</div>'); 61 60 endif; 62 63 e('</div>'); 64 65 endforeach; 61 e('</div>'); 62 endforeach; 66 63 else: 67 64 echo $html->para(null, __('No tests found', true)); 68 65 endif; 69 66 70 // Webquests 67 // Webquests --> ResultWebquest 71 68 $wpoints = (int) 0; // webquest points 72 69 if ( count($data['webquests']) > 0 ): 73 70 echo '<h1>Webquests</h1>'; 74 71 foreach ($data['webquests'] as $w): 75 76 72 $wpoints += $w['ResultWebquest']['points']; 77 73 $div_id = 'w'.$w['Webquest']['id']; … … 85 81 '/admin/webquests/points/'.$w['ResultWebquest']['id'].'/down', 86 82 array('update' => $div_id, 87 'loading' =>"Element.show('loadingweb'); ",88 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 89 'complete'=>"Element.hide('loadingweb');Effect.Appear( ".$div_id.")"),null,false);83 'loading' =>"Element.show('loadingweb');Element.hide('".$div_id."')", 84 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 85 'complete'=>"Element.hide('loadingweb');Effect.Appear('".$div_id."')"),null,false); 90 86 echo $ajax->link($html->image('static/aupmod.png', array('alt'=>__('Points up', true), 'title'=>__('Points up', true))), 91 87 '/admin/webquests/points/'.$w['ResultWebquest']['id'].'/up', 92 88 array('update' => $div_id, 93 ' after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')',94 'loading' =>"Element.show('loadingweb')",95 'complete'=>"Element.hide('loadingweb');Effect.Appear( ".$div_id.")"),null,false);89 'loading' =>"Element.show('loadingweb');Element.hide('".$div_id."')", 90 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 91 'complete'=>"Element.hide('loadingweb');Effect.Appear('".$div_id."')"),null,false); 96 92 e('</div>'); 97 93 e('</div>'); … … 108 104 if ( count($data['treasures']) > 0 ): 109 105 foreach ($data['treasures'] as $tr): 110 $tpoints += (int) $tr['ResultTreasure']['points'];111 106 $div_id = 'tr'.$tr['Treasure']['id']; 112 107 e('<div style="border:1px dotted gray;padding:4px;margin:2px;height:20px;">'); … … 119 114 '/admin/treasures/points/'.$tr['Treasure']['id'].'/down', 120 115 array('update' => $div_id, 121 'loading '=>"Element.show('loadtre'); ",122 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 123 'complete'=>"Element.hide('loadtre');Effect.Appear( ".$div_id.")"),null,false);116 'loading '=>"Element.show('loadtre');Element.hide('".$div_id."')", 117 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 118 'complete'=>"Element.hide('loadtre');Effect.Appear('".$div_id."')"),null,false); 124 119 echo $ajax->link($html->image('static/aupmod.png', array('alt'=>__('Points up', true), 'title'=>__('Points up', true))), 125 120 '/admin/treasures/points/'.$tr['Treasure']['id'].'/up', 126 121 array('update' => $div_id, 127 122 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 128 'loading '=>"Element.show('loadtre')", 129 'complete'=>"Element.hide('loadtre');Effect.Appear(".$div_id.")"),null,false); 130 e('</div>'); 131 e('</div>'); 132 133 endforeach; 123 'loading '=>"Element.show('loadtre');Element.hide('".$div_id."')", 124 'complete'=>"Element.hide('loadtre');Effect.Appear('".$div_id."')"),null,false); 125 e('</div>'); 126 e('</div>'); 127 endforeach; 134 128 echo $ajax->div('loadtre',array('style'=>'display:none')).$html->image('static/loading.gif',array('alt'=>'Loading')).$ajax->divEnd('loadtre'); 135 129 else: 136 130 echo $html->para(null, __('No Scavenger hunts found', true)); 137 131 endif; 138 132 133 // Replies on forums. Model: Topic 139 134 echo '<h1>'.__('Participations in forums', true).'</h1>'; 135 $rpoints = (int) 0; 140 136 if ( count($data['replies']) > 0 ): 141 // Replies on forums. Model: Topic142 $rpoints = (int) 0; // reply points143 137 foreach ($data['replies'] as $re): 144 $div_id = 're '.$re['Reply']['id'];138 $div_id = 'rep'.$re['Reply']['id']; 145 139 e('<div style="border:1px dotted gray;padding:4px;margin:2px;height:20px;">'); 146 140 e($html->div(null, $re['Reply']['points'].' '.__('points', true), array('id'=>$div_id, 'style'=>'width:150px;float:left;'))); … … 152 146 '/admin/replies/points/'.$re['Reply']['id'].'/down', 153 147 array('update' => $div_id, 154 'loading '=>"Element.show('loadreply');", 155 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 156 'complete'=>"Element.hide('loadreply');Effect.Appear(".$div_id.")"),null,false); 148 'loading' => "Element.show('lorep');Element.hide('".$div_id."')", 149 'complete'=>"Element.hide('lorep');Effect.Appear('".$div_id."')", 150 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')'), 151 null,false); 157 152 echo $ajax->link($html->image('static/aupmod.png', array('alt'=>__('Points up', true), 'title'=>__('Points up', true))), 158 153 '/admin/replies/points/'.$re['Reply']['id'].'/up', 159 array('update' => $div_id, 160 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 161 'loading '=>"Element.show('loadreply')", 162 'complete'=>"Element.hide('loadreply');Effect.Appear(".$div_id.")"),null,false); 163 echo '</div>'; 164 $rpoints += $re['Reply']['points']; //sum 165 154 array('update' => $div_id, 155 'loading' =>"Element.show('lorep');Element.hide('".$div_id."')", 156 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 157 'complete'=>"Element.hide('lorep');Effect.Appear('".$div_id."')"),null,false); 158 e('</div>'); 166 159 e('</div>'); 167 endforeach; 168 e($html->div(null, $html->image('static/loading.gif', array('alt'=>'Loading')),array('id'=>'loadreply', 'style'=>'display:none;'))); 169 else: 170 echo $html->para(null, 'No reply found'); 171 endif; 172 160 $rpoints += (int) $re['Reply']['points']; 161 endforeach; 162 e($html->div(null, $html->image('static/loading.gif', array('alt'=>'Loading')), array('style'=>'display:none', 'id'=>'lorep'))); 163 else: 164 echo $html->para(null, __('No reply found', true)); 165 endif; 166 173 167 // Participations, model: Participation 174 168 $ppoints = (int) 0; // participation points … … 177 171 foreach ($data['participations'] as $p): 178 172 e('<div style="border:1px dotted gray;padding:4px;margin:2px;height:20px;">'); 179 180 173 $div_id = 'pa'.$p['Participation']['id']; 181 182 174 $ppoints += $p['Participation']['points']; 183 175 … … 187 179 echo __('Participation', true).': '. $html->link($p['Participation']['title'], '#', array('title'=>__('View text', true), 'onclick'=>"window.open('/admin/participations/show/".$p['Participation']['id']."','mywin','left=20,top=20,width=700,height=700,toolbar=0,resizable=1')")).' '; 188 180 189 echo $ajax->link($html->image('static/adownmod.png', array('alt'=>__('Points down', true), 'title'=>__('Points down', true))) ,181 echo $ajax->link($html->image('static/adownmod.png', array('alt'=>__('Points down', true), 'title'=>__('Points down', true))), 190 182 '/admin/participations/points/'.$p['Participation']['id'].'/down', 191 183 array('update' => $div_id, 192 'loading' =>"Element.show('loadingpa'); ",193 'interactive'=>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 194 'complete' =>"Element.hide('loadingpa');Effect.Appear( ".$div_id.");"),null,false);184 'loading' =>"Element.show('loadingpa');Element.hide('".$div_id."')", 185 'interactive'=>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 186 'complete' =>"Element.hide('loadingpa');Effect.Appear('".$div_id."')"),null,false); 195 187 echo $ajax->link($html->image('static/aupmod.png', array('alt'=>__('Points up', true), 'title'=>__('Points up', true))), 196 188 '/admin/participations/points/'.$p['Participation']['id'].'/up', 197 189 array('update' => $div_id, 198 'loading' =>"Element.show('loadingpa');", 199 'interactive'=>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 200 'complete' =>"Element.hide('loadingpa');Effect.Appear(".$div_id.");"),null,false); 201 202 e('</div>'); 203 e('</div>'); 204 endforeach; 205 206 e($html->div(null, $html->image('static/loading.gif', array('alt'=>'Loading')), array('style'=>'display:none;', 'id'=>'loadingpa'))); 207 190 'loading' =>"Element.show('loadingpa');Element.hide('".$div_id."')", 191 'interactive'=>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 192 'complete' =>"Element.hide('loadingpa');Effect.Appear('".$div_id."')"),null,false); 193 194 e('</div>'); 195 e('</div>'); 196 endforeach; 197 e($html->div(null, $html->image('static/loading.gif', array('alt'=>'Loading')), array('style'=>'display:none', 'id'=>'loadingpa'))); 208 198 else: 209 199 echo $html->para(null, __('No participation found', true)); 210 200 endif; 211 201 202 212 203 // Reports, model: Report 213 $repoints = (int) 0; // participationpoints204 $repoints = (int) 0; // report points 214 205 echo '<h1>'.__('Reports', true).'</h1>'; 215 206 if ( count($data['reports']) > 0 ): 216 207 foreach ($data['reports'] as $r): 217 208 e('<div style="border:1px dotted gray;padding:4px;margin:2px;height:20px;">'); 218 219 209 $div_id = 're'.$r['Report']['id']; 220 221 210 $repoints += (int) $r['Report']['points']; 222 223 211 echo $html->div(null, $r['Report']['points'].' '.__('points',true), array('id'=>$div_id,'style'=>'width:150px;float:left;')); 224 212 … … 229 217 '/admin/reports/points/'.$r['Report']['id'].'/down', 230 218 array('update' => $div_id, 231 'loading' =>"Element.show('loadingrep'); ",232 'interactive'=>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 233 'complete' =>"Element.hide('loadingrep');Effect.Appear( ".$div_id.");"),null,false);219 'loading' =>"Element.show('loadingrep');Element.hide('".$div_id."')", 220 'interactive'=>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 221 'complete' =>"Element.hide('loadingrep');Effect.Appear('".$div_id."')"),null,false); 234 222 echo $ajax->link($html->image('static/aupmod.png', array('alt'=>__('Points up', true), 'title'=>__('Points up', true))), 235 223 '/admin/reports/points/'.$r['Report']['id'].'/up', 236 224 array('update' => $div_id, 237 'loading' =>"Element.show('loadingrep'); ",238 'interactive'=>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 239 'complete' =>"Element.hide('loadingrep');Effect.Appear( ".$div_id.");"),null,false);225 'loading' =>"Element.show('loadingrep');Element.hide('".$div_id."')", 226 'interactive'=>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 227 'complete' =>"Element.hide('loadingrep');Effect.Appear('".$div_id."')"),null,false); 240 228 241 229 e('</div>'); … … 251 239 echo $html->div(null, __('Scavengers hunts', true) .' ' .__('points', true) .': '. $tpoints); 252 240 echo $html->div(null, 'Webquests ' .__('points', true) .': '. $wpoints); 241 echo $html->div(null, __('Replies', true). ' ' .__('points', true) .': '. $rpoints); 253 242 echo $html->div(null, __('Participations', true) .' '. __('points', true) .': '. $ppoints, array('id'=>'parpoints')); 254 243 echo $html->div(null, __('Reports', true) .' '. __('points', true) .': '. $repoints, array('id'=>'reppoints')); … … 256 245 $points = ($tpoints + $wpoints + $rpoints + $ppoints + $repoints); 257 246 258 echo $ajax->div('totalpoints') . '<b>'.__('Total points', true).': ' . $points .'</b>'. $ajax->divEnd('totalpoints');247 echo $ajax->div('totalpoints') .'<b>'.__('Total points', true).': ' . $points .'</b>'. $ajax->divEnd('totalpoints'); 259 248 ?> 260 249 </div>
