@@ -16,66 +16,63 @@ require('./header.inc.phtml'); ?>
16
16
<label for="order">Order by:</label>
17
17
<select class="form-control form-control-sm" name="order" id="order" onchange="form.submit();"
18
18
style="display:inline-block;width:200px;">
19
- <option value="created-asc"<?php
19
+ <option value="created-asc"<?
20
20
if ($ order === 'created-asc ' ) { echo ' selected="selected" ' ;
21
21
} ?> >Created (Ascending)</option>
22
- <option value="created-desc"<?php
22
+ <option value="created-desc"<?
23
23
if ($ order === 'created-desc ' ) { echo ' selected="selected" ' ;
24
24
} ?> >Created (Descending)</option>
25
- <option value="id-asc"<?php
25
+ <option value="id-asc"<?
26
26
if ($ order === 'id-asc ' ) { echo ' selected="selected" ' ;
27
27
} ?> >Id (Ascending)</option>
28
- <option value="id-desc"<?php
28
+ <option value="id-desc"<?
29
29
if ($ order === 'id-desc ' ) { echo ' selected="selected" ' ;
30
30
} ?> >Id (Descending)</option>
31
- <option value="title-asc"<?php
31
+ <option value="title-asc"<?
32
32
if ($ order === 'title-asc ' ) { echo ' selected="selected" ' ;
33
33
} ?> >Title (Ascending)</option>
34
- <option value="title-desc"<?php
34
+ <option value="title-desc"<?
35
35
if ($ order === 'title-desc ' ) { echo ' selected="selected" ' ;
36
36
} ?> >Title (Descending)</option>
37
- <option value="updated-asc"<?php
37
+ <option value="updated-asc"<?
38
38
if ($ order === 'updated-asc ' ) { echo ' selected="selected" ' ;
39
39
} ?> >Updated (Ascending)</option>
40
- <option value="updated-desc"<?php
40
+ <option value="updated-desc"<?
41
41
if ($ order === 'updated-desc ' ) { echo ' selected="selected" ' ;
42
42
} ?> >Updated (Descending)</option>
43
- <option value="user-id-asc"<?php
43
+ <option value="user-id-asc"<?
44
44
if ($ order === 'user-id-asc ' ) { echo ' selected="selected" ' ;
45
45
} ?> >User Id (Ascending)</option>
46
- <option value="user-id-desc"<?php
46
+ <option value="user-id-desc"<?
47
47
if ($ order === 'user-id-desc ' ) { echo ' selected="selected" ' ;
48
48
} ?> >User Id (Descending)</option>
49
49
</select>
50
50
<input class="btn btn-sm btn-secondary" type="submit" value="Reorder"/>
51
51
</form>
52
52
<table class="table table-hover table-striped" id="docs_tbl">
53
- <thead>
54
- <tr>
55
- <th class="left">Found <?php echo number_format ($ this ->getContext ()->sum_documents ); ?> document<?php echo ($ this ->getContext ()->sum_documents != 1 ? "s " : "" ); ?> </th>
56
- <th class="left">Author</th>
57
- </tr>
58
- </thead><tbody>
59
- <?php foreach ($ this ->getContext ()->documents as $ document ) {
60
- $ user = $ document ->getUser ();
61
- if ($ user ) {
62
- $ user_url = $ user ->getURI ();
63
- $ avatar_url = $ user ->getAvatarURI (22 );
64
- }
65
- ?>
66
- <tr>
67
- <td><strong><a href="<?php echo $ document ->getURI (); ?> "><?php echo filter_var ($ document ->getTitle (), FILTER_SANITIZE_STRING ); ?> </a></strong><br/><span style="color:#aaa;"><?php echo rtrim (Common::stripUpTo (Common::stripUpTo (trim (filter_var ($ document ->getContent (true ), FILTER_SANITIZE_STRING )), "\n" , 90 ), ". " , 90 ), ". " ); ?> </span></td>
68
- <td><?php if ($ user ) { ?> <a href="<?php echo $ user_url ; ?> "><img class="avatar" src="<?php echo $ avatar_url ; ?> "/> <?php echo filter_var ($ user ->getName (), FILTER_SANITIZE_STRING ); ?> </a><?php } else { ?> Anonymous<?php } ?> </td>
69
- </tr>
70
- <?php } ?>
53
+ <thead><tr><th class="left">Document</th><th class="left">Author</th></tr></thead><tbody>
54
+ <? foreach ($ this ->getContext ()->documents as $ document )
55
+ {
56
+ $ doc_title = filter_var ($ document ->getTitle (), FILTER_SANITIZE_FULL_SPECIAL_CHARS );
57
+ $ doc_brief = rtrim (Common::stripUpTo (Common::stripUpTo (trim (filter_var ($ document ->getContent (true ), FILTER_SANITIZE_STRING )), "\n" , 128 ), '. ' , 128 ), '. ' );
58
+ $ doc_user = $ document ->getUser ();
59
+ $ doc_user_string = ($ doc_user ?
60
+ sprintf ('<a href="%s"><img class="img-fluid rounded mr-2" src="%s"/>%s</a> ' ,
61
+ $ doc_user ->getURI (), $ doc_user ->getAvatarURI (40 ), filter_var ($ doc_user ->getName (), FILTER_SANITIZE_FULL_SPECIAL_CHARS )
62
+ ) : 'Anonymous '
63
+ );
64
+ echo '<tr><td><strong><a href=" ' . $ document ->getURI () . '"> ' . $ doc_title . '</a></strong><br/> '
65
+ . '<span class="text-muted"> ' . $ doc_brief . '</span></td><td> ' . $ doc_user_string . '</td></tr> ' ;
66
+ } ?>
71
67
</tbody></table>
72
68
</div>
73
- <?php ob_start (); ?>
69
+ <? ob_start (); ?>
74
70
<script type="text/javascript">
75
71
$(document).ready(function(){
76
72
$('#order_by_form').hide();
77
73
$('#docs_tbl').DataTable({
78
- "responsive": true
74
+ "language": {"zeroRecords": "No matching documents found"},
75
+ "responsive": true,
79
76
});
80
77
});
81
78
</script>
0 commit comments