diff --git a/README.md b/README.md index 3a3df6b..999bba9 100644 --- a/README.md +++ b/README.md @@ -46,3 +46,10 @@ php yii migrate **NOTES:** - Check and edit the other files in the `config/` directory to customize your application as required. + + +To start the server: + +~~~ +php yii panel +~~~ diff --git a/composer.json b/composer.json index 51fa65b..883cdff 100644 --- a/composer.json +++ b/composer.json @@ -14,10 +14,13 @@ "dmstr/yii2-adminlte-asset": "2.*", "linslin/yii2-curl": "1.0.8", "shifrin/yii2-noty": "^1.0", - "ratchet/pawl": "^0.2.2" + "ratchet/pawl": "^0.2.2", + "voskobovich/yii2-many-many-behavior": "^3.2", + "kartik-v/yii2-widgets": "^3.4", + "kartik-v/yii2-datecontrol": "^1.9", + "voskobovich/yii2-linker-behavior": "4.0.1-rc" }, "require-dev": { - "yiisoft/yii2-codeception": "*", "yiisoft/yii2-debug": "*", "yiisoft/yii2-gii": "*", "yiisoft/yii2-faker": "*" @@ -25,12 +28,6 @@ "config": { "process-timeout": 1800 }, - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/Devristo/phpws" - } - ], "extra": { "asset-installer-paths": { "npm-asset-library": "vendor/npm", diff --git a/composer.lock b/composer.lock index f5c52f7..55a815f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "4eebb1b64abc9c9ef27b292ac4defceb", - "content-hash": "e1ae4793c697f2640f949031921bb1fa", + "hash": "93b039facde77e73e4fa37dec8dcedaa", + "content-hash": "06c2ad7f9fe21fa14444b1ff254ecdf3", "packages": [ { "name": "almasaeed2010/adminlte", @@ -663,6 +663,62 @@ ], "time": "2016-10-24 15:52:54" }, + { + "name": "fxp/composer-asset-plugin", + "version": "v1.2.2", + "source": { + "type": "git", + "url": "https://github.com/fxpio/composer-asset-plugin.git", + "reference": "60bc94db574103dfc73acb907fa79c6dfc86c96e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fxpio/composer-asset-plugin/zipball/60bc94db574103dfc73acb907fa79c6dfc86c96e", + "reference": "60bc94db574103dfc73acb907fa79c6dfc86c96e", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "php": ">=5.3.3" + }, + "require-dev": { + "composer/composer": "^1.0.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Fxp\\Composer\\AssetPlugin\\FxpAssetPlugin", + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Fxp\\Composer\\AssetPlugin\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Pluchino", + "email": "francois.pluchino@gmail.com" + } + ], + "description": "NPM/Bower Dependency Manager for Composer", + "homepage": "https://github.com/fxpio/composer-asset-plugin", + "keywords": [ + "asset", + "bower", + "composer", + "dependency manager", + "nodejs", + "npm", + "package" + ], + "time": "2016-10-12 08:03:45" + }, { "name": "guzzle/common", "version": "v3.9.2", @@ -923,6 +979,1262 @@ ], "time": "2016-06-24 23:00:38" }, + { + "name": "kartik-v/bootstrap-fileinput", + "version": "v4.3.5", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/bootstrap-fileinput.git", + "reference": "6e1a8ca5ca04d4927540ccf18bbfc3253286bd0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/bootstrap-fileinput/zipball/6e1a8ca5ca04d4927540ccf18bbfc3253286bd0c", + "reference": "6e1a8ca5ca04d4927540ccf18bbfc3253286bd0c", + "shasum": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "kartik\\plugins\\fileinput\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "An enhanced HTML 5 file input for Bootstrap 3.x with features for file preview for many file types, multiple selection, ajax uploads, and more.", + "homepage": "https://github.com/kartik-v/bootstrap-fileinput", + "keywords": [ + "ajax", + "bootstrap", + "delete", + "file", + "image", + "input", + "jquery", + "multiple", + "preview", + "progress", + "upload" + ], + "time": "2016-09-20 05:47:41" + }, + { + "name": "kartik-v/bootstrap-star-rating", + "version": "v4.0.1", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/bootstrap-star-rating.git", + "reference": "d66083c14f9386ede23fccb76dea1a380db67ded" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/bootstrap-star-rating/zipball/d66083c14f9386ede23fccb76dea1a380db67ded", + "reference": "d66083c14f9386ede23fccb76dea1a380db67ded", + "shasum": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "A simple yet powerful JQuery star rating plugin for Bootstrap.", + "homepage": "https://github.com/kartik-v/bootstrap-star-rating", + "keywords": [ + "Rating", + "awesome", + "bootstrap", + "font", + "glyphicon", + "star", + "svg" + ], + "time": "2016-02-28 16:13:18" + }, + { + "name": "kartik-v/dependent-dropdown", + "version": "v1.4.4", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/dependent-dropdown.git", + "reference": "a13970aec78e8eaae5cb9f1168df20d443f95113" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/dependent-dropdown/zipball/a13970aec78e8eaae5cb9f1168df20d443f95113", + "reference": "a13970aec78e8eaae5cb9f1168df20d443f95113", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "kartik\\plugins\\depdrop\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "A multi level dependent dropdown JQuery plugin that allows nested dependencies.", + "homepage": "https://github.com/kartik-v/dependent-dropdown", + "keywords": [ + "dependent", + "dropdown", + "jquery", + "option", + "select" + ], + "time": "2015-12-16 18:15:01" + }, + { + "name": "kartik-v/php-date-formatter", + "version": "v1.3.3", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/php-date-formatter.git", + "reference": "38984fb614f3ebc3605a8e369eee1406feea02a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/php-date-formatter/zipball/38984fb614f3ebc3605a8e369eee1406feea02a4", + "reference": "38984fb614f3ebc3605a8e369eee1406feea02a4", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "kartik\\plugins\\dateformatter\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "A Javascript datetime formatting and manipulation library using PHP date-time formats.", + "homepage": "https://github.com/kartik-v/php-date-formatter", + "keywords": [ + "date", + "datetime", + "formatter", + "javascript", + "php", + "php-date-formatter.js", + "time" + ], + "time": "2015-12-21 18:22:51" + }, + { + "name": "kartik-v/yii2-datecontrol", + "version": "v1.9.4", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-datecontrol.git", + "reference": "4e858b5cd38130c37739b2f582b66a044f77c95c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-datecontrol/zipball/4e858b5cd38130c37739b2f582b66a044f77c95c", + "reference": "4e858b5cd38130c37739b2f582b66a044f77c95c", + "shasum": "" + }, + "require": { + "kartik-v/php-date-formatter": ">1.3", + "kartik-v/yii2-krajee-base": "~1.7" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\datecontrol\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "Date control module allowing separation of formats for View and Model for Yii Framework 2.0", + "homepage": "https://github.com/kartik-v/yii2-datecontrol", + "keywords": [ + "control", + "date", + "extension", + "format", + "yii", + "yii2" + ], + "time": "2015-07-30 18:30:18" + }, + { + "name": "kartik-v/yii2-krajee-base", + "version": "v1.8.7", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-krajee-base.git", + "reference": "8f558809e6093c8f4f4599b7b9fd64b366b22a60" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/8f558809e6093c8f4f4599b7b9fd64b366b22a60", + "reference": "8f558809e6093c8f4f4599b7b9fd64b366b22a60", + "shasum": "" + }, + "require": { + "yiisoft/yii2-bootstrap": "@dev" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "psr-4": { + "kartik\\base\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "Base library and foundation components for all Yii2 Krajee extensions.", + "homepage": "https://github.com/kartik-v/yii2-krajee-base", + "keywords": [ + "base", + "extension", + "foundation", + "krajee", + "widget", + "yii2" + ], + "time": "2016-09-04 09:25:29" + }, + { + "name": "kartik-v/yii2-widget-activeform", + "version": "v1.4.8", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-activeform.git", + "reference": "53c2f877f12ba0b79e8346b6cae50cbba2bcfc69" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-activeform/zipball/53c2f877f12ba0b79e8346b6cae50cbba2bcfc69", + "reference": "53c2f877f12ba0b79e8346b6cae50cbba2bcfc69", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "~1.7" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "kartik\\form\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "Enhanced Yii2 active-form and active-field with full bootstrap styling support (sub repo split from yii2-widgets).", + "homepage": "https://github.com/kartik-v/yii2-widget-activeform", + "keywords": [ + "activefield", + "activeform", + "extension", + "field", + "form", + "widget", + "yii2" + ], + "time": "2016-04-27 18:38:05" + }, + { + "name": "kartik-v/yii2-widget-affix", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-affix.git", + "reference": "2184119bfa518c285406156f744769b13b861712" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-affix/zipball/2184119bfa518c285406156f744769b13b861712", + "reference": "2184119bfa518c285406156f744769b13b861712", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\affix\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "A scrollspy and affixed enhanced navigation to highlight page sections (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-affix", + "keywords": [ + "affix", + "bootstrap", + "extension", + "jquery", + "navigation", + "plugin", + "scrollspy", + "widget", + "yii2" + ], + "time": "2014-11-09 04:56:27" + }, + { + "name": "kartik-v/yii2-widget-alert", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-alert.git", + "reference": "5b312eeaf429c2affe6a96217d79f0c761159643" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-alert/zipball/5b312eeaf429c2affe6a96217d79f0c761159643", + "reference": "5b312eeaf429c2affe6a96217d79f0c761159643", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\alert\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "A widget to generate alert based notifications using bootstrap-alert plugin (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-alert", + "keywords": [ + "alert", + "block", + "bootstrap", + "extension", + "flash", + "jquery", + "notification", + "plugin", + "widget", + "yii2" + ], + "time": "2014-11-19 06:44:12" + }, + { + "name": "kartik-v/yii2-widget-colorinput", + "version": "v1.0.3", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-colorinput.git", + "reference": "3f6e847ef72cf6e27e4d3b4870b00b8f80d51752" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-colorinput/zipball/3f6e847ef72cf6e27e4d3b4870b00b8f80d51752", + "reference": "3f6e847ef72cf6e27e4d3b4870b00b8f80d51752", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "kartik\\color\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "An enhanced Yii 2 widget encapsulating the HTML 5 color input (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-colorinput", + "keywords": [ + "HTML5", + "color", + "extension", + "form", + "input", + "jquery", + "plugin", + "widget", + "yii2" + ], + "time": "2016-01-14 11:15:49" + }, + { + "name": "kartik-v/yii2-widget-datepicker", + "version": "v1.4.2", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-datepicker.git", + "reference": "8738f6dc3211d949b05189ba103aab786143fc6c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-datepicker/zipball/8738f6dc3211d949b05189ba103aab786143fc6c", + "reference": "8738f6dc3211d949b05189ba103aab786143fc6c", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "~1.7" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "kartik\\date\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "Enhanced Yii2 wrapper for the bootstrap datepicker plugin (sub repo split from yii2-widgets).", + "homepage": "https://github.com/kartik-v/yii2-widget-datepicker", + "keywords": [ + "date", + "extension", + "form", + "jquery", + "picker", + "plugin", + "select2", + "widget", + "yii2" + ], + "time": "2016-09-04 10:52:50" + }, + { + "name": "kartik-v/yii2-widget-datetimepicker", + "version": "v1.4.2", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-datetimepicker.git", + "reference": "f4e7024e31da40460d1b36dc880c2ec20a21bf6e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-datetimepicker/zipball/f4e7024e31da40460d1b36dc880c2ec20a21bf6e", + "reference": "f4e7024e31da40460d1b36dc880c2ec20a21bf6e", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\datetime\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "Enhanced Yii2 wrapper for the bootstrap datetimepicker plugin (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-datetimepicker", + "keywords": [ + "datetime", + "extension", + "form", + "jquery", + "picker", + "plugin", + "select2", + "widget", + "yii2" + ], + "time": "2016-01-10 12:18:38" + }, + { + "name": "kartik-v/yii2-widget-depdrop", + "version": "v1.0.4", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-depdrop.git", + "reference": "6918ca6f7d7be153c80f6aa9c261f9b333293e9c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-depdrop/zipball/6918ca6f7d7be153c80f6aa9c261f9b333293e9c", + "reference": "6918ca6f7d7be153c80f6aa9c261f9b333293e9c", + "shasum": "" + }, + "require": { + "kartik-v/dependent-dropdown": "~1.4", + "kartik-v/yii2-krajee-base": "~1.7" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\depdrop\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "Widget that enables setting up dependent dropdowns with nested dependencies (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-depdrop", + "keywords": [ + "dependent", + "dropdown", + "extension", + "form", + "jquery", + "plugin", + "widget", + "yii2" + ], + "time": "2016-01-10 17:30:48" + }, + { + "name": "kartik-v/yii2-widget-fileinput", + "version": "v1.0.5", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-fileinput.git", + "reference": "3b8f6819f2cd01becff5251b8b952ac3e57b903a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-fileinput/zipball/3b8f6819f2cd01becff5251b8b952ac3e57b903a", + "reference": "3b8f6819f2cd01becff5251b8b952ac3e57b903a", + "shasum": "" + }, + "require": { + "kartik-v/bootstrap-fileinput": "~4.2", + "kartik-v/yii2-krajee-base": "~1.7" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "kartik\\file\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "An enhanced FileInput widget for Bootstrap 3.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-fileinput", + "keywords": [ + "extension", + "file", + "form", + "input", + "jquery", + "plugin", + "upload", + "widget", + "yii2" + ], + "time": "2016-06-16 06:53:01" + }, + { + "name": "kartik-v/yii2-widget-growl", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-growl.git", + "reference": "c79abaa47e9103e93345cd1eca7bc75e17e9a92e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-growl/zipball/c79abaa47e9103e93345cd1eca7bc75e17e9a92e", + "reference": "c79abaa47e9103e93345cd1eca7bc75e17e9a92e", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\growl\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "A widget to generate growl based notifications using bootstrap-growl plugin (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-growl", + "keywords": [ + "alert", + "bootstrap", + "extension", + "growl", + "jquery", + "notification", + "plugin", + "widget", + "yii2" + ], + "time": "2015-05-03 08:23:04" + }, + { + "name": "kartik-v/yii2-widget-rangeinput", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-rangeinput.git", + "reference": "ad82cf956b95555d39dbb534587c7827b1dc7bdf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-rangeinput/zipball/ad82cf956b95555d39dbb534587c7827b1dc7bdf", + "reference": "ad82cf956b95555d39dbb534587c7827b1dc7bdf", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\range\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "An enhanced Yii 2 widget encapsulating the HTML 5 range input (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-rangeinput", + "keywords": [ + "HTML5", + "extension", + "form", + "input", + "jquery", + "plugin", + "range", + "widget", + "yii2" + ], + "time": "2015-11-22 06:52:44" + }, + { + "name": "kartik-v/yii2-widget-rating", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-rating.git", + "reference": "69b192bc2b26a435618e17eed7c56294ef805fab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-rating/zipball/69b192bc2b26a435618e17eed7c56294ef805fab", + "reference": "69b192bc2b26a435618e17eed7c56294ef805fab", + "shasum": "" + }, + "require": { + "kartik-v/bootstrap-star-rating": "*", + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "kartik\\rating\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "A Yii2 widget for the simple yet powerful bootstrap-star-rating plugin with fractional rating support (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-rating", + "keywords": [ + "Rating", + "bootstrap", + "extension", + "form", + "input", + "jquery", + "plugin", + "star", + "widget", + "yii2" + ], + "time": "2016-02-17 19:13:26" + }, + { + "name": "kartik-v/yii2-widget-select2", + "version": "v2.0.8", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-select2.git", + "reference": "4d03239c1e28ef8d3b96ab7fe360f5cbda34fb69" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-select2/zipball/4d03239c1e28ef8d3b96ab7fe360f5cbda34fb69", + "reference": "4d03239c1e28ef8d3b96ab7fe360f5cbda34fb69", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "~1.7" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "kartik\\select2\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "Enhanced Yii2 wrapper for the Select2 jQuery plugin (sub repo split from yii2-widgets).", + "homepage": "https://github.com/kartik-v/yii2-widget-select2", + "keywords": [ + "dropdown", + "extension", + "form", + "jquery", + "plugin", + "select2", + "widget", + "yii2" + ], + "time": "2016-02-17 11:49:30" + }, + { + "name": "kartik-v/yii2-widget-sidenav", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-sidenav.git", + "reference": "02ee4f142d7dfbb316f878e538cc7b946f4502d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-sidenav/zipball/02ee4f142d7dfbb316f878e538cc7b946f4502d2", + "reference": "02ee4f142d7dfbb316f878e538cc7b946f4502d2", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\sidenav\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "An enhanced side navigation menu styled for bootstrap (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-sidenav", + "keywords": [ + "bootstrap", + "extension", + "jquery", + "menu", + "navigation", + "plugin", + "sidenav", + "widget", + "yii2" + ], + "time": "2014-11-09 08:07:23" + }, + { + "name": "kartik-v/yii2-widget-spinner", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-spinner.git", + "reference": "3132ba14d58e0564d17f3b846b04c42aa72bdde3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-spinner/zipball/3132ba14d58e0564d17f3b846b04c42aa72bdde3", + "reference": "3132ba14d58e0564d17f3b846b04c42aa72bdde3", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\spinner\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "A widget to render animated CSS3 loading spinners with VML fallback for IE (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-spinner", + "keywords": [ + "CSS3", + "extension", + "jquery", + "loading", + "plugin", + "spinner", + "widget", + "yii2" + ], + "time": "2014-11-09 05:02:05" + }, + { + "name": "kartik-v/yii2-widget-switchinput", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-switchinput.git", + "reference": "7d8ee999d79bcdc1601da5cd59439ac7eb1f5ea6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-switchinput/zipball/7d8ee999d79bcdc1601da5cd59439ac7eb1f5ea6", + "reference": "7d8ee999d79bcdc1601da5cd59439ac7eb1f5ea6", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\switchinput\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "A Yii2 wrapper widget for the Bootstrap Switch plugin to use checkboxes & radios as toggle switchinputes (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-switchinput", + "keywords": [ + "bootstrap", + "extension", + "form", + "input", + "jquery", + "plugin", + "switchinput", + "toggle", + "widget", + "yii2" + ], + "time": "2016-01-10 16:47:35" + }, + { + "name": "kartik-v/yii2-widget-timepicker", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-timepicker.git", + "reference": "fa230caf281fbf6abea29a5dc1c28ebc005e4438" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-timepicker/zipball/fa230caf281fbf6abea29a5dc1c28ebc005e4438", + "reference": "fa230caf281fbf6abea29a5dc1c28ebc005e4438", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\time\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "Enhanced Yii2 wrapper for the bootstrap timepicker plugin (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-timepicker", + "keywords": [ + "bootstrap", + "extension", + "form", + "jquery", + "picker", + "plugin", + "time", + "widget", + "yii2" + ], + "time": "2016-01-12 09:50:39" + }, + { + "name": "kartik-v/yii2-widget-touchspin", + "version": "v1.2.1", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-touchspin.git", + "reference": "afc56f68d87c65c9659b76ac82ae4ae8160634c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-touchspin/zipball/afc56f68d87c65c9659b76ac82ae4ae8160634c6", + "reference": "afc56f68d87c65c9659b76ac82ae4ae8160634c6", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\touchspin\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "A Yii2 wrapper widget for the Bootstrap Switch plugin to use checkboxes & radios as toggle touchspines (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-touchspin", + "keywords": [ + "bootstrap", + "extension", + "form", + "input", + "jquery", + "plugin", + "spinner", + "touch", + "widget", + "yii2" + ], + "time": "2016-01-10 17:10:39" + }, + { + "name": "kartik-v/yii2-widget-typeahead", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-typeahead.git", + "reference": "e369cd55cb2fb9d3a82b57ea6c9a62d69f14fb94" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-typeahead/zipball/e369cd55cb2fb9d3a82b57ea6c9a62d69f14fb94", + "reference": "e369cd55cb2fb9d3a82b57ea6c9a62d69f14fb94", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "~1.7" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\typeahead\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "Enhanced Yii2 wrapper for the Twitter Typeahead plugin (sub repo split from yii2-widgets).", + "homepage": "https://github.com/kartik-v/yii2-widget-typeahead", + "keywords": [ + "dropdown", + "extension", + "form", + "jquery", + "plugin", + "typeahead", + "widget", + "yii2" + ], + "time": "2015-06-28 18:05:41" + }, + { + "name": "kartik-v/yii2-widgets", + "version": "v3.4.0", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widgets.git", + "reference": "f435d5e96c4848844bdfa9cee58249ccfb3e2dd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widgets/zipball/f435d5e96c4848844bdfa9cee58249ccfb3e2dd2", + "reference": "f435d5e96c4848844bdfa9cee58249ccfb3e2dd2", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*", + "kartik-v/yii2-widget-activeform": "*", + "kartik-v/yii2-widget-affix": "*", + "kartik-v/yii2-widget-alert": "*", + "kartik-v/yii2-widget-colorinput": "*", + "kartik-v/yii2-widget-datepicker": "*", + "kartik-v/yii2-widget-datetimepicker": "*", + "kartik-v/yii2-widget-depdrop": "*", + "kartik-v/yii2-widget-fileinput": "*", + "kartik-v/yii2-widget-growl": "*", + "kartik-v/yii2-widget-rangeinput": "*", + "kartik-v/yii2-widget-rating": "*", + "kartik-v/yii2-widget-select2": "*", + "kartik-v/yii2-widget-sidenav": "*", + "kartik-v/yii2-widget-spinner": "*", + "kartik-v/yii2-widget-switchinput": "*", + "kartik-v/yii2-widget-timepicker": "*", + "kartik-v/yii2-widget-touchspin": "*", + "kartik-v/yii2-widget-typeahead": "*" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "kartik\\widgets\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "Collection of useful widgets for Yii Framework 2.0 extending functionalities for Bootstrap", + "homepage": "https://github.com/kartik-v/yii2-widgets", + "keywords": [ + "extension", + "form", + "widget", + "yii2" + ], + "time": "2014-11-09 19:54:17" + }, { "name": "linslin/yii2-curl", "version": "1.0.8", @@ -1931,6 +3243,115 @@ ], "time": "2016-11-25 12:32:42" }, + { + "name": "voskobovich/yii2-linker-behavior", + "version": "4.0.1-rc", + "source": { + "type": "git", + "url": "https://github.com/voskobovich/yii2-linker-behavior.git", + "reference": "b4f0e9b05bbd53fdbd3fcca318b31f6cced4cc66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voskobovich/yii2-linker-behavior/zipball/b4f0e9b05bbd53fdbd3fcca318b31f6cced4cc66", + "reference": "b4f0e9b05bbd53fdbd3fcca318b31f6cced4cc66", + "shasum": "" + }, + "require": { + "fxp/composer-asset-plugin": "*", + "php": ">=5.4.0", + "yiisoft/yii2": "^2" + }, + "require-dev": { + "codeception/codeception": "*", + "yiisoft/yii2-codeception": "^2" + }, + "type": "yii2-behavior", + "autoload": { + "psr-4": { + "voskobovich\\linker\\": "src", + "voskobovich\\linker\\interfaces\\": "src/interfaces", + "voskobovich\\linker\\updaters\\": "src/updaters" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Vitaly Voskobovich", + "email": "vitaly@voskobovich.com", + "homepage": "http://voskobovich.com" + }, + { + "name": "Konstantin Sirotkin", + "email": "beowulfenator@gmail.com", + "homepage": "http://beowulfenator.github.io" + } + ], + "description": "This behavior makes it easy to maintain many-to-many and one-to-many relations in your ActiveRecord models.", + "homepage": "https://github.com/voskobovich/yii2-linker-behavior", + "keywords": [ + "Active Record", + "Behavior", + "ar", + "many-to-many", + "one-to-many", + "relations", + "yii2" + ], + "time": "2016-12-04 11:00:39" + }, + { + "name": "voskobovich/yii2-many-many-behavior", + "version": "v3.2.2", + "source": { + "type": "git", + "url": "https://github.com/voskobovich/yii2-many-to-many-behavior.git", + "reference": "cb130c10aceefe57bd2d3b0544986d84026455ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voskobovich/yii2-many-to-many-behavior/zipball/cb130c10aceefe57bd2d3b0544986d84026455ae", + "reference": "cb130c10aceefe57bd2d3b0544986d84026455ae", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "yiisoft/yii2": "~2.0.0" + }, + "require-dev": { + "yiisoft/yii2-codeception": "~2.0" + }, + "type": "yii2-behavior", + "autoload": { + "psr-4": { + "voskobovich\\behaviors\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Vitaly Voskobovich", + "email": "vitaly@voskobovich.com", + "homepage": "http://voskobovich.com" + } + ], + "description": "This behavior makes it easy to maintain relations many-to-many in the your ActiveRecord model.", + "homepage": "https://github.com/voskobovich/ManyToManyBehavior", + "keywords": [ + "Active Record", + "Behavior", + "many-to-many", + "relation", + "yii2" + ], + "time": "2016-01-14 09:39:52" + }, { "name": "yiisoft/yii2", "version": "2.0.10", @@ -2287,52 +3708,6 @@ "description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).", "time": "2016-04-07 12:29:16" }, - { - "name": "yiisoft/yii2-codeception", - "version": "2.0.5", - "source": { - "type": "git", - "url": "https://github.com/yiisoft/yii2-codeception.git", - "reference": "c916a36d09fc128b05a374e7922bc56854334d56" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-codeception/zipball/c916a36d09fc128b05a374e7922bc56854334d56", - "reference": "c916a36d09fc128b05a374e7922bc56854334d56", - "shasum": "" - }, - "require": { - "yiisoft/yii2": ">=2.0.4" - }, - "type": "yii2-extension", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "yii\\codeception\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Mark Jebri", - "email": "mark.github@yandex.ru" - } - ], - "description": "The Codeception integration for the Yii framework", - "keywords": [ - "codeception", - "yii2" - ], - "abandoned": "codeception/codeception", - "time": "2016-03-17 03:41:26" - }, { "name": "yiisoft/yii2-debug", "version": "2.0.7", diff --git a/config/main.php b/config/main.php index 873695f..e1fd364 100644 --- a/config/main.php +++ b/config/main.php @@ -5,8 +5,8 @@ $params = require(__DIR__ . '/params.php'); return [ 'id' => 'basic', 'name' => 'SmartHome', - 'sourceLanguage' => 'ru', 'language' => 'ru', + 'sourceLanguage' => 'ru', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'components' => [ @@ -77,6 +77,9 @@ return [ 'api' => [ 'class' => 'app\modules\api\Module', ], + 'datecontrol' => [ + 'class' => '\kartik\datecontrol\Module' + ], ], 'params' => $params, 'defaultRoute' => ['panel/index'], diff --git a/giiTemplates/crud/my/views/index.php b/giiTemplates/crud/my/views/index.php index bf7175a..d897040 100644 --- a/giiTemplates/crud/my/views/index.php +++ b/giiTemplates/crud/my/views/index.php @@ -61,7 +61,7 @@ if (($tableSchema = $generator->getTableSchema()) === false) { } ?> - ['class' => 'yii\grid\ActionColumn'], + ['class' => 'app\components\ActionButtonColumn'], ], ]); ?> diff --git a/migrations/m161208_212800_event_refactor.php b/migrations/m161208_212800_event_refactor.php new file mode 100644 index 0000000..60f4174 --- /dev/null +++ b/migrations/m161208_212800_event_refactor.php @@ -0,0 +1,28 @@ +renameTable('event', 'trigger'); + $this->dropColumn('trigger', 'task_id'); + + $this->addColumn('task', 'type', $this->integer()->notNull()->after('id')); + $this->addColumn('task', 'item_id', $this->integer()->after('type')); + $this->addColumn('task', 'item_value', $this->string()->after('item_id')); + + $this->dropTable('task_action'); + } + + public function safeDown() + { + $this->renameTable('trigger', 'event'); + $this->addColumn('trigger', 'task_id', $this->integer()->notNull()->after('id')); + + $this->dropColumn('task', 'type'); + $this->dropColumn('task', 'item_id'); + $this->dropColumn('task', 'item_value'); + } +} diff --git a/migrations/m161209_211635_create_junction_table_for_trigger_and_task_tables.php b/migrations/m161209_211635_create_junction_table_for_trigger_and_task_tables.php new file mode 100644 index 0000000..e85b4f1 --- /dev/null +++ b/migrations/m161209_211635_create_junction_table_for_trigger_and_task_tables.php @@ -0,0 +1,91 @@ +createTable('trigger_task', [ + 'trigger_id' => $this->integer(), + 'task_id' => $this->integer(), + 'PRIMARY KEY(trigger_id, task_id)', + ]); + + // creates index for column `trigger_id` + $this->createIndex( + 'idx-trigger_task-trigger_id', + 'trigger_task', + 'trigger_id' + ); + + // add foreign key for table `trigger` + $this->addForeignKey( + 'fk-trigger_task-trigger_id', + 'trigger_task', + 'trigger_id', + 'trigger', + 'id', + 'CASCADE' + ); + + // creates index for column `task_id` + $this->createIndex( + 'idx-trigger_task-task_id', + 'trigger_task', + 'task_id' + ); + + // add foreign key for table `task` + $this->addForeignKey( + 'fk-trigger_task-task_id', + 'trigger_task', + 'task_id', + 'task', + 'id', + 'CASCADE' + ); + } + + /** + * @inheritdoc + */ + public function down() + { + // drops foreign key for table `trigger` + $this->dropForeignKey( + 'fk-trigger_task-trigger_id', + 'trigger_task' + ); + + // drops index for column `trigger_id` + $this->dropIndex( + 'idx-trigger_task-trigger_id', + 'trigger_task' + ); + + // drops foreign key for table `task` + $this->dropForeignKey( + 'fk-trigger_task-task_id', + 'trigger_task' + ); + + // drops index for column `task_id` + $this->dropIndex( + 'idx-trigger_task-task_id', + 'trigger_task' + ); + + $this->dropTable('trigger_task'); + } +} diff --git a/models/Task.php b/models/Task.php index 17bbf41..37a04a8 100644 --- a/models/Task.php +++ b/models/Task.php @@ -2,19 +2,27 @@ namespace app\models; +use voskobovich\linker\LinkerBehavior; use Yii; +use yii\db\ActiveRecord; use yii\helpers\ArrayHelper; /** * This is the model class for table "task". * * @property integer $id + * @property integer $type + * @property integer $item_id + * @property string $item_value * @property string $name * - * @property TaskAction[] $taskActions + * @property Item $item + * @property Trigger[] $triggers */ -class Task extends \yii\db\ActiveRecord +class Task extends ActiveRecord { + const TYPE_ITEM_VALUE = 10; + /** * @inheritdoc */ @@ -29,8 +37,10 @@ class Task extends \yii\db\ActiveRecord public function rules() { return [ - [['name'], 'required'], - [['name'], 'string', 'max' => 255], + [['name', 'type'], 'required'], + [['type', 'item_id'], 'integer'], + [['item_value', 'name'], 'string', 'max' => 255], + [['trigger_ids'], 'each', 'rule' => ['integer']], ]; } @@ -41,20 +51,69 @@ class Task extends \yii\db\ActiveRecord { return [ 'id' => 'ID', - 'name' => 'Name', + 'type' => 'Тип', + 'item_id' => 'Элемент', + 'item_value' => 'Значение Элемента', + 'trigger_ids' => 'Triggers', + 'name' => 'Название', ]; } + /** + * @inheritdoc + */ + public function behaviors() + { + return [ + [ + 'class' => LinkerBehavior::className(), + 'relations' => [ + 'trigger_ids' => 'triggers', + ], + ], + ]; + } + + /** + * @return array + */ + public static function getList() + { + return ArrayHelper::map(self::find()->all(), 'id', 'name'); + } + + /** + * @return array + */ + public static function getTypes() + { + return [ + self::TYPE_ITEM_VALUE => 'Изменить значение Элемента', + ]; + } + + /** + * @return string + */ + public function getTypeLabel() + { + return self::getTypes()[$this->type]; + } + /** * @return \yii\db\ActiveQuery */ - public function getTaskActions() + public function getTriggers() { - return $this->hasMany(TaskAction::className(), ['task_id' => 'id']); + return $this->hasMany(Trigger::className(), ['id' => 'trigger_id']) + ->viaTable('trigger_task', ['task_id' => 'id']); } - public static function getList() + /** + * @return \yii\db\ActiveQuery + */ + public function getItem() { - return ArrayHelper::map(self::find()->all(), 'id', 'name'); + return $this->hasOne(Item::className(), ['id' => 'item_id']); } } diff --git a/models/TaskAction.php b/models/TaskAction.php deleted file mode 100644 index 66b9f01..0000000 --- a/models/TaskAction.php +++ /dev/null @@ -1,72 +0,0 @@ - 255], - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'type' => 'Тип', - 'item_id' => 'Элемент', - 'item_value' => 'Значение Элемента', - 'task_id' => 'Задача', - 'name' => 'Название', - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getItem() - { - return $this->hasOne(Item::className(), ['id' => 'item_id']); - } - - public static function getTypes() - { - return [ - self::TYPE_CHANGE_ITEM_VALUE => 'Изменить значение Элемента', - ]; - } -} diff --git a/models/Event.php b/models/Trigger.php similarity index 58% rename from models/Event.php rename to models/Trigger.php index a85e115..4f37e80 100644 --- a/models/Event.php +++ b/models/Trigger.php @@ -2,26 +2,26 @@ namespace app\models; +use voskobovich\linker\LinkerBehavior; use Yii; use yii\db\ActiveRecord; use yii\helpers\ArrayHelper; /** - * This is the model class for table "event". + * This is the model class for table "trigger". * * @property integer $id * @property integer $type - * @property string $trig_date + * @property integer $trig_date * @property string $trig_time * @property string $trig_time_wdays * @property integer $trig_item_id * @property string $trig_item_value - * @property integer $task_id * @property string $name * - * @property Task $task + * @property Task[] $tasks */ -class Event extends ActiveRecord +class Trigger extends ActiveRecord { const TYPE_BY_ITEM_VALUE = 10; const TYPE_BY_USER_ITEM_CHANGE = 20; @@ -33,7 +33,7 @@ class Event extends ActiveRecord */ public static function tableName() { - return 'event'; + return 'trigger'; } /** @@ -43,9 +43,26 @@ class Event extends ActiveRecord { return [ [['type', 'name'], 'required'], - [['type', 'trig_item_id', 'task_id'], 'integer'], - [['type'], 'in', 'range' => self::getStatusesArray()], - [['trig_date', 'trig_item_value', 'name', 'trig_time', 'trig_time_wdays'], 'string', 'max' => 255], + [['type', 'trig_item_id', 'trig_date'], 'integer'], + [['type'], 'in', 'range' => self::getTypesArray()], + [['trig_item_value', 'name', 'trig_time', 'trig_time_wdays'], 'string', 'max' => 255], + [['trig_time', 'trig_time_wdays', 'trig_date'], 'default', 'value' => null], + [['task_ids'], 'each', 'rule' => ['integer']], + ]; + } + + /** + * @inheritdoc + */ + public function behaviors() + { + return [ + [ + 'class' => LinkerBehavior::className(), + 'relations' => [ + 'task_ids' => 'tasks', + ], + ], ]; } @@ -62,7 +79,7 @@ class Event extends ActiveRecord 'trig_time_wdays' => 'Дни срабатывания', 'trig_item_id' => 'Элемент срабатывания', 'trig_item_value' => 'Значение элемента срабатывания', - 'task_id' => 'Задача', + 'task_ids' => 'Задачи', 'name' => 'Имя', ]; } @@ -70,7 +87,7 @@ class Event extends ActiveRecord /** * @return array */ - public static function getStatuses() + public static function getTypes() { return [ self::TYPE_BY_ITEM_VALUE => 'Значение Элемента', @@ -83,26 +100,33 @@ class Event extends ActiveRecord /** * @return array */ - public static function getStatusesArray() + public static function getTypesArray() { - return [ - self::TYPE_BY_ITEM_VALUE, - self::TYPE_BY_USER_ITEM_CHANGE, - self::TYPE_BY_DATE, - self::TYPE_BY_TIME, - ]; + return array_keys(self::getTypes()); + } + + /** + * @return string + */ + public function getTypeLabel() + { + return self::getTypes()[$this->type]; + } + + /** + * @return array + */ + public static function getList() + { + return ArrayHelper::map(self::find()->all(), 'id', 'name'); } /** * @return \yii\db\ActiveQuery */ - public function getTask() + public function getTasks() { - return $this->hasOne(Task::className(), ['id' => 'task_id']); - } - - public static function getList() - { - return ArrayHelper::map(self::find()->all(), 'id', 'name'); + return $this->hasMany(Task::className(), ['id' => 'task_id']) + ->viaTable('trigger_task', ['trigger_id' => 'id']); } } diff --git a/modules/admin/controllers/TaskActionController.php b/modules/admin/controllers/TaskActionController.php deleted file mode 100644 index 8265518..0000000 --- a/modules/admin/controllers/TaskActionController.php +++ /dev/null @@ -1,124 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], - ], - ], - ]; - } - - /** - * Lists all TaskAction models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new TaskActionSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); - } - - /** - * Displays a single TaskAction model. - * @param integer $id - * @return mixed - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new TaskAction model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new TaskAction(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); - } else { - return $this->render('create', [ - 'model' => $model, - ]); - } - } - - /** - * Updates an existing TaskAction model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); - } else { - return $this->render('update', [ - 'model' => $model, - ]); - } - } - - /** - * Deletes an existing TaskAction model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the TaskAction model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return TaskAction the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = TaskAction::findOne($id)) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); - } - } -} diff --git a/modules/admin/controllers/EventController.php b/modules/admin/controllers/TriggerController.php similarity index 80% rename from modules/admin/controllers/EventController.php rename to modules/admin/controllers/TriggerController.php index aaa48b5..d9dde75 100644 --- a/modules/admin/controllers/EventController.php +++ b/modules/admin/controllers/TriggerController.php @@ -3,16 +3,16 @@ namespace app\modules\admin\controllers; use Yii; -use app\models\Event; -use app\modules\admin\models\EventSearch; +use app\models\Trigger; +use app\modules\admin\models\TriggerSearch; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; /** - * EventController implements the CRUD actions for Event model. + * TriggerController implements the CRUD actions for Trigger model. */ -class EventController extends Controller +class TriggerController extends Controller { /** * @inheritdoc @@ -30,12 +30,12 @@ class EventController extends Controller } /** - * Lists all Event models. + * Lists all Trigger models. * @return mixed */ public function actionIndex() { - $searchModel = new EventSearch(); + $searchModel = new TriggerSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', [ @@ -45,7 +45,7 @@ class EventController extends Controller } /** - * Displays a single Event model. + * Displays a single Trigger model. * @param integer $id * @return mixed */ @@ -57,13 +57,13 @@ class EventController extends Controller } /** - * Creates a new Event model. + * Creates a new Trigger model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { - $model = new Event(); + $model = new Trigger(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); @@ -75,7 +75,7 @@ class EventController extends Controller } /** - * Updates an existing Event model. + * Updates an existing Trigger model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed @@ -94,7 +94,7 @@ class EventController extends Controller } /** - * Deletes an existing Event model. + * Deletes an existing Trigger model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed @@ -107,15 +107,15 @@ class EventController extends Controller } /** - * Finds the Event model based on its primary key value. + * Finds the Trigger model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id - * @return Event the loaded model + * @return Trigger the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { - if (($model = Event::findOne($id)) !== null) { + if (($model = Trigger::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); diff --git a/modules/admin/models/TaskActionSearch.php b/modules/admin/models/TaskActionSearch.php deleted file mode 100644 index 6b1ee51..0000000 --- a/modules/admin/models/TaskActionSearch.php +++ /dev/null @@ -1,72 +0,0 @@ - $query, - ]); - - $this->load($params); - - if (!$this->validate()) { - // uncomment the following line if you do not want to return any records when validation fails - // $query->where('0=1'); - return $dataProvider; - } - - // grid filtering conditions - $query->andFilterWhere([ - 'id' => $this->id, - 'type' => $this->type, - 'item_id' => $this->item_id, - ]); - - $query->andFilterWhere(['like', 'item_value', $this->item_value]) - ->andFilterWhere(['like', 'name', $this->name]); - - return $dataProvider; - } -} diff --git a/modules/admin/models/TaskSearch.php b/modules/admin/models/TaskSearch.php index f0b9967..e1b2fc5 100644 --- a/modules/admin/models/TaskSearch.php +++ b/modules/admin/models/TaskSearch.php @@ -18,8 +18,8 @@ class TaskSearch extends Task public function rules() { return [ - [['id'], 'integer'], - [['name'], 'safe'], + [['id', 'type', 'item_id'], 'integer'], + [['item_value', 'name'], 'safe'], ]; } @@ -60,9 +60,12 @@ class TaskSearch extends Task // grid filtering conditions $query->andFilterWhere([ 'id' => $this->id, + 'type' => $this->type, + 'item_id' => $this->item_id, ]); - $query->andFilterWhere(['like', 'name', $this->name]); + $query->andFilterWhere(['like', 'item_value', $this->item_value]) + ->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; } diff --git a/modules/admin/models/EventSearch.php b/modules/admin/models/TriggerSearch.php similarity index 85% rename from modules/admin/models/EventSearch.php rename to modules/admin/models/TriggerSearch.php index b530874..9ddb216 100644 --- a/modules/admin/models/EventSearch.php +++ b/modules/admin/models/TriggerSearch.php @@ -5,12 +5,12 @@ namespace app\modules\admin\models; use Yii; use yii\base\Model; use yii\data\ActiveDataProvider; -use app\models\Event; +use app\models\Trigger; /** - * EventSearch represents the model behind the search form about `app\models\Event`. + * TriggerSearch represents the model behind the search form about `app\models\Trigger`. */ -class EventSearch extends Event +class TriggerSearch extends Trigger { /** * @inheritdoc @@ -18,7 +18,7 @@ class EventSearch extends Event public function rules() { return [ - [['id', 'type', 'trig_item_id', 'task_id'], 'integer'], + [['id', 'type', 'trig_item_id'], 'integer'], [['trig_date', 'trig_time', 'trig_time_wdays', 'trig_item_value', 'name'], 'safe'], ]; } @@ -41,7 +41,7 @@ class EventSearch extends Event */ public function search($params) { - $query = Event::find(); + $query = Trigger::find(); // add conditions that should always apply here @@ -62,7 +62,6 @@ class EventSearch extends Event 'id' => $this->id, 'type' => $this->type, 'trig_item_id' => $this->trig_item_id, - 'task_id' => $this->task_id, ]); $query->andFilterWhere(['like', 'trig_date', $this->trig_date]) diff --git a/modules/admin/views/event/_form.php b/modules/admin/views/event/_form.php deleted file mode 100644 index 2b0367d..0000000 --- a/modules/admin/views/event/_form.php +++ /dev/null @@ -1,53 +0,0 @@ - - -
- = Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?> -
- render('_search', ['model' => $searchModel]); ?> - - - = GridView::widget([ - 'dataProvider' => $dataProvider, - 'summaryOptions' => ['class' => 'alert alert-info'], - 'layout' => '{summary}- = Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> - = Html::a('Удалить', ['delete', 'id' => $model->id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => 'Are you sure you want to delete this item?', - 'method' => 'post', - ], - ]) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'id', - 'type', - 'item_id', - 'item_value', - 'name', - ], - ]) ?> - -= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
- render('_search', ['model' => $searchModel]); ?> = GridView::widget([ @@ -25,9 +26,18 @@ $this->params['breadcrumbs'][] = $this->title; 'filterModel' => $searchModel, 'columns' => [ 'id', + [ + 'filter' => Task::getTypes(), + 'attribute' => 'type', + 'value' => function (Task $model) { + return $model->getTypeLabel(); + }, + ], +// 'item_id', +// 'item_value', 'name', - ['class' => 'yii\grid\ActionColumn'], + ['class' => 'app\components\ActionButtonColumn'], ], ]); ?> diff --git a/modules/admin/views/task/view.php b/modules/admin/views/task/view.php index 4e8fb46..960eeb6 100644 --- a/modules/admin/views/task/view.php +++ b/modules/admin/views/task/view.php @@ -27,6 +27,9 @@ $this->params['breadcrumbs'][] = $this->title; 'model' => $model, 'attributes' => [ 'id', + 'type', + 'item_id', + 'item_value', 'name', ], ]) ?> diff --git a/modules/admin/views/trigger/_form.php b/modules/admin/views/trigger/_form.php new file mode 100644 index 0000000..2509f62 --- /dev/null +++ b/modules/admin/views/trigger/_form.php @@ -0,0 +1,96 @@ + + += Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
- render('_search', ['model' => $searchModel]); ?> = GridView::widget([ @@ -25,12 +26,21 @@ $this->params['breadcrumbs'][] = $this->title; 'filterModel' => $searchModel, 'columns' => [ 'id', - 'type', - 'item_id', - 'item_value', 'name', + [ + 'filter' => Trigger::getTypes(), + 'attribute' => 'type', + 'value' => function (Trigger $model) { + return $model->getTypeLabel(); + }, + ], +// 'trig_date', +// 'trig_time', +// 'trig_time_wdays', +// 'trig_item_id', +// 'trig_item_value', - ['class' => 'yii\grid\ActionColumn'], + ['class' => 'app\components\ActionButtonColumn'], ], ]); ?> diff --git a/modules/admin/views/event/update.php b/modules/admin/views/trigger/update.php similarity index 60% rename from modules/admin/views/event/update.php rename to modules/admin/views/trigger/update.php index c23321c..5d3a28a 100644 --- a/modules/admin/views/event/update.php +++ b/modules/admin/views/trigger/update.php @@ -1,16 +1,16 @@ title = 'Изменить Event: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Events', 'url' => ['index']]; +$this->title = 'Изменить Trigger: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Triggers', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = 'Редактирование'; ?> -= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> @@ -27,13 +27,15 @@ $this->params['breadcrumbs'][] = $this->title; 'model' => $model, 'attributes' => [ 'id', - 'type', - 'trig_date', - 'trig_time', + [ + 'attribute' => 'type', + 'value' => $model->getTypeLabel(), + ], + 'trig_date:datetime', + 'trig_time:time', 'trig_time_wdays', 'trig_item_id', 'trig_item_value', - 'task_id', 'name', ], ]) ?> diff --git a/scheme.jpg b/scheme.jpg deleted file mode 100644 index 0a660c5..0000000 Binary files a/scheme.jpg and /dev/null differ diff --git a/servers/Panel.php b/servers/Panel.php index 5cd0574..8ac703a 100644 --- a/servers/Panel.php +++ b/servers/Panel.php @@ -3,7 +3,8 @@ namespace app\servers; use app\models\Board; -use app\models\Event; +use app\models\Task; +use app\models\Trigger; use app\models\History; use app\models\Item; use app\models\TaskAction; @@ -117,7 +118,7 @@ class Panel implements MessageComponentInterface } } - $this->scheduleEvents(); + $this->scheduleTriggers(); $this->log('Server started'); } @@ -354,7 +355,7 @@ class Panel implements MessageComponentInterface } // Trig event - $this->trigItemValueEvent($item, $value); + $this->triggerItemValue($item, $value); if (in_array($item->type, [ Item::TYPE_SWITCH, @@ -418,7 +419,7 @@ class Panel implements MessageComponentInterface } // Trig event - $this->trigItemValueEvent($item, $value); + $this->triggerItemValue($item, $value); if (in_array($item->type, [ Item::TYPE_SWITCH, @@ -933,10 +934,10 @@ class Panel implements MessageComponentInterface * @param Item $item * @param string $value */ - private function trigItemValueEvent($item, $value) + private function triggerItemValue($item, $value) { // Find event - $event = Event::findOne([ + $event = Trigger::findOne([ 'trig_item_id' => $item->id, 'trig_item_value' => $value, ]); @@ -945,28 +946,29 @@ class Panel implements MessageComponentInterface return; } - $this->trigEvent($event); + $this->trigger($event); } /** - * @param TaskAction $action + * @param Task $task */ - private function doTaskAction($action) + private function doTask($task) { - switch ($action->type) { - case TaskAction::TYPE_CHANGE_ITEM_VALUE: - $item = $action->item; + switch ($task->type) { + case Task::TYPE_ITEM_VALUE: + $item = $task->item; switch ($item->type) { case Item::TYPE_SWITCH: $data = [ - 'type' => $action->item_value == '1' ? 'turnON' : 'turnOFF', + 'type' => $task->item_value == '1' ? 'turnON' : 'turnOFF', 'pin' => $item->pin, ]; break; case Item::TYPE_RGB: - $rgbData = $this->valueToRgbData($action->item_value); + $rgbData = $this->valueToRgbData($task->item_value); + $red = $rgbData[0]; $green = $rgbData[1]; $blue = $rgbData[2]; @@ -984,7 +986,7 @@ class Panel implements MessageComponentInterface default: $data = [ 'type' => 'value', - 'value' => $action->item_value, + 'value' => $task->item_value, 'pin' => $item->pin, ]; @@ -997,171 +999,173 @@ class Panel implements MessageComponentInterface } } + /** + * @param string $value + * @return array + */ private function valueToRgbData($value) { return explode(',', $value); } /** - * @param Event $event + * @param Trigger $trigger */ - private function trigEvent($event) + private function trigger($trigger) { - $this->log("Event [{$event->id}] triggered. Doing the tasks..."); + $this->log("Trigger [{$trigger->id}] triggered. Doing the tasks..."); // Do the tasks - $task = $event->task; - - foreach ($task->taskActions as $action) { - $this->doTaskAction($action); + foreach ($trigger->tasks as $task) { + $this->doTask($task); } - $this->log("Tasks for Event [{$event->id}] done!"); + $this->log("Tasks for Trigger [{$trigger->id}] done!"); } /** - * @param Event $event + * @param Trigger $trigger */ - private function trigDateEvent($event) + private function triggerDate($trigger) { - $this->trigEvent($event); + $this->trigger($trigger); } /** - * @param Event $event + * @param Trigger $trigger */ - private function trigTimeEvent($event) + private function triggerTime($trigger) { - $this->trigEvent($event); + $this->trigger($trigger); - $this->scheduleEvents(); + $this->scheduleTriggers(); } - protected function scheduleEvents() + protected function scheduleTriggers() { - $this->log("Scheduling Events..."); + $this->log("Scheduling Triggers..."); - /** @var Event[] $events */ - $events = Event::find()->where([ + /** @var Trigger[] $triggers */ + $triggers = Trigger::find()->where([ 'type' => [ - Event::TYPE_BY_DATE, - Event::TYPE_BY_TIME, + Trigger::TYPE_BY_DATE, + Trigger::TYPE_BY_TIME, ], ])->all(); - foreach ($events as $event) { - switch ($event->type) { - case Event::TYPE_BY_DATE: - if (isset($this->eventTimers[$event->id])) { - $this->log("Event [{$event->id}] already scheduled"); + foreach ($triggers as $trigger) { + switch ($trigger->type) { + case Trigger::TYPE_BY_DATE: + if (isset($this->eventTimers[$trigger->id])) { + $this->log("Trigger [{$trigger->id}] already scheduled"); break; } - if ($event->trig_date and $event->trig_date > time()) { - $timeout = $event->trig_date - time(); + if ($trigger->trig_date and $trigger->trig_date > time()) { + $timeout = $trigger->trig_date - time(); - $this->log("Scheduling Event [{$event->id}] with timeout $timeout sec."); + $this->log("Scheduling Trigger [{$trigger->id}] with timeout $timeout sec."); - $this->eventTimers[$event->id] = $this->loop->addTimer( + $this->eventTimers[$trigger->id] = $this->loop->addTimer( $timeout, - function () use ($event) { - $this->log("Event [{$event->id}] triggered by date"); + function () use ($trigger) { + $this->log("Trigger [{$trigger->id}] triggered by date"); - if (isset($this->eventTimers[$event->id])) { - unset($this->eventTimers[$event->id]); + if (isset($this->eventTimers[$trigger->id])) { + unset($this->eventTimers[$trigger->id]); } - return $this->trigDateEvent($event); + return $this->triggerDate($trigger); }); } else { - $this->log("Event [{$event->id}] expired by date"); + $this->log("Trigger [{$trigger->id}] expired by date"); } break; - case Event::TYPE_BY_TIME: - if ($event->trig_time_wdays != '') { // Every week events - $this->log("Event [{$event->id}] runs every week"); + case Trigger::TYPE_BY_TIME: + if ($trigger->trig_time_wdays != '') { // Every week triggers + $this->log("Trigger [{$trigger->id}] runs every week"); - $days = explode(',', $event->trig_time_wdays); + $days = explode(',', $trigger->trig_time_wdays); foreach ($days as $day) { - $trigTimestamp = strtotime($day . ', ' . $event->trig_time); + $trigTimestamp = strtotime($day . ', ' . $trigger->trig_time); if (strtolower(date('l')) == $day) { - $trigTimestamp = strtotime('+1 week, ' . $event->trig_time); + $trigTimestamp = strtotime('+1 week, ' . $trigger->trig_time); } - if (isset($this->eventTimers[$event->id][$trigTimestamp])) { - $this->log("Event [{$event->id}] already scheduled by time [$trigTimestamp]"); + if (isset($this->eventTimers[$trigger->id][$trigTimestamp])) { + $this->log("Trigger [{$trigger->id}] already scheduled by time [$trigTimestamp]"); break; } if (time() < $trigTimestamp) { $timeout = $trigTimestamp - time(); - $this->log("Scheduling Event [{$event->id}] with timeout $timeout sec. for timeout [$trigTimestamp]"); + $this->log("Scheduling Trigger [{$trigger->id}] with timeout $timeout sec. for timeout [$trigTimestamp]"); - $this->eventTimers[$event->id][$trigTimestamp] = $this->loop->addTimer( + $this->eventTimers[$trigger->id][$trigTimestamp] = $this->loop->addTimer( $timeout, - function () use ($event, $trigTimestamp) { - $this->log("Event [{$event->id}] triggered by time [$trigTimestamp]"); + function () use ($trigger, $trigTimestamp) { + $this->log("Trigger [{$trigger->id}] triggered by time [$trigTimestamp]"); - if (isset($this->eventTimers[$event->id][$trigTimestamp])) { - unset($this->eventTimers[$event->id][$trigTimestamp]); + if (isset($this->eventTimers[$trigger->id][$trigTimestamp])) { + unset($this->eventTimers[$trigger->id][$trigTimestamp]); } - return $this->trigTimeEvent($event); + return $this->triggerTime($trigger); } ); } else { $this->log("Trigger time $trigTimestamp is lower than current time " . time()); } } - } else { // Everyday events - $this->log("Event [{$event->id}] runs every day"); + } else { // Everyday triggers + $this->log("Trigger [{$trigger->id}] runs every day"); - if (isset($this->eventTimers[$event->id])) { - $this->log("Event [{$event->id}] already scheduled by time"); + if (isset($this->eventTimers[$trigger->id])) { + $this->log("Trigger [{$trigger->id}] already scheduled by time"); break; } - // Schedule event for today - $trigTimestamp = strtotime('today, ' . $event->trig_time); + // Schedule trigger for today + $trigTimestamp = strtotime('today, ' . $trigger->trig_time); if (time() < $trigTimestamp) { $timeout = $trigTimestamp - time(); - $this->log("Scheduling Event [{$event->id}] with timeout $timeout sec."); + $this->log("Scheduling Trigger [{$trigger->id}] with timeout $timeout sec."); - $this->eventTimers[$event->id] = $this->loop->addTimer( + $this->eventTimers[$trigger->id] = $this->loop->addTimer( $timeout, - function () use ($event) { - $this->log("Event [{$event->id}] triggered by time"); + function () use ($trigger) { + $this->log("Trigger [{$trigger->id}] triggered by time"); - if (isset($this->eventTimers[$event->id])) { - unset($this->eventTimers[$event->id]); + if (isset($this->eventTimers[$trigger->id])) { + unset($this->eventTimers[$trigger->id]); } - return $this->trigTimeEvent($event); + return $this->triggerTime($trigger); } ); } else { - $trigTimestamp = strtotime('tomorrow, ' . $event->trig_time); + $trigTimestamp = strtotime('tomorrow, ' . $trigger->trig_time); $timeout = $trigTimestamp - time(); - $this->log("Event [{$event->id}] expired by time. Scheduling for the next day ($timeout sec.)..."); + $this->log("Trigger [{$trigger->id}] expired by time. Scheduling for the next day ($timeout sec.)..."); - $this->eventTimers[$event->id] = $this->loop->addTimer( + $this->eventTimers[$trigger->id] = $this->loop->addTimer( $timeout, - function () use ($event) { - $this->log("Event [{$event->id}] triggered by time"); + function () use ($trigger) { + $this->log("Trigger [{$trigger->id}] triggered by time"); - if (isset($this->eventTimers[$event->id])) { - unset($this->eventTimers[$event->id]); + if (isset($this->eventTimers[$trigger->id])) { + unset($this->eventTimers[$trigger->id]); } - return $this->trigTimeEvent($event); + return $this->triggerTime($trigger); } ); } diff --git a/smarthome.sql b/smarthome.sql deleted file mode 100644 index 69b080b..0000000 --- a/smarthome.sql +++ /dev/null @@ -1,125 +0,0 @@ --- phpMyAdmin SQL Dump --- version 4.4.15.5 --- http://www.phpmyadmin.net --- --- Хост: 127.0.0.1:3306 --- Время создания: Авг 15 2016 г., 01:06 --- Версия сервера: 5.6.29 --- Версия PHP: 7.0.4 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; - --- --- База данных: `smarthome` --- - --- -------------------------------------------------------- - --- --- Структура таблицы `history` --- - -CREATE TABLE IF NOT EXISTS `history` ( - `id` int(11) NOT NULL, - `item_id` int(11) NOT NULL, - `commited_at` int(11) NOT NULL, - `value` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Структура таблицы `item` --- - -CREATE TABLE IF NOT EXISTS `item` ( - `id` int(11) NOT NULL, - `type` int(11) NOT NULL, - `update_interval` int(11) NOT NULL, - `save_history_interval` int(11) DEFAULT '0', - `room_id` int(11) DEFAULT NULL, - `url` varchar(255) NOT NULL, - `name` varchar(255) NOT NULL, - `sort_order` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Структура таблицы `room` --- - -CREATE TABLE IF NOT EXISTS `room` ( - `id` int(11) NOT NULL, - `name` varchar(255) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Индексы сохранённых таблиц --- - --- --- Индексы таблицы `history` --- -ALTER TABLE `history` - ADD PRIMARY KEY (`id`), - ADD KEY `item_id` (`item_id`); - --- --- Индексы таблицы `item` --- -ALTER TABLE `item` - ADD PRIMARY KEY (`id`), - ADD KEY `group_id` (`room_id`); - --- --- Индексы таблицы `room` --- -ALTER TABLE `room` - ADD PRIMARY KEY (`id`); - --- --- AUTO_INCREMENT для сохранённых таблиц --- - --- --- AUTO_INCREMENT для таблицы `history` --- -ALTER TABLE `history` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT для таблицы `item` --- -ALTER TABLE `item` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; --- --- AUTO_INCREMENT для таблицы `room` --- -ALTER TABLE `room` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; --- --- Ограничения внешнего ключа сохраненных таблиц --- - --- --- Ограничения внешнего ключа таблицы `history` --- -ALTER TABLE `history` - ADD CONSTRAINT `history_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `item` (`id`) ON DELETE CASCADE; - --- --- Ограничения внешнего ключа таблицы `item` --- -ALTER TABLE `item` - ADD CONSTRAINT `item_ibfk_1` FOREIGN KEY (`room_id`) REFERENCES `room` (`id`) ON DELETE CASCADE; - -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/views/layouts/_left.php b/views/layouts/_left.php index 5072cea..5f06c9b 100644 --- a/views/layouts/_left.php +++ b/views/layouts/_left.php @@ -27,13 +27,10 @@ ['label' => 'Настройки', 'options' => ['class' => 'header']], ['label' => 'Элементы', 'icon' => 'fa fa-cubes', 'url' => ['/admin/item/index']], ['label' => 'Платы', 'icon' => 'fa fa-cogs', 'url' => ['/admin/board/index']], - ['label' => 'Events', 'icon' => 'fa fa-cogs', 'items' => [ - ['label' => 'События', 'icon' => 'fa fa-cubes', 'url' => ['/admin/event/index']], - ['label' => 'Задачи', 'icon' => 'fa fa-cubes', 'url' => ['/admin/task/index']], - ['label' => 'Действия', 'icon' => 'fa fa-cubes', 'url' => ['/admin/task-action/index']], - ]], + ['label' => 'Triggers', 'icon' => 'fa fa-feed', 'url' => ['/admin/trigger/index']], + ['label' => 'Задачи', 'icon' => 'fa fa-check', 'url' => ['/admin/task/index']], ['label' => 'Комнаты', 'icon' => 'fa fa-folder-open', 'url' => ['/admin/room/index']], - ['label' => 'История', 'icon' => 'fa fa-bar-chart', 'url' => ['/admin/history/index']], +// ['label' => 'История', 'icon' => 'fa fa-bar-chart', 'url' => ['/admin/history/index']], ['label' => 'Пользователи', 'icon' => 'fa fa-users', 'url' => ['/admin/user/index']], ['label' => 'Yii2', 'options' => ['class' => 'header'], 'visible' => YII_DEBUG], diff --git a/web/css/site.css b/web/css/site.css index adaa987..1cf2c4f 100644 --- a/web/css/site.css +++ b/web/css/site.css @@ -141,8 +141,8 @@ position: absolute; top: 50px; display: block; - width: 20px; - height: 20px; + width: 30px; + height: 30px; background: #605ca8; border-radius: 50%; } @@ -185,3 +185,7 @@ transform: translateY(-25px); } } + +.select2-container--krajee .select2-selection--single { + line-height: 2; +}