summaryrefslogtreecommitdiff
path: root/public/app/views/components/theme.php
blob: af05bda9b97d277d029aa4533d7955b7b6e6ca58 (plain)
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
<?php 
/** themes
 * --- -- -- - - -
 * auto select one id of L = array.LENGTH, per month:
 * ( ( (month*31 + day) % L*2 ) div 2 )
 * this will allow theme exchange every 2 days
 * 
 * 
 * 4-day rollup:
 * --- -- -- - - -
 * supports up to 21 themes/season
 * = 84 themes/year
 * 
 * algo:
 * ( ( ( month*31 + day) % L*4 ) div 4 )
 * change seasonal theme every 4 days
 * ... Catch Exceptions:
 * if (month == 12) : month = 0
 * if (month == 6 && day == 1) then day = 2
 * 
 */

// decide a theme season according to month
$mo = intval(date('m'));

switch ($mo) {
    case 12: case 1: case 2:
        $season = 'winter';
        break;

    case 3: case 4: case 5:
        $season = 'spring';
        break;

    case 6: case 7: case 8:
        $season = 'summer';
        break;

    case 9: case 10: case 11:
        $season = 'fall';
        break;

    default:
        $season = 'spring';
}


$theme_def = [
    
    # --- summer ---

    's1' => [
        'css' => 'summer-01',
        'url' => 'https://www.freepik.com/free-photo/nazare-portugal_7487018.htm',
        'label' => 'frimufilms: North beach and ocean in Nazare, Portugal'
    ],

    's2' => [
        'css' => 'summer-02',
        'url' => 'https://www.pxfuel.com/en/desktop-wallpaper-elkiv',
        'label' => '@pxfuel: Faded orange lines'
    ],

    's5' => [
        'css' => 'summer-05',
        'url' => 'https://www.vecteezy.com/vector-art/6691305',
        'label' => 'Mohammad Arfa Affan: 3d Vectors (@Vecteezy)'
    ],

    's9' => [
        'css' => 'summer-09',
        'url' => 'https://unsplash.com/photos/cNagAGEok9k',
        'label' => 'Willian Justen de Vasconcellos: Desert, Huacachina, Peru'
    ],

    # --- fall ---

    'f8' => [
        'css' => 'fall-08',
        'url' => 'https://www.flickr.com/photos/docsearls/12114022885/',
        'label' => 'Doc Searls: Amazing Santa Barbara sunset (2014/01)'
    ],

    'f9' => [
        'css' => 'fall-09',
        'url' => 'https://www.freepik.com/free-photo/flock-birds-flying-during-sunset_13962565.htm',
        'label' => 'wirestock: View of a flock of birds flying into a beautiful sky during sunset'
    ],


    # --- winter ---

    'w3' =>  [
        'css' => 'winter-03',
        'url' => 'https://unsplash.com/photos/yzkoleKww6w',
        'label' => 'Raimond Klavins: Snow covered mountain under blue sky during daytime, Himalayas'
    ],

    'w8' =>  [
        'css' => 'winter-08',
        'url' => 'https://www.freepik.com/free-photo/3d-iceberg-blue-sea_3585791.htm',
        'label' => 'kjpargeter: 3d iceberg in blue sea'
    ],

    'w9' =>  [
        'css' => 'winter-09',
        'url' => 'https://www.freepik.com/free-photo/abstract-water-waves-with-ink-dots_5068293.htm',
        'label' => 'freepik: Abstract water waves with ink dots'
    ],

    'w10' =>  [
        'css' => 'winter-10',
        'url' => 'https://unsplash.com/photos/D1eFDB4CMj0',
        'label' => 'Vidar Nordli-Mathisen: Skogsøya, Norway'
    ],


    # --- spring ---

    'g1' => [
        'css' => 'spring-01',
        'url' => 'https://www.flickr.com/photos/youngsabroad/26305344342/',
        'label' => 'A Young Retirement: Bokeh background'
    ],

    'g4' => [
        'css' => 'spring-04',
        'url' => 'https://www.pxfuel.com/en/desktop-wallpaper-evgsz',
        'label' => '@pxfuel: Nature, lights'
    ],

    'g9' => [
        'css' => 'spring-09',
        'url' => 'https://www.flickr.com/photos/112072356@N06/14882252902/',
        'label' => 'auimeesri: banana leaf; blur green of banana leaf with water drop'
    ]


];


$themes = [

    'summer' => [ 's1', 's2', 's5', 'g9', 'g1', 's9' ],


    'fall'   => [ 'f8', 's5', 'g4', 's2', 'f9' ],


    'winter' => [ 'w3', 'w8', 'w9', 'w10' ],


    'spring' => [ 'g1', 'g4', 'w3', 'g9', 'f9' ]

];

/** check algo in the begining of this file */
$day = intval(date('d'));
$themesLen = count($themes[$season]);
if ($mo == 12)              { $mo = 0; }
if ($mo == 6 && $day == 1)  { $day == 2; }
$imageID = intdiv( ( ( $mo*31 + $day) % $themesLen*4 ), 4 );

define('THEME', $theme_def[ $themes[ $season ][ $imageID ] ]);
// testing: define('THEME', $theme_def[ $themes[ 'summer' ][ 5 ] ]);

?>
    <!-- theme overides -->
<link href="/assets/css/themes/<?=THEME['css']?>.css" rel="stylesheet">