There should be a sensor, probably an LDR (light dependent resistor) which, by increasing its' resistance, should allow the controlling electronics to turn OFF the solar light when the light intensity is sufficient. This is what one might look like.
With regard to the flat battery have you tested the output voltage of the solar cell when it's exposed to sunlight? Hopefully the battery might state its' voltage value so you know how much to expect from the solar cell (e.g. 5V therefore to charge it the solar cell needs to produce at least 6.5V - these are not actual figures for your device just showing that the solar cell like any charging power supply needs to supply more than the battery can, to charge it. Sorry if you know all this).Hopefully the solar cell may have its specifications listed on it somewhere. The solar cell's output will vary depending on its' exposure angle etc.
Hopefully this is of some help.