public static function approve_entry($entryid, $approve = true) {
        global $PAGE, $DB;

        $params = array('entryid' => $entryid, 'approve' => $approve);
        $params = self::validate_parameters(self::approve_entry_parameters(), $params);
        $warnings = array();

        $record = $DB->get_record('data_records', array('id' => $params['entryid']), '*', MUST_EXIST);
        list($database, $course, $cm, $context) = self::validate_database($record->dataid);
        // Check database is open in time.
        data_require_time_available($database, null, $context);
        // Check specific capabilities.
        require_capability('mod/data:approve', $context);

        data_approve_entry($record->id, $params['approve']);

        $result = array(
            'status' => true,
            'warnings' => $warnings
        );
        return $result;
    }