original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Approves or unapproves an entry.
  
  @param int $entryid          the record entry id id
  @param bool $approve         whether to approve (true) or unapprove the entry
  @return array of warnings and the entries
  @since Moodle 3.3
  @throws moodle_exception
docstring_tokens: Approves or unapproves an entry .