Changeset 687 for trunk/app/controllers

Show
Ignore:
Timestamp:
08/02/08 00:10:46 (4 months ago)
Author:
aarkerio
Message:

Test JS

Files:
1 modified

Legend:

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

    r570 r687  
    99 
    1010uses('sanitize'); 
    11 uses('L10n'); 
    1211 
    1312class TreasuresController extends AppController { 
     
    2423 
    2524/* 
     25 * chksw()  
    2626 * check if tresure string is OK, if so, save student data on ResultTreasure model  
    2727 * 
    2828 */ 
    2929  
    30  public function  chksw() 
     30 public function chksw() 
    3131 { 
    3232   $this->layout    = 'ajax'; 
     
    8181 
    8282 public function view($treasure_id, $vclassroom_id) 
    83  {     
    84   if ( $this->Test->chk($test_id, $this->Auth->user('id'), $vclassroom_id) === true ): 
    85          $username = $this->Test->User->field('User.username', array("User.id"=>$user_id)); 
    86      $this->flash('You already have answered this test', '/users/portfolio/'.$username); 
     83 { 
     84  if ( $this->Treasure->chk($treasure_id, $this->Auth->user('id'), $vclassroom_id) === false ): 
     85         $this->set('already', false); 
     86         $this->set('data', false); 
     87  else: 
     88         $this->set('already', true); 
    8789  endif; 
    8890     
    8991  // student belongs to this class? 
    90   if ( $this->Auth->user() && $this->Auth->user('group_id') == 3): 
     92  if ( $this->Auth->user() ): 
    9193             $this->set('belongs', $this->Treasure->Vclassroom->belongs($this->Auth->user('id'), $vclassroom_id)); 
    9294  else: 
     
    104106  $this->Edublog->blog($data['Treasure']['user_id']); // blogger elements 
    105107             
    106   $this->set('data', $data);  
     108  $this->set('data', $data); 
     109 
     110  $this->set('vclassroom_id', $vclassroom_id);  
    107111 } 
    108112