/** * Save a slider array in the database * If ID is passed, it will update that ID. * If no ID or ID = 0, it will insert * * @param $slider = array(); of slider data * @return ID of saved slider or false if error * @since 0.0.1 */ protected function save_slider($slider) { // create a new object $slider_obj = new Enp_quiz_Save_slider(); // pass to save_sliders so we can decide // if we should insert or update the slider $slider_obj->save_slider($slider); }
/** * Save a slider array in the database * Often used in a foreach loop to loop over all sliders * If ID is passed, it will update that ID. * If no ID or ID = 0, it will insert * * @param $slider = array(); of slider data * @return ID of saved slider or false if error * @since 0.0.1 */ protected function save_slider($slider) { self::$slider = $slider; // check to see if the id exists if (self::$slider['slider_id'] === 0) { // It doesn't exist yet, so insert it! $this->insert_slider(); } else { // we have a slider_id, so update it! $this->update_slider(); } }