MDL-43468 context: Context IDs are forced to be int

The method context::insert_context_record() sets the context::$id to
an int, while when we create an instance, the $id is often read from
a DB $record object, and is a string. The ID should always be an int.