Non-equilibrium phase transitions in colloidal glasses and gels