Changeset 730 for trunk/app

Show
Ignore:
Timestamp:
08/20/08 20:54:59 (3 months ago)
Author:
aarkerio
Message:

Bugs fixed

Location:
trunk/app
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/config/core.php

    r617 r730  
    199199 *                  ); 
    200200 */ 
    201      Cache::config('default', array('engine' => 'File')); 
     201 Cache::config('default', array('engine' => 'File')); 
     202  
     203/* Cache::config('default', array('engine' => 'Xcache', //[required] 
     204                      'duration'=> 3600, //[optional] 
     205                      'probability'=> 100, //[optional] 
     206                      'user' => 'aarkerio', //user from xcache.admin.user settings 
     207                      'password' => 'kunst99' //plaintext password (xcache.admin.pass) 
     208                 ) 
     209         ); */ 
    202210?> 
  • trunk/app/controllers/answers_controller.php

    r696 r730  
    4949   $this->layout = 'admin'; 
    5050 
    51    if (empty($this->data["Answer"])): 
     51   if (empty($this->data['Answer'])): 
    5252        $this->data = $this->Answer->read(null, $answer_id ); 
    5353   else: 
     
    5656         
    5757       $this->Sanitize->clean($this->data['Answer']);  
    58          
     58        
    5959       if ($this->Answer->save($this->data)): 
    60           $this->msgFlash(__('Answer updated', true),'/admin/questions/answers/'.$this->data['Answer']['question_id']); 
     60          $this->msgFlash(__('Data saved', true),'/admin/questions/answers/'.$this->data['Answer']['question_id']); 
    6161       endif; 
    6262 endif;   
     
    6565 public function admin_listing($question_id) 
    6666 { 
    67      $this->layout    = 'ajax'; 
     67     $this->layout = 'ajax'; 
    6868         
    69      $conditions = array("Answer.user_id"=>$this->Auth->user('id'), "Answer.question_id"=>$question_id); 
     69     $conditions   = array('Answer.user_id'=>$this->Auth->user('id'), 'Answer.question_id'=>$question_id); 
    7070         
    71      $fields     = array("Answer.id", "Answer.user_id", "Answer.correct"); 
     71     $fields       = array('Answer.id', 'Answer.user_id', 'Answer.correct'); 
    7272         
    73      $order = "Answer.id DESC"; 
     73     $order        = 'Answer.id DESC'; 
    7474         
    7575     $this->set('data', $this->Answer->findAll($conditions, $fields, $order)); 
     
    8080  public function admin_questions($test_id) 
    8181  { 
    82         $this->pageTitle = 'Answers'; 
     82     $this->pageTitle = __('Answers', true); 
    8383         
    84         $conditions = array("Answer.user_id"=>$this->Auth->user('id'), "Answer.id"=>$test_id); 
     84     $conditions = array('Answer.user_id'=>$this->Auth->user('id'), 'Answer.id'=>$test_id); 
    8585         
    86         $fields     = array("Answer.id", "Answer.user_id", "Answer.title", "Answer.description"); 
     86     $fields     = array("Answer.id", "Answer.user_id", "Answer.title", "Answer.description"); 
    8787         
    88         $order = "Answer.id DESC"; 
     88     $order    = 'Answer.id DESC'; 
    8989         
    90         $this->set('data', $this->Answer->findAll($conditions, $fields, $order)); 
     90     $this->set('data', $this->Answer->findAll($conditions, $fields, $order)); 
    9191  } 
    9292 
  • trunk/app/controllers/vclassrooms_controller.php

    r729 r730  
    115115            $this->set('msg', __('You are already member of this class', true)); 
    116116            $this->render('jointoclass', 'ajax'); 
    117      else: 
     117    else: 
    118118            $this->data['UsersVclassroom']['user_id'] = $this->Auth->user('id'); 
    119119 
  • trunk/app/locale/spa/LC_MESSAGES/default.po

    r729 r730  
    44msgid  "Yes" 
    55msgstr "Si" 
     6 
     7msgid  "Points up" 
     8msgstr "Subir puntos" 
     9 
     10msgid  "Points down" 
     11msgstr "Bajar puntos" 
     12 
     13msgid  "Participations in forums" 
     14msgstr "Participaciones en foros" 
    615 
    716msgid  "You have been registered" 
  • trunk/app/models/vclassroom.php

    r729 r730  
    120120                       ); */  
    121121 /** 
    122  *  Get student record in Vclassroom , return array 
     122 *  Get student record in Vclassroom , return array  usd in admin_record method (vclassrooms_controller.php) 
    123123 * 
    124  * @param  integer $user_id  description 
     124 * @param  integer $user_id:  in $fact student_id 
    125125 * @param  integer $vclassroom_id  description 
    126126 * @return array   $record description 
    127127 * @access public 
    128  * @author author Manuel Montoya  
     128 * @author Manuel Montoya  
    129129 **/ 
    130130 public function studentRecord($user_id, $vclassroom_id) 
     
    133133     $record                  = array(); 
    134134    
    135      $this->User->unbindAll(); 
    136       
     135     $this->User->unbindAll();  // unbind unnecesaries tables 
     136      
     137     //Get the student data 
    137138     $record   = $this->User->find(array('User.id'=>$user_id), array('id', 'username', 'name', 'email')); 
    138139      
    139      // Consult Test Model 
     140     // Consult Test Model associated to this Vclassroom 
    140141     $this->TestsVclassroom->bindModel(array('belongsTo'=>array('Test'))); 
    141142      
     
    143144     $fields            = array('TestsVclassroom.test_id', 'TestsVclassroom.id', 'Test.title');  
    144145     $record['tests']   = $this->TestsVclassroom->findAll($conditions, $fields); 
    145      //die(debug($record['tests'])); 
     146     // die(debug($record)); 
    146147    
    147148     foreach($record['tests'] as $k => $t): 
     
    151152        
    152153       $conditions = array('Result.vclassroom_id'=>$vclassroom_id,'Result.user_id'=>$user_id,'Result.test_id'=>$t['TestsVclassroom']['test_id']); 
    153        $fields     = array('Result.correct', 'Result.answer_id','Test.title', 'Question.question', 'Question.worth'); 
     154       $fields     = array('Result.correct', 'Result.answer_id','Question.worth'); 
    154155       $results    = $this->Test->Result->findAll($conditions, $fields); 
    155  
     156       //debug($results); 
     157       // Get points from answers 
    156158       if ( count($results) > 0 ): 
    157159            $points     = (int) 0; 
    158160       else: 
    159             $points     = null;   //student has no answered this test yet 
     161            $points     = null;   //student has not answered this test yet 
    160162       endif; 
    161163        
    162164       foreach($results as $r): 
    163165            if ($r['Result']['correct'] == 1): 
    164                   $points     += $r['Question']['worth'];      
     166                  $points     += (int) $r['Question']['worth'];      
    165167        endif; 
    166168       endforeach; 
     
    169171     endforeach; 
    170172     //die(debug($record['tests'])); 
    171      // Consult Treasure Model 
     173 
     174     // Now Treasure Model 
    172175     $conditions = array('ResultTreasure.vclassroom_id'=>$vclassroom_id, 'ResultTreasure.user_id'=>$user_id); 
    173176     $fields     = array('ResultTreasure.points', 'Treasure.title', 'Treasure.id'); //null; 
  • trunk/app/views/vclassrooms/admin_record.ctp

    r728 r730  
    11<?php 
    22 //die(debug($data)); 
    3  
    43 echo $html->addCrumb('Control Panel', '/admin/entries/start');  
    54 echo $html->addCrumb(__('Groups', true), '/admin/vclassrooms/listing'); 
     
    101100       endforeach; 
    102101 else: 
    103     echo  $html->para(null, 'No webquests found'); 
     102    echo  $html->para(null, __('No Webquests found', true)); 
    104103 endif; 
    105104  
    106105 // Treasures. Model: Treasure   
    107106 $tpoints = (int) 0; // tresure points 
     107 echo '<h1>'. __('Scavengers hunts', true).'</h1>'; 
    108108 if ( count($data['treasures']) > 0 ): 
    109   echo '<h1>Treasures</h1>'; 
    110109  foreach ($data['treasures'] as $tr): 
    111   
    112      $tpoints += $tr['ResultTreasure']['points']; 
     110     $tpoints += (int) $tr['ResultTreasure']['points']; 
    113111     $div_id   = 'tr'.$tr['Treasure']['id']; 
    114112     e('<div style="border:1px dotted gray;padding:4px;margin:2px;height:20px;">'); 
    115113     e($html->div(null, $tr['ResultTreasure']['points'] .' points',  array('id'=>$div_id, 'style'=>'width:150px;float:left;'))); 
    116114     e('<div style="width:450px;float:right;">'); 
    117      echo $html->link($tr['Treasure']['title'], '#', array('title'=>'View reply', 'onclick'=> 
     115     echo $html->link($tr['Treasure']['title'], '#', array('title'=>__('View text', true), 'onclick'=> 
    118116        "window.open('/admin/treasures/see/".$data['User']['id']."/".$tr['Treasure']['id']."','mywin','left=20,top=20,width=700,height=700,toolbar=0,resizable=1')")) . '&nbsp;&nbsp;'; 
    119117 
    120      echo $ajax->link($html->image('static/adownmod.png', array('alt'=>'Points down', 'title'=>'Points down')), 
     118     echo $ajax->link($html->image('static/adownmod.png', array('alt'=>__('Points down', true), 'title'=>__('Points down', true))), 
    121119                           '/admin/treasures/points/'.$tr['Treasure']['id'].'/down', 
    122120                        array('update'  => $div_id, 
     
    124122                                  'after'   =>'tp('.$data['User']['id'].','.$data['Vclassroom']['id'].')', 
    125123                          'complete'=>"Element.hide('loadingre');Effect.Appear(".$div_id.")"),null,false); 
    126      echo $ajax->link($html->image('static/aupmod.png', array('alt'=>'Points up', 'title'=>'Points up')), 
     124     echo $ajax->link($html->image('static/aupmod.png', array('alt'=>__('Points up', true), 'title'=>__('Points up', true))), 
    127125                           '/admin/treasures/points/'.$tr['Treasure']['id'].'/up', 
    128126                        array('update'  => $div_id, 
     
    135133     endforeach; 
    136134 else: 
    137        echo  $html->para(null, 'No treasures found'); 
     135     echo $html->para(null, __('No Scavenger hunts found', true)); 
    138136 endif; 
    139137    
    140  // Replies on forums. Model: Topic 
    141  $rpoints = (int) 0;  // reply points 
     138 
     139 echo '<h1>'.__('Participations in forums', true).'</h1>'; 
     140 
    142141 if ( count($data['replies']) > 0 ): 
    143     echo '<h1>Replies in forums</h1>'; 
    144     foreach ($data['replies'] as $re): 
    145       
     142   // Replies on forums. Model: Topic 
     143   $rpoints = (int) 0;  // reply points 
     144   foreach ($data['replies'] as $re):   
    146145      $div_id = 're'.$re['Reply']['id']; 
    147146      e('<div style="border:1px dotted gray;padding:4px;margin:2px;height:20px;">');