cinecturlink2/inc/lib.cinecturlink2.activityreport.php

85 lines
2.6 KiB
PHP
Raw Normal View History

2021-09-07 12:33:18 +00:00
<?php
/**
* @brief cinecturlink2, a plugin for Dotclear 2
2021-11-02 22:55:41 +00:00
*
* @package Dotclear
* @subpackage Plugin
2021-11-02 22:55:41 +00:00
*
* @author Jean-Christian Denis and Contributors
2021-11-02 22:55:41 +00:00
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2021-09-07 12:33:18 +00:00
if (!defined('DC_RC_PATH')) {
return null;
2021-09-07 12:33:18 +00:00
}
class cinecturlink2ActivityReportBehaviors
{
2022-11-17 21:01:00 +00:00
public static function add()
{
2022-11-17 21:01:00 +00:00
dcCore::app()->activityReport->addGroup('cinecturlink2', __('Plugin cinecturlink2'));
2021-09-07 12:33:18 +00:00
// from BEHAVIOR cinecturlink2AfterAddLink in cinecturlink2/inc/class.cinecturlink2.php
2022-11-17 21:01:00 +00:00
dcCore::app()->activityReport->addAction(
'cinecturlink2',
'create',
__('link creation'),
__('A new cineturlink named "%s" was added by "%s"'),
'cinecturlink2AfterAddLink',
['cinecturlink2ActivityReportBehaviors', 'addLink']
);
// from BEHAVIOR cinecturlink2AfterUpdLink in cinecturlink2/inc/class.cinecturlink2.php
2022-11-17 21:01:00 +00:00
dcCore::app()->activityReport->addAction(
'cinecturlink2',
'update',
__('updating link'),
__('Cinecturlink named "%s" has been updated by "%s"'),
'cinecturlink2AfterUpdLink',
['cinecturlink2ActivityReportBehaviors', 'updLink']
);
// from BEHAVIOR cinecturlink2BeforeDelLink in cinecturlink2/inc/class.cinecturlink2.php
2022-11-17 21:01:00 +00:00
dcCore::app()->activityReport->addAction(
'cinecturlink2',
'delete',
__('link deletion'),
__('Cinecturlink named "%s" has been deleted by "%s"'),
'cinecturlink2BeforeDelLink',
['cinecturlink2ActivityReportBehaviors', 'delLink']
);
}
2021-09-07 12:33:18 +00:00
public static function addLink($cur)
{
$logs = [
$cur->link_title,
2022-11-17 21:01:00 +00:00
dcCore::app()->auth->getInfo('user_cn'),
];
2022-11-17 21:01:00 +00:00
dcCore::app()->activityReport->addLog('cinecturlink2', 'create', $logs);
}
2021-09-07 12:33:18 +00:00
public static function updLink($cur, $id)
{
2022-11-17 21:01:00 +00:00
$C2 = new cinecturlink2();
$rs = $C2->getLinks(['link_id' => $id]);
2021-09-07 12:33:18 +00:00
$logs = [
$rs->link_title,
2022-11-17 21:01:00 +00:00
dcCore::app()->auth->getInfo('user_cn'),
];
2022-11-17 21:01:00 +00:00
dcCore::app()->activityReport->addLog('cinecturlink2', 'update', $logs);
}
2021-09-07 12:33:18 +00:00
public static function delLink($id)
{
2022-11-17 21:01:00 +00:00
$C2 = new cinecturlink2();
$rs = $C2->getLinks(['link_id' => $id]);
2021-09-07 12:33:18 +00:00
$logs = [
$rs->link_title,
2022-11-17 21:01:00 +00:00
dcCore::app()->auth->getInfo('user_cn'),
];
2022-11-17 21:01:00 +00:00
dcCore::app()->activityReport->addLog('cinecturlink2', 'delete', $logs);
}
2021-11-02 22:55:41 +00:00
}