Quantal density-functional theory in the presence of a magnetic field