Changeset 747 for trunk/app

Show
Ignore:
Timestamp:
09/01/08 22:38:27 (3 months ago)
Author:
aarkerio
Message:

Little Bugs fixed

Location:
trunk/app
Files:
3 modified

Legend:

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

    r728 r747  
    3030 public function chksw() 
    3131 { 
    32    $this->layout    = 'ajax'; 
    33  
    34    if ( !empty($this->data['ResultTreasure']) ): 
    35       $this->Sanitize = new Sanitize; 
    36             
    37       $this->Sanitize->clean($this->data['ResultTreasure']); 
    38  
    39       $secret = $this->Treasure->field('secret', array('status'=>1,'id'=>$this->data['ResultTreasure']['treasure_id'])); 
     32  $this->layout    = 'ajax'; 
     33 
     34  if ( !empty($this->data['ResultTreasure']) ): 
     35    $this->Sanitize = new Sanitize; 
     36    $this->Sanitize->clean($this->data['ResultTreasure']); 
     37    $conditions = array('ResultTreasure.treasure_id'=>$this->data['ResultTreasure']['treasure_id'],'ResultTreasure.user_id'=>$this->Auth->user('id')); 
     38    $answer = $this->Treasure->ResultTreasure->field('id', $conditions); 
     39 
     40    if ($answer != false): 
     41       $this->set('msg', __('You already answered this Scavenger Hunt', true)); 
     42       $this->render('chksw', 'ajax'); 
     43       return false; 
     44    endif; 
     45 
     46    $secret = $this->Treasure->field('secret', array('status'=>1,'id'=>$this->data['ResultTreasure']['treasure_id'])); 
    4047                  
    41       if ( $this->data['ResultTreasure']['secret'] ==  $secret ): 
     48    if ( $this->data['ResultTreasure']['secret'] ==  $secret ): 
    4249        $this->data['ResultTreasure']['user_id'] = $this->Auth->user('id'); 
    43        
    4450    $this->Treasure->ResultTreasure->save($this->data['ResultTreasure']); 
    45  
    4651        $this->set('msg', 'Cool!, the '. $this->data['ResultTreasure']['points'] .' points are yours'); 
    4752        $this->render('chksw', 'ajax'); 
    4853      
    49       else: 
    50           $this->set('msg', 'Sorry, word is incorrect'); 
    51       $this->render('chksw', 'ajax'); 
    52       endif;  
     54    else: 
     55        $this->set('msg', __('Sorry, code is incorrect', true)); 
     56    $this->render('chksw', 'ajax'); 
     57    endif;  
    5358   endif; 
    5459 } 
  • trunk/app/locale/spa/LC_MESSAGES/default.po

    r733 r747  
    44msgid  "Yes" 
    55msgstr "Si" 
     6 
     7msgid  "You already answered this Scavenger Hunt" 
     8msgstr "Ya has encontrado este tesoro" 
    69 
    710msgid  "Reports" 
  • trunk/app/views/treasures/admin_edit.ctp

    r693 r747  
    1313</td><td> 
    1414  <?php 
    15     echo $form->label('Treasure.points', 'Points:');  
     15    echo $form->label('Treasure.points', __('Points', true));  
    1616    echo $form->select('Treasure.points', array(1=>1,2=>2,3=>3,4=>4,5=>5,6=>6,7=>7,8=>8,9=>9,10=>10));  
    1717  ?> 
     
    3030 
    3131<tr><td colspan="3"> 
    32    <?php echo $form->input('Treasure.secret', array('size'=>15, 'maxlength'=>15, 'between'=>': ')); ?> 
     32   <?php echo $form->input('Treasure.secret', array('size'=>15, 'maxlength'=>15, 'between'=>': ', 'label'=>__('Code', true))); ?> 
    3333  </td> 
    3434</tr>