コード例 #1
0
 public function new_action()
 {
     $title = array('title' => 'Create New Slider', 'page' => 'unoslider', 'link' => 'Back');
     $name = '';
     $width = 960;
     $height = 350;
     $slides = '';
     $presets = null;
     $transitions = array('grow' => array('topleft', 'topright', 'bottomleft', 'bottomright'), 'swap' => array('top', 'right', 'bottom', 'left'), 'stretch' => array('center', 'vertical', 'horizontal', 'alternate'), 'squeeze' => array('center', 'vertical', 'horizontal', 'alternate'), 'shrink' => array('topleft', 'topright', 'bottomleft', 'bottomright'), 'slide_in' => array('top', 'right', 'bottom', 'left', 'alternate_vertical', 'alternate_horizontal'), 'slide_out' => array('top', 'right', 'bottom', 'left', 'alternate_vertical', 'alternate_horizontal'), 'drop' => array('topleft', 'topright', 'bottomleft', 'bottomright', 'top', 'right', 'bottom', 'left', 'alternate_vertical', 'alternate_horizontal'), 'appear' => array('topleft', 'topright', 'bottomleft', 'bottomright', 'top', 'right', 'bottom', 'left', 'alternate_vertical', 'alternate_horizontal'), 'flash' => array(), 'fade' => array());
     $patterns = array('horizontal' => array('top', 'bottom', 'topleft', 'topright', 'bottomleft', 'bottomright'), 'vertical' => array('left', 'right', 'topleft', 'topright', 'bottomleft', 'bottomright'), 'diagonal' => array('topleft', 'topright', 'bottomleft', 'bottomright'), 'random' => array(), 'spiral' => array('topleft', 'topright', 'bottomleft', 'bottomright'), 'horizontal_zigzag' => array('topleft', 'topright', 'bottomleft', 'bottomright'), 'vertical_zigzag' => array('topleft', 'topright', 'bottomleft', 'bottomright'), 'chess' => array(), 'explode' => array('center', 'top', 'right', 'bottom', 'left'), 'implode' => array('center', 'top', 'right', 'bottom', 'left'));
     $themes = array('fusion' => 'Fusion', 'basic' => 'Basic', 'elegant' => 'Elegant', 'inline' => 'Inline', 'light' => 'Light', 'minimalist' => 'Minimalist', 'modern' => 'Modern', 'panel' => 'Panel', 'ribbon' => 'Ribbon', 'slick' => 'Slick', 'smooth' => 'Smooth', 'square' => 'Square', 'text' => 'Text', 'custom' => 'Custom');
     $options = $this->_default_options();
     $this->_custom_presets();
     $this->view->empty_navigation = false;
     $this->view->empty_slideshow = false;
     $tooltips = '';
     $layers = '';
     $links = '';
     $preset = '';
     $theme = '';
     if (isset($_GET['id'])) {
         require_once UNOSLIDER_BASE . '/application/models/unoslider.php';
         $model = new Unoslider_Model();
         $old_navigation = $options['navigation'];
         $old_slideshow = $options['slideshow'];
         $data = $model->get_one($_GET['id'], 'id, title, size, theme, slides, options, links, tooltip, layers, presets');
         $size = unserialize($data->size);
         $slides = unserialize($data->slides);
         $options = unserialize($data->options);
         $tooltips = unserialize($data->tooltip);
         $layers = unserialize($data->layers);
         $links = unserialize($data->links);
         $preset = unserialize($data->presets);
         $theme = $data->theme;
         if (empty($options['navigation'])) {
             $options['navigation'] = $old_navigation;
             $this->view->empty_navigation = true;
         }
         if (empty($options['slideshow'])) {
             $options['slideshow'] = $old_slideshow;
             $this->view->empty_slideshow = true;
         }
         $title['title'] = 'Edit slider';
         $width = $size['width'];
         $height = $size['height'];
         $name = $data->title;
     }
     $this->view->options = $options;
     $this->view->tooltips = $tooltips;
     $this->view->layers = $layers;
     $this->view->links = $links;
     $this->view->presets = $preset;
     $this->view->themes = $themes;
     $this->view->theme = $theme;
     $this->view->patterns = $patterns;
     $this->view->transitions = $transitions;
     $this->view->navigation = explode(',', $options['navigation']['autohide']);
     $this->view->slides = $slides;
     $this->view->name = $name;
     $this->view->width = $width;
     $this->view->height = $height;
     $this->view->title = $title;
 }
コード例 #2
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();
     }
 }