Here in Madurai those elephants are kept in stables within the walls of the Meenakshi Temple where they eat, sleep, walk and go to work like this one, painted and ready to go to the main entrance of the sanctorum to be part of the religious act of blessing people for a coin(see next).
They are trained from young to gather coins with their trunk and in exchange on order of the tamer to put their trunk as a blessing on the heads of the visitors of the temple, yes on order as you would pass closely he doesn't know better then to put his trunk on your head but no he is not allowed, first the coin that he swings straight to the hand of his tamer then the blessings, an enchanting attraction for the public.
You could say that his life is tilted , not knowing his natural environment, whole his life living between walls. Every respectable temple has their own elephants. During the mating season they can become dangerous and many accidents happened already in Kerala where they attack their tamer sometimes deadly during this period. Not so many elephants are left in Tamil Nadu, lucky there are still some reserves in the mountains where they can breed in a natural way.