-
Notifications
You must be signed in to change notification settings - Fork 0
/
web_content_talks.php
129 lines (113 loc) · 2.6 KB
/
web_content_talks.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
<?php
// config
$filename = 'output_web_talks.html';
include 'functions.php';
date_default_timezone_set('utc');
include 'simplexlsx/simplexlsx.class.php';
$xlsx = new SimpleXLSX('talks_bios.xlsx');
// write header
file_put_contents($filename, '<html><head><meta charset="utf-8"></head><body>'."\n\n");
$topics = array();
foreach( $xlsx->rows() as $line => $row) {
if ($line === 0 || $line === 1){
continue;
}
$speaker1 = trim($row[0]);
$speaker2 = trim($row[1]);
$speaker3 = trim($row[2]);
$topic = trim($row[3]);
$titleTalk = trim($row[4]);
$abstract = trim($row[5]);
$bio1 = trim($row[6]);
$bio2 = trim($row[7]);
$bio3 = trim($row[8]);
$jobDesc1 = trim($row[9]);
$jobDesc2 = trim($row[10]);
$jobDesc3 = trim($row[11]);
$day = trim($row[12]);
$start = trim($row[13]);
$end = trim($row[14]);
$mail1 = trim($row[15]);
$mail2 = trim($row[16]);
$mail3 = trim($row[17]);
// skip i.e. lightning talks
if( $mail1 === '' ) {
continue;
}
// Generate speaker list
if($jobDesc1 !== '') {
$speakerList = sprintf(
'<a href="%s">%s</a> (%s)',
getSpeakerURL($speaker1),
$speaker1,
$jobDesc1
);
}
else {
$speakerList = sprintf(
'<a href="%s">%s</a>',
getSpeakerURL($speaker1),
$speaker1
);
}
if( $speaker2 !== '') {
if($jobDesc2 !== '') {
$speakerList = sprintf(
'%s, <a href="%s">%s</a> (%s)',
$speakerList,
getSpeakerURL($speaker2),
$speaker2,
$jobDesc2
);
}
else {
$speakerList = sprintf(
'%s, <a href="%s">%s</a>',
$speakerList,
getSpeakerURL($speaker2),
$speaker2
);
}
}
if( $speaker3 !== '') {
if($jobDesc3 !== '') {
$speakerList = sprintf(
'%s, <a href="%s">%s</a> (%s)',
$speakerList,
getSpeakerURL($speaker3),
$speaker3,
$jobDesc3
);
}
else {
$speakerList = sprintf(
'%s, <a href="%s">%s</a>',
$speakerList,
getSpeakerURL($speaker3),
$speaker3
);
}
}
$date = sprintf('%s from: %s ~ to: %s', $day, $start, $end);
$text = sprintf(
'<h2 id="%s">%s [%s]</h2>'."\n".
'<p><i>%s</i></p>'."\n".
'<p>%s</p>'."\n".
'<p><small>%s</small></p>'."\n\n",
getAnchor($titleTalk),
$titleTalk,
$topic,
$speakerList,
$abstract,
$date
);
$topics[$topic][] = $text;
}
foreach($topics as $topic => $talks) {
foreach($talks as $talk) {
file_put_contents($filename, sprintf("%s\n", $talk), FILE_APPEND );
}
file_put_contents($filename, "<!-- ********** NEXT TOPIC ********** -->\n\n", FILE_APPEND );
}
// write footer
file_put_contents($filename, "\n\n".'</body></html>', FILE_APPEND);