protected function validate_relatedcompetencyid($data) {

        if ($this->get('competencyid') == $data) {
            // A competency cannot be related to itself.
            return new lang_string('invaliddata', 'error');

        } if ($this->get('competencyid') > $data) {
            // The competency ID must be lower than the related competency ID.
            return new lang_string('invaliddata', 'error');

        } else if (!competency::record_exists($data)) {
            return new lang_string('invaliddata', 'error');

        } else if (!competency::share_same_framework(array($data, $this->get('competencyid')))) {
            // The competencies must belong to the same framework.
            return new lang_string('invaliddata', 'error');
        }

        return true;
    }
protected function validate_relatedcompetencyid($data) {

        if ($this->get('competencyid') == $data) {
            // A competency cannot be related to itself.
            return new lang_string('invaliddata', 'error');

        } if ($this->get('competencyid') > $data) {
            // The competency ID must be lower than the related competency ID.
            return new lang_string('invaliddata', 'error');

        } else if (!competency::record_exists($data)) {
            return new lang_string('invaliddata', 'error');

        } else if (!competency::share_same_framework(array($data, $this->get('competencyid')))) {
            // The competencies must belong to the same framework.
            return new lang_string('invaliddata', 'error');
        }

        return true;
    }
protected function validate_relatedcompetencyid ( $ data ) { if ( $ this -> get ( 'competencyid' ) == $ data ) { // A competency cannot be related to itself. return new lang_string ( 'invaliddata' , 'error' ) ; } if ( $ this -> get ( 'competencyid' ) > $ data ) { // The competency ID must be lower than the related competency ID. return new lang_string ( 'invaliddata' , 'error' ) ; } else if ( ! competency :: record_exists ( $ data ) ) { return new lang_string ( 'invaliddata' , 'error' ) ; } else if ( ! competency :: share_same_framework ( array ( $ data , $ this -> get ( 'competencyid' ) ) ) ) { // The competencies must belong to the same framework. return new lang_string ( 'invaliddata' , 'error' ) ; } return true ; }
Validate related competency ID.

@param int $data The related competency ID.
@return true|lang_string
Validate related competency ID .