private function copyMoveSlide($slideID, $targetSliderID, $operation)
 {
     if ($operation == "move") {
         $targetSlider = new BannerRotator();
         $targetSlider->initByID($targetSliderID);
         $maxOrder = $targetSlider->getMaxOrder();
         $newOrder = $maxOrder + 1;
         $arrUpdate = array("slider_id" => $targetSliderID, "slide_order" => $newOrder);
         //Update children
         $arrChildren = $this->getArrSlideChildren($slideID);
         foreach ($arrChildren as $child) {
             $childID = $child->getID();
             $this->db->update(GlobalsBannerRotator::$table_slides, $arrUpdate, array("id" => $childID));
         }
         $this->db->update(GlobalsBannerRotator::$table_slides, $arrUpdate, array("id" => $slideID));
     } else {
         //In place of copy
         $newSlideID = $this->duplicateSlide($slideID);
         $this->duplicateChildren($slideID, $newSlideID);
         $this->copyMoveSlide($newSlideID, $targetSliderID, "move");
     }
 }
 public function createSlide($sliderID, $obj = "")
 {
     $imageID = null;
     if (is_array($obj)) {
         $urlImage = UniteFunctionsBanner::getVal($obj, "url");
         $imageID = UniteFunctionsBanner::getVal($obj, "id");
     } else {
         $urlImage = $obj;
     }
     //Get max order
     $slider = new BannerRotator();
     $slider->initByID($sliderID);
     $maxOrder = $slider->getMaxOrder();
     $order = $maxOrder + 1;
     $params = array();
     if (!empty($urlImage)) {
         $params["background_type"] = "image";
         $params["image"] = $urlImage;
         if (!empty($imageID)) {
             $params["image_id"] = $imageID;
         }
     } else {
         //Create transparent slide
         $params["background_type"] = "trans";
     }
     $jsonParams = json_encode($params);
     $arrInsert = array("params" => $jsonParams, "slider_id" => $sliderID, "slide_order" => $order, "layers" => "");
     $slideID = $this->db->insert(GlobalsBannerRotator::$table_slides, $arrInsert);
     return $slideID;
 }