original_string: public static function change_items_context($component, $itemtype, $itemids, $newcontext) {
          global $DB;
          if (empty($itemids)) {
              return;
          }
          if (!is_array($itemids)) {
              $itemids = array($itemids);
          }
          list($sql, $params) = $DB->get_in_or_equal($itemids, SQL_PARAMS_NAMED);
          $params['component'] = $component;
          $params['itemtype'] = $itemtype;
          if ($newcontext instanceof context) {
              $newcontext = $newcontext->id;
          }
  
          $DB->set_field_select('tag_instance', 'contextid', $newcontext,
              'component = :component AND itemtype = :itemtype AND itemid ' . $sql, $params);
      }
code: public static function change_items_context($component, $itemtype, $itemids, $newcontext) {
          global $DB;
          if (empty($itemids)) {
              return;
          }
          if (!is_array($itemids)) {
              $itemids = array($itemids);
          }
          list($sql, $params) = $DB->get_in_or_equal($itemids, SQL_PARAMS_NAMED);
          $params['component'] = $component;
          $params['itemtype'] = $itemtype;
          if ($newcontext instanceof context) {
              $newcontext = $newcontext->id;
          }
  
          $DB->set_field_select('tag_instance', 'contextid', $newcontext,
              'component = :component AND itemtype = :itemtype AND itemid ' . $sql, $params);
      }
code_tokens: public static function change_items_context ( $ component , $ itemtype , $ itemids , $ newcontext ) { global $ DB ; if ( empty ( $ itemids ) ) { return ; } if ( ! is_array ( $ itemids ) ) { $ itemids = array ( $ itemids ) ; } list ( $ sql , $ params ) = $ DB -> get_in_or_equal ( $ itemids , SQL_PARAMS_NAMED ) ; $ params [ 'component' ] = $ component ; $ params [ 'itemtype' ] = $ itemtype ; if ( $ newcontext instanceof context ) { $ newcontext = $ newcontext -> id ; } $ DB -> set_field_select ( 'tag_instance' , 'contextid' , $ newcontext , 'component = :component AND itemtype = :itemtype AND itemid ' . $ sql , $ params ) ; }
docstring: Moves all tags of the specified items to the new context
  
  @param string $component the component that was tagged
  @param string $itemtype the type of record to tag ('post' for blogs, 'user' for users, etc.)
  @param array $itemids
  @param context|int $newcontext target context to move tags to
docstring_tokens: Moves all tags of the specified items to the new context