コード例 #1
0
 public function addClass($code, $name, $description)
 {
     $class_new = new class_model();
     $class_year = new ClassYear();
     $class_user = new ClassUser();
     $class_new->class_code = $code;
     $class_new->class_name = $name;
     $class_new->class_description = $description;
     $class_new->save(FALSE);
     $class_id = class_model::model()->findByAttributes(array('class_id' => $class_new->class_id));
     $class_year->class_code = $code;
     $class_year->is_active = 1;
     $class_year->class_id = $class_id->class_id;
     $class_year->class_year = date("Y");
     $class_year->save(FALSE);
     $class_user->user_id = Yii::app()->session['user_id'];
     $class_user->admin_id = Yii::app()->session['user_id'];
     $class_user->class_id = $class_id->class_id;
     $class_user->is_active = 1;
     $class_user->save(FALSE);
     return $class_id->class_id;
 }