-
Notifications
You must be signed in to change notification settings - Fork 0
/
novos-colaboradores.php
70 lines (55 loc) · 2.17 KB
/
novos-colaboradores.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
<?php
$file = new \SplFileObject("testenc.csv");
$file->setFlags(\SplFileObject::READ_CSV);
$values = [];
foreach ($file as $row) {
$values[] = $row;
}
$values = array_filter($values);
$array_final = [];
foreach ($values as $key => $item) {
if (isset($item[0]) && !empty($item[0])) {
$username = explode(" ", $item[0]);
$firstname = mb_strtolower($username[0]);
$lastname = mb_strtolower(end($username));
$array_final[] = [
'firstname' => ucfirst($firstname),
'lastname' => ucfirst($lastname),
'sector' => ucwords(mb_strtolower($item[2])),
'local' => $item[1]
];
}
}
$array_final_final_mesmo = array_chunk($array_final, 4);
// print_r($array_final_final_mesmo);
// exit;
foreach ($array_final_final_mesmo as $key => $item) {
echo "<tr id='fotos_" . $key . "'>\r\n";
foreach($item as $value){
echo gerar_fotos($value['firstname'], $value['lastname']);
}
echo "</tr>\r\n";
echo "<tr id='informacoes_" . $key . "'>\r\n";
foreach($item as $value){
echo gerar_valores($value['firstname'], $value['lastname'], $value['sector'], $value['local']);
}
echo "</tr>\r\n";
}
function gerar_fotos($firstname, $lastname)
{
return '
<td width="150">
<img style="width: 120px; height: 160px; display: block; margin-left: auto; margin-right: auto; border-radius: 10%; border: 1px solid; border-color: #ab9b6a;"
src="https://arquivos.essentialnutrition.com.br/images/novos-colaboradores/' . ucfirst($firstname) . ucfirst($lastname) . '.jpg"
alt="" />
</td>';
}
function gerar_valores($firstname, $lastname, $sector, $local)
{
return
' <td width="150">
<p style="text-align: center; font-family: arial, sans-serif; color: #1a1a1a; font-size: 12px; line-height: 18px; margin-bottom: 30px;">
<b>' . ucfirst($firstname) . ' ' . ucfirst($lastname) . '<br /></b>' . ucfirst(mb_strtolower($sector)) . ' <br /> ' . $local . '
</p>
</td>';
}