Skip to content

Commit 976e831

Browse files
committed
Update copyrights, add counter for dashboard
1 parent 0c049d3 commit 976e831

File tree

14 files changed

+73
-47
lines changed

14 files changed

+73
-47
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Changelog
22
=========
33

4+
## 1.2.0 (2023-06-25)
5+
* Update copyrights, add counter for dashboard
6+
47
## 1.1.9 (2020-07-01)
58
* Update dependencies, README.md
69
* Fixed error determining loading of common modules

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 - 2020 W.D.M.Group, Ukraine
3+
Copyright (c) 2019 - 2023 W.D.M.Group, Ukraine
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Module.php

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
* Yii2 Tickets
77
*
88
* @category Module
9-
* @version 1.1.9
9+
* @version 1.2.0
1010
* @author Alexsander Vyshnyvetskyy <alex.vyshnyvetskyy@gmail.com>
1111
* @link https://github.com/wdmg/yii2-tickets
12-
* @copyright Copyright (c) 2019 - 2021 W.D.M.Group, Ukraine
12+
* @copyright Copyright (c) 2019 - 2023 W.D.M.Group, Ukraine
1313
* @license https://opensource.org/licenses/MIT Massachusetts Institute of Technology (MIT) License
1414
*
1515
*/
1616

17+
use wdmg\helpers\ArrayHelper;
1718
use Yii;
1819
use wdmg\base\BaseModule;
1920

@@ -45,7 +46,7 @@ class Module extends BaseModule
4546
/**
4647
* @var string the module version
4748
*/
48-
private $version = "1.1.9";
49+
private $version = "1.2.0";
4950

5051
/**
5152
* @var integer, priority of initialization
@@ -70,15 +71,28 @@ public function init()
7071
/**
7172
* {@inheritdoc}
7273
*/
73-
public function dashboardNavItems($options = false)
74+
public function dashboardNavItems($options = null)
7475
{
7576
$items = [
7677
'label' => $this->name,
7778
'url' => [$this->routePrefix . '/'. $this->id],
7879
'icon' => 'fa fa-fw fa-ticket-alt',
7980
'active' => in_array(\Yii::$app->controller->module->id, [$this->id])
8081
];
81-
return $items;
82+
83+
if (!is_null($options)) {
84+
85+
if (isset($options['count'])) {
86+
$items['label'] .= '<span class="badge badge-default float-right">' . $options['count'] . '</span>';
87+
unset($options['count']);
88+
}
89+
90+
if (is_array($options))
91+
$items = ArrayHelper::merge($items, $options);
92+
93+
}
94+
95+
return $items;
8296
}
8397

