Skip to content

Commit 6be4875

Browse files
committed
Update dependencies, README.md
1 parent e6ad85f commit 6be4875

File tree

18 files changed

+411
-65
lines changed

18 files changed

+411
-65
lines changed

CHANGELOG.md

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

4+
## 1.1.9 (2020-07-01)
5+
* Update dependencies, README.md
6+
* Fixed error determining loading of common modules
7+
* Rebased to base ActiveRecord model
8+
49
## 1.1.8 (2020-03-27)
510
* Added pagination
611
* Up to date dependencies
@@ -18,7 +23,7 @@ Changelog
1823
* Module refactoring
1924

2025
## 1.1.3 (2019-06-05)
21-
* Module transferred to base module interface. Update Yii2 version.g
26+
* Module transferred to base module interface. Update Yii2 version
2227

2328
## 1.1.2 (2019-06-01)
2429
* Bugfix, routing and refactoring

Module.php

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Yii2 Tasks
77
*
88
* @category Module
9-
* @version 1.1.8
9+
* @version 1.1.9
1010
* @author Alexsander Vyshnyvetskyy <alex.vyshnyvetskyy@gmail.com>
1111
* @link https://github.com/wdmg/yii2-tasks
1212
* @copyright Copyright (c) 2019 - 2020 W.D.M.Group, Ukraine
@@ -45,7 +45,7 @@ class Module extends BaseModule
4545
/**
4646
* @var string the module version
4747
*/
48-
private $version = "1.1.8";
48+
private $version = "1.1.9";
4949

