zoneclearFeedServer/inc/class.zcfsactivityreportbeh...

160 lines
4.6 KiB
PHP
Raw Normal View History

2021-09-11 09:57:13 +00:00
<?php
/**
* @brief zoneclearFeedServer, a plugin for Dotclear 2
2021-11-06 15:30:19 +00:00
*
2021-09-11 09:57:13 +00:00
* @package Dotclear
* @subpackage Plugin
2021-11-06 15:30:19 +00:00
*
2021-09-11 09:57:13 +00:00
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
2021-11-06 15:30:19 +00:00
*
2021-09-11 09:57:13 +00:00
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
# This file is used with plugin activityReport
2022-11-15 20:05:21 +00:00
dcCore::app()->activityReport->addGroup(
2021-09-11 09:57:13 +00:00
'zoneclearFeedServer',
__('Plugin zoneclearFeedServer')
);
# from BEHAVIOR zoneclearFeedServerAfterAddFeed in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
2022-11-15 20:05:21 +00:00
dcCore::app()->activityReport->addAction(
2021-09-11 09:57:13 +00:00
'zoneclearFeedServer',
'create',
__('feed creation'),
__('A new feed named "%s" point to "%s" was added by "%s"'),
'zoneclearFeedServerAfterAddFeed',
2021-09-12 20:35:57 +00:00
['zoneclearFeedServerActivityReportBehaviors', 'addFeed']
2021-09-11 09:57:13 +00:00
);
# from BEHAVIOR zoneclearFeedServerAfterUpdFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
2022-11-15 20:05:21 +00:00
dcCore::app()->activityReport->addAction(
2021-09-11 09:57:13 +00:00
'zoneclearFeedServer',
'updatefeedinfo',
__('updating feed info'),
__('Feed named "%s" point to "%s" has been updated by "%s"'),
'zoneclearFeedServerAfterUpdFeed',
2021-09-12 20:35:57 +00:00
['zoneclearFeedServerActivityReportBehaviors', 'updFeedInfo']
2021-09-11 09:57:13 +00:00
);
# from BEHAVIOR zoneclearFeedServerAfterUpdFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
2022-11-15 20:05:21 +00:00
dcCore::app()->activityReport->addAction(
2021-09-11 09:57:13 +00:00
'zoneclearFeedServer',
'updatefeedrecords',
__('updating feed records'),
__('Records of the feed named "%s" have been updated automatically'),
'zoneclearFeedServerAfterUpdFeed',
2021-09-12 20:35:57 +00:00
['zoneclearFeedServerActivityReportBehaviors', 'updFeedRecord']
2021-09-11 09:57:13 +00:00
);
# from BEHAVIOR zoneclearFeedServerAfterDelFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
2022-11-15 20:05:21 +00:00
dcCore::app()->activityReport->addAction(
2021-09-11 09:57:13 +00:00
'zoneclearFeedServer',
'delete',
__('feed deletion'),
__('Feed named "%s" point to "%s" has been deleted by "%s"'),
'zoneclearFeedServerAfterDelFeed',
2021-09-12 20:35:57 +00:00
['zoneclearFeedServerActivityReportBehaviors', 'delFeed']
2021-09-11 09:57:13 +00:00
);
# from BEHAVIOR zoneclearFeedServerAfterEnableFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
2022-11-15 20:05:21 +00:00
dcCore::app()->activityReport->addAction(
2021-09-11 09:57:13 +00:00
'zoneclearFeedServer',
'status',
__('feed status'),
__('Feed named "%s" point to "%s" has been set to "%s"'),
'zoneclearFeedServerAfterEnableFeed',
2021-09-12 20:35:57 +00:00
['zoneclearFeedServerActivityReportBehaviors', 'enableFeed']
2021-09-11 09:57:13 +00:00
);
class zoneclearFeedServerActivityReportBehaviors
{
public static function addFeed($cur)
{
2021-09-12 20:35:57 +00:00
$logs = [
2021-09-11 09:57:13 +00:00
$cur->feed_name,
$cur->feed_feed,
2022-11-15 20:05:21 +00:00
dcCore::app()->auth->getInfo('user_cn'),
2021-09-12 20:35:57 +00:00
];
2021-09-11 09:57:13 +00:00
2022-11-15 20:05:21 +00:00
dcCore::app()->activityReport->addLog(
2021-09-11 09:57:13 +00:00
'zoneclearFeedServer',
'create',
$logs
);
}
public static function updFeedInfo($cur, $id)
{
if (defined('DC_CONTEXT_ADMIN')) {
2022-11-15 20:05:21 +00:00
$zc = new zoneclearFeedServer();
2021-09-12 20:35:57 +00:00
$rs = $zc->getFeeds(['feed_id' => $id]);
2021-09-11 09:57:13 +00:00
2021-09-12 20:35:57 +00:00
$logs = [
2021-09-11 09:57:13 +00:00
$rs->feed_name,
$rs->feed_feed,
2022-11-15 20:05:21 +00:00
dcCore::app()->auth->getInfo('user_cn'),
2021-09-12 20:35:57 +00:00
];
2021-09-11 09:57:13 +00:00
2022-11-15 20:05:21 +00:00
dcCore::app()->activityReport->addLog(
2021-09-11 09:57:13 +00:00
'zoneclearFeedServer',
'updatefeedinfo',
$logs
);
}
}
2021-11-06 15:30:19 +00:00
public static function updFeedRecord($cur, $id)
2021-09-11 09:57:13 +00:00
{
if (!defined('DC_CONTEXT_ADMIN')) {
2022-11-15 20:05:21 +00:00
$zc = new zoneclearFeedServer();
2021-09-12 20:35:57 +00:00
$rs = $zc->getFeeds(['feed_id' => $id]);
2021-09-11 09:57:13 +00:00
2021-09-12 20:35:57 +00:00
$logs = [
2022-11-15 20:05:21 +00:00
$rs->feed_name,
2021-09-12 20:35:57 +00:00
];
2021-09-11 09:57:13 +00:00
2022-11-15 20:05:21 +00:00
dcCore::app()->activityReport->addLog(
2021-09-11 09:57:13 +00:00
'zoneclearFeedServer',
'updatefeedrecords',
$logs
);
}
}
public static function delFeed($id)
{
2022-11-15 20:05:21 +00:00
$zc = new zoneclearFeedServer();
2021-09-12 20:35:57 +00:00
$rs = $zc->getFeeds(['feed_id' => $id]);
2021-09-11 09:57:13 +00:00
2021-09-12 20:35:57 +00:00
$logs = [
2021-09-11 09:57:13 +00:00
$rs->feed_name,
$rs->feed_feed,
2022-11-15 20:05:21 +00:00
dcCore::app()->auth->getInfo('user_cn'),
2021-09-12 20:35:57 +00:00
];
2021-09-11 09:57:13 +00:00
2022-11-15 20:05:21 +00:00
dcCore::app()->activityReport->addLog(
2021-09-11 09:57:13 +00:00
'zoneclearFeedServer',
'delete',
$logs
);
}
public static function enableFeed($id, $enable, $time)
{
2022-11-15 20:05:21 +00:00
$zc = new zoneclearFeedServer();
2021-09-12 20:35:57 +00:00
$rs = $zc->getFeeds(['feed_id' => $id]);
2021-09-11 09:57:13 +00:00
2021-09-12 20:35:57 +00:00
$logs = [
2021-09-11 09:57:13 +00:00
$rs->feed_name,
$rs->feed_feed,
2022-11-15 20:05:21 +00:00
$enable ? 'enable' : 'disable',
2021-09-12 20:35:57 +00:00
];
2021-09-11 09:57:13 +00:00
2022-11-15 20:05:21 +00:00
dcCore::app()->activityReport->addLog(
2021-09-11 09:57:13 +00:00
'zoneclearFeedServer',
'status',
$logs
);
}
2021-11-06 15:30:19 +00:00
}