8498
/**

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Yii2](https://img.shields.io/badge/required-Yii2_v2.0.40-blue.svg)](https://packagist.org/packages/yiisoft/yii2)
1+
[![Yii2](https://img.shields.io/badge/required-Yii2_v2.0.35-blue.svg)](https://packagist.org/packages/yiisoft/yii2)
22
[![Downloads](https://img.shields.io/packagist/dt/wdmg/yii2-tickets.svg)](https://packagist.org/packages/wdmg/yii2-tickets)
33
[![Packagist Version](https://img.shields.io/packagist/v/wdmg/yii2-tickets.svg)](https://packagist.org/packages/wdmg/yii2-tickets)
44
![Progress](https://img.shields.io/badge/progress-ready_to_use-green.svg)
@@ -11,11 +11,11 @@ Ticket system for Yii2.
1111

1212
This module is an integral part of the [Butterfly.СMS](https://butterflycms.com/) content management system, but can also be used as an standalone extension.
1313

14-
Copyrights (c) 2019-2021 [W.D.M.Group, Ukraine](https://wdmg.com.ua/)
14+
Copyrights (c) 2019-2023 [W.D.M.Group, Ukraine](https://wdmg.com.ua/)
1515

1616
# Requirements
1717
* PHP 5.6 or higher
18-
* Yii2 v.2.0.40 and newest
18+
* Yii2 v.2.0.35 and newest
1919
* [Yii2 Base](https://github.com/wdmg/yii2-base) module (required)
2020
* [Yii2 Editor](https://github.com/wdmg/yii2-editor) module
2121
* [Yii2 Tasks](https://github.com/wdmg/yii2-tasks) module (optionaly)
@@ -67,9 +67,6 @@ Use the `Module::dashboardNavItems()` method of the module to generate a navigat
6767

6868

6969
# Status and version [ready to use]
70+
* v.1.2.0 - Update copyrights, add counter for dashboard
7071
* v.1.1.9 - Update dependencies, README.md
71-
* v.1.1.8 - Added pagination, up to date dependencies
72-
* v.1.1.7 - Fixed deprecated class declaration
73-
* v.1.1.6 - Added extra options to composer.json and navbar menu icon
74-
* v.1.1.5 - Added choice param for non interactive mode
75-
* v.1.1.4 - Module refactoring
72+
* v.1.1.8 - Added pagination, up to date dependencies

commands/InitController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function actionIndex($params = null)
3434
'║ ║'. "\n" .
3535
'║ TICKETS MODULE, v.'.$version.''. "\n" .
3636
'║ by Alexsander Vyshnyvetskyy ║'. "\n" .
37-
'║ (c) 2019-2021 W.D.M.Group, Ukraine ║'. "\n" .
37+
'║ (c) 2019-2023 W.D.M.Group, Ukraine ║'. "\n" .
3838
'║ ║'. "\n" .
3939
'╚════════════════════════════════════════════════╝';
4040
echo $name = $this->ansiFormat($welcome . "\n\n", Console::FG_GREEN);

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"keywords": ["yii2", "yii2-tickets", "ticket system", "wdmg"],
55
"type": "yii2-extension",
66
"license": "MIT",
7-
"version": "1.1.9",
7+
"version": "1.2.0",
88
"homepage": "https://github.com/wdmg/yii2-tickets",
99
"support": {
1010
"source": "https://github.com/wdmg/yii2-tickets",
@@ -21,7 +21,7 @@
2121
}
2222
],
2323
"require": {
24-
"yiisoft/yii2": "^2.0.40",
24+
"yiisoft/yii2": "^2.0.35",
2525
"wdmg/yii2-base": "^1.2.4",
2626
"wdmg/yii2-editor": "^1.0.10",
2727
"wdmg/yii2-helpers": "^1.3.2"

docs/images/yii2-tickets.png

870 Bytes
Loading

messages/ru-RU/app/modules/tickets.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
'Ticket has been successfully updated!' => 'Тикет был успешно обновлён!',
6161
'An error occurred while updating the ticket.' => 'Произошла ошибка при обновлении тикета.',
6262

63+
'New tickets in the last 24 hours' => 'Новых тикетов за последние сутки',
64+
6365
'Update' => 'Обновить',
6466
'Edit' => 'Редактировать',
6567
'Search' => 'Поиск',

models/Tickets.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,19 @@ public static function getAllLabelsList()
228228
];
229229
}
230230

231+
/**
232+
* Return stats count by all users
233+
*
234+
* @return array|null
235+
*/
236+
public static function getStatsCount($asArray = false) {
237+
$counts = static::find()
238+
->select([new \yii\db\Expression('SUM( CASE WHEN `created_at` >= TIMESTAMP(CURRENT_TIMESTAMP() - INTERVAL 1 DAY) THEN 1 END ) AS count')])
239+
->addSelect([new \yii\db\Expression('SUM( CASE WHEN `id` > 0 THEN 1 END ) AS total')]);
240+
241+
if ($asArray)
242+
return $counts->asArray()->one();
243+
244+
return $counts->one();
245+
}
231246
}

views/attachments/index.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,18 @@
4040
'options' => [
4141
'class' => 'pagination',
4242
],
43+
'maxButtonCount' => 5,
4344
'activePageCssClass' => 'active',
4445
'linkContainerOptions' => [
4546
'class' => 'linkContainerOptions',
4647
],
4748
'linkOptions' => [
4849
'class' => 'linkOptions',
4950
],
50-
'maxButtonCount' => 5,
51-
'activePageCssClass' => 'active',
52-
'prevPageCssClass' => 'prev',
53-
'nextPageCssClass' => 'next',
54-
'firstPageCssClass' => 'first',
55-
'lastPageCssClass' => 'last',
51+
'prevPageCssClass' => '',
52+
'nextPageCssClass' => '',
53+
'firstPageCssClass' => 'previous',
54+
'lastPageCssClass' => 'next',
5655
'firstPageLabel' => Yii::t('app/modules/tickets', 'First page'),
5756
'lastPageLabel' => Yii::t('app/modules/tickets', 'Last page'),
5857
'prevPageLabel' => Yii::t('app/modules/tickets', '&larr; Prev page'),

0 commit comments

Comments
 (0)