5050
/**
5151
* @var integer, priority of initialization
@@ -78,7 +78,27 @@ public function dashboardNavItems($createLink = false)
7878
'icon' => 'fa fa-fw fa-tasks',
7979
'active' => in_array(\Yii::$app->controller->module->id, [$this->id])
8080
];
81-
return $items;
81+
82+
83+
84+
return [
85+
'label' => $this->name,
86+
'url' => [$this->routePrefix . '/'. $this->id],
87+
'icon' => 'fa fa-fw fa-tasks',
88+
'active' => in_array(\Yii::$app->controller->module->id, [$this->id]),
89+
'items' => [
90+
[
91+
'label' => Yii::t('app/modules/tasks', 'Tasks list'),
92+
'url' => [$this->routePrefix . '/tasks/list/all'],
93+
'active' => (in_array(\Yii::$app->controller->module->id, ['list']) && Yii::$app->controller->id == 'all'),
94+
],
95+
[
96+
'label' => Yii::t('app/modules/tasks', 'Subunits list'),
97+
'url' => [$this->routePrefix . '/tasks/subunits/index'],
98+
'active' => (in_array(\Yii::$app->controller->module->id, ['subunits']) && Yii::$app->controller->id == 'index'),
99+
]
100+
]
101+
];
82102
}
83103

84104
/**

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
[![Yii2](https://img.shields.io/badge/required-Yii2_v2.0.33-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-tasks.svg)](https://packagist.org/packages/wdmg/yii2-tasks)
33
[![Packagist Version](https://img.shields.io/packagist/v/wdmg/yii2-tasks.svg)](https://packagist.org/packages/wdmg/yii2-tasks)
4-
![Progress](https://img.shields.io/badge/progress-in_development-red.svg)
4+
![Progress](https://img.shields.io/badge/progress-ready_to_use-green.svg)
55
[![GitHub license](https://img.shields.io/github/license/wdmg/yii2-tasks.svg)](https://github.com/wdmg/yii2-tasks/blob/master/LICENSE)
66

7+
<img src="./docs/images/yii2-tasks.png" width="100%" alt="Yii2 Tasks Module" />
8+
79
# Yii2 Tasks Module
8-
Task manager for Yii2
10+
Task manager for Yii2.
11+
12+
The module implements indexed search using morphology (phpMorphy) or Porter's stemmer algorithm (LinguaStem). A live full-text search by data model is also provided.
13+
14+
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.
15+
16+
Copyrights (c) 2019-2020 [W.D.M.Group, Ukraine](https://wdmg.com.ua/)
917

1018
# Requirements
1119
* PHP 5.6 or higher
12-
* Yii2 v.2.0.33 and newest
20+
* Yii2 v.2.0.35 and newest
1321
* [Yii2 Base](https://github.com/wdmg/yii2-base) module (required)
1422
* [Yii2 Tickets](https://github.com/wdmg/yii2-tickets) module (optionaly)
1523
* [Yii2 Users](https://github.com/wdmg/yii2-users) module (optionaly)
@@ -60,6 +68,7 @@ Use the `Module::dashboardNavItems()` method of the module to generate a navigat
6068
?>
6169

6270
# Status and version [in progress development]
71+
* v.1.1.9 - Update dependencies, README.md
6372
* v.1.1.8 - Added pagination, up to date dependencies
6473
* v.1.1.7 - Fixed deprecated class declaration
6574
* v.1.1.6 - Added extra options to composer.json and navbar menu icon

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"keywords": ["yii2", "yii2-tasks", "task manager", "wdmg"],
55
"type": "yii2-extension",
66
"license": "MIT",
7-
"version": "1.1.8",
7+
"version": "1.1.9",
88
"homepage": "https://github.com/wdmg/yii2-tasks",
99
"support": {
1010
"source": "https://github.com/wdmg/yii2-tasks",
@@ -21,8 +21,9 @@
2121
}
2222
],
2323
"require": {
24-
"yiisoft/yii2": "^2.0.33",
25-
"wdmg/yii2-base": "^1.2.0",
24+
"yiisoft/yii2": "^2.0.35",
25+
"wdmg/yii2-base": "^1.2.4",
26+
"wdmg/yii2-selectinput": "^1.0.9",
2627
"wdmg/yii2-helpers": "^1.3.2",
2728
"wdmg/yii2-editor": "^1.0.10",
2829
"wdmg/yii2-datepicker": "^1.0.8"

docs/images/yii2-tasks.png

384 KB
Loading

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,24 @@
3434
'Status' => 'Статус',
3535
'Actions' => 'Действия',
3636

37+
'Users' => 'Пользователи',
38+
'Active' => 'Активно',
39+
'Not active' => 'Не активно',
40+
41+
'All statuses' => 'Все статусы',
3742
'Wating' => 'В ожидании',
3843
'Progress' => 'В процессе',
3944
'Complete' => 'Завершено',
4045
'Unsuccessfully' => 'Не выполнено',
4146
'Suspended' => 'Остановлено',
4247
'Canceled' => 'Отменено',
4348

49+
'Tasks list' => 'Список задач',
50+
'Subunits list' => 'Список подразделений',
51+
52+
'Subdivisions' => 'Подразделения',
53+
'Create subdivision' => 'Создать подразделение',
54+
4455
'View task: {name}' => 'Просмотр задачи: {name}',
4556
'Update task: {name}' => 'Редактирование задачи: {name}',
4657

models/Tasks.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Yii;
66
use \wdmg\base\models\ActiveRecord;
77
use \yii\behaviors\TimeStampBehavior;
8+
use yii\helpers\ArrayHelper;
89

910
/**
1011
* This is the model class for table "tasks".
@@ -120,6 +121,30 @@ public function attributeLabels()
120121
];
121122
}
122123

124+
/**
125+
* @return array
126+
*/
127+
public function getStatusesList($allStatuses = false)
128+
{
129+
$list = [];
130+
if ($allStatuses) {
131+
$list = [
132+
'*' => Yii::t('app/modules/tasks', 'All statuses')
133+
];
134+
}
135+
136+
$list = ArrayHelper::merge($list, [
137+
self::TS_STATUS_WATING => Yii::t('app/modules/tasks','Wating'),
138+
self::TS_STATUS_PROGRESS => Yii::t('app/modules/tasks','Progress'),
139+
self::TS_STATUS_COMPLETE => Yii::t('app/modules/tasks','Complete'),
140+
self::TS_STATUS_UNSUCCESS => Yii::t('app/modules/tasks','Unsuccessfully'),
141+
self::TS_STATUS_SUSPENDED => Yii::t('app/modules/tasks','Suspended'),
142+
self::TS_STATUS_CANCELED => Yii::t('app/modules/tasks','Canceled'),
143+
]);
144+
145+
return $list;
146+
}
147+
123148
/**
124149
* @return \yii\db\ActiveQuery
125150
*/

models/TasksSubunits.php

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Yii;
66
use \wdmg\base\models\ActiveRecord;
77
use \yii\behaviors\TimeStampBehavior;
8+
use yii\helpers\ArrayHelper;
89

910
/**
1011
* This is the model class for table "tasks_subunits".
@@ -20,6 +21,13 @@
2021
*/
2122
class TasksSubunits extends ActiveRecord
2223
{
24+
/**
25+
* Subdivision status
26+
* const, int: 10 - Not Active, 20 - Active
27+
*/
28+
const SUB_STATUS_DISABLE = 10;
29+
const SUB_STATUS_ACTIVE = 20;
30+
2331
/**
2432
* {@inheritdoc}
2533
*/
@@ -28,6 +36,20 @@ public static function tableName()
2836
return '{{%tasks_subunits}}';
2937
}
3038

