The medium-modified $g\to c\bar{c}$ splitting function in the BDMPS-Z formalism