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
/**
* @var Course_WikiController $controller
* @var string $sort
* @var bool $sort_asc
* @var WikiPage[]|null $pages
* @var int $last_visit
*
* @var int $num_entries
* @var int $limit
* @var int $pagenumber
*/
?>
<table class="default">
<caption>
<?= _('Letzte Änderungen') ?>
</caption>
<colgroup>
<col style="min-width: 120px;">
<col>
<col style="min-width: 150px;">
<col>
</colgroup>
<thead>
<tr class="sortable">
<th <? if ($sort === 'name') echo 'class="' . ($sort_asc ? 'sortasc' : 'sortdesc') . '"'; ?>>
<a href="<?= $controller->newpages(['sort' => 'name', 'sort_asc' => $sort !== 'name' || !$sort_asc ? 1 : 0]) ?>">
<?= _('Seitenname') ?>
</a>
</th>
<th><?= _('Text') ?></th>
<th><?= _('Autor/-in') ?></th>
<th <? if ($sort === 'chdate') echo 'class="' . ($sort_asc ? 'sortasc' : 'sortdesc') . '"'; ?>>
<a href="<?= $controller->newpages(['sort' => 'chdate', 'sort_asc' => $sort === 'chdate' && !$sort_asc ? 1 : 0]) ?>">
<?= _('Datum') ?>
</a>
</th>
<th class="actions"><?= _('Aktionen') ?></th>
</tr>
</thead>
<tbody>
<? if (count($pages) === 0): ?>
<tr>
<td colspan="4">
<?= _('Keine Seiten wurden seit Ihrem letzten Besuch verändert.') ?>
</td>
</tr>
<? endif ?>
<? foreach ($pages as $page) : ?>
<tr>
<td>
<a href="<?= $controller->page($page) ?>">
<?= htmlReady($page->name) ?>
</a>
</td>
<td>
<?
$authors = [$page->user_id => $page->user];
$versions = [$page];
$oldcontent = "";
$oldversion = $page;
while ($oldversion = $oldversion->predecessor) {
if ($oldversion->mkdate >= $last_visit && $oldversion->user_id !== User::findCurrent()->id) {
$oldcontent = $oldversion->content;
if (!isset($authors[$oldversion->user_id])) {
$versions[] = $oldversion;
$authors[$oldversion->user_id] = $oldversion->user;
}
} else {
break;
}
}
if ($oldversion) {
$oldcontent = $oldversion->content;
}
$oldcontent = strip_tags(wikiReady($oldcontent));
$content = strip_tags(wikiReady($page->content));
$commonFromStart = $controller->findLongestCommonSubstring($content, $oldcontent);
$commonFromEnd = $controller->findLongestCommonSubstring($content, $oldcontent, true);
$oldcontent = mb_substr($oldcontent, $commonFromStart, mb_strlen($oldcontent) - mb_strlen($content));
$content = mb_substr($content, $commonFromStart, $commonFromEnd - $commonFromStart);
if ($content) {
echo htmlReady(mila($content, 300), true, true);
} elseif ($oldcontent) {
echo _('Gelöscht') . ': ' . htmlReady(mila($oldcontent, 300), true, true);
}
?>
</td>
<td>
<ul class="wiki_authors">
<? foreach ($authors as $user_id => $user) : ?>
<li>
<? if ($user): ?>
<?= Avatar::getAvatarDropdownHTML($user, true) ?>
<? else: ?>
<?= _('unbekannt') ?>
<? endif; ?>
<? foreach ($versions as $version) : ?>
<? if ($version->user_id === $user_id) : ?>
<a href="<?= $controller->versiondiff($page, is_a($version, 'WikiVersion') ? $version->id : null) ?>"
title="<?= _('Einzelne Änderung anzeigen') ?>"
data-dialog>
<?= Icon::create('log')->asImg(['class' => 'text-bottom']) ?>
</a>
<? endif ?>
<? endforeach ?>
</li>
<? endforeach ?>
</ul>
</td>
<td><?= strftime('%x %X', $page->chdate) ?></td>
<td class="actions">
<?= $controller->getActionMenu($page, 'newpages') ?>
</td>
</tr>
<? endforeach ?>
</tbody>
<? if ($num_entries > $limit) : ?>
<tfoot>
<tr>
<td colspan="4" class="actions">
<?= Pagination::create($num_entries, $pagenumber, $limit)->asLinks() ?>
</td>
</tr>
</tfoot>
<? endif ?>
</table>
|