original_string: public static function get_course_publications($courseid) {
          global $DB;
          $sql = 'SELECT cp.id, cp.status, cp.timechecked, cp.timepublished, rh.hubname,
                         rh.huburl, cp.courseid, cp.enrollable, cp.hubcourseid
                  FROM {course_published} cp, {registration_hubs} rh
                  WHERE cp.huburl = rh.huburl and cp.courseid = :courseid and rh.huburl = :huburl
                  ORDER BY cp.enrollable DESC, rh.hubname, cp.timepublished';
          $params = array('courseid' => $courseid, 'huburl' => HUB_MOODLEORGHUBURL);
          $records = $DB->get_records_sql($sql, $params);
  
          // Add links for publications that are listed.
          foreach ($records as $id => $record) {
              if ($record->status) {
                  $records[$id]->link = new moodle_url(HUB_MOODLEORGHUBURL, ['courseid' => $record->hubcourseid]);
              }
          }
          return $records;
      }
code: public static function get_course_publications($courseid) {
          global $DB;
          $sql = 'SELECT cp.id, cp.status, cp.timechecked, cp.timepublished, rh.hubname,
                         rh.huburl, cp.courseid, cp.enrollable, cp.hubcourseid
                  FROM {course_published} cp, {registration_hubs} rh
                  WHERE cp.huburl = rh.huburl and cp.courseid = :courseid and rh.huburl = :huburl
                  ORDER BY cp.enrollable DESC, rh.hubname, cp.timepublished';
          $params = array('courseid' => $courseid, 'huburl' => HUB_MOODLEORGHUBURL);
          $records = $DB->get_records_sql($sql, $params);
  
          // Add links for publications that are listed.
          foreach ($records as $id => $record) {
              if ($record->status) {
                  $records[$id]->link = new moodle_url(HUB_MOODLEORGHUBURL, ['courseid' => $record->hubcourseid]);
              }
          }
          return $records;
      }
code_tokens: public static function get_course_publications ( $ courseid ) { global $ DB ; $ sql = 'SELECT cp.id, cp.status, cp.timechecked, cp.timepublished, rh.hubname,
                         rh.huburl, cp.courseid, cp.enrollable, cp.hubcourseid
                  FROM {course_published} cp, {registration_hubs} rh
                  WHERE cp.huburl = rh.huburl and cp.courseid = :courseid and rh.huburl = :huburl
                  ORDER BY cp.enrollable DESC, rh.hubname, cp.timepublished' ; $ params = array ( 'courseid' => $ courseid , 'huburl' => HUB_MOODLEORGHUBURL ) ; $ records = $ DB -> get_records_sql ( $ sql , $ params ) ; // Add links for publications that are listed. foreach ( $ records as $ id => $ record ) { if ( $ record -> status ) { $ records [ $ id ] -> link = new moodle_url ( HUB_MOODLEORGHUBURL , [ 'courseid' => $ record -> hubcourseid ] ) ; } } return $ records ; }
docstring: Get all publication for a course
  
  @param int $courseid local course id
  @return array of publication
docstring_tokens: Get all publication for a course