Various fixes and improvements to class flags

Fixes a couple of bugs (resolves #1211), adds class flag creation/modification time and scheduling status (resolves #1137), and improves query performance.
The documentation for ```classflags()``` also needs to be updated for this as well, since you say that ```v``` will always be just an id literal in this case, and doesn't mention the case where ```v``` is an object itself.