Magnetic order and electronic structure in thin films