All-optical controlled multifunction operation in two-dimensional photonic crystals