-
Notifications
You must be signed in to change notification settings - Fork 0
/
fleaditlater.plugin.disabled.php
executable file
·71 lines (67 loc) · 2.88 KB
/
fleaditlater.plugin.disabled.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
<?php
/*
@name FleadItLater
@author Idleman <[email protected]>
@link http://blog.idleman.fr
@licence CC by nc sa http://creativecommons.org/licenses/by-nc-sa/2.0/fr/
@version 1.1.5
@description Le plugin FleadItLater ajoute un bouton permettant de marquer un evenement comme "a lire plus tard" qui s'affichera dans un menu de droite.
*/
function fleaditlater_plugin_AddButton(&$event){
$mysqli = new MysqlEntity();
$id = $mysqli->escape_string($event->getId());
$count = $mysqli->customQuery('SELECT COUNT(id) FROM `'.MYSQL_PREFIX.'plugin_feaditlater` WHERE event='.$id);
$count = $count->fetch_row();
if(!$count[0]){
echo '<a class="pointer fleaditLaterButton" onclick="fleadItLater('.$id.',\'add\',this);">'._t('P_FLEADITLATER_READLATER').'</a> ';
}
}
function fleaditlater_plugin_displayEvents(&$myUser){
$mysqli = new MysqlEntity();
$query = $mysqli->customQuery('SELECT le.id,le.title,le.link FROM `'.MYSQL_PREFIX.'event` le INNER JOIN `'.MYSQL_PREFIX.'plugin_feaditlater` fil ON (le.id=fil.event)');
if($query!=null){
echo '<aside class="fleaditLaterMenu">
<h3 class="left">'._t('P_FLEADITLATER_TOREAD').'</h3>
<ul class="clear">
<li>
<ul> ';
while($data = $query->fetch_array()){
echo '<li>
<img src="plugins/fleaditlater/img/read_icon.png" width="16" height="11">
<a title="'.$data['link'].'" href="'.$data['link'].'" target="_blank">
'.Functions::truncate($data['title'],37).'
</a>
<button class="right unreadForFeed" onclick="fleadItLater('.$data['id'].',\'delete\',this)">
<span title="'._t('P_FLEADITLATER_MARK_AS_READ').'" alt="'._t('P_FLEADITLATER_MARK_AS_READ').'">'._t('P_FLEADITLATER_MARK_AS_READ_SHORT').'</span>
</button>
</li>';
}
echo '</ul>
</li>
</ul>
</aside>';
}
}
function fleaditlater_plugin_action($_,$myUser){
$mysqli = new MysqlEntity();
if ($_['action']=='fleadItLater') {
if($myUser==false) exit(_t('P_FLEADITLATER_NOT_CONNECTED_ERROR'));
if (isset($_['id'])){
$id = $mysqli->escape_string($_['id']);
if(isset($_['state']) && $_['state']=='add'){
$return = $mysqli->customQuery('INSERT INTO `'.MYSQL_PREFIX.'plugin_feaditlater` (event)VALUES(\''.$id.'\')');
}else{
$return = $mysqli->customQuery('DELETE FROM `'.MYSQL_PREFIX.'plugin_feaditlater` WHERE event=\''.$id.'\'');
}
if(!$return) echo $mysqli->error;
}
}
}
Plugin::addJs("/js/main.js");
// Ajout de la fonction au Hook situé dans les options d'évenements
Plugin::addHook("event_post_top_options", "fleaditlater_plugin_AddButton");
//Ajout de la fonction au Hook situé après le menu des fluxs
Plugin::addHook("menu_post_folder_menu", "fleaditlater_plugin_displayEvents");
//Ajout des actions fleadit
Plugin::addHook("action_post_case", "fleaditlater_plugin_action");
?>