Changeset 741 for trunk

Show
Ignore:
Timestamp:
08/27/08 20:16:13 (3 months ago)
Author:
aarkerio
Message:

Little Bugs fixed

Location:
trunk/app
Files:
2 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/reports_controller.php

    r740 r741  
    113113 } 
    114114 /*=== ADMIN  METHODS ===*/ 
    115  public function admin_points($participation_id, $sense) 
     115 public function admin_points($report_id, $sense) 
    116116 { 
    117    $points = $this->Participation->field('points', array('Participation.id'=>$participation_id)); 
     117   $points = (int) $this->Report->field('points', array('Report.id'=>$report_id)); 
    118118    
    119119   $points = ($sense == 'up' ) ? ($points + 1) : ($points - 1); 
    120120 
    121    $this->data['Participation']['id']       = $participation_id;     
     121   $this->data['Report']['id']       = $report_id;     
    122122       
    123    $this->data['Participation']['points']   = $points; 
     123   $this->data['Report']['points']   = $points; 
    124124      
    125    if ($this->Participation->save($this->data['Participation'])): 
     125   if ($this->Report->save($this->data)): 
    126126             $this->set('points', $points); 
    127          $this->render('points', 'ajax'); 
     127         $this->render('admin_points', 'ajax'); 
    128128   endif; 
    129129 } 
  • trunk/app/controllers/webquests_controller.php

    r740 r741  
    8585         $this->data['ResultWebquest']['user_id'] = $this->Auth->user('id'); 
    8686                   
    87          if ($this->Webquest->ResultWebquest->save($this->data['ResultWebquest'])): 
     87         if ($this->Webquest->ResultWebquest->save($this->data)): 
    8888             $this->msgFlash(__('Data saved', true),  
    8989          '/vclassrooms/show/'.$this->data['ResultWebquest']['blogger_id'].'/'.$this->data['ResultWebquest']['vclassroom_id']); 
     
    9494 public function admin_points($resultwebquest_id, $sense) 
    9595 { 
    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; 
    103103      
    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; 
    108108 } 
    109109 
  • trunk/app/models/vclassroom.php

    r732 r741  
    206206     // Webquest 
    207207     $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; 
    209209     $record['webquests']          = $this->Webquest->ResultWebquest->findAll($conditions, $fields); 
    210210     $record['Vclassroom']['id']   = $vclassroom_id; // dirty but works      
  • trunk/app/views/vclassrooms/admin_record.ctp

    r733 r741  
    11<?php 
    2  //die(debug($data)); 
     2 // die(debug($data)); 
    33 echo $html->addCrumb('Control Panel', '/admin/entries/start');  
    44 echo $html->addCrumb(__('Groups', true), '/admin/vclassrooms/listing'); 
     
    7979     e($html->div(null, $w['ResultWebquest']['points'] .' '.__('points', true),  array('id'=>$div_id, 'style'=>'width:150px;float:left;'))); 
    8080     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'=> 
    8282        "window.open('/admin/webquests/see/".$data['User']['id']."/".$w['Webquest']['id']."','mywin','left=20,top=20,width=700,height=700,toolbar=0,resizable=1')")) . '&nbsp;&nbsp;'; 
    8383 
    8484      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('loadingre');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); 
    9090      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('loadingre');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); 
    9696      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'); 
    100101 else: 
    101102    echo  $html->para(null, __('No Webquests found', true)); 
     
    118119                           '/admin/treasures/points/'.$tr['Treasure']['id'].'/down', 
    119120                        array('update'  => $div_id, 
    120                               'loading '=>"Element.show('loadingre');", 
    121                                   'after'   =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 
    122                           'complete'=>"Element.hide('loadingre');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); 
    123124     echo $ajax->link($html->image('static/aupmod.png', array('alt'=>__('Points up', true), 'title'=>__('Points up', true))), 
    124125                           '/admin/treasures/points/'.$tr['Treasure']['id'].'/up', 
    125126                        array('update'  => $div_id, 
    126127                                  'after'   =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 
    127                               'loading '=>"Element.show('loadingre')", 
    128                           'complete'=>"Element.hide('loadingre');Effect.Appear(".$div_id.")"),null,false); 
     128                              'loading '=>"Element.show('loadtre')", 
     129                          'complete'=>"Element.hide('loadtre');Effect.Appear(".$div_id.")"),null,false); 
    129130      e('</div>');   
    130131      e('</div>'); 
    131132  
    132133     endforeach; 
     134 echo $ajax->div('loadtre',array('style'=>'display:none')).$html->image('static/loading.gif',array('alt'=>'Loading')).$ajax->divEnd('loadtre'); 
    133135 else: 
    134136     echo $html->para(null, __('No Scavenger hunts found', true));