forked from mapasculturais/mapasculturais
-
Notifications
You must be signed in to change notification settings - Fork 0
/
report.php
97 lines (82 loc) · 3.2 KB
/
report.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
<?php
use MapasCulturais\Entities\Registration as R;
use MapasCulturais\Entities\Agent;
function echoStatus($registration){
switch ($registration->status){
case R::STATUS_APPROVED:
echo 'selecionada';
break;
case R::STATUS_NOTAPPROVED:
echo 'não selecionada';
break;
case R::STATUS_WAITLIST:
echo 'suplente';
break;
case R::STATUS_INVALID:
echo 'inválida';
break;
case R::STATUS_SENT:
echo 'pendente';
break;
}
}
$_properties = $app->config['registration.propertiesToExport'];
?>
<style>
tbody td, table th{
text-align: left !important;
border:1px solid black !important;
}
</style>
<table>
<thead>
<tr>
<th>Número</th>
<th>Status</th>
<?php if($entity->registrationCategories):?>
<th><?php echo $entity->registrationCategTitle ?></th>
<?php endif; ?>
<th>Arquivos</th>
<?php foreach($entity->getUsedAgentRelations() as $def): ?>
<th><?php echo $def->label; ?></th>
<?php foreach($_properties as $prop): if($prop === 'name') continue; ?>
<th><?php echo $def->label; ?> - <?php echo Agent::getPropertyLabel($prop); ?></th>
<?php endforeach; ?>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php foreach($entity->sentRegistrations as $r): ?>
<tr>
<td><a href="<?php echo $r->singleUrl; ?>" target="_blank"><?php echo $r->number; ?></a></td>
<td><?php echo echoStatus($r); ?></td>
<?php if($entity->registrationCategories):?>
<td><?php echo $r->category; ?></td>
<?php endif; ?>
<td>
<?php if(key_exists('zipArchive', $r->files)): ?>
<a href="<?php echo $r->files['zipArchive']->url; ?>">zip</a>
<?php endif; ?>
</td>
<?php
foreach($r->_getDefinitionsWithAgents() as $def):
if($def->use == 'dontUse') continue;
$agent = $def->agent;
?>
<?php if($agent): ?>
<td><a href="<?php echo $agent->singleUrl; ?>" target="_blank"><?php echo $r->agentsData[$def->agentRelationGroupName]['name'];?></a></td>
<?php
foreach($_properties as $prop):
if($prop === 'name') continue;
$val = isset($r->agentsData[$def->agentRelationGroupName][$prop]) ? $r->agentsData[$def->agentRelationGroupName][$prop] : '';
?>
<td><?php echo $prop === 'location' ? "{$val['latitude']},{$val['longitude']}" : $val ?></td>
<?php endforeach; ?>
<?php else: ?>
<?php echo str_repeat('<td></td>', count($_properties)) ?>
<?php endif; ?>
<?php endforeach ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>