Skip to content

Commit

Permalink
Update copyrights, add counter for dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-wdmg committed Jun 25, 2023
1 parent f8c72ad commit 1602af6
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 54 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
=========

## 1.2.0 (2023-06-25)
* Update copyrights, add counter for dashboard

## 1.1.9 (2020-07-01)
* Update dependencies, README.md
* Fixed error determining loading of common modules
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

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

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
32 changes: 19 additions & 13 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
* Yii2 Tasks
*
* @category Module
* @version 1.1.9
* @version 1.2.0
* @author Alexsander Vyshnyvetskyy <alex.vyshnyvetskyy@gmail.com>
* @link https://github.com/wdmg/yii2-tasks
* @copyright Copyright (c) 2019 - 2021 W.D.M.Group, Ukraine
* @copyright Copyright (c) 2019 - 2023 W.D.M.Group, Ukraine
* @license https://opensource.org/licenses/MIT Massachusetts Institute of Technology (MIT) License
*
*/

use wdmg\helpers\ArrayHelper;
use Yii;
use wdmg\base\BaseModule;

Expand Down Expand Up @@ -45,7 +46,7 @@ class Module extends BaseModule
/**
* @var string the module version
*/
private $version = "1.1.9";
private $version = "1.2.0";

/**
* @var integer, priority of initialization
Expand All @@ -70,18 +71,9 @@ public function init()
/**
* {@inheritdoc}
*/
public function dashboardNavItems($options = false)
public function dashboardNavItems($options = null)
{
$items = [
'label' => $this->name,
'url' => [$this->routePrefix . '/'. $this->id],
'icon' => 'fa fa-fw fa-tasks',
'active' => in_array(\Yii::$app->controller->module->id, [$this->id])
];



return [
'label' => $this->name,
'url' => [$this->routePrefix . '/'. $this->id],
'icon' => 'fa fa-fw fa-tasks',
Expand All @@ -99,6 +91,20 @@ public function dashboardNavItems($options = false)
]
]
];

if (!is_null($options)) {

if (isset($options['count'])) {
$items['label'] .= '<span class="badge badge-default float-right">' . $options['count'] . '</span>';
unset($options['count']);
}

if (is_array($options))
$items = ArrayHelper::merge($items, $options);

}

return $items;
}

