References #116. Changed count function logic.

As there is not student role the count function logic had to be changed.
Using left joins and a condition to count all the users that have no
roles assigned. Also making an exclusion for user identifier of 0. The
logic for all users count has also been changed to use the sum of
teachers and students (using corresponding methods for that). Rewrote
all the function to use countQuery instead of fetching results and
returning rowCount. This make more sense as those are indeed count
methods and in addition count query should be cheaper and faster to run.