Changeset 676 for trunk/app/controllers

Show
Ignore:
Timestamp:
07/25/08 00:24:52 (4 months ago)
Author:
aarkerio
Message:

Update testt

Location:
trunk/app/controllers
Files:
2 modified

Legend:

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

    r675 r676  
    4545  public function view($test_id, $vclassroom_id) 
    4646  { 
    47     $user_id = $this->Test->field('Test.user_id', array("Test.id"=>$test_id)); 
     47    $user_id = (int) $this->Test->field('Test.user_id', array("Test.id"=>$test_id)); 
    4848     
    4949    $this->pageTitle = __('Test', true); 
     
    5555    // student belongst to this class? 
    5656    if ( $this->Auth->user() ): 
    57       $this->set('belongs', $this->Test->Vclassroom->belongs($this->Auth->user('id'), $vclassroom_id)); 
     57           $this->set('belongs', $this->Test->Vclassroom->belongs($this->Auth->user('id'), $vclassroom_id)); 
    5858    else: 
    59              $this->set('belongs', false); 
     59           $this->set('belongs', false); 
    6060    endif;      
    61     
    62     if ( $this->Test->chk($test_id, $this->Auth->user('id'), $vclassroom_id) === false ):   // true = already 
     61      
     62    if ( $this->Test->chk($test_id, $this->Auth->user('id'), $vclassroom_id) === false ):   // true = already answered this test 
    6363             $this->set('already', false); 
    6464             $this->set('data', false); 
     
    6666             $this->set('already', true); 
    6767    endif; 
    68      
    69           
     68              
    7069    $conditions = array("Test.id"=>$test_id, "Test.status"=>1); 
    7170 
  • trunk/app/controllers/vclassrooms_controller.php

    r640 r676  
    7676             $this->set('belongs', false); 
    7777   endif; 
    78         
    79    // temporal lines, move to model later 
    80    //$this->Vclassroom->Ecourse->unbindModel(array('hasMany'=>array('Vclassroom'), 'belongsTo'=>array('User'))); 
    81    //$this->Vclassroom->Test->unbindModel(array('hasMany'=>array('Question'), 'belongsTo'=>array('User'))); 
    82    $this->Vclassroom->bindModel(array('belongsTo'=>array('Ecourse'=>array('fields'=>'id, title')))); 
    83    $conditions = array("Vclassroom.status"=>1, "Vclassroom.id"=>$vclassroom_id); 
    84    $this->set('data', $this->Vclassroom->find($conditions)); 
     78       
     79   $this->set('data', $this->Vclassroom->classElements($vclassroom_id)); 
    8580 } 
    8681