-
Notifications
You must be signed in to change notification settings - Fork 0
/
timeline.php
212 lines (175 loc) · 6.18 KB
/
timeline.php
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
<?php
/*
MIT License
Copyright (c) 2023 Golovanov Grigoriy
Contact e-mail: [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// Spaces between nodes
define("NODE_SPACES", 1);
define("HEAVY_VERTICAL", "┃");
define("HEAVY_VERTICAL_RIGHT", "┣");
define("HEAVY_VERTICAL_LEFT", "┫");
define("HEAVY_HORIZONTAL", "━");
define("LIGHT_VERTICAL", "│");
define("LIGHT_VERTICAL_LEFT", "┤");
define("LIGHT_VERTICAL_RIGHT", "├");
define("LIGHT_HORIZONTAL", "─");
define("DOUBLE_VERTICAL", "║");
define("DOUBLE_VERTICAL_LEFT", "╣");
define("DOUBLE_VERTICAL_RIGHT", "╠");
define("DOUBLE_HORIZONTAL", "═");
// Line style
$sLineStyle='HEAVY'; //DOUBLE, HEAVY, LIGHT
switch ($sLineStyle) {
case 'HEAVY':
define("VERTICAL", HEAVY_VERTICAL);
define("VERTICAL_LEFT", HEAVY_VERTICAL_LEFT);
define("VERTICAL_RIGHT", HEAVY_VERTICAL_RIGHT);
define("HORIZONTAL", HEAVY_HORIZONTAL);
break;
case 'LIGHT':
define("VERTICAL", LIGHT_VERTICAL);
define("VERTICAL_LEFT", LIGHT_VERTICAL_LEFT);
define("VERTICAL_RIGHT", LIGHT_VERTICAL_RIGHT);
define("HORIZONTAL", LIGHT_HORIZONTAL);
break;
case 'DOUBLE':
define("VERTICAL", DOUBLE_VERTICAL);
define("VERTICAL_LEFT", DOUBLE_VERTICAL_LEFT);
define("VERTICAL_RIGHT", DOUBLE_VERTICAL_RIGHT);
define("HORIZONTAL", DOUBLE_HORIZONTAL);
break;
}
// Array with data. Use '\n' for the new line
$aData['2009-10-11'] = "Lorem ipsum dolor sit amet";
$aData['2001-03-05'] = "Consectetur adipiscing elit";
$aData['2002-09-19'] = "Sed do eiusmod tempor incididunt \nut labore et dolore \nmagna aliqua.";
$aData['2007-08-12'] = "Ut enim ad minim veniam";
$aData['2007-09-12'] = "Quis nostrud exercitation \nullamco laboris nisi \nut aliquip ex ea \ncommodo consequat";
$aData['2003-03-25'] = "Duis aute irure dolor";
$aData['2004-12-01'] = "In reprehenderit in voluptate";
$aData['2010-01-29'] = "Velit esse cillum dolore";
$aData['2005-02-12'] = "Eu fugiat nulla pariatur.";
$aData['2006-03-09'] = "Excepteur sint occaecat cupidatat";
$aData['2008-01-23'] = "Sunt in culpa qui \nofficia deserunt mollit";
$aData['2002-07-15'] = "Anim id est laborum.";
$aData['2000-01-01'] = "Sint cillum ut enim";
ksort($aData);
?>
<html>
<head>
<link href="css/styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<center><h2>Time Line!</h2></center>
<div class="main">
<?php
for($l=0; $l<1; $l++) {
fDrawVerticalLine();
}
$m=0;
foreach($aData as $sDate=>$sStr) {
for($l=0; $l<NODE_SPACES; $l++) {
fDrawVerticalLine();
}
$aEXPn=explode("\n",$sStr);
if (($m % 2)==0) {
fDrawLeftLineSubj($sDate);
foreach($aEXPn as $sPartString) {
$sPartString=fReplaceSpaces($sPartString);
fDrawLeftLineText($sPartString);
}
} else {
fDrawRightLineSubj($sDate);
foreach($aEXPn as $sPartString) {
$sPartString=fReplaceSpaces($sPartString);
fDrawRightLineText(trim($sPartString));
}
}
$m++;
}
for($l=0; $l<1; $l++) {
fDrawVerticalLine();
}
function fReplaceSpaces($sPartString) {
$aEXP=explode(" ",trim($sPartString));
$sPartString=implode(" ", $aEXP);
return $sPartString;
}
function fDrawVerticalLine() {
print "<div class=\"container\">".
"<div class=\"column\"> </div>".
"<div class=\"horizontal_line\"> </div>".
"<div class=\"vertical_line\">".VERTICAL."</div>".
"<div class=\"column\"> </div>".
"</div>";
}
function fDrawLeftLineSubj($sLeftText) {
for($l=0; $l<5; $l++) {
$sHorizontaLine .= HORIZONTAL;
}
$sRightText=" ";
print "<div class=\"container\">".
"<div class=\"column text_right text_bold\">".$sLeftText." </div>".
"<div class=\"horizontal_line\">".$sHorizontaLine."</div>".
"<div class=\"vertical_line\">".VERTICAL_LEFT."</div>".
"<div class=\"column text_bold\">".$sRightText."</div>".
"</div>";
}
function fDrawLeftLineText($sLeftText) {
for($l=0; $l<5; $l++) {
$sHorizontaLine .= HORIZONTAL;
}
$sRightText=" ";
print "<div class=\"container\">".
"<div class=\"column text_right\">".$sLeftText." </div>".
"<div class=\"horizontal_line\"> </div>".
"<div class=\"vertical_line\">".VERTICAL."</div>".
"<div class=\"column text_right\">".$sRightText."</div>".
"</div>";
}
function fDrawRightLineSubj($sRightText) {
for($l=0; $l<5; $l++) {
$sHorizontaLine .= HORIZONTAL;
}
$sLeftText=" ";
print "<div class=\"container\">".
"<div class=\"column\">".$sLeftText."</div>".
"<div class=\"horizontal_line\"> </div>".
"<div class=\"vertical_line\">".VERTICAL_RIGHT."</div>".
"<div class=\"horizontal_line\">".$sHorizontaLine."</div>".
"<div class=\"column text_left text_bold\"> ".$sRightText."</div>".
"</div>";
}
function fDrawRightLineText($sRightText) {
for($l=0; $l<5; $l++) {
$sHorizontaLine .= HORIZONTAL;
}
$sLeftText=" ";
print "<div class=\"container\">".
"<div class=\"column\">".$sLeftText."</div>".
"<div class=\"horizontal_line\"> </div>".
"<div class=\"vertical_line\">".VERTICAL."</div>".
"<div class=\"horizontal_line\"> </div>".
"<div class=\"column\"> ".$sRightText."</div>".
"</div>";
}
?>
</div>
</body>
</html>