original_string: public static function action_category_move_courses_into(\core_course_category $oldcategory,
                                                               \core_course_category $newcategory, array $courseids) {
          global $DB;
  
          list($where, $params) = $DB->get_in_or_equal($courseids, SQL_PARAMS_NAMED);
          $params['categoryid'] = $oldcategory->id;
          $sql = "SELECT c.id FROM {course} c WHERE c.id {$where} AND c.category <> :categoryid";
          if ($DB->record_exists_sql($sql, $params)) {
              // Likely being tinkered with.
              throw new \moodle_exception('coursedoesnotbelongtocategory');
          }
  
          // All courses are currently within the old category.
          return self::move_courses_into_category($newcategory, $courseids);
      }
code: public static function action_category_move_courses_into(\core_course_category $oldcategory,
                                                               \core_course_category $newcategory, array $courseids) {
          global $DB;
  
          list($where, $params) = $DB->get_in_or_equal($courseids, SQL_PARAMS_NAMED);
          $params['categoryid'] = $oldcategory->id;
          $sql = "SELECT c.id FROM {course} c WHERE c.id {$where} AND c.category <> :categoryid";
          if ($DB->record_exists_sql($sql, $params)) {
              // Likely being tinkered with.
              throw new \moodle_exception('coursedoesnotbelongtocategory');
          }
  
          // All courses are currently within the old category.
          return self::move_courses_into_category($newcategory, $courseids);
      }
code_tokens: public static function action_category_move_courses_into ( \ core_course_category $ oldcategory , \ core_course_category $ newcategory , array $ courseids ) { global $ DB ; list ( $ where , $ params ) = $ DB -> get_in_or_equal ( $ courseids , SQL_PARAMS_NAMED ) ; $ params [ 'categoryid' ] = $ oldcategory -> id ; $ sql = "SELECT c.id FROM {course} c WHERE c.id {$where} AND c.category <> :categoryid" ; if ( $ DB -> record_exists_sql ( $ sql , $ params ) ) { // Likely being tinkered with. throw new \ moodle_exception ( 'coursedoesnotbelongtocategory' ) ; } // All courses are currently within the old category. return self :: move_courses_into_category ( $ newcategory , $ courseids ) ; }
docstring: Moves courses out of one category and into a new category.
  
  @param \core_course_category $oldcategory The category we are moving courses out of.
  @param \core_course_category $newcategory The category we are moving courses into.
  @param array $courseids The ID's of the courses we want to move.
  @return bool True on success.
  @throws \moodle_exception
docstring_tokens: Moves courses out of one category and into a new category .