<?php

class compareAttributes extends CValidator
{

    public $compareAttribute;
    
    /**
     * Validates the attribute of the object.
     * If there is any error, the error message is added to the object.
     * @param CModel $object the object being validated
     * @param string $attribute the attribute being validated
     */
    
    protected function validateAttribute($object, $attribute)
    {
        $compareAttribute = $this->compareAttribute;
        if ($object->$attribute != $object->$compareAttribute) {
            $this->addError($object, $attribute, __('USER_MODEL_CANNOT_CHANGE_SYSTEM_ADMIN_NAME'));
            return false;
        }
        return true;
    }
}