Changeset 676 for trunk/app/controllers
- Timestamp:
- 07/25/08 00:24:52 (4 months ago)
- Location:
- trunk/app/controllers
- Files:
-
- 2 modified
-
tests_controller.php (modified) (3 diffs)
-
vclassrooms_controller.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/tests_controller.php
r675 r676 45 45 public function view($test_id, $vclassroom_id) 46 46 { 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)); 48 48 49 49 $this->pageTitle = __('Test', true); … … 55 55 // student belongst to this class? 56 56 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)); 58 58 else: 59 $this->set('belongs', false);59 $this->set('belongs', false); 60 60 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 63 63 $this->set('already', false); 64 64 $this->set('data', false); … … 66 66 $this->set('already', true); 67 67 endif; 68 69 68 70 69 $conditions = array("Test.id"=>$test_id, "Test.status"=>1); 71 70 -
trunk/app/controllers/vclassrooms_controller.php
r640 r676 76 76 $this->set('belongs', false); 77 77 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)); 85 80 } 86 81
