Changeset 676 for trunk/app/models

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

Update testt

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/models/vclassroom.php

    r664 r676  
    303303 } 
    304304 
     305 /** 
     306 * classElements  
     307 * Get class (group) active elements (Webquest, Test, Trasures, Forums, etc) 
     308 * this method is used in show() method, vclassrooms_controller.php 
     309 * @param  integer $vclassroom_id  description 
     310 * @return array   $record description 
     311 * @access public 
     312 * @author author Manuel Montoya  
     313 **/ 
     314 public function classElements($vclassroom_id) 
     315 { 
     316  try{    
     317 
     318   $this->unbindModel(array('hasAndBelongsToMany'=>array('Test', 'Webquest', 'Treasure'))); 
     319   
     320   $this->bindModel(array( 
     321                          'belongsTo'           =>array('Ecourse'=>array('fields'=>'id, title')), 
     322                          'hasAndBelongsToMany' =>array( 
     323                                          'Test' => 
     324                       array('className'             => 'Test', 
     325                         'joinTable'             => 'tests_vclassrooms', 
     326                         'foreignKey'            => 'vclassroom_id', 
     327                         'associationForeignKey' => 'test_id', 
     328                         'conditions'            => 'status=1', 
     329                         'fields'                => 'id, title' 
     330                         ), 
     331                                        'Webquest' => 
     332                       array('className'             => 'Webquest', 
     333                         'joinTable'             => 'vclassrooms_webquests', 
     334                         'foreignKey'            => 'vclassroom_id', 
     335                         'associationForeignKey' => 'webquest_id', 
     336                                                 'conditions'            => 'status=1', 
     337                         'unique'                => true, 
     338                         'fields'                => 'id, title'                       
     339                                                 ), 
     340                                        'Treasure' => 
     341                       array('className'             => 'Treasure', 
     342                         'joinTable'             => 'treasures_vclassrooms', 
     343                         'foreignKey'            => 'vclassroom_id', 
     344                         'associationForeignKey' => 'treasure_id', 
     345                         'conditions'            => 'Treasure.status=1', 
     346                                                 'fields'                => 'id, title', 
     347                         'unique'                => true 
     348                         ) 
     349                                              ) 
     350              ) 
     351                    ); 
     352 
     353   $conditions = array('Vclassroom.status'=>1, 'Vclassroom.id'=>$vclassroom_id); 
     354 
     355   $data = $this->find($conditions); 
     356 
     357   return $data; 
     358  } 
     359 
     360  catch(Exception $e) 
     361  { 
     362    echo $e->getMessage(); 
     363    exit(); 
     364  } 
     365 } 
     366 
    305367/** 
    306368 *  Get student evaluation, return integer