39+
/**
40+
* {@inheritdoc}
41+
*/
42+
public function init()
43+
{
44+
parent::init();
45+
$this->_module = parent::getModule(true);
46+
}
47+
48+
/**
49+
* @var Instance of current module
50+
*/
51+
private $_module;
52+
3153
/**
3254
* {@inheritdoc}
3355
*/
@@ -77,4 +99,71 @@ public function attributeLabels()
7799
'status' => Yii::t('app/modules/tasks', 'Status'),
78100
];
79101
}
102+
103+
/**
104+
* {@inheritdoc}
105+
*/
106+
public function afterFind()
107+
{
108+
109+
if (is_string($this->users_id))
110+
$this->users_id = \explode(',', $this->users_id);
111+
112+
parent::afterFind();
113+
}
114+
115+
/**
116+
* {@inheritdoc}
117+
*/
118+
public function beforeSave($insert)
119+
{
120+
if (is_array($this->users_id))
121+
$this->users_id = \implode(',', $this->users_id);
122+
123+
return parent::beforeSave($insert);
124+
}
125+
126+
/**
127+
* @return \yii\db\ActiveQuery
128+
*/
129+
public function getUsers()
130+
{
131+
if (class_exists('\wdmg\users\models\Users') && $this->_module->moduleLoaded('users'))
132+
return $this->hasMany(\wdmg\users\models\Users::class, ['id' => 'users_id']);
133+
else
134+
return null;
135+
136+
}
137+
138+
/**
139+
* @return \yii\db\ActiveQuery
140+
*/
141+
public function getOwner()
142+
{
143+
if (class_exists('\wdmg\users\models\Users') && $this->_module->moduleLoaded('users'))
144+
return $this->hasOne(\wdmg\users\models\Users::class, ['id' => 'owner_id']);
145+
else
146+
return null;
147+
}
148+
149+
150+
/**
151+
* @return array
152+
*/
153+
public function getStatusesList($allStatuses = false)
154+
{
155+
$list = [];
156+
if ($allStatuses) {
157+
$list = [
158+
'*' => Yii::t('app/modules/tasks', 'All statuses')
159+
];
160+
}
161+
162+
$list = ArrayHelper::merge($list, [
163+
self::SUB_STATUS_DISABLE => Yii::t('app/modules/tasks','Not active'),
164+
self::SUB_STATUS_ACTIVE => Yii::t('app/modules/tasks','Active'),
165+
]);
166+
167+
return $list;
168+
}
80169
}

views/subunits/_form.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use yii\helpers\Html;
44
use yii\widgets\ActiveForm;
5+
use wdmg\widgets\SelectInput;
56

67
/* @var $this yii\web\View */
78
/* @var $model wdmg\tasks\models\TasksSubunits */
@@ -18,12 +19,30 @@
1819

1920
<?= $form->field($model, 'owner_id')->textInput() ?>
2021

21-
<?= $form->field($model, 'users_id')->textarea(['rows' => 6]) ?>
22+
<?php
2223

23-
<?= $form->field($model, 'status')->textInput() ?>
24+
$users_id = '';
25+
if (is_array($model->users_id))
26+
$users_id = \implode(',', $model->users_id);
2427

28+
echo $form->field($model, 'users_id')
29+
->textarea(['rows' => 6, 'value' => $users_id])
30+
->label(Yii::t('app/modules/tasks', 'Users'));
31+
32+
?>
33+
34+
<?= $form->field($model, 'status')->widget(SelectInput::class, [
35+
'items' => $model->getStatusesList(),
36+
'options' => [
37+
'id' => 'task-form-status',
38+
'class' => 'form-control'
39+
]
40+
]); ?>
41+
42+
<hr/>
2543
<div class="form-group">
26-
<?= Html::submitButton(Yii::t('app/modules/tasks', 'Save'), ['class' => 'btn btn-success']) ?>
44+
<?= Html::a(Yii::t('app/modules/tasks', '&larr; Back to list'), ['list/all'], ['class' => 'btn btn-default pull-left']) ?>&nbsp;
45+
<?= Html::submitButton(Yii::t('app/modules/tasks', 'Save'), ['class' => 'btn btn-save btn-success pull-right']) ?>
2746
</div>
2847

2948
<?php ActiveForm::end(); ?>

views/subunits/create.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
$this->title = Yii::t('app/modules/tasks', 'Create subunits');
99
$this->params['breadcrumbs'][] = ['label' => Yii::t('app/modules/tasks', 'Tasks'), 'url' => ['../tasks']];
10-
$this->params['breadcrumbs'][] = ['label' => Yii::t('app/modules/tasks', 'Tasks Subunits'), 'url' => ['index']];
10+
$this->params['breadcrumbs'][] = ['label' => Yii::t('app/modules/tasks', 'Subdivisions'), 'url' => ['index']];
1111
$this->params['breadcrumbs'][] = $this->title;
1212
?>
1313
<div class="page-header">

0 commit comments

Comments
 (0)