It is generally the same idea as a toilet bowel air freshener that hangs on the inside of the bowel. Its "supposed" to deoderize the area and keep away foul smells - some even contain antibacterial ingredients that they release when wet. Its still a gross....regardless.
So the guy's toilets don't smell as bad. Although, even when cakes are in there I avoid walking past the toilets altogether as it still smells of p!ss.
It's used to keep urinals disinfected and deodorized. And yes, I had to look it up.