aboutsummaryrefslogtreecommitdiffstats
path: root/view/theme/diabook/config.php
blob: 2a418909b0254a637d3198f542e6d2ea56467bbf (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php
/**
 * Theme settings
 */



function theme_content(&$a){
	if(!local_user())
		return;		
	
	$font_size = get_pconfig(local_user(), 'diabook', 'font_size' );
	$line_height = get_pconfig(local_user(), 'diabook', 'line_height' );
	$resolution = get_pconfig(local_user(), 'diabook', 'resolution' );
	$color = get_pconfig(local_user(), 'diabook', 'color' );
	$TSearchTerm = get_pconfig(local_user(), 'diabook', 'TSearchTerm' );
	$ELZoom = get_pconfig(local_user(), 'diabook', 'ELZoom' );
	$ELPosX = get_pconfig(local_user(), 'diabook', 'ELPosX' );
	$ELPosY = get_pconfig(local_user(), 'diabook', 'ELPosY' );
	$close_pages = get_pconfig(local_user(), 'diabook', 'close_pages' );
	$close_mapquery = get_pconfig(local_user(), 'diabook', 'close_mapquery' );
	$close_profiles = get_pconfig(local_user(), 'diabook', 'close_profiles' );
	$close_helpers = get_pconfig(local_user(), 'diabook', 'close_helpers' );
	$close_services = get_pconfig(local_user(), 'diabook', 'close_services' );
	$close_friends = get_pconfig(local_user(), 'diabook', 'close_friends' );
	$close_twitter = get_pconfig(local_user(), 'diabook', 'close_twitter' );
	$close_lastusers = get_pconfig(local_user(), 'diabook', 'close_lastusers' );
	$close_lastphotos = get_pconfig(local_user(), 'diabook', 'close_lastphotos' );
	$close_lastlikes = get_pconfig(local_user(), 'diabook', 'close_lastlikes' );
	
	
	return diabook_form($a,$font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY, $close_pages, $close_mapquery, $close_profiles, $close_helpers, $close_services, $close_friends, $close_twitter, $close_lastusers, $close_lastphotos, $close_lastlikes);
}

function theme_post(&$a){
	if(! local_user())
		return;
	
	if (isset($_POST['diabook-settings-submit'])){
		set_pconfig(local_user(), 'diabook', 'font_size', $_POST['diabook_font_size']);
		set_pconfig(local_user(), 'diabook', 'line_height', $_POST['diabook_line_height']);
		set_pconfig(local_user(), 'diabook', 'resolution', $_POST['diabook_resolution']);
		set_pconfig(local_user(), 'diabook', 'color', $_POST['diabook_color']);	
		set_pconfig(local_user(), 'diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);	
		set_pconfig(local_user(), 'diabook', 'ELZoom', $_POST['diabook_ELZoom']);	
		set_pconfig(local_user(), 'diabook', 'ELPosX', $_POST['diabook_ELPosX']);	
		set_pconfig(local_user(), 'diabook', 'ELPosY', $_POST['diabook_ELPosY']);	
		set_pconfig(local_user(), 'diabook', 'ELPosY', $_POST['diabook_ELPosY']);
		set_pconfig(local_user(), 'diabook', 'close_pages', $_POST['diabook_close_pages']);
		set_pconfig(local_user(), 'diabook', 'close_mapquery', $_POST['diabook_close_mapquery']);
		set_pconfig(local_user(), 'diabook', 'close_profiles', $_POST['diabook_close_profiles']);
		set_pconfig(local_user(), 'diabook', 'close_helpers', $_POST['diabook_close_helpers']);
		set_pconfig(local_user(), 'diabook', 'close_services', $_POST['diabook_close_services']);
		set_pconfig(local_user(), 'diabook', 'close_friends', $_POST['diabook_close_friends']);
		set_pconfig(local_user(), 'diabook', 'close_twitter', $_POST['diabook_close_twitter']);
		set_pconfig(local_user(), 'diabook', 'close_lastusers', $_POST['diabook_close_lastusers']);
		set_pconfig(local_user(), 'diabook', 'close_lastphotos', $_POST['diabook_close_lastphotos']);
		set_pconfig(local_user(), 'diabook', 'close_lastlikes', $_POST['diabook_close_lastlikes']);
			
	}
}


function theme_admin(&$a){
	$font_size = get_config('diabook', 'font_size' );
	$line_height = get_config('diabook', 'line_height' );
	$resolution = get_config('diabook', 'resolution' );
	$color = get_config('diabook', 'color' );	
	$TSearchTerm = get_config('diabook', 'TSearchTerm' );	
	$ELZoom = get_config('diabook', 'ELZoom' );
	$ELPosX = get_config('diabook', 'ELPosX' );
	$ELPosY = get_config('diabook', 'ELPosY' );
	$close_pages = get_config('diabook', 'close_pages' );
	$close_mapquery = get_config('diabook', 'close_mapquery' );
	$close_profiles = get_config('diabook', 'close_profiles' );
	$close_helpers = get_config('diabook', 'close_helpers' );
	$close_services = get_config('diabook', 'close_services' );
	$close_friends = get_config('diabook', 'close_friends' );
	$close_twitter = get_config('diabook', 'close_twitter' );
	$close_lastusers = get_config('diabook', 'close_lastusers' );
	$close_lastphotos = get_config('diabook', 'close_lastphotos' );
	$close_lastlikes = get_config('diabook', 'close_lastlikes' );
	
	return diabook_form($a,$font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY, $close_pages, $close_mapquery, $close_profiles, $close_helpers, $close_services, $close_friends, $close_twitter, $close_lastusers, $close_lastphotos, $close_lastlikes);
}

function theme_admin_post(&$a){
	if (isset($_POST['diabook-settings-submit'])){
		set_config('diabook', 'font_size', $_POST['diabook_font_size']);
		set_config('diabook', 'line_height', $_POST['diabook_line_height']);
		set_config('diabook', 'resolution', $_POST['diabook_resolution']);
		set_config('diabook', 'color', $_POST['diabook_color']);
		set_config('diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);
		set_config('diabook', 'ELZoom', $_POST['diabook_ELZoom']);
		set_config('diabook', 'ELPosX', $_POST['diabook_ELPosX']);
		set_config('diabook', 'close_pages', $_POST['diabook_close_pages']);
		set_config('diabook', 'close_mapquery', $_POST['diabook_close_mapquery']);
		set_config('diabook', 'close_profiles', $_POST['diabook_close_profiles']);
		set_config('diabook', 'close_helpers', $_POST['diabook_close_helpers']);
		set_config('diabook', 'close_services', $_POST['diabook_close_services']);
		set_config('diabook', 'close_friends', $_POST['diabook_close_friends']);
		set_config('diabook', 'close_twitter', $_POST['diabook_close_twitter']);
		set_config('diabook', 'close_lastusers', $_POST['diabook_close_lastusers']);
		set_config('diabook', 'close_lastphotos', $_POST['diabook_close_lastphotos']);
		set_config('diabook', 'close_lastlikes', $_POST['diabook_close_lastlikes']);
		
	}
}


function diabook_form(&$a, $font_size, $line_height, $resolution, $color, $TSearchTerm, $ELZoom, $ELPosX, $ELPosY, $close_pages, $close_mapquery, $close_profiles, $close_helpers, $close_services, $close_friends, $close_twitter, $close_lastusers, $close_lastphotos, $close_lastlikes){
	$line_heights = array(
		"1.3"=>"1.3",
		"---"=>"---",
		"1.6"=>"1.6",				
		"1.5"=>"1.5",		
		"1.4"=>"1.4",
		"1.2"=>"1.2",
		"1.1"=>"1.1",
	);
	
	$font_sizes = array(
		'14'=>'14',
		"---"=>"---",
		"16"=>"16",		
		"15"=>"15",
		'13.5'=>'13.5',
		'13'=>'13',		
		'12.5'=>'12.5',
		'12'=>'12',
		);
	$resolutions = array(
		'normal'=>'normal',
		'wide'=>'wide',		
		);
	$colors = array(
		'diabook'=>'diabook',
		'aerith'=>'aerith',		
		'blue'=>'blue',		
		'green'=>'green',
		'pink'=>'pink',	
		'red'=>'red',
		'dark'=>'dark',						
		);
	$close_pagesC = array(
		'0'=>'show',	
		'1'=>'hide',							
		);
	$close_mapqueryC = array(
		'0'=>'show',	
		'1'=>'hide',									
		);
	$close_profilesC = array(
		'0'=>'show',	
		'1'=>'hide',								
		);
	$close_helpersC = array(
	   '0'=>'show',	
		'1'=>'hide',									
		);
	$close_servicesC = array(
		'0'=>'show',	
		'1'=>'hide',							
		);
	$close_friendsC = array(
		'0'=>'show',	
		'1'=>'hide',								
		);
	$close_twitterC = array(
		'0'=>'show',	
		'1'=>'hide',								
		);
	$close_lastusersC = array(
		'0'=>'show',	
		'1'=>'hide',									
		);
	$close_lastphotosC = array(
		'0'=>'show',	
		'1'=>'hide',								
		);
	$close_lastlikesC = array(
		'0'=>'show',	
		'1'=>'hide',								
		);
		
	
	
	$t = file_get_contents( dirname(__file__). "/theme_settings.tpl" );
	$o .= replace_macros($t, array(
		'$submit' => t('Submit'),
		'$baseurl' => $a->get_baseurl(),
		'$title' => t("Theme settings"),
		'$font_size' => array('diabook_font_size', t('Set font-size for posts and comments'), $font_size, '', $font_sizes),
		'$line_height' => array('diabook_line_height', t('Set line-height for posts and comments'), $line_height, '', $line_heights),
		'$resolution' => array('diabook_resolution', t('Set resolution for middle column'), $resolution, '', $resolutions),
		'$color' => array('diabook_color', t('Set color scheme'), $color, '', $colors),	
		'$TSearchTerm' => array('diabook_TSearchTerm', t('Set twitter search term'), $TSearchTerm, '', $TSearchTerm),	
		'$ELZoom' => array('diabook_ELZoom', t('Set zoomfactor for Earth Layer'), $ELZoom, '', $ELZoom),	
		'$ELPosX' => array('diabook_ELPosX', t('Set longitude (X) for Earth Layer'), $ELPosX, '', $ELPosX),	
		'$ELPosY' => array('diabook_ELPosY', t('Set latitude (Y) for Earth Layer'), $ELPosY, '', $ELPosY),	
		'$close_pages' => array('diabook_close_pages', t('Community Pages'), $close_pages, '', $close_pagesC),	
		'$close_mapquery' => array('diabook_close_mapquery', t('Earth Layers'), $close_mapquery, '', $close_mapqueryC),		
		'$close_profiles' => array('diabook_close_profiles', t('Community Profiles'), $close_profiles, '', $close_profilesC),		
		'$close_helpers' => array('diabook_close_helpers', t('Help or @NewHere ?'), $close_helpers, '', $close_helpersC),		
		'$close_services' => array('diabook_close_services', t('Connect Services'), $close_services, '', $close_servicesC),			
		'$close_friends' => array('diabook_close_friends', t('Find Friends'), $close_friends, '', $close_friendsC),				
		'$close_twitter' => array('diabook_close_twitter', t('Last Tweets'), $close_twitter, '', $close_twitterC),				
		'$close_lastusers' => array('diabook_close_lastusers', t('Last users'), $close_lastusers, '', $close_lastusersC),				
		'$close_lastphotos' => array('diabook_close_lastphotos', t('Last photos'), $close_lastphotos, '', $close_lastphotosC),				
		'$close_lastlikes' => array('diabook_close_lastlikes', t('Last likes'), $close_lastlikes, '', $close_lastlikesC),				
	));
	return $o;
}