-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathboot.php
More file actions
59 lines (48 loc) · 2.47 KB
/
boot.php
File metadata and controls
59 lines (48 loc) · 2.47 KB
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
<?php
if (rex::isBackend()) {
rex_view::addJSFile($this->getAssetsUrl('jquery.tablesorter.min.js'));
rex_view::addCssFile($this->getAssetsUrl('theme.default.min.css'));
rex_extension::register('PAGE_STRUCTURE_HEADER', function ($params) {
$for_categories = explode(',',$this->getConfig('for_categories'));
$params = $params->getParams();
// nur in den eingestellten Kategorien ausführen
if (
(!$this->getConfig('for_all_categories') && in_array($params['category_id'],$for_categories)) ||
($this->getConfig('for_all_categories') && !in_array($params['category_id'],$for_categories))
) {
rex_extension::register('OUTPUT_FILTER', function ($params) {
// Tabelle und Pager laden
list($table2,$pager) = structure_plus::get_article_table();
// Ersetzungen durchführen
$subject = $params->getSubject();
$subject = preg_replace('/(<table.*?<\/table>.*?)<table.*?<\/table>/s','$1###tab2###',$subject,1);
$subject = str_replace('###tab2###',$table2,$subject);
rex_logger::factory()->log('notice',$pager,[],__FILE__,__LINE__);
$subject = preg_replace('/<nav class="rex-nav-pagination">.*?<\/nav>/s',$pager,$subject);
$subject .= '<script>
$(document).on(\'rex:ready\', function (e, container) {
$("#sp_table").tablesorter();
});
</script>';
return $subject;
});
}
});
// Setzt automatisch das art_online_from auf das aktuelle Datum
$extension_points = ['ART_ADDED','CAT_ADDED'];
foreach ($extension_points as $extensionpint) {
rex_extension::register($extensionpint, function ($params) {
$_params = $params->getParams();
$sql = rex_sql::factory();
$sql->setTable(rex::getTable('article'));
$sql->select();
$fields = $sql->getFieldnames();
if (in_array('art_online_from',$fields)) {
$sql->setTable(rex::getTable('article'));
$sql->setValue('art_online_from',time());
$sql->setWhere('id = :id',['id'=>$_params['id']]);
$sql->update();
}
});
}
}