/**
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Yii2](https://img.shields.io/badge/required-Yii2_v2.0.40-blue.svg)](https://packagist.org/packages/yiisoft/yii2)
[![Yii2](https://img.shields.io/badge/required-Yii2_v2.0.35-blue.svg)](https://packagist.org/packages/yiisoft/yii2)
[![Downloads](https://img.shields.io/packagist/dt/wdmg/yii2-tasks.svg)](https://packagist.org/packages/wdmg/yii2-tasks)
[![Packagist Version](https://img.shields.io/packagist/v/wdmg/yii2-tasks.svg)](https://packagist.org/packages/wdmg/yii2-tasks)
![Progress](https://img.shields.io/badge/progress-ready_to_use-green.svg)
Expand All @@ -11,11 +11,11 @@ Task manager for Yii2.

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.

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

# Requirements
* PHP 5.6 or higher
* Yii2 v.2.0.40 and newest
* Yii2 v.2.0.35 and newest
* [Yii2 Base](https://github.com/wdmg/yii2-base) module (required)
* [Yii2 Tickets](https://github.com/wdmg/yii2-tickets) module (optionaly)
* [Yii2 Users](https://github.com/wdmg/yii2-users) module (optionaly)
Expand Down Expand Up @@ -65,9 +65,7 @@ Use the `Module::dashboardNavItems()` method of the module to generate a navigat
]);
?>

# Status and version [in progress development]
# Status and version [ready to use]
* v.1.2.0 - Update copyrights, add counter for dashboard
* v.1.1.9 - Update dependencies, README.md
* v.1.1.8 - Added pagination, up to date dependencies
* v.1.1.7 - Fixed deprecated class declaration
* v.1.1.6 - Added extra options to composer.json and navbar menu icon
* v.1.1.5 - Added choice param for non interactive mode
* v.1.1.8 - Added pagination, up to date dependencies
2 changes: 1 addition & 1 deletion commands/InitController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function actionIndex($params = null)
'║ ║'. "\n" .
'║ TASKS MODULE, v.'.$version.''. "\n" .
'║ by Alexsander Vyshnyvetskyy ║'. "\n" .
'║ (c) 2019-2021 W.D.M.Group, Ukraine ║'. "\n" .
'║ (c) 2019-2023 W.D.M.Group, Ukraine ║'. "\n" .
'║ ║'. "\n" .
'╚════════════════════════════════════════════════╝';
echo $name = $this->ansiFormat($welcome . "\n\n", Console::FG_GREEN);
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"keywords": ["yii2", "yii2-tasks", "task manager", "wdmg"],
"type": "yii2-extension",
"license": "MIT",
"version": "1.1.9",
"version": "1.2.0",
"homepage": "https://github.com/wdmg/yii2-tasks",
"support": {
"source": "https://github.com/wdmg/yii2-tasks",
Expand All @@ -21,12 +21,12 @@
}
],
"require": {
"yiisoft/yii2": "^2.0.40",
"yiisoft/yii2": "^2.0.35",
"wdmg/yii2-base": "^1.2.4",
"wdmg/yii2-selectinput": "^1.0.9",
"wdmg/yii2-helpers": "^1.3.2",
"wdmg/yii2-editor": "^1.0.10",
"wdmg/yii2-datepicker": "^1.0.8"
"wdmg/yii2-datepicker": "^1.1.0"
},
"minimum-stability": "dev",
"autoload": {
Expand Down
Binary file modified docs/images/yii2-tasks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions messages/ru-RU/app/modules/tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
'Task has been successfully created!' => 'Задача была успешно создана!',
'An error occurred while creating the task.' => 'Произошла ошибка при создании задачи.',

'New tasks in the last 24 hours' => 'Новых задач за последние сутки',

'Update' => 'Обновить',
'Edit' => 'Редактировать',
Expand Down
16 changes: 16 additions & 0 deletions models/Tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,20 @@ public function getUser($user_id = null)
else
return null;
}

/**
* Return stats count by all users
*
* @return array|null
*/
public static function getStatsCount($asArray = false) {
$counts = static::find()
->select([new \yii\db\Expression('SUM( CASE WHEN `created_at` >= TIMESTAMP(CURRENT_TIMESTAMP() - INTERVAL 1 DAY) THEN 1 END ) AS count')])
->addSelect([new \yii\db\Expression('SUM( CASE WHEN `id` > 0 THEN 1 END ) AS total')]);

if ($asArray)
return $counts->asArray()->one();

return $counts->one();
}
}
10 changes: 5 additions & 5 deletions views/subunits/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
'format' => 'raw',
'header' => Yii::t('app/modules/tasks', 'Users'),
'value' => function($model) {
if (is_countable($model->users)) {
if (is_array($model->users)) {

$output = '';
foreach ($model->users as $user) {
Expand Down Expand Up @@ -114,10 +114,10 @@
],
'maxButtonCount' => 5,
'activePageCssClass' => 'active',
'prevPageCssClass' => 'prev',
'nextPageCssClass' => 'next',
'firstPageCssClass' => 'first',
'lastPageCssClass' => 'last',
'prevPageCssClass' => '',
'nextPageCssClass' => '',
'firstPageCssClass' => 'previous',
'lastPageCssClass' => 'next',
'firstPageLabel' => Yii::t('app/modules/tasks', 'First page'),
'lastPageLabel' => Yii::t('app/modules/tasks', 'Last page'),
'prevPageLabel' => Yii::t('app/modules/tasks', '&larr; Prev page'),
Expand Down
2 changes: 1 addition & 1 deletion views/subunits/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
'format' => 'raw',
'label' => Yii::t('app/modules/tasks', 'Users'),
'value' => function($model) {
if (is_countable($model->users)) {
if (is_array($model->users)) {

$output = '';
foreach ($model->users as $user) {
Expand Down
11 changes: 5 additions & 6 deletions views/tasks/all.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,18 @@
'options' => [
'class' => 'pagination',
],
'maxButtonCount' => 5,
'activePageCssClass' => 'active',
'linkContainerOptions' => [
'class' => 'linkContainerOptions',
],
'linkOptions' => [
'class' => 'linkOptions',
],
'maxButtonCount' => 5,
'activePageCssClass' => 'active',
'prevPageCssClass' => 'prev',
'nextPageCssClass' => 'next',
'firstPageCssClass' => 'first',
'lastPageCssClass' => 'last',
'prevPageCssClass' => '',
'nextPageCssClass' => '',
'firstPageCssClass' => 'previous',
'lastPageCssClass' => 'next',
'firstPageLabel' => Yii::t('app/modules/tasks', 'First page'),
'lastPageLabel' => Yii::t('app/modules/tasks', 'Last page'),
'prevPageLabel' => Yii::t('app/modules/tasks', '&larr; Prev page'),
Expand Down
11 changes: 5 additions & 6 deletions views/tasks/current.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,18 @@
'options' => [
'class' => 'pagination',
],
'maxButtonCount' => 5,
'activePageCssClass' => 'active',
'linkContainerOptions' => [
'class' => 'linkContainerOptions',
],
'linkOptions' => [
'class' => 'linkOptions',
],
'maxButtonCount' => 5,
'activePageCssClass' => 'active',
'prevPageCssClass' => 'prev',
'nextPageCssClass' => 'next',
'firstPageCssClass' => 'first',
'lastPageCssClass' => 'last',
'prevPageCssClass' => '',
'nextPageCssClass' => '',
'firstPageCssClass' => 'previous',
'lastPageCssClass' => 'next',
'firstPageLabel' => Yii::t('app/modules/tasks', 'First page'),
'lastPageLabel' => Yii::t('app/modules/tasks', 'Last page'),
'prevPageLabel' => Yii::t('app/modules/tasks', '&larr; Prev page'),
Expand Down
11 changes: 5 additions & 6 deletions views/tasks/my.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,18 @@
'options' => [
'class' => 'pagination',
],
'maxButtonCount' => 5,
'activePageCssClass' => 'active',
'linkContainerOptions' => [
'class' => 'linkContainerOptions',
],
'linkOptions' => [
'class' => 'linkOptions',
],
'maxButtonCount' => 5,
'activePageCssClass' => 'active',
'prevPageCssClass' => 'prev',
'nextPageCssClass' => 'next',
'firstPageCssClass' => 'first',
'lastPageCssClass' => 'last',
'prevPageCssClass' => '',
'nextPageCssClass' => '',
'firstPageCssClass' => 'previous',
'lastPageCssClass' => 'next',
'firstPageLabel' => Yii::t('app/modules/tasks', 'First page'),
'lastPageLabel' => Yii::t('app/modules/tasks', 'Last page'),
'prevPageLabel' => Yii::t('app/modules/tasks', '&larr; Prev page'),
Expand Down
8 changes: 4 additions & 4 deletions views/workflow/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
],
'maxButtonCount' => 5,
'activePageCssClass' => 'active',
'prevPageCssClass' => 'prev',
'nextPageCssClass' => 'next',
'firstPageCssClass' => 'first',
'lastPageCssClass' => 'last',
'prevPageCssClass' => '',
'nextPageCssClass' => '',
'firstPageCssClass' => 'previous',
'lastPageCssClass' => 'next',
'firstPageLabel' => Yii::t('app/modules/tasks', 'First page'),
'lastPageLabel' => Yii::t('app/modules/tasks', 'Last page'),
'prevPageLabel' => Yii::t('app/modules/tasks', '&larr; Prev page'),
Expand Down

0 comments on commit 1602af6

Please sign in to comment.