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;
        }
    }
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;
        }
    }
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 ; } }
Add a community course
@param object $course
@param integer $userid
@return id of course or false if already added
Add a community course