-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy patharticle.php
95 lines (84 loc) · 4.39 KB
/
article.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
<?php
/*
@nom: article
@auteur: Maël ILLOUZ ([email protected])
@description: Page de gestion de l'affichage des articles. Sera utilisé de base ainsi que pour le scroll infini
*/
include ('common.php');
Plugin::callHook("index_pre_treatment", array(&$_));
$view = "article";
$articleConf = array();
//recuperation de tous les flux
$allFeeds = $feedManager->getFeedsPerFolder();
$tpl->assign('allFeeds',$allFeeds);
$scroll = isset($_['scroll']) ? (int) $_['scroll'] : 0;
$tpl->assign('scrollpage',$scroll);
// récupération des variables pour l'affichage
$articleConf['articlePerPages'] = (int) $configurationManager->get('articlePerPages');
$articleDisplayLink = $configurationManager->get('articleDisplayLink');
$articleDisplayDate = $configurationManager->get('articleDisplayDate');
$articleDisplayAuthor = $configurationManager->get('articleDisplayAuthor');
$articleDisplayHomeSort = $configurationManager->get('articleDisplayHomeSort');
$articleDisplayFolderSort = $configurationManager->get('articleDisplayFolderSort');
$articleDisplayMode = $configurationManager->get('articleDisplayMode');
$optionFeedIsVerbose = $configurationManager->get('optionFeedIsVerbose');
$tpl->assign('articleDisplayAuthor',$articleDisplayAuthor);
$tpl->assign('articleDisplayDate',$articleDisplayDate);
$tpl->assign('articleDisplayLink',$articleDisplayLink);
$tpl->assign('articleDisplayMode',$articleDisplayMode);
if(isset($_['hightlighted'])) {
$hightlighted = $_['hightlighted'];
$tpl->assign('hightlighted',$hightlighted);
}
$tpl->assign('time',$_SERVER['REQUEST_TIME']);
$target = '`'.MYSQL_PREFIX.'event`.`title`,`'.MYSQL_PREFIX.'event`.`unread`,`'.MYSQL_PREFIX.'event`.`favorite`,`'.MYSQL_PREFIX.'event`.`feed`,';
if($articleDisplayMode=='summary') $target .= '`'.MYSQL_PREFIX.'event`.`description`,';
if($articleDisplayMode=='content') $target .= '`'.MYSQL_PREFIX.'event`.`content`,';
if($articleDisplayLink) $target .= '`'.MYSQL_PREFIX.'event`.`link`,';
if($articleDisplayDate) $target .= '`'.MYSQL_PREFIX.'event`.`pubdate`,';
if($articleDisplayAuthor) $target .= '`'.MYSQL_PREFIX.'event`.`creator`,';
$target .= '`'.MYSQL_PREFIX.'event`.`id`';
$nblus = isset($_['nblus']) ? (int) $_['nblus'] : 0;
$articleConf['startArticle'] = ($scroll*$articleConf['articlePerPages'])-$nblus;
if ($articleConf['startArticle'] < 0) $articleConf['startArticle']=0;
$action = $_['action'];
$tpl->assign('action',$action);
$filter = array();
Plugin::callHook("article_pre_action", array(&$_,&$filter,&$articleConf));
switch($action){
/* AFFICHAGE DES EVENEMENTS D'UN FLUX EN PARTICULIER */
case 'selectedFeed':
$currentFeed = $feedManager->getById($_['feed']);
$allowedOrder = array('date'=>'pubdate DESC','older'=>'pubdate','unread'=>'unread DESC,pubdate DESC');
$order = (isset($_['order'])?$allowedOrder[$_['order']]:$allowedOrder['unread']);
$events = $currentFeed->getEvents($order,$articleConf['startArticle'],$articleConf['articlePerPages'],$target,$filter);
break;
/* AFFICHAGE DES EVENEMENTS D'UN DOSSIER EN PARTICULIER */
case 'selectedFolder':
$currentFolder = $folderManager->getById($_['folder']);
if($articleDisplayFolderSort) {$order = '`'.MYSQL_PREFIX.'event`.`pubdate` desc';} else {$order = '`'.MYSQL_PREFIX.'event`.`pubdate` asc';}
$events = $currentFolder->getEvents($order,$articleConf['startArticle'],$articleConf['articlePerPages'],$target,$filter);
break;
/* AFFICHAGE DES EVENEMENTS FAVORIS */
case 'favorites':
$filter['favorite'] = 1;
$events = $eventManager->loadAllOnlyColumn($target,$filter,'pubdate DESC',$articleConf['startArticle'].','.$articleConf['articlePerPages']);
break;
/* AFFICHAGE DES EVENEMENTS NON LUS (COMPORTEMENT PAR DEFAUT) */
case 'unreadEvents':
default:
$filter['unread'] = 1;
if($articleDisplayHomeSort) {$order = 'pubdate desc';} else {$order = 'pubdate asc';}
if($optionFeedIsVerbose) {
$events = $eventManager->loadAllOnlyColumn($target,$filter,$order,$articleConf['startArticle'].','.$articleConf['articlePerPages']);
} else {
$events = $eventManager->getEventsNotVerboseFeed($order,$articleConf['startArticle'],$articleConf['articlePerPages'],$target);
}
break;
}
$tpl->assign('events',$events);
$tpl->assign('scroll',$scroll);
$view = "article";
Plugin::callHook("index_post_treatment", array(&$events));
$html = $tpl->draw($view);
?>