]> git.mxchange.org Git - friendica.git/blob - view/theme/quattro/config.php
47210012caa8f7ce95ae89640781a60ce78502c1
[friendica.git] / view / theme / quattro / config.php
1 <?php
2
3 /**
4  * Theme settings
5  */
6
7 use Friendica\App;
8
9 function theme_content(App $a) {
10         if (!local_user()) {
11                 return;
12         }
13
14         $align = get_pconfig(local_user(), 'quattro', 'align' );
15         $color = get_pconfig(local_user(), 'quattro', 'color' );
16         $tfs = get_pconfig(local_user(),"quattro","tfs");
17         $pfs = get_pconfig(local_user(),"quattro","pfs");
18
19         return quattro_form($a,$align, $color, $tfs, $pfs);
20 }
21
22 function theme_post(App $a) {
23         if (! local_user()) {
24                 return;
25         }
26
27         if (isset($_POST['quattro-settings-submit'])){
28                 set_pconfig(local_user(), 'quattro', 'align', $_POST['quattro_align']);
29                 set_pconfig(local_user(), 'quattro', 'color', $_POST['quattro_color']);
30                 set_pconfig(local_user(), 'quattro', 'tfs', $_POST['quattro_tfs']);
31                 set_pconfig(local_user(), 'quattro', 'pfs', $_POST['quattro_pfs']);
32         }
33 }
34
35 function theme_admin(App $a) {
36         $align = get_config('quattro', 'align' );
37         $color = get_config('quattro', 'color' );
38         $tfs = get_config("quattro","tfs");
39         $pfs = get_config("quattro","pfs");
40
41         return quattro_form($a,$align, $color, $tfs, $pfs);
42 }
43
44 function theme_admin_post(App $a) {
45         if (isset($_POST['quattro-settings-submit'])){
46                 set_config('quattro', 'align', $_POST['quattro_align']);
47                 set_config('quattro', 'color', $_POST['quattro_color']);
48                 set_config('quattro', 'tfs', $_POST['quattro_tfs']);
49                 set_config('quattro', 'pfs', $_POST['quattro_pfs']);
50         }
51 }
52
53 /// @TODO $a is no longer used here
54 function quattro_form(App $a, $align, $color, $tfs, $pfs) {
55         $colors = array(
56                 "dark"  => "Quattro",
57                 "lilac" => "Lilac",
58                 "green" => "Green",
59         );
60
61         if ($tfs === false) {
62                 $tfs = "20";
63         }
64         if ($pfs === false) {
65                 $pfs = "12";
66         }
67
68         $t = get_markup_template("theme_settings.tpl" );
69         $o .= replace_macros($t, array(
70                 '$submit'  => t('Submit'),
71                 '$baseurl' => App::get_baseurl(),
72                 '$title'   => t("Theme settings"),
73                 '$align'   => array('quattro_align', t('Alignment'), $align, '', array('left'=>t('Left'), 'center'=>t('Center'))),
74                 '$color'   => array('quattro_color', t('Color scheme'), $color, '', $colors),
75                 '$pfs'     => array('quattro_pfs', t('Posts font size'), $pfs),
76                 '$tfs'     => array('quattro_tfs', t('Textareas font size'), $tfs),
77         ));
78         return $o;
79 }