<?php
class EWebUser extends CWebUser{
    protected $_model;
    function isAdmin(){
        $user = $this->loadUser();
		//die('agdfsgfgdf'.UserType::model()->findByPk( $user->user_type_id )->type);
        if ($user)
		   if ((UserType::model()->findByPk( $user->user_type_id )->type) == 'staff' ||(UserType::model()->findByPk( $user->user_type_id )->type) == 'administrator' || (UserType::model()->findByPk( $user->user_type_id )->type)=='superadmin')
		   		return true;
        return false;
    }
    // Load user model.
    protected function loadUser()
    {
        if ( $this->_model === null ) {
                $this->_model = User::model()->findByPk( $this->id );
        }
        return $this->_model;
    }
}