Hi
u can apply simple way. on condition in rule function
return array(
array('student_id, exam_id, grading_level_id, is_failed','required','numerical', 'integerOnly'=>true,'on'=>'user'),
array('grading_level_id, is_failed', 'required','numerical', 'integerOnly'=>true,'on'=>'guest'),
array('marks', 'length', 'max'=>7),
array('remarks', 'length', 'max'=>255),
array('created_at, updated_at', 'safe'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, student_id, exam_id, marks, grading_level_id, remarks, is_failed, created_at, updated_at', 'safe', 'on'=>'search'),
);
$model = new Users('user');
and guest validation u can use the guest
$model = new Users('guest');
Hope it will be done