A density functional theory of polymer phase transitions and interfaces