';
echo '
YearlyData 年度数据统计 v' . self::VERSION . '
';
echo '新增功能:年度目标设置与进度追踪
';
echo '请在左侧菜单「控制台 → 年度数据」中查看统计数据
';
echo '';**/
// 默认显示条数
$topLimit = new Text('topLimit', null, '10',
_t('排行榜显示条数'),
_t('设置排行榜默认显示的条目数量'));
$form->addInput($topLimit);
// 默认年份
$defaultYear = new Text('defaultYear', null, date('Y'),
_t('默认统计年份'),
_t('设置默认统计的年份,留空则为当前年份'));
$form->addInput($defaultYear);
// 是否统计草稿
$includeDraft = new Radio('includeDraft',
['0' => _t('否'), '1' => _t('是')],
'0',
_t('是否统计草稿'),
_t('选择是否将草稿文章纳入统计'));
$form->addInput($includeDraft);
// 图表主题色
$chartColor = new Text('chartColor', null, '#667eea',
_t('图表主题色'),
_t('设置图表的主题颜色,使用十六进制颜色值'));
$form->addInput($chartColor);
// 年度目标设置标题
echo '';
echo '
' . date('Y') . '年度目标设置
';
echo '
设置' . date('Y') . '年度的数据目标值,将在统计面板中显示进度条
';
echo '
提示:每年的目标需要单独设置,请根据年度更新目标值
';
echo '
';
// 年度总文章数目标
$targetPosts = new Text('targetPosts', null, '400',
_t('年度文章数目标'),
_t('设置' . date('Y') . '年度文章发布目标数量,0表示不设置'));
$form->addInput($targetPosts);
// 年度总评论数目标
$targetComments = new Text('targetComments', null, '5000',
_t('年度评论数目标'),
_t('设置' . date('Y') . '年度评论数量目标,0表示不设置'));
$form->addInput($targetComments);
// 年度总图片数目标
$targetImages = new Text('targetImages', null, '10000',
_t('年度图片数目标'),
_t('设置' . date('Y') . '年度图片上传目标数量,0表示不设置'));
$form->addInput($targetImages);
// 年度总字数目标
$targetWords = new Text('targetWords', null, '2400000',
_t('年度总字数目标'),
_t('设置' . date('Y') . '年度文章总字数目标(单位:字),0表示不设置'));
$form->addInput($targetWords);
}
/**
* 个人用户的配置面板
*/
public static function personalConfig(Form $form)
{
// 暂无个人配置
}
/**
* 获取插件配置
*/
public static function getConfig($key = null)
{
try {
$config = Options::alloc()->plugin('YearlyData');
if ($key !== null) {
return isset($config->$key) ? $config->$key : null;
}
return $config;
} catch (\Exception $e) {
return null;
}
}
/**
* 获取插件版本
*/
public static function getVersion()
{
return self::VERSION;
}
}