Scheme for tunable quantum phase gate and effective preparation of graph-state entanglement