public function onQuickFormEvent($event, $arg, &$caller) {
        if ($event == 'createElement') {
            $attributes = $arg[2];
            if (!is_array($attributes) || !array_key_exists('gradinginstance', $attributes) || !($attributes['gradinginstance'] instanceof gradingform_instance)) {
                throw new moodle_exception('exc_gradingformelement', 'grading');
            }
        }

        $name = $this->getName();
        if ($name && $caller->elementExists($name)) {
            $caller->addRule($name, $this->get_gradinginstance()->default_validation_error_message(), 'gradingvalidated', $this->gradingattributes);
        }
        return parent::onQuickFormEvent($event, $arg, $caller);
    }
public function onQuickFormEvent($event, $arg, &$caller) {
        if ($event == 'createElement') {
            $attributes = $arg[2];
            if (!is_array($attributes) || !array_key_exists('gradinginstance', $attributes) || !($attributes['gradinginstance'] instanceof gradingform_instance)) {
                throw new moodle_exception('exc_gradingformelement', 'grading');
            }
        }

        $name = $this->getName();
        if ($name && $caller->elementExists($name)) {
            $caller->addRule($name, $this->get_gradinginstance()->default_validation_error_message(), 'gradingvalidated', $this->gradingattributes);
        }
        return parent::onQuickFormEvent($event, $arg, $caller);
    }
public function onQuickFormEvent ( $ event , $ arg , & $ caller ) { if ( $ event == 'createElement' ) { $ attributes = $ arg [ 2 ] ; if ( ! is_array ( $ attributes ) || ! array_key_exists ( 'gradinginstance' , $ attributes ) || ! ( $ attributes [ 'gradinginstance' ] instanceof gradingform_instance ) ) { throw new moodle_exception ( 'exc_gradingformelement' , 'grading' ) ; } } $ name = $ this -> getName ( ) ; if ( $ name && $ caller -> elementExists ( $ name ) ) { $ caller -> addRule ( $ name , $ this -> get_gradinginstance ( ) -> default_validation_error_message ( ) , 'gradingvalidated' , $ this -> gradingattributes ) ; } return parent :: onQuickFormEvent ( $ event , $ arg , $ caller ) ; }
Called by HTML_QuickForm whenever form event is made on this element.
Adds necessary rules to the element and checks that coorenct instance of gradingform_instance
is passed in attributes

@param string $event Name of event
@param mixed $arg event arguments
@param object $caller calling object
@return bool
@throws moodle_exception
Called by HTML_QuickForm whenever form event is made on this element . Adds necessary rules to the element and checks that coorenct instance of gradingform_instance is passed in attributes