original_string: public function block_community_add_course($course, $userid) {
          global $DB;
  
          $community = $this->block_community_get_course($course->url, $userid);
  
          if (empty($community)) {
              $community = new stdClass();
              $community->userid = $userid;
              $community->coursename = $course->name;
              $community->coursedescription = $course->description;
              $community->courseurl = $course->url;
              $community->imageurl = $course->imageurl;
              return $DB->insert_record('block_community', $community);
          } else {
              return false;
          }
      }
code: public function block_community_add_course($course, $userid) {
          global $DB;
  
          $community = $this->block_community_get_course($course->url, $userid);
  
          if (empty($community)) {
              $community = new stdClass();
              $community->userid = $userid;
              $community->coursename = $course->name;
              $community->coursedescription = $course->description;
              $community->courseurl = $course->url;
              $community->imageurl = $course->imageurl;
              return $DB->insert_record('block_community', $community);
          } else {
              return false;
          }
      }
code_tokens: public function block_community_add_course ( $ course , $ userid ) { global $ DB ; $ community = $ this -> block_community_get_course ( $ course -> url , $ userid ) ; if ( empty ( $ community ) ) { $ community = new stdClass ( ) ; $ community -> userid = $ userid ; $ community -> coursename = $ course -> name ; $ community -> coursedescription = $ course -> description ; $ community -> courseurl = $ course -> url ; $ community -> imageurl = $ course -> imageurl ; return $ DB -> insert_record ( 'block_community' , $ community ) ; } else { return false ; } }
docstring: Add a community course
  @param object $course
  @param integer $userid
  @return id of course or false if already added
docstring_tokens: Add a community course