Show
Ignore:
Timestamp:
03/28/08 10:03:54 (10 months ago)
Author:
aarkerio
Message:

Improvs on Lessons and Images

Files:
1 modified

Legend:

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

    r342 r352  
    99class Ecourse extends AppModel { 
    1010   
    11   public $name = 'Ecourse'; 
     11  public $name = 'Ecourse';  
    1212   
    1313  public $belongsTo = array('User', 'Subject', 'Lang'); 
    1414   
    15   public $hasMany   = array('Vclassroom'); 
     15  public $hasMany   =  array('Vclassroom' => 
     16                array(  
     17                  'className'  =>  'Vclassroom',      
     18                  'foreignKey' =>  'ecourse_id',  
     19                  'conditions' =>  'status = 1' 
     20                                  ) 
     21   ); 
    1622   
     23  public function filed()  
     24  { 
     25      $this->unbindModel(array('hasMany'=>array('Vclassroom'))); 
     26 
     27      $this->bindModel( array('hasMany' => array('Vclassroom' => 
     28                                               array(  
     29                                                 'className'  =>  'Vclassroom',      
     30                                                 'foreignKey' =>  'ecourse_id',  
     31                                                 'conditions' =>  'status = 0' 
     32                                                                 ) 
     33                                   )) 
     34                      ); 
     35       return true;  
     36  } 
     37     
    1738  public $validate = array( 
    1839        'title' => array(