PageRenderTime 11ms CodeModel.GetById 2ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/b2evolution/corporatemag/_skin.class.php

http://laibcomsthemes.googlecode.com/
PHP | 153 lines | 108 code | 9 blank | 36 comment | 7 complexity | 2e224e660cf3c634182278858e6ae02b MD5 | raw file
  1<?php
  2/**
  3 * This file implements a class derived of the generic Skin class in order to provide custom code for
  4 * the skin in this folder.
  5 *
  6 * This file is part of the b2evolution project - {@link http://b2evolution.net/}
  7 *
  8 * @package skins
  9 * @subpackage nonzero
 10 *
 11 * @version $Id: _skin.class.php,v 1.3 2009/05/24 21:14:38 fplanque Exp $
 12 */
 13if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
 14
 15/**
 16 * Specific code for this skin.
 17 *
 18 * ATTENTION: if you make a new skin you have to change the class name below accordingly
 19 */
 20class corporatemag_Skin extends Skin
 21{
 22	/**
 23	* Get default name for the skin.
 24	* Note: the admin can customize it.
 25	*/
 26	function get_default_name()
 27	{
 28		return 'corporatemag';
 29	}
 30
 31	/**
 32	* Get default type for the skin.
 33	*/
 34	function get_default_type()
 35	{
 36		return 'normal';
 37	}
 38
 39	/**
 40	* Get definitions for editable params
 41	*
 42	* @see Plugin::GetDefaultSettings()
 43	* @param local params like 'for_editing' => true
 44	*/
 45	function get_param_definitions( $params )
 46	{
 47		$r = array_merge( array(
 48			'skin_color'	=>	array(
 49				'label'		=>	T_('Skin Color'),
 50				'defaultvalue'	=>	'red',
 51				'note'		=>	'',
 52				'type'		=>	'select',
 53				'options'	=>	array(
 54					'blue'		=>	'blue',
 55					'brown'		=>	'brown',
 56					'green'		=>	'green',
 57					'magenta'	=>	'magenta',
 58					'red'		=>	'red',
 59				),
 60			),
 61			'width_style'	=>	array(
 62				'label'		=>	T_('Width Style'),
 63				'defaultvalue'	=>	'fluid',
 64				'note'		=>	'',
 65				'type'		=>	'select',
 66				'options'	=>	array(
 67					'fixed'		=>	'fixed',
 68					'fluid'		=>	'fluid',
 69				),
 70			),
 71			'column_count'	=>	array(
 72				'label'		=>	T_('No. of Columns'),
 73				'defaultvalue'	=>	'3',
 74				'note'		=>	'',
 75				'type'		=>	'select',
 76				'options'	=>	array(
 77					'3'		=>	'3',
 78					'2'		=>	'2',
 79					'1'		=>	'1',
 80				),
 81			),
 82			'html5_support'	=>	array(
 83				'label'		=>	T_('HTML5'),
 84				'defaultvalue'	=>	'1',
 85				'note'		=>	'activate HTML5 support across all browsers (as of 08/08/2009)',
 86				'type'		=>	'checkbox'
 87			),
 88			'featuredCat'	=>	array(
 89				'label'		=>	T_('featuredCat'),
 90				'defaultvalue'	=>	'1',
 91				'note'		=>	'featured Category',
 92				'type'		=>	'checkbox'
 93			),
 94			'featuredNum'	=>	array(
 95				'label'		=>	T_('featuredNum'),
 96				'defaultvalue'	=>	'5',
 97				'note'		=>	'number of featured articles',
 98				'type'		=>	'checkbox'
 99			),
100		), parent::get_param_definitions( $params ) );
101		return $r;
102	}
103
104	/**
105	* Get ready for displaying the skin.
106	*
107	* This may register some CSS or JS...
108	*/
109	function display_init()
110	{
111		// call parent:
112		parent::display_init();
113
114		// Add custom CSS:
115		$custom_css	=	'';
116		$skincolor	=	$this->get_setting('skin_color');
117		$widthstyle	=	'';
118		$html5support	=	'';
119		$featuredCat	=	'';
120		$featuredNum	=	'';
121
122		if( $this->get_setting('width_style') == 'fixed' )
123		{	// Fixed Layout
124			$widthstyle .= 'width: 950px !important; /* fixed */';
125		}
126
127		if( $this->get_setting('width_style') == 'fluid' )
128		{	// Fluid Layout
129			$widthstyle .= 'width: 90% !important; /* fluid */';
130		}
131
132		if( $this->get_setting('html5_support') == '1' )
133		{	// HTML5 Support
134			$html5support .= '
135	<!--[if IE]>
136		<script src="rsc/js/html5.js"></script>
137	<![endif]-->
138	<link rel="stylesheet" href="rsc/css/html5.css" type="text/css" />
139			';
140		}
141
142		$custom_css = ''.$html5support.'
143		<link rel="stylesheet" href="rsc/css/'.$skincolor.'.css" type="text/css" title="'.$skincolor.'" />
144		<style type="text/css">
145		div.widthstyle {
146			'.$widthstyle.'
147		}
148		</style>
149		';
150		add_headline( $custom_css );
151	}
152}
153?>