public function preview_action()
 {
     require_once UNOSLIDER_BASE . '/application/models/unoslider_presets.php';
     $model = new Unoslider_Presets_Model();
     if ($_GET['preset_id'] != $_GET['preset_name']) {
         $data = $model->get_one($_GET['preset_id']);
         $this->view->response = json_encode(array('animation' => unserialize($data->animation), 'block' => unserialize($data->block), 'title' => $data->title));
     } else {
         $this->view->response = json_encode($_GET['preset_id']);
     }
     $this->render_ajax('preview');
     exit;
 }
 private function _custom_presets()
 {
     require_once UNOSLIDER_BASE . '/application/models/unoslider_presets.php';
     $model = new Unoslider_Presets_Model();
     $presets = $model->get_all('id, title, animation, block');
     $custom_presets = array();
     foreach ($presets as $id => $preset) {
         $custom_presets[$id]['id'] = $preset->id;
         $custom_presets[$id]['name'] = $preset->title;
         $custom_presets[$id]['animation'] = unserialize($preset->animation);
         $custom_presets[$id]['block'] = unserialize($preset->block);
     }
     $this->view->custom_presets = htmlspecialchars(json_encode($custom_presets));
 }
Ejemplo n.º 3
0
 private function _prepare($id)
 {
     require_once UNOSLIDER_BASE . '/application/models/unoslider.php';
     require_once UNOSLIDER_BASE . '/application/models/unoslider_presets.php';
     $model = new Unoslider_Model();
     $presets_model = new Unoslider_Presets_Model();
     $custom_presets = array();
     $slider = $model->get_one($id, 'id, title, size, theme, slides, options, links, tooltip, layers, perslide, presets');
     if (!empty($slider)) {
         $raw_presets = unserialize($slider->presets);
         if (!empty($raw_presets)) {
             $presets_ids = array_filter(array_map('map', $raw_presets), 'strlen');
             if (!empty($presets_ids)) {
                 $custom_presets = $presets_model->get_list($presets_ids);
             }
             $build_preset_object = array();
             foreach ($raw_presets as $preset) {
                 if (is_int($preset['id'])) {
                     foreach ($custom_presets as $custom_preset) {
                         if ($preset['id'] == $custom_preset->id) {
                             $build_preset_object[] = array('animation' => unserialize($custom_preset->animation), 'block' => unserialize($custom_preset->block), 'id' => $custom_preset->id);
                         }
                     }
                 } else {
                     $build_preset_object[] = $preset['name'];
                 }
             }
         }
     }
     if ($slider) {
         $size = unserialize($slider->size);
         $slides = unserialize($slider->slides);
         $perslide = unserialize($slider->perslide);
         $options = unserialize($slider->options);
         $links = unserialize($slider->links);
         $tooltips = unserialize($slider->tooltip);
         $layers = unserialize($slider->layers);
         $navigation_ex = explode(',', $options['navigation']['autohide']);
         $navigation = "[";
         foreach ($navigation_ex as $nav) {
             $navigation .= ",'" . $nav . "'";
         }
         $navigation .= ']';
         if (!empty($raw_presets)) {
             $this->view->presets = json_encode($build_preset_object);
         }
         $this->view->options = $options;
         $this->view->navigation = $navigation;
         $this->view->slides = $slides;
         $this->view->links = $links;
         $this->view->tooltips = $tooltips;
         $this->view->layers = $layers;
         $this->view->perslide = $perslide;
         $this->view->width = $size['width'];
         $this->view->height = $size['height'];
         $this->view->theme = $slider->theme;
         //$this->view->title = $title;
         $this->view->id = $id;
         $this->view->enable();
     } else {
         $this->view->disable();
     }
 }