aboutsummaryrefslogtreecommitdiffstats
path: root/view/theme/redbasic/php/config.php
blob: 7470c399a78de473cc8d5e24b6b90d7e04d9c977 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php

function theme_content(&$a) {
	if(!local_user()) { return;}

	$nav_colour = get_pconfig(local_user(),'redbasic', 'nav_colour' );
	$background_colour = get_pconfig(local_user(),'redbasic', 'background_colour' );
	$background_image = get_pconfig(local_user(),'redbasic', 'background_image' );
	$item_colour = get_pconfig(local_user(),'redbasic', 'item_colour' );
	$item_opacity = get_pconfig(local_user(),'redbasic', 'item_opacity' );
	$font_size = get_pconfig(local_user(),'redbasic', 'font_size' );
	$font_colour = get_pconfig(local_user(),'redbasic', 'font_colour' );
	$radius = get_pconfig(local_user(),'redbasic', 'radius' );
	return redbasic_form($a, $nav_colour, $background_colour, $background_image, $item_colour, $item_opacity, 
		$font_size, $font_colour, $radius);
}

function theme_post(&$a) {
	if(!local_user()) { return;}

	if (isset($_POST['redbasic-settings-submit'])) {
		set_pconfig(local_user(), 'redbasic', 'nav_colour', $_POST['redbasic_nav_colour']);
		set_pconfig(local_user(), 'redbasic', 'background_colour', $_POST['redbasic_background_colour']);
		set_pconfig(local_user(), 'redbasic', 'background_image', $_POST['redbasic_background_image']);
		set_pconfig(local_user(), 'redbasic', 'item_colour', $_POST['redbasic_item_colour']);
		set_pconfig(local_user(), 'redbasic', 'item_opacity', $_POST['redbasic_item_opacity']);
		set_pconfig(local_user(), 'redbasic', 'font_size', $_POST['redbasic_font_size']);
		set_pconfig(local_user(), 'redbasic', 'font_colour', $_POST['redbasic_font_colour']);
		set_pconfig(local_user(), 'redbasic', 'radius', $_POST['redbasic_radius']);
	}
}

function redbasic_form(&$a, $nav_colour, $background_colour, $background_image, $item_colour, $item_opacity, 
		$font_size, $font_colour, $radius) {

		$nav_colours = array (
		  'red' => 'red',
		  'black' => 'black',	
		  'silver' => 'silver',	
		);

	  $t = get_markup_template('theme_settings.tpl');
	  $o .= replace_macros($t, array(
		'$submit' => t('Submit'),
		'$baseurl' => $a->get_baseurl(),
		'$title' => t("Theme settings"),
		'$nav_colour' => array('redbasic_nav_colour', t('Navigation bar colour'), $nav_colour, '', $nav_colours),
		'$background_colour' => array('redbasic_background_colour', t('Set the background colour'), $background_colour),
		'$background_image' => array('redbasic_background_image', t('Set the background image'), $background_image),
		'$item_colour' => array('redbasic_item_colour', t('Set the background colour of items'), $item_colour),
		'$item_opacity' => array('redbasic_item_opacity', t('Set the opacity of items'), $item_opacity),
		'$font_size' => array('redbasic_font_size', t('Set font-size for posts and comments'), $font_size),
		'$font_colour' => array('redbasic_font_colour', t('Set font-colour for posts and comments'), $font_colour),
		'$radius' => array('redbasic_radius', t('Set radius of corners'), $radius),
		));

	return $o;
}