core+userportal: get events by VM and template IDs

This patch changes the current get events by VM and template names, to
work with IDs. These queries are used in the user portal.

Change-Id: I3c179171f60b74b52cf7a0a7ca7b4b8087b5ceb2
Bug-Url: https://bugzilla.redhat.com/968961
Signed-off-by: Oved Ourfali <oourfali@redhat.com>