Dotclear

source: plugins/cinecturlink2/inc/lib.cinecturlink2.activityreport.php @ 3247

Revision 3247, 2.5 KB checked in by JcDenis, 10 years ago (diff)

Switch to Dotclear 2.6, Add dashboard icon, Clean up code

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3#
4# This file is part of cinecturlink2, a plugin for Dotclear 2.
5#
6# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
7# contact@jcdenis.fr http://jcd.lv
8#
9# Licensed under the GPL version 2.0 license.
10# A copy of this license is available in LICENSE file or at
11# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12#
13# -- END LICENSE BLOCK ------------------------------------
14
15if (!defined('DC_RC_PATH')) {
16
17     return null;
18}
19
20# This file is used with plugin activityReport
21$core->activityReport->addGroup('cinecturlink2', __('Plugin cinecturlink2'));
22
23# from BEHAVIOR cinecturlink2AfterAddLink in cinecturlink2/inc/class.cinecturlink2.php
24$core->activityReport->addAction(
25     'cinecturlink2',
26     'create',
27     __('link creation'),
28     __('A new cineturlink named "%s" was added by "%s"'),
29     'cinecturlink2AfterAddLink',
30     array('cinecturlink2ActivityReportBehaviors', 'addLink')
31);
32# from BEHAVIOR cinecturlink2AfterUpdLink in cinecturlink2/inc/class.cinecturlink2.php
33$core->activityReport->addAction(
34     'cinecturlink2',
35     'update',
36     __('updating link'),
37     __('Cinecturlink named "%s" has been updated by "%s"'),
38     'cinecturlink2AfterUpdLink',
39     array('cinecturlink2ActivityReportBehaviors', 'updLink')
40);
41# from BEHAVIOR cinecturlink2BeforeDelLink in cinecturlink2/inc/class.cinecturlink2.php
42$core->activityReport->addAction(
43     'cinecturlink2',
44     'delete',
45     __('link deletion'),
46     __('Cinecturlink named "%s" has been deleted by "%s"'),
47     'cinecturlink2BeforeDelLink',
48     array('cinecturlink2ActivityReportBehaviors', 'delLink')
49);
50
51class cinecturlink2ActivityReportBehaviors
52{
53     public static function addLink($cur)
54     {
55          global $core;
56
57          $logs = array(
58               $cur->link_title,
59               $core->auth->getInfo('user_cn')
60          );
61
62          $core->activityReport->addLog('cinecturlink2', 'create', $logs);
63     }
64
65     public static function updLink($cur, $id)
66     {
67          global $core;
68          $C2 = new cinecturlink2($core);
69          $rs = $C2->getLinks(array('link_id'=>$id));
70
71          $logs = array(
72               $rs->link_title,
73               $core->auth->getInfo('user_cn')
74          );
75
76          $core->activityReport->addLog('cinecturlink2', 'update', $logs);
77     }
78
79     public static function delLink($id)
80     {
81          global $core;
82          $C2 = new cinecturlink2($core);
83          $rs = $C2->getLinks(array('link_id'=>$id));
84
85          $logs = array(
86               $rs->link_title,
87               $core->auth->getInfo('user_cn')
88          );
89
90          $core->activityReport->addLog('cinecturlink2', 'delete', $logs);
91     }
92}
Note: See TracBrowser for help on using the repository browser.

Sites map