Is it a mitzva of לילה? Or is it a mitzva of פרסומי ניסא? It is clear that the reason for the mitzva is פרסומי ניסא, the question is how did chazal make the takana? Did they make it a regular mitzva of לילה like so many other mitzvos or did they make the takana as well a mitzva of פרסומי ניסא?
This would seem to be a machlokes harishonim. The gemara wants to know why the language of משתשקע החצה עד שתכלה רגל מן השוק, is used. The gemara offers 2 answers, אי לא אדליק מדליק אי נמי לשיעורא. Tosafos there understands this to mean as follows. the first answer is saying that if you did not light in this time (from shkia until תכלה רגל מן השוק) you missed the mitzva and cannot do the mitzva anymore, the second answer argues and says that it is coming to tell us how long the candles must burn. The Rambam as well understands the first answer as Tosafos, the Rambam however holds that the second answer is not arguing, rather it adds another requirement, how long the candles need to burn. The Rambam understands that these 2 go together and that the shiur is not in time but rather from when you light until תכלה רגל מן השוק. This is meduyak in the Rambam because he writes that תכלה רגל מן השוק is כחצי שיעור או יתר. The Rambam clearly states that the shiur of תכלה רגל מן השוק could be longer then a half hour.
According to both Tosafos and the Rambam it would seem that the mitva is a mitzva of פרסומי ניסא and therefore if you light after תכלה רגל מן השוק you are not יוצא. The Rashba however writes that the gemara did not mean that you are not יוצא at all. Rather you are not יוצא the way the Chachamim wanted but you are certainly יוצא the mitzva if you light at night. The Rashba seems to holds that it is a mitzva of night and therefore b'dieved the zman is all night. Lechatchila the chachamim said you should light when there is pirsumei nisa.
The same thing applies to lighting before the zman. According to the Rashba, just like you can do mitzva's of night starting from plag hamincha, you can light from plag hamincha. According to the Rambam there is no such din, lighting is not a mitzva of night and therefore before shkia is simply not the zman.
The obvious question on the Rambam is what about Friday night. The answer is that since Chanukka is 8 days and there must always be a Friday night, Chazal made a special takana on Friday night that you can light before shkia. According to the Rashba we don't need to come on to this, it is just the regular din of doing mitzvos of night from plag.