public static function get_category_courses_visibility($categoryid) {
        global $DB;
        $sql = "SELECT c.id, c.visible
                  FROM {course} c
                 WHERE c.category = :category";
        $params = array('category' => (int)$categoryid);
        return $DB->get_records_sql($sql, $params);
    }
public static function get_category_courses_visibility($categoryid) {
        global $DB;
        $sql = "SELECT c.id, c.visible
                  FROM {course} c
                 WHERE c.category = :category";
        $params = array('category' => (int)$categoryid);
        return $DB->get_records_sql($sql, $params);
    }
public static function get_category_courses_visibility ( $ categoryid ) { global $ DB ; $ sql = "SELECT c.id, c.visible
                  FROM {course} c
                 WHERE c.category = :category" ; $ params = array ( 'category' => ( int ) $ categoryid ) ; return $ DB -> get_records_sql ( $ sql , $ params ) ; }
Returns an array of courseids and visiblity for all courses within the given category.
@param int $categoryid
@return array
Returns an array of courseids and visiblity for all courses within the given category .