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
|
<div id="messagebox-container">
<? if (Request::isXhr()) : ?>
<? foreach (PageLayout::getMessages() as $messagebox) : ?>
<?= $messagebox ?>
<? endforeach ?>
<? endif; ?>
</div>
<form method="post">
<?= CSRFProtection::tokenTag() ?>
<table id="mvv_contacts" class="default collapsable">
<caption>
<span class="actions"><? printf('%s Ansprechpartner', $count) ?></span>
</caption>
<thead>
<tr>
<?= $controller->renderSortLink('shared/contacts/', _('Name/Institution'), 'name', ['style' => 'width: 40%;']) ?>
<?= $controller->renderSortLink('shared/contacts/', _('Alternative Kontaktmail'), 'alt_mail', ['style' => 'width: 20%;']) ?>
<?= $controller->renderSortLink('shared/contacts/', _('Status'), 'contact_status', ['style' => 'width: 15%;']) ?>
<?= $controller->renderSortLink('shared/contacts/', _('Zuordnungen'), 'count_relations', ['style' => 'width: 20%;']) ?>
<th style="width: 5%; text-align: right;"><?= _('Aktionen') ?></th>
</tr>
</thead>
<? if ($contacts) : ?>
<? foreach ($contacts as $mvv_contact) : ?>
<? $perm = new MvvPerm($mvv_contact) ?>
<tbody class="<?= ($contact_id == $mvv_contact->contact_id ? 'not-collapsed' : 'collapsed') ?>">
<tr class="header-row">
<td class="toggle-indicator">
<a class="mvv-load-in-new-row"
href="<?= $controller->url_for('shared/contacts/details/index', $mvv_contact->contact_id) ?>"><?= htmlReady($mvv_contact->getContactName()) ?></a>
</td>
<td class="dont-hide"><?= htmlReady($mvv_contact->alt_mail); ?></td>
<td class="dont-hide"><?= htmlReady($GLOBALS['MVV_CONTACTS']['STATUS']['values'][$mvv_contact->contact_status]['name'] ?? '') ?></td>
<td class="dont-hide"><?= htmlReady($mvv_contact->count_relations); ?></td>
<td class="dont-hide actions">
<?
$actions = ActionMenu::get()->setContext($mvv_contact->getContactName());
if ($perm->haveFieldPerm('ranges', MvvPerm::PERM_CREATE)) {
$actions->addLink(
$controller->url_for('shared/contacts/add_ranges_to_contact', $mvv_contact->contact_id),
_('Ansprechpartner zuordnen'),
Icon::create('person'),
['data-dialog' => 'size=auto']
);
$actions->addButton(
'delete_all_ranges',
_('Alle Zuordnungen löschen'),
Icon::create('trash'),
[
'data-confirm' => _('Wollen Sie wirklich alle Zuordnungen entfernen?'),
'data-dialog' => 'size=auto',
'formaction' => $controller->url_for('shared/contacts/delete_all_ranges', $mvv_contact->contact_id),
]
);
}
if ($mvv_contact->contact_status === 'extern' && $perm->havePerm(MvvPerm::PERM_CREATE)) {
$actions->addButton(
'delete_extern_contact',
_('Externe Person löschen'),
Icon::create('trash'),
[
'data-confirm' => _('Wollen Sie die externe Person wirklich löschen?'),
'data-dialog' => 'size=auto',
'formaction' => $controller->url_for('shared/contacts/delete_extern_contact', $mvv_contact->contact_id),
]
);
}
echo $actions;
?>
</td>
</tr>
<? if ($contact_id == $mvv_contact->contact_id) : ?>
<tr class="loaded-details nohover">
<?= $this->render_partial('shared/contacts/details', compact('mvv_contact')) ?>
</tr>
<? endif; ?>
</tbody>
<? endforeach; ?>
<? if ($count > MVVController::$items_per_page) : ?>
<tfoot>
<tr>
<td colspan="10" style="text-align: right">
<?
$pagination = $GLOBALS['template_factory']->open('shared/pagechooser');
$pagination->clear_attributes();
$pagination->set_attribute('perPage', MVVController::$items_per_page);
$pagination->set_attribute('num_postings', $count);
$pagination->set_attribute('page', $page);
$page_link = explode('?', $controller->action_url('index'))[0] . '?page_contacts=%s';
$pagination->set_attribute('pagelink', $page_link);
echo $pagination->render();
?>
</td>
</tr>
</tfoot>
<? endif; ?>
<? endif; ?>
</table>
</form>
<script type="text/javascript">
jQuery(function ($) {
$(document).on('dialog-close', function(event) {
if ($('div.ui-dialog.studip-confirmation').length) {
STUDIP.MVV.Contact.reload_contacttable();
}
});
});
</script>
|