Changeset 741
- Timestamp:
- 08/27/08 20:16:13 (3 months ago)
- Location:
- trunk/app
- Files:
-
- 2 added
- 4 modified
-
controllers/reports_controller.php (modified) (1 diff)
-
controllers/webquests_controller.php (modified) (2 diffs)
-
models/vclassroom.php (modified) (1 diff)
-
views/reports/admin_points.ctp (added)
-
views/vclassrooms/admin_record.ctp (modified) (3 diffs)
-
views/webquests/admin_points.ctp (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/reports_controller.php
r740 r741 113 113 } 114 114 /*=== ADMIN METHODS ===*/ 115 public function admin_points($ participation_id, $sense)115 public function admin_points($report_id, $sense) 116 116 { 117 $points = $this->Participation->field('points', array('Participation.id'=>$participation_id));117 $points = (int) $this->Report->field('points', array('Report.id'=>$report_id)); 118 118 119 119 $points = ($sense == 'up' ) ? ($points + 1) : ($points - 1); 120 120 121 $this->data[' Participation']['id'] = $participation_id;121 $this->data['Report']['id'] = $report_id; 122 122 123 $this->data[' Participation']['points'] = $points;123 $this->data['Report']['points'] = $points; 124 124 125 if ($this-> Participation->save($this->data['Participation'])):125 if ($this->Report->save($this->data)): 126 126 $this->set('points', $points); 127 $this->render(' points', 'ajax');127 $this->render('admin_points', 'ajax'); 128 128 endif; 129 129 } -
trunk/app/controllers/webquests_controller.php
r740 r741 85 85 $this->data['ResultWebquest']['user_id'] = $this->Auth->user('id'); 86 86 87 if ($this->Webquest->ResultWebquest->save($this->data ['ResultWebquest'])):87 if ($this->Webquest->ResultWebquest->save($this->data)): 88 88 $this->msgFlash(__('Data saved', true), 89 89 '/vclassrooms/show/'.$this->data['ResultWebquest']['blogger_id'].'/'.$this->data['ResultWebquest']['vclassroom_id']); … … 94 94 public function admin_points($resultwebquest_id, $sense) 95 95 { 96 $points =$this->Webquest->ResultWebquest->field('points', array('ResultWebquest.id'=>$resultwebquest_id));97 98 $points = ($sense == 'up' ) ? ($points + 1) : ($points - 1);99 100 $this->data['Participation']['id'] = $participation_id;101 102 $this->data['Participation']['points'] = $points;96 $points = (int) $this->Webquest->ResultWebquest->field('points', array('ResultWebquest.id'=>$resultwebquest_id)); 97 98 $points = ($sense == 'up' ) ? ($points + 1) : ($points - 1); 99 100 $this->data['ResultWebquest']['id'] = $resultwebquest_id; 101 102 $this->data['ResultWebquest']['points'] = $points; 103 103 104 if ($this->Webquest->ResultWebquest->save($this->data['Participation'])):105 $this->set('points', $points);106 $this->render('points', 'ajax');107 endif;104 if ($this->Webquest->ResultWebquest->save($this->data)): 105 $this->set('points', $points); 106 $this->render('admin_points', 'ajax'); 107 endif; 108 108 } 109 109 -
trunk/app/models/vclassroom.php
r732 r741 206 206 // Webquest 207 207 $conditions = array('ResultWebquest.vclassroom_id'=>$vclassroom_id, 'ResultWebquest.user_id'=>$user_id); 208 $fields = array('Webquest.title', 'Webquest.id', 'ResultWebquest.points' ); //null;208 $fields = array('Webquest.title', 'Webquest.id', 'ResultWebquest.points', 'ResultWebquest.id'); //null; 209 209 $record['webquests'] = $this->Webquest->ResultWebquest->findAll($conditions, $fields); 210 210 $record['Vclassroom']['id'] = $vclassroom_id; // dirty but works -
trunk/app/views/vclassrooms/admin_record.ctp
r733 r741 1 1 <?php 2 // die(debug($data));2 // die(debug($data)); 3 3 echo $html->addCrumb('Control Panel', '/admin/entries/start'); 4 4 echo $html->addCrumb(__('Groups', true), '/admin/vclassrooms/listing'); … … 79 79 e($html->div(null, $w['ResultWebquest']['points'] .' '.__('points', true), array('id'=>$div_id, 'style'=>'width:150px;float:left;'))); 80 80 e('<div style="width:450px;float:right;">'); 81 echo $html->link($w['Webquest']['title'], '#'.$div_id, array('title'=>__('View reply', true), 'onclick'=>81 echo $html->link($w['Webquest']['title'], '#'.$div_id, array('title'=>__('View text', true), 'onclick'=> 82 82 "window.open('/admin/webquests/see/".$data['User']['id']."/".$w['Webquest']['id']."','mywin','left=20,top=20,width=700,height=700,toolbar=0,resizable=1')")) . ' '; 83 83 84 84 echo $ajax->link($html->image('static/adownmod.png', array('alt'=>__('Points down', true), 'title'=>__('Points down', true))), 85 '/admin/webquests/points/'.$w[' Webquest']['id'].'/down',86 array('update' => $div_id, 87 'loading '=>"Element.show('loadingre');",88 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 89 'complete'=>"Element.hide('loading re');Effect.Appear(".$div_id.")"),null,false);85 '/admin/webquests/points/'.$w['ResultWebquest']['id'].'/down', 86 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); 90 90 echo $ajax->link($html->image('static/aupmod.png', array('alt'=>__('Points up', true), 'title'=>__('Points up', true))), 91 '/admin/webquests/points/'.$w[' Webquest']['id'].'/up',92 array('update' => $div_id, 93 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 94 'loading '=>"Element.show('loadingre')",95 'complete'=>"Element.hide('loading re');Effect.Appear(".$div_id.")"),null,false);91 '/admin/webquests/points/'.$w['ResultWebquest']['id'].'/up', 92 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); 96 96 e('</div>'); 97 e('</div>'); 98 99 endforeach; 97 e('</div>'); 98 99 endforeach; 100 echo $ajax->div('loadingweb',array('style'=>'display:none')).$html->image('static/loading.gif',array('alt'=>'Loading')).$ajax->divEnd('loadingweb'); 100 101 else: 101 102 echo $html->para(null, __('No Webquests found', true)); … … 118 119 '/admin/treasures/points/'.$tr['Treasure']['id'].'/down', 119 120 array('update' => $div_id, 120 'loading '=>"Element.show('load ingre');",121 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 122 'complete'=>"Element.hide('load ingre');Effect.Appear(".$div_id.")"),null,false);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); 123 124 echo $ajax->link($html->image('static/aupmod.png', array('alt'=>__('Points up', true), 'title'=>__('Points up', true))), 124 125 '/admin/treasures/points/'.$tr['Treasure']['id'].'/up', 125 126 array('update' => $div_id, 126 127 'after' =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 127 'loading '=>"Element.show('load ingre')",128 'complete'=>"Element.hide('load ingre');Effect.Appear(".$div_id.")"),null,false);128 'loading '=>"Element.show('loadtre')", 129 'complete'=>"Element.hide('loadtre');Effect.Appear(".$div_id.")"),null,false); 129 130 e('</div>'); 130 131 e('</div>'); 131 132 132 133 endforeach; 134 echo $ajax->div('loadtre',array('style'=>'display:none')).$html->image('static/loading.gif',array('alt'=>'Loading')).$ajax->divEnd('loadtre'); 133 135 else: 134 136 echo $html->para(null, __('No Scavenger hunts found', true));
