b2evolution PHP Cross Reference Blogging Systems

Source: /inc/skins/views/_coll_skin.view.php - 103 lines - 3376 bytes - Text - Print

Description: This file implements the UI view for the Advanced blog properties. This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}. See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**
   3   * This file implements the UI view for the Advanced blog properties.
   4   *
   5   * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}.
   6   * See also {@link http://sourceforge.net/projects/evocms/}.
   7   *
   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}.
   9   *
  10   * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)
  11   *
  12   * @package admin
  13   *
  14   * @version $Id: _coll_skin.view.php 6136 2014-03-08 07:59:48Z manuel $
  15   */
  16  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  17  
  18  /**
  19   * @var Blog
  20   */
  21  global $edited_Blog;
  22  
  23  global $admin_url, $dispatcher;
  24  
  25  $skin_type = param( 'skin_type', 'string', 'normal' );
  26  
  27  $block_item_Widget = new Widget( 'block_item' );
  28  $display_same_as_normal = false;
  29  
  30  switch( $skin_type )
  31  {
  32      case 'normal':
  33          $block_item_Widget->title = T_('Choose a skin');
  34          break;
  35  
  36      case 'mobile':
  37          $block_item_Widget->title = T_('Choose a Mobile Phone skin');
  38          $display_same_as_normal = true;
  39          break;
  40  
  41      case 'tablet':
  42          $block_item_Widget->title = T_('Choose a Tablet skin');
  43          $display_same_as_normal = true;
  44          break;
  45  
  46      default:
  47          debug_die( 'Invalid skin type!' );
  48  }
  49  
  50  // Get what is the current skin ID from this kind of skin type
  51  $current_skin_ID = $edited_Blog->get_setting( $skin_type.'_skin_ID', true );
  52  
  53  if( $current_User->check_perm( 'options', 'edit', false ) )
  54  {    // We have permission to modify:
  55      $block_item_Widget->global_icon( T_('Install new skin...'), 'new', $dispatcher.'?ctrl=skins&amp;action=new&amp;redirect_to='.rawurlencode(url_rel_to_same_host(regenerate_url('','skinpage=selection','','&'), $admin_url)), T_('Install new'), 3, 4 );
  56      $block_item_Widget->global_icon( T_('Keep current skin!'), 'close', regenerate_url( 'skinpage' ), ' '.T_('Don\'t change'), 3, 4 );
  57  }
  58  
  59  $block_item_Widget->disp_template_replaced( 'block_start' );
  60  
  61      $SkinCache = & get_SkinCache();
  62      $SkinCache->load_all();
  63  
  64      if( $display_same_as_normal )
  65      {
  66          $skinshot_title = T_('Same as normal skin');
  67          $select_url = '?ctrl=coll_settings&tab=skin&blog='.$edited_Blog->ID.'&amp;action=update&amp;skinpage=selection&amp;'.$skin_type.'_skin_ID=0&amp;'.url_crumb('collection');
  68          $disp_params = array(
  69              'function'     => 'select',
  70              'selected'     => $current_skin_ID == '0',
  71              'select_url'   => $select_url,
  72          );
  73          Skin::disp_skinshot( $skinshot_title, $skinshot_title, $disp_params );
  74      }
  75  
  76      $SkinCache->rewind();
  77      while( ( $iterator_Skin = & $SkinCache->get_next() ) != NULL )
  78      {
  79          if( $iterator_Skin->type != $skin_type )
  80          {    // This skin cannot be used here...
  81              continue;
  82          }
  83  
  84          $selected = ( $current_skin_ID == $iterator_Skin->ID );
  85          $blog_skin_param = $skin_type.'_skin_ID=';
  86          $select_url = '?ctrl=coll_settings&tab=skin&blog='.$edited_Blog->ID.'&amp;action=update&amp;skinpage=selection&amp;'.$blog_skin_param.$iterator_Skin->ID.'&amp;'.url_crumb('collection');
  87          $preview_url = url_add_param( $edited_Blog->gen_blogurl(), 'tempskin='.rawurlencode($iterator_Skin->folder) );
  88  
  89          $disp_params = array(
  90              'function'     => 'select',
  91              'selected'     => $selected,
  92              'select_url'   => $select_url,
  93              'function_url' => $preview_url
  94          );
  95          // Display skinshot:
  96          Skin::disp_skinshot( $iterator_Skin->folder, $iterator_Skin->name, $disp_params );
  97      }
  98  
  99      echo '<div class="clear"></div>';
 100  
 101  $block_item_Widget->disp_template_replaced( 'block_end' );
 102  
 103  ?>

title

Description

title

Description

title

Description

title

title

Body