From 8af1342727613fdb6c32ca43f0d54bd5edaff504 Mon Sep 17 00:00:00 2001 From: yarik Date: Fri, 28 Oct 2016 16:10:21 +0300 Subject: [PATCH] For leha commit. --- backend/controllers/ArticleController.php | 4 ++-- backend/controllers/BannerController.php | 8 ++++---- backend/controllers/BgController.php | 4 ++-- backend/controllers/BrandController.php | 10 +++++----- backend/controllers/CategoryController.php | 14 +++++++------- backend/controllers/DeliveryController.php | 4 ++-- backend/controllers/EventController.php | 8 ++++---- backend/controllers/LabelController.php | 4 ++-- backend/controllers/OrderController.php | 173 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/controllers/OrdersController.php | 145 ------------------------------------------------------------------------------------------------------------------------------------------------- backend/controllers/PageController.php | 4 ++-- backend/controllers/SeoCategoryController.php | 4 ++-- backend/controllers/SeoController.php | 4 ++-- backend/controllers/SeoDynamicController.php | 4 ++-- backend/controllers/ServiceController.php | 4 ++-- backend/controllers/SiteController.php | 763 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- backend/controllers/SliderImageController.php | 4 ++-- backend/controllers/UserController.php | 330 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------- backend/models/Label.php | 31 ++++++++++++++++--------------- backend/models/LabelSearch.php | 62 +++++++++++++++++++++++++++++++++++--------------------------- backend/models/LoginForm.php | 8 ++++---- backend/models/Order.php | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/models/OrderLabelLang.php | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/models/OrderProducts.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ backend/models/OrderSearch.php | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/models/Orders.php | 91 ------------------------------------------------------------------------------------------- backend/models/OrdersLabelLang.php | 107 ----------------------------------------------------------------------------------------------------------- backend/models/OrdersProducts.php | 45 --------------------------------------------- backend/models/OrdersSearch.php | 96 ------------------------------------------------------------------------------------------------ backend/views/article/_form.php | 4 ++-- backend/views/article/_form_language.php | 18 +++++++++--------- backend/views/article/_search.php | 47 ----------------------------------------------- backend/views/article/create.php | 4 ++-- backend/views/article/update.php | 4 ++-- backend/views/banner/_form.php | 4 ++-- backend/views/banner/_form_language.php | 6 +++--- backend/views/banner/_search.php | 38 -------------------------------------- backend/views/banner/create.php | 4 ++-- backend/views/banner/index.php | 2 +- backend/views/banner/update.php | 10 +++++----- backend/views/banner/view.php | 6 +++--- backend/views/bg/_form.php | 4 ++-- backend/views/bg/_form_language.php | 2 +- backend/views/bg/_search.php | 33 --------------------------------- backend/views/bg/create.php | 4 ++-- backend/views/bg/update.php | 4 ++-- backend/views/brand/_form.php | 4 ++-- backend/views/brand/_form_language.php | 12 ++++++------ backend/views/brand/_search.php | 35 ----------------------------------- backend/views/brand/create.php | 4 ++-- backend/views/brand/index.php | 6 +++--- backend/views/brand/update.php | 10 +++++----- backend/views/brand/view.php | 12 ++++++------ backend/views/category/_form.php | 6 +++--- backend/views/category/_form_language.php | 14 +++++++------- backend/views/category/_search.php | 35 ----------------------------------- backend/views/category/create.php | 4 ++-- backend/views/category/index.php | 8 ++++---- backend/views/category/update.php | 10 +++++----- backend/views/category/view.php | 16 ++++++++-------- backend/views/delivery/_form.php | 6 +++--- backend/views/delivery/_form_language.php | 8 ++++---- backend/views/delivery/_search.php | 33 --------------------------------- backend/views/delivery/create.php | 6 +++--- backend/views/delivery/index.php | 2 +- backend/views/delivery/update.php | 6 +++--- backend/views/event/_form.php | 4 ++-- backend/views/event/_form_language.php | 14 +++++++------- backend/views/event/_search.php | 49 ------------------------------------------------- backend/views/event/create.php | 4 ++-- backend/views/event/index.php | 2 +- backend/views/event/update.php | 10 +++++----- backend/views/event/view.php | 8 ++++---- backend/views/feedback/index.php | 33 ++++++++++++++++++--------------- backend/views/label/_form.php | 6 +++--- backend/views/label/_form_language.php | 6 +++--- backend/views/label/_search.php | 29 ----------------------------- backend/views/label/create.php | 6 +++--- backend/views/label/index.php | 4 ++-- backend/views/label/update.php | 10 +++++----- backend/views/label/view.php | 4 ++-- backend/views/layouts/main-sidebar.php | 4 ++-- backend/views/order/_form.php | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/views/order/add.php | 30 ++++++++++++++++++++++++++++++ backend/views/order/create.php | 19 +++++++++++++++++++ backend/views/order/index.php | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/views/order/show.php | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/views/order/update.php | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/views/orders/_form.php | 68 -------------------------------------------------------------------- backend/views/orders/add.php | 30 ------------------------------ backend/views/orders/create.php | 19 ------------------- backend/views/orders/index.php | 103 ------------------------------------------------------------------------------------------------------- backend/views/orders/show.php | 197 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- backend/views/orders/update.php | 144 ------------------------------------------------------------------------------------------------------------------------------------------------ backend/views/page/_form.php | 4 ++-- backend/views/page/_form_language.php | 16 ++++++++-------- backend/views/page/_search.php | 43 ------------------------------------------- backend/views/page/create.php | 4 ++-- backend/views/page/update.php | 4 ++-- backend/views/seo-category/_form.php | 4 ++-- backend/views/seo-category/_form_language.php | 2 +- backend/views/seo-category/_search.php | 33 --------------------------------- backend/views/seo-category/create.php | 4 ++-- backend/views/seo-category/index.php | 4 ++-- backend/views/seo-category/update.php | 8 ++++---- backend/views/seo-dynamic/_form.php | 4 ++-- backend/views/seo-dynamic/_form_language.php | 14 +++++++------- backend/views/seo-dynamic/_search.php | 45 --------------------------------------------- backend/views/seo-dynamic/create.php | 6 +++--- backend/views/seo-dynamic/index.php | 6 +++--- backend/views/seo-dynamic/update.php | 10 +++++----- backend/views/seo-dynamic/view.php | 12 ++++++------ backend/views/seo/_form.php | 4 ++-- backend/views/seo/_form_language.php | 10 +++++----- backend/views/seo/_search.php | 39 --------------------------------------- backend/views/seo/create.php | 4 ++-- backend/views/seo/index.php | 4 ++-- backend/views/seo/update.php | 4 ++-- backend/views/seo/view.php | 2 +- backend/views/service/_form.php | 4 ++-- backend/views/service/_form_language.php | 14 +++++++------- backend/views/service/_search.php | 45 --------------------------------------------- backend/views/service/create.php | 4 ++-- backend/views/service/update.php | 4 ++-- backend/views/site/login.php | 56 +++++++++++++++++++++++++++++++------------------------- backend/views/slider-image/_form.php | 4 ++-- backend/views/slider-image/_form_language.php | 4 ++-- backend/views/slider-image/_search.php | 41 ----------------------------------------- backend/views/slider-image/create.php | 4 ++-- backend/views/slider-image/update.php | 4 ++-- backend/views/slider/_search.php | 36 ------------------------------------ backend/views/user/_search.php | 37 ------------------------------------- backend/web/js/site.js | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------- backup_leha.sql | 3996 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/behaviors/ArtBoxAccessBehavior.php | 10 +++++----- common/behaviors/SaveImgBehavior.php | 4 ++-- common/behaviors/Slug.php | 14 +++++++------- common/components/artboxtree/ArtboxTreeBehavior.php | 8 ++++---- common/components/artboxtree/ArtboxTreeHelper.php | 6 +++--- common/components/artboxtree/ArtboxTreeQueryTrait.php | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------- common/components/artboxtree/ArtboxTreeWidget.php | 8 ++++---- common/components/artboxtree/treelist/TreeListWidget.php | 4 ++-- common/components/artboxtree/treemenu/TreeMenuWidget.php | 4 ++-- common/models/Article.php | 25 +++++++++++++------------ common/models/ArticleLang.php | 7 ++----- common/models/Banner.php | 8 ++++---- common/models/BannerLang.php | 10 +++++----- common/models/BannerSearch.php | 6 +++--- common/models/Bg.php | 4 ++-- common/models/BgLang.php | 4 ++-- common/models/Delivery.php | 16 ++++++++-------- common/models/DeliverySearch.php | 8 ++++---- common/models/Event.php | 6 +++--- common/models/EventLang.php | 25 +++++++++++-------------- common/models/EventSearch.php | 4 ++-- common/models/Feedback.php | 35 +++++++++++++++++++---------------- common/models/FeedbackSearch.php | 58 ++++++++++++++++++++++++++++++++++------------------------ common/models/LoginForm.php | 8 ++++---- common/models/Order.php | 274 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/OrderDeliveryLang.php | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/OrderProduct.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/OrderSearch.php | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/Orders.php | 268 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- common/models/OrdersDeliveryLang.php | 119 ----------------------------------------------------------------------------------------------------------------------- common/models/OrdersProducts.php | 56 -------------------------------------------------------- common/models/OrdersSearch.php | 102 ------------------------------------------------------------------------------------------------------ common/models/Page.php | 4 ++-- common/models/PageLang.php | 7 ++----- common/models/ProductToRating.php | 4 ++-- common/models/Seo.php | 4 ++-- common/models/SeoCategory.php | 4 ++-- common/models/SeoCategoryLang.php | 10 +++++----- common/models/SeoCategorySearch.php | 12 ++++++------ common/models/SeoDynamic.php | 4 ++-- common/models/SeoDynamicLang.php | 20 ++++++++++---------- common/models/SeoDynamicSearch.php | 12 ++++++------ common/models/SeoLang.php | 10 +++++----- common/models/SeoSearch.php | 18 +++++++++--------- common/models/Service.php | 4 ++-- common/models/ServiceLang.php | 21 +++++++++------------ common/models/SliderImage.php | 4 ++-- common/models/SliderImageLang.php | 4 ++-- common/modules/comment/migrations/m160724_162347_artbox_comment.php | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------- common/modules/comment/migrations/m160726_211227_create_artbox_comment_rating.php | 39 +++++++++++++++++++++++++-------------- common/modules/comment/models/CommentModel.php | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------- common/modules/comment/models/CommentModelSearch.php | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------- common/modules/comment/models/RatingModel.php | 35 +++++++++++++++++------------------ common/modules/comment/models/interfaces/CommentInterface.php | 10 +++++----- common/modules/comment/todo | 8 ++++---- common/modules/comment/views/artbox_comment_item.php | 4 ++-- common/modules/comment/views/manage/index.php | 8 +++----- common/modules/file/FileUploadAsset.php | 43 +++++++++++++++++++++++++++++++++++++++++++ common/modules/file/Module.php | 15 +++++++++++++++ common/modules/file/assets/css/fileupload/style.css | 7 +++++++ common/modules/file/assets/css/jquery.fileupload-noscript.css | 22 ++++++++++++++++++++++ common/modules/file/assets/css/jquery.fileupload-ui-noscript.css | 17 +++++++++++++++++ common/modules/file/assets/css/jquery.fileupload-ui.css | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/css/jquery.fileupload.css | 37 +++++++++++++++++++++++++++++++++++++ common/modules/file/assets/img/loading.gif | Bin 0 -> 3897 bytes common/modules/file/assets/img/progressbar.gif | Bin 0 -> 3323 bytes common/modules/file/assets/js/cors/jquery.postmessage-transport.js | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/js/cors/jquery.xdr-transport.js | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/js/jquery.fileupload-angular.js | 425 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/js/jquery.fileupload-audio.js | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/js/jquery.fileupload-image.js | 321 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/js/jquery.fileupload-jquery-ui.js | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/js/jquery.fileupload-process.js | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/js/jquery.fileupload-ui.js | 710 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/js/jquery.fileupload-validate.js | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/js/jquery.fileupload-video.js | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/js/jquery.fileupload.js | 1477 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/js/jquery.iframe-transport.js | 217 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/assets/js/vendor/jquery.ui.widget.js | 572 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/config.php | 3 +++ common/modules/file/controllers/UploaderController.php | 259 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/models/ImageSizerForm.php | 38 ++++++++++++++++++++++++++++++++++++++ common/modules/file/views/_gallery_item.php | 9 +++++++++ common/modules/file/views/_one_item.php | 17 +++++++++++++++++ common/modules/file/widgets/ImageUploader.php | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/file/widgets/views/image_sizer.php | 203 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/language/behaviors/LanguageBehavior.php | 96 ++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------ common/modules/language/components/LanguageRequest.php | 14 +++++++------- common/modules/language/migrations/m160829_104745_create_table_language.php | 35 +++++++++++++++++++---------------- common/modules/language/migrations/m160829_105345_add_default_languages.php | 69 ++++++++++++++++++++++++++++++++++++++------------------------------- common/modules/language/migrations/m160901_140639_add_ukrainian_language.php | 40 ++++++++++++++++++++++------------------ common/modules/language/models/Language.php | 47 +++++++++++++++++++++++++---------------------- common/modules/language/readme.txt | 8 ++++---- common/modules/language/widgets/LanguageForm.php | 22 +++++++++++----------- common/modules/language/widgets/LanguagePicker.php | 4 ++-- common/modules/language/widgets/views/language_form_frame.php | 16 ++++++++-------- common/modules/product/controllers/ManageController.php | 18 +++++++++--------- common/modules/product/controllers/ProductUnitController.php | 4 ++-- common/modules/product/controllers/VariantController.php | 40 ++++++++++++++++++++-------------------- common/modules/product/helpers/ProductHelper.php | 39 ++++++++++++++++++++++++--------------- common/modules/product/models/Brand.php | 12 ++++++------ common/modules/product/models/BrandLang.php | 25 +++++++++++-------------- common/modules/product/models/BrandSearch.php | 34 ++++++++++++++++++---------------- common/modules/product/models/Category.php | 34 +++++++++++++++++----------------- common/modules/product/models/CategoryLang.php | 25 +++++++++++-------------- common/modules/product/models/CategorySearch.php | 14 +++++++------- common/modules/product/models/Export.php | 14 +++++++------- common/modules/product/models/Import.php | 70 +++++++++++++++++++++++++++++++++++----------------------------------- common/modules/product/models/Product.php | 72 ++++++++++++++++++++++++++++++++++++------------------------------------ common/modules/product/models/ProductCategory.php | 4 ++-- common/modules/product/models/ProductImage.php | 4 ++-- common/modules/product/models/ProductLang.php | 19 ++++++++----------- common/modules/product/models/ProductOption.php | 4 ++-- common/modules/product/models/ProductSearch.php | 48 +++++++++++++++++++++++------------------------- common/modules/product/models/ProductStock.php | 12 ++++++------ common/modules/product/models/ProductUnit.php | 4 ++-- common/modules/product/models/ProductUnitLang.php | 12 ++++++------ common/modules/product/models/ProductUnitSearch.php | 14 +++++++------- common/modules/product/models/ProductVariant.php | 706 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- common/modules/product/models/ProductVariantLang.php | 12 ++++++------ common/modules/product/models/ProductVariantSearch.php | 16 ++++++++-------- common/modules/product/models/Stock.php | 8 ++++---- common/modules/product/views/manage/_form.php | 12 ++++++------ common/modules/product/views/manage/_form_language.php | 6 +++--- common/modules/product/views/manage/create.php | 4 ++-- common/modules/product/views/manage/export.php | 4 ++-- common/modules/product/views/manage/index.php | 341 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------- common/modules/product/views/manage/update.php | 10 +++++----- common/modules/product/views/manage/view.php | 157 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------- common/modules/product/views/product-unit/_form.php | 4 ++-- common/modules/product/views/product-unit/_form_language.php | 4 ++-- common/modules/product/views/product-unit/create.php | 4 ++-- common/modules/product/views/product-unit/index.php | 4 ++-- common/modules/product/views/product-unit/update.php | 8 ++++---- common/modules/product/views/product-unit/view.php | 4 ++-- common/modules/product/views/variant/_form.php | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------- common/modules/product/views/variant/_form_language.php | 2 +- common/modules/product/views/variant/create.php | 25 ++++++++++++++----------- common/modules/product/views/variant/index.php | 140 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------- common/modules/product/views/variant/update.php | 55 +++++++++++++++++++++++++++++++++---------------------- common/modules/product/views/variant/view.php | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------- common/modules/product/widgets/views/brandsCarousel.php | 2 +- common/modules/product/widgets/views/product_smart.php | 12 ++++++------ common/modules/product/widgets/views/submenu.php | 6 +++--- common/modules/rubrication/controllers/TaxGroupController.php | 4 ++-- common/modules/rubrication/controllers/TaxOptionController.php | 22 ++++++++++++---------- common/modules/rubrication/models/TaxGroup.php | 12 ++++++------ common/modules/rubrication/models/TaxGroupLang.php | 15 ++++++--------- common/modules/rubrication/models/TaxGroupToCategory.php | 4 ++-- common/modules/rubrication/models/TaxOption.php | 13 +++++++------ common/modules/rubrication/models/TaxOptionLang.php | 8 +++----- common/modules/rubrication/views/tax-group/_form.php | 6 +++--- common/modules/rubrication/views/tax-group/_form_language.php | 6 +++--- common/modules/rubrication/views/tax-group/create.php | 4 ++-- common/modules/rubrication/views/tax-group/index.php | 2 +- common/modules/rubrication/views/tax-group/update.php | 6 +++--- common/modules/rubrication/views/tax-option/_form.php | 4 ++-- common/modules/rubrication/views/tax-option/_form_language.php | 4 ++-- common/modules/rubrication/views/tax-option/create.php | 8 ++++---- common/modules/rubrication/views/tax-option/index.php | 4 ++-- common/modules/rubrication/views/tax-option/update.php | 8 ++++---- common/modules/rubrication/views/tax-option/view.php | 4 ++-- common/translation/ru/app.php | 7 +++---- common/translation/ua/app.php | 7 +++---- common/widgets/views/basket_modal.php | 6 +++--- console/controllers/SiteMapController.php | 4 ++-- console/migrations/m160926_122456_create_articles_lang_table.php | 2 +- console/migrations/m160928_100918_create_page_lang_table.php | 2 +- console/migrations/m160928_104529_create_banner_lang_table.php | 4 ++-- console/migrations/m160928_112124_create_bg_lang_table.php | 2 +- console/migrations/m160928_122509_create_brand_lang_table.php | 8 ++++---- console/migrations/m160928_133403_create_category_lang_table.php | 8 ++++---- console/migrations/m160928_161047_create_event_lang_table.php | 8 ++++---- console/migrations/m160929_135920_create_order_delivery_lang_table.php | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ console/migrations/m160929_135920_create_orders_delivery_lang_table.php | 42 ------------------------------------------ console/migrations/m160929_142458_create_order_label_lang_table.php | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ console/migrations/m160929_142458_create_orders_label_lang_table.php | 40 ---------------------------------------- console/migrations/m160929_144357_create_product_lang_table.php | 76 ++++++++++++++++++++++++++++++++++++++++++---------------------------------- console/migrations/m160929_155222_create_product_spec_lang_table.php | 2 +- console/migrations/m160929_173535_create_product_unit_lang_table.php | 4 ++-- console/migrations/m160929_175821_create_product_variant_lang_table.php | 4 ++-- console/migrations/m160930_082350_create_project_lang_table.php | 2 +- console/migrations/m160930_100954_create_seo_lang_table.php | 16 ++++++++-------- console/migrations/m160930_133757_create_service_lang_table.php | 6 +++--- console/migrations/m160930_142752_create_slider_image_lang_table.php | 2 +- console/migrations/m160930_145734_create_tax_group_lang_table.php | 4 ++-- console/migrations/m160930_151832_create_tax_option_lang_table.php | 2 +- console/migrations/m161011_104931_create_stock_lang_table.php | 4 ++-- standards | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ todo | 3 ++- 324 files changed, 14150 insertions(+), 5467 deletions(-) create mode 100755 backend/controllers/OrderController.php delete mode 100755 backend/controllers/OrdersController.php create mode 100755 backend/models/Order.php create mode 100755 backend/models/OrderLabelLang.php create mode 100755 backend/models/OrderProducts.php create mode 100755 backend/models/OrderSearch.php delete mode 100755 backend/models/Orders.php delete mode 100755 backend/models/OrdersLabelLang.php delete mode 100755 backend/models/OrdersProducts.php delete mode 100755 backend/models/OrdersSearch.php delete mode 100755 backend/views/article/_search.php delete mode 100755 backend/views/banner/_search.php delete mode 100755 backend/views/bg/_search.php delete mode 100755 backend/views/brand/_search.php delete mode 100755 backend/views/category/_search.php delete mode 100755 backend/views/delivery/_search.php delete mode 100755 backend/views/event/_search.php delete mode 100755 backend/views/label/_search.php create mode 100755 backend/views/order/_form.php create mode 100755 backend/views/order/add.php create mode 100755 backend/views/order/create.php create mode 100755 backend/views/order/index.php create mode 100755 backend/views/order/show.php create mode 100755 backend/views/order/update.php delete mode 100755 backend/views/orders/_form.php delete mode 100755 backend/views/orders/add.php delete mode 100755 backend/views/orders/create.php delete mode 100755 backend/views/orders/index.php delete mode 100755 backend/views/orders/show.php delete mode 100755 backend/views/orders/update.php delete mode 100755 backend/views/page/_search.php delete mode 100755 backend/views/seo-category/_search.php delete mode 100755 backend/views/seo-dynamic/_search.php delete mode 100755 backend/views/seo/_search.php delete mode 100755 backend/views/service/_search.php delete mode 100755 backend/views/slider-image/_search.php delete mode 100755 backend/views/slider/_search.php delete mode 100755 backend/views/user/_search.php create mode 100644 backup_leha.sql create mode 100755 common/models/Order.php create mode 100755 common/models/OrderDeliveryLang.php create mode 100755 common/models/OrderProduct.php create mode 100755 common/models/OrderSearch.php delete mode 100755 common/models/Orders.php delete mode 100755 common/models/OrdersDeliveryLang.php delete mode 100755 common/models/OrdersProducts.php delete mode 100755 common/models/OrdersSearch.php create mode 100755 common/modules/file/FileUploadAsset.php create mode 100755 common/modules/file/Module.php create mode 100755 common/modules/file/assets/css/fileupload/style.css create mode 100755 common/modules/file/assets/css/jquery.fileupload-noscript.css create mode 100755 common/modules/file/assets/css/jquery.fileupload-ui-noscript.css create mode 100755 common/modules/file/assets/css/jquery.fileupload-ui.css create mode 100755 common/modules/file/assets/css/jquery.fileupload.css create mode 100755 common/modules/file/assets/img/loading.gif create mode 100755 common/modules/file/assets/img/progressbar.gif create mode 100755 common/modules/file/assets/js/cors/jquery.postmessage-transport.js create mode 100755 common/modules/file/assets/js/cors/jquery.xdr-transport.js create mode 100755 common/modules/file/assets/js/jquery.fileupload-angular.js create mode 100755 common/modules/file/assets/js/jquery.fileupload-audio.js create mode 100755 common/modules/file/assets/js/jquery.fileupload-image.js create mode 100755 common/modules/file/assets/js/jquery.fileupload-jquery-ui.js create mode 100755 common/modules/file/assets/js/jquery.fileupload-process.js create mode 100755 common/modules/file/assets/js/jquery.fileupload-ui.js create mode 100755 common/modules/file/assets/js/jquery.fileupload-validate.js create mode 100755 common/modules/file/assets/js/jquery.fileupload-video.js create mode 100755 common/modules/file/assets/js/jquery.fileupload.js create mode 100755 common/modules/file/assets/js/jquery.iframe-transport.js create mode 100755 common/modules/file/assets/js/vendor/jquery.ui.widget.js create mode 100755 common/modules/file/config.php create mode 100755 common/modules/file/controllers/UploaderController.php create mode 100755 common/modules/file/models/ImageSizerForm.php create mode 100755 common/modules/file/views/_gallery_item.php create mode 100755 common/modules/file/views/_one_item.php create mode 100755 common/modules/file/widgets/ImageUploader.php create mode 100755 common/modules/file/widgets/views/image_sizer.php create mode 100755 console/migrations/m160929_135920_create_order_delivery_lang_table.php delete mode 100755 console/migrations/m160929_135920_create_orders_delivery_lang_table.php create mode 100755 console/migrations/m160929_142458_create_order_label_lang_table.php delete mode 100755 console/migrations/m160929_142458_create_orders_label_lang_table.php create mode 100644 standards diff --git a/backend/controllers/ArticleController.php b/backend/controllers/ArticleController.php index 7a837e0..2c6c2e3 100755 --- a/backend/controllers/ArticleController.php +++ b/backend/controllers/ArticleController.php @@ -94,7 +94,7 @@ } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } @@ -121,7 +121,7 @@ } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } diff --git a/backend/controllers/BannerController.php b/backend/controllers/BannerController.php index 8450a61..77d5756 100755 --- a/backend/controllers/BannerController.php +++ b/backend/controllers/BannerController.php @@ -89,13 +89,13 @@ if($model->save() && $model->transactionStatus) { return $this->redirect([ 'view', - 'id' => $model->banner_id, + 'id' => $model->id, ]); } } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } @@ -116,13 +116,13 @@ if($model->save() && $model->transactionStatus) { return $this->redirect([ 'view', - 'id' => $model->banner_id, + 'id' => $model->id, ]); } } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } diff --git a/backend/controllers/BgController.php b/backend/controllers/BgController.php index 599beee..189ab2a 100755 --- a/backend/controllers/BgController.php +++ b/backend/controllers/BgController.php @@ -95,7 +95,7 @@ } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } @@ -123,7 +123,7 @@ } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } diff --git a/backend/controllers/BrandController.php b/backend/controllers/BrandController.php index c68ab4f..2fa0fff 100755 --- a/backend/controllers/BrandController.php +++ b/backend/controllers/BrandController.php @@ -98,13 +98,13 @@ if($model->save() && $model->transactionStatus) { return is_null(Yii::$app->request->post('create_and_new')) ? $this->redirect([ 'view', - 'id' => $model->brand_id, + 'id' => $model->id, ]) : $this->redirect(array_merge([ 'create' ], Yii::$app->request->queryParams)); } } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } @@ -126,13 +126,13 @@ if($model->save() && $model->transactionStatus) { return $this->redirect([ 'view', - 'id' => $model->brand_id, + 'id' => $model->id, ]); } } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } @@ -163,7 +163,7 @@ */ protected function findModel($id) { - if(( $model = Brand::find()->with('lang')->where(['brand_id' => $id])->one() ) !== NULL) { + if(( $model = Brand::find()->with('lang')->where(['id' => $id])->one() ) !== NULL) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); diff --git a/backend/controllers/CategoryController.php b/backend/controllers/CategoryController.php index a52ff2c..43b9487 100755 --- a/backend/controllers/CategoryController.php +++ b/backend/controllers/CategoryController.php @@ -93,7 +93,7 @@ if($model->save() && $model->transactionStatus) { return is_null(Yii::$app->request->post('create_and_new')) ? $this->redirect([ 'view', - 'id' => $model->category_id, + 'id' => $model->id, ]) : $this->redirect(array_merge([ 'create' ], Yii::$app->request->queryParams)); } } @@ -102,9 +102,9 @@ } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, 'categories' => ArtboxTreeHelper::treeMap(Category::find() - ->getTree(), 'category_id', 'category_id', '.'), + ->getTree(), 'id', 'id', '.'), ]); } @@ -125,15 +125,15 @@ if($model->save() && $model->transactionStatus) { return $this->redirect([ 'view', - 'id' => $model->category_id, + 'id' => $model->id, ]); } } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, 'categories' => ArtboxTreeHelper::treeMap(Category::find() - ->getTree(), 'category_id', 'category_id', '.'), + ->getTree(), 'id', 'id', '.'), ]); } @@ -165,7 +165,7 @@ protected function findModel($id) { if(( $model = Category::find() - ->where([ 'category_id' => $id ]) + ->where([ 'id' => $id ]) ->with('lang') ->one() ) !== NULL ) { diff --git a/backend/controllers/DeliveryController.php b/backend/controllers/DeliveryController.php index 8019f03..eecc45d 100755 --- a/backend/controllers/DeliveryController.php +++ b/backend/controllers/DeliveryController.php @@ -84,7 +84,7 @@ } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, 'parent_items' => $parent_items, ]); } @@ -117,7 +117,7 @@ } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, 'parent_items' => $parent_items, ]); } diff --git a/backend/controllers/EventController.php b/backend/controllers/EventController.php index 315c33e..44b8a8e 100755 --- a/backend/controllers/EventController.php +++ b/backend/controllers/EventController.php @@ -91,13 +91,13 @@ if($model->save() && $model->transactionStatus) { return $this->redirect([ 'view', - 'id' => $model->event_id, + 'id' => $model->id, ]); } } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } @@ -121,13 +121,13 @@ if($model->save() && $model->transactionStatus) { return $this->redirect([ 'view', - 'id' => $model->event_id, + 'id' => $model->id, ]); } } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } diff --git a/backend/controllers/LabelController.php b/backend/controllers/LabelController.php index 36b166e..e4ca3e1 100755 --- a/backend/controllers/LabelController.php +++ b/backend/controllers/LabelController.php @@ -80,7 +80,7 @@ } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } @@ -109,7 +109,7 @@ } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } diff --git a/backend/controllers/OrderController.php b/backend/controllers/OrderController.php new file mode 100755 index 0000000..5464b1d --- /dev/null +++ b/backend/controllers/OrderController.php @@ -0,0 +1,173 @@ + [ + 'class' => AccessBehavior::className(), + 'rules' => [ + 'site' => [ + [ + 'actions' => [ + 'login', + 'error', + ], + 'allow' => true, + ], + ], + ], + ], + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], + ], + ], + ]; + } + + public function actionIndex() + { + $searchModel = new orderearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render( + 'index', + [ + 'dataProvider' => $dataProvider, + 'searchModel' => $searchModel, + ] + ); + } + + public function actionShow($id) + { + + $model = $this->findModel((int) $id); + $dataProvider = new ActiveDataProvider( + [ + 'query' => orderProduct::find() + ->where([ 'order_id' => (int) $id ]), + 'pagination' => [ + 'pageSize' => 20, + ], + ] + ); + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect([ 'index' ]); + } else { + $model_orderproduct = new orderProduct(); + + return $this->renderAjax( + 'show', + [ + 'model' => $model, + 'model_orderproduct' => $model_orderproduct, + 'dataProvider' => $dataProvider, + ] + ); + } + } + + public function actionLabelupdate() + { + $model = order::findOne($_POST[ 'order_id' ]); + $model->label = $_POST[ 'label_id' ]; + $model->save(); + } + + public function actionPayupdate() + { + $model = order::findOne($_POST[ 'order_id' ]); + $model->pay = $_POST[ 'pay_id' ]; + $model->save(); + } + + public function actionDelete() + { + $model = order::findOne($_GET[ 'id' ]); + $model->delete(); + return Yii::$app->response->redirect([ '/order/index' ]); + } + + public function actionAdd() + { + $model = new orderProduct(); + if ($model->load(Yii::$app->request->post())) { + + if (!$modelMod = ProductVariant::find() + ->with([ 'product' ]) + ->where([ 'sku' => $model->sku ]) + ->one() + ) { + throw new HttpException(404, 'Данного артикля не существует!'); + } + $model->product_name = $modelMod->product->name; + $model->name = $modelMod->name; + $model->sku = $modelMod->sku; + $model->price = $modelMod->price; + $model->sum_cost = $model->count * $modelMod->price; + $model->product_variant_id = $modelMod->id; + $model->save(); + //return Yii::$app->response->redirect(['/admin/order/show','id'=>$_GET['order_id']]); + } + + //return $this->render('add',['model'=>$model]); + } + + public function actionCreate() + { + $model = new order(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect([ 'index' ]); + } else { + return $this->render( + 'create', + [ + 'model' => $model, + ] + ); + } + } + + public function actionDeleteProduct() + { + $model = orderProduct::findOne($_GET[ 'id' ]); + $model->delete(); + return Yii::$app->response->redirect( + [ + '/admin/order/show', + 'id' => $_GET[ 'order_id' ], + ] + ); + } + + protected function findModel($id) + { + if (( $model = order::findOne($id) ) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + } diff --git a/backend/controllers/OrdersController.php b/backend/controllers/OrdersController.php deleted file mode 100755 index 4794d3a..0000000 --- a/backend/controllers/OrdersController.php +++ /dev/null @@ -1,145 +0,0 @@ -[ - 'class' => AccessBehavior::className(), - 'rules' => - ['site' => - [ - [ - 'actions' => ['login', 'error'], - 'allow' => true, - ] - ] - ] - ], - 'verbs' => [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], - ], - ], - ]; - } - - public function actionIndex() - { - $searchModel = new OrdersSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'dataProvider'=>$dataProvider, - 'searchModel'=>$searchModel, - ]); - } - - public function actionShow($id) - { - - $model = $this->findModel((int)$id); - $dataProvider = new ActiveDataProvider([ - 'query' => OrdersProducts::find()->where(['order_id'=>(int)$id]), - 'pagination' => [ - 'pageSize' => 20, - ], - ]); - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['index']); - } else { - $model_orderproducts = new OrdersProducts; - - - return $this->renderAjax('show', [ - 'model' => $model, - 'model_orderproducts'=>$model_orderproducts, - 'dataProvider' => $dataProvider, - ]); - } - } - - public function actionLabelupdate(){ - $model = Orders::findOne($_POST['order_id']); - $model->label = $_POST['label_id']; - $model->save(); - } - - public function actionPayupdate(){ - $model = Orders::findOne($_POST['order_id']); - $model->pay = $_POST['pay_id']; - $model->save(); - } - - public function actionDelete(){ - $model = Orders::findOne($_GET['id']); - $model->delete(); - return Yii::$app->response->redirect(['/orders/index']); - } - - - public function actionAdd(){ - $model = new OrdersProducts; - if ($model->load(Yii::$app->request->post())) { - - if(!$modelMod = ProductVariant::find()->with(['product'])->where(['sku'=>$model->sku])->one()) - throw new HttpException(404, 'Данного артикля не существует!'); - $model->product_name = $modelMod->product->name; - $model->name = $modelMod->name; - $model->sku = $modelMod->sku; - $model->price = $modelMod->price; - $model->sum_cost = $model->count*$modelMod->price; - $model->mod_id = $modelMod->id; - $model->save(); - //return Yii::$app->response->redirect(['/admin/orders/show','id'=>$_GET['order_id']]); - } - - //return $this->render('add',['model'=>$model]); - } - - public function actionCreate(){ - $model = new Orders(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['index']); - } else { - return $this->render('create', [ - 'model' => $model, - ]); - } - } - - public function actionDelete_product(){ - $model = OrdersProducts::findOne($_GET['id']); - $model->delete(); - return Yii::$app->response->redirect(['/admin/orders/show','id'=>$_GET['order_id']]); - } - - protected function findModel($id) - { - if (($model = Orders::findOne($id)) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); - } - } -} diff --git a/backend/controllers/PageController.php b/backend/controllers/PageController.php index e9b6521..18b663c 100755 --- a/backend/controllers/PageController.php +++ b/backend/controllers/PageController.php @@ -94,7 +94,7 @@ } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } @@ -122,7 +122,7 @@ } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } diff --git a/backend/controllers/SeoCategoryController.php b/backend/controllers/SeoCategoryController.php index 09c7945..d749ea0 100755 --- a/backend/controllers/SeoCategoryController.php +++ b/backend/controllers/SeoCategoryController.php @@ -79,7 +79,7 @@ } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } @@ -106,7 +106,7 @@ } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } diff --git a/backend/controllers/SeoController.php b/backend/controllers/SeoController.php index d1130d8..dd61108 100755 --- a/backend/controllers/SeoController.php +++ b/backend/controllers/SeoController.php @@ -93,7 +93,7 @@ } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } @@ -120,7 +120,7 @@ } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } diff --git a/backend/controllers/SeoDynamicController.php b/backend/controllers/SeoDynamicController.php index 1b10cff..5b67b28 100755 --- a/backend/controllers/SeoDynamicController.php +++ b/backend/controllers/SeoDynamicController.php @@ -106,7 +106,7 @@ } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, 'seo_category' => $seo_category, ]); } @@ -136,7 +136,7 @@ } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, 'seo_category' => $seo_category, ]); } diff --git a/backend/controllers/ServiceController.php b/backend/controllers/ServiceController.php index 1a80a55..de422c7 100755 --- a/backend/controllers/ServiceController.php +++ b/backend/controllers/ServiceController.php @@ -94,7 +94,7 @@ } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } @@ -122,7 +122,7 @@ } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } diff --git a/backend/controllers/SiteController.php b/backend/controllers/SiteController.php index ebb6744..88fe3cb 100755 --- a/backend/controllers/SiteController.php +++ b/backend/controllers/SiteController.php @@ -1,696 +1,93 @@ [ - 'class' => VerbFilter::className(), - 'actions' => [ + + /** + * @inheritdoc + */ + public function behaviors() + { + return [ + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [], ], - ], - ]; - } - - /** - * @inheritdoc - */ - public function actions() - { - return [ - 'error' => [ - 'class' => 'yii\web\ErrorAction', - ], - ]; - } - - - public function actionImages(){ - $files = ProductImage::find()->all(); - foreach($files as $file_object){ - $file = $file_object->image; - $file_array = explode('/',$file); - if(is_array($file_array) && count($file_array) >3){ - $count = count($file_array); - $file_name = $file_array[$count-2]."_".$file_array[$count-1]; - print_r($file_name); - $save_image = Yii::getAlias('@productsDir') . "/" . $file_name; - copy($file, $save_image); - $file_object->image = $file_name; - $file_object->save(); - } - + ]; } - - - } - - public function actionIndex() - { - return $this->render('index'); - } - - public function actionLogin() - { - $this->layout = '/none'; - - if (!\Yii::$app->user->isGuest) { - return $this->goHome(); + + /** + * @inheritdoc + */ + public function actions() + { + return [ + 'error' => [ + 'class' => 'yii\web\ErrorAction', + ], + ]; } - - $model = new LoginForm(); - if ($model->load(Yii::$app->request->post()) && $model->login()) { - return $this->redirect(Url::to('/admin/site/index')); - } else { - return $this->render('login', [ - 'model' => $model, - ]); + + public function actionImages() + { + $files = ProductImage::find() + ->all(); + foreach($files as $file_object) { + $file = $file_object->image; + $file_array = explode('/', $file); + if(is_array($file_array) && count($file_array) > 3) { + $count = count($file_array); + $file_name = $file_array[ $count - 2 ] . "_" . $file_array[ $count - 1 ]; + print_r($file_name); + $save_image = Yii::getAlias('@productsDir') . "/" . $file_name; + copy($file, $save_image); + $file_object->image = $file_name; + $file_object->save(); + } + + } + } - } - - public function actionLogout() - { - Yii::$app->user->logout(); - - return $this->goHome(); - } - - public function actionGo() { - $new_products = $linked_products = 0; - - // открываем файл и перебираем - $filename = Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFileProducts'); - if (!is_file($filename)) { - var_dump("File $filename not found"); - return Controller::EXIT_CODE_ERROR; + + public function actionIndex() + { + return $this->render('index'); } - var_dump("File $filename loaded\n"); - - $db = yii::$app->db; - - if (($handle = fopen ($filename, 'r')) !== FALSE) + + public function actionLogin() { - $j = 0; - - while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE) - { - $j++; - - foreach ($data as &$value) - { - //$value = mb_convert_encoding ($value, "UTF-8", mb_detect_encoding ($value)); - $value = iconv ('windows-1251', "UTF-8//TRANSLIT//IGNORE", $value); - $value = trim ($value); - } - - // будет всегда 19 элементов - for ($i = 0; $i <= 18; $i++) - { - if (! isset ($data[$i])) - { - $data[$i] = null; - } - } - - // 1 Группа (категория) - $catalog_name = $data[0]; - if (empty ($catalog_name)) - { - CONTINUE; - } - - // 2 Бренд - $brand_name = $data[1]; - if (empty ($brand_name)) - { - CONTINUE; - } - - // 3 Название товара - $product_name = $data[2]; - if (empty ($product_name)) - { - CONTINUE; - } - - // 4 Описание Укр - $product_body_uk = $data[3]; - - // 5 Описание Рус - $product_body_ru = $data[4]; - - // 6 Фильтр (через запятую) - $filters = explode (',', $data[5]); - - // 7 Доп фильтр через запятую - $filters_extra = explode (',', $data[6]); - - // 8 Пол череззапятую (мужской, женский, детский, унисекс) - $gender = explode (',', $data[7]); - - // 9 Год - $years = explode (',', $data[8]); - - // 10 Цена старая - $product_cost_old = $data[9]; - - // 11 Цена - $produc_cost = $data[10]; - - // 12 Акция - $product_akciya = (bool)$data[11]; - - // 13 Сопуд. Тов. - $similar = explode (',', $data[12]); - - // 14 Новинки - $product_new = (bool)$data[13]; - - // 15 Топ продаж - $product_top = (bool)$data[14]; - - // 16 Сетка Характеристик - $feature = explode ('=', $data[15]); - - // 17 ВИДЕО КОД - $product_video = $data[16]; - - // 18 Галлерея фото - $fotos = explode (',', $data[17]); - - // 19 Штрих код товара. - // расшифровал - это модификации товара! - - $product_image = explode ('=', $data[18]); - $product_image = @$product_image[3]; - - if ( ($_product = Product::find()->filterWhere(['ilike', 'name', trim($product_name)])->one()) === null ) { - $_product = new Product(); - } - - // ==== Set category ==== - if ( ($category = Category::find()->filterWhere(['ilike', 'name', trim($catalog_name)])->one()) !== null ) { - $_product->categories = [$category->category_id]; - } else { - // Create category - $category = new Category(); - $category->name = trim($catalog_name); - $category->save(); - $_product->categories = [$category->category_id]; - } - - // ===== Set brand ==== - if ( $brand_name ) { - if ( ($brand = Brand::find()->filterWhere(['ilike', 'name', trim($brand_name)])->one()) !== null ) { - $_product->brand_id = $brand->brand_id; - } else { - // Create brand - $brand = new Brand(); - $brand->name = trim($brand_name); - $brand->save(); - $_product->brand_id = $brand->brand_id; - } - } - - $_product->name = $product_name; - $_product->video = $product_video; - $_product->description = $product_body_ru; - $_product->top = $product_top; - $_product->akciya = $product_akciya; - $_product->new = $product_new; - - - $_product->save(); - - - // @todo Set image - /*// картинки - if (is_file ($dir.'/mod/' . $product_image)) - { - $resizeObj = new resize ($dir.'/mod/' . $product_image); - $resizeObj->resizeImage (135, 200, 'auto'); - $resizeObj->saveImage ($dir.'/products/ico/' . $product_image, 100); - $resizeObj->resizeImage (370, 370, 'auto'); - $resizeObj->saveImage ($dir.'/products/big/' . $product_image, 100); - }*/ - - // ==== mods ==== - - // (типа штрих код товара) - - // нужно для проставления характеристик относящихся к модификациям - $MOD_ARRAY = []; - - for ($i = 18; $i < count ($data); $i ++) - { - if (! empty ($data[$i])) - { - $mod_arr = explode ('=', $data[$i]); - $mod_art = $mod_arr[0]; - $mod_size = $mod_arr[1]; - $mod_color = $mod_arr[2]; - $mod_image = $mod_arr[3]; - $mod_cost = $produc_cost; - $mod_old_cost = $product_cost_old; - - // Check product variant - if ( ($_productVariant = ProductVariant::find()->andWhere(['ilike', 'sku', $mod_art])->andWhere(['product_id' => $_product->product_id])->one()) === null ) { - $_productVariant = new ProductVariant(); - $_productVariant->product_id = $_product->product_id; - } - - $_productVariant->sku = $mod_art; - $_productVariant->price = $mod_cost; - $_productVariant->price_old = $mod_old_cost; - - $_productVariant->save(); - - $MOD_ARRAY[] = $_productVariant->product_variant_id; - - - $dir = Yii::getAlias('@productsDir').'/'; - if (is_file ($dir . $mod_image)) - { - $resizeObj = new resize ($dir . $mod_image); - $resizeObj->resizeImage (40, 40, 'crop'); - $resizeObj->saveImage ($dir.'ico/' . $mod_image, 100); - $resizeObj->resizeImage (370, 370, 'auto'); - $resizeObj->saveImage ($dir.'/big/' . $mod_image, 100); - } - } - } - - /*// ==== fotos ==== - - foreach ($fotos as $foto) - { - $fields = [ - 'product_id' => $product_id, - 'image' => $foto - ]; - - $modelFotos = Fotos::find () - ->where ('image=:image', [ - ':image' => $foto - ]) - ->one (); - - if (empty ($modelFotos->id)) - { - $db->createCommand () - ->insert ('products_fotos', $fields) - ->execute (); - } - else - { - $db->createCommand () - ->update ('products_fotos', $fields, 'id = ' . $modelFotos->id) - ->execute (); - } - - if (is_file ($dir.'/fotos/' . $foto)) - { - $resizeObj = new resize ($dir.'/fotos/' . $foto); - $resizeObj->resizeImage (100, 100, 'crop'); - $resizeObj->saveImage ($dir.'/fotos/ico/' . $foto, 100); - $resizeObj->resizeImage (400, 400, 'crop'); - $resizeObj->saveImage ($dir.'/fotos/big/' . $foto, 100); - } - }*/ - - // ======================== - // ==== ХАРАКТЕРИСТИКИ ==== - // ======================== - - // есть общие характеристики, которые относятся product_id, такие как brand, gender... - // есть характеристики, которые относятся mod_id, такие как цвет, размер... - - // ==== gender ==== - - /*if (! empty ($gender)) - { - $bookGender = Book::find () - ->where ('book_alias=:book', [ - ':book' => 'gender' - ]) - ->one (); - - foreach ($gender as $filter) - { - if (! empty ($filter)) - { - $bookGenderValue = BookValue::find () - ->where (' - book_id=:book - AND book_value_title=:value - AND book_value_alias=:alias - ', [ - ':book' => $bookGender->book_id, - ':value' => $filter, - ':alias' => Translite::rusencode ($filter), - ] - ) - ->one(); - - if (! isset ($bookGenderValue->book_value_id) || empty ($bookGenderValue->book_value_id)) - { - $db->createCommand () - ->insert (BookValue::tableName (), [ - 'book_id' => $bookGender->book_id, - 'book_value_title' => $filter, - 'book_value_alias' => Translite::rusencode ($filter), - ]) - ->execute (); - - $book_value_id = Yii::$app->db->lastInsertID; - } - else - { - $book_value_id = $bookGenderValue->book_value_id; - } - - // + products_value - $db->createCommand (' - INSERT IGNORE products_value - SET - product_id = '.(int)$product_id.', - book_value_id = '.(int)$book_value_id.' - ') - ->execute (); - } - } - } - - // есть характеристики, которые относятся mod_id, такие как цвет, размер... - - // ==== destination ==== - - if (! empty ($filters)) - { - $bookDestination = Book::find () - ->where ('book_alias=:book', [ - ':book' => 'destination' - ]) - ->one (); - - foreach ($filters as $filter) - { - if (! empty ($filter)) - { - $bookDestinationValue = BookValue::find () - ->where (' - book_id=:book - AND book_value_title=:value - AND book_value_alias=:alias - ', [ - ':book' => $bookDestination->book_id, - ':value' => $filter, - ':alias' => Translite::rusencode ($filter), - ] - ) - ->one(); - - if (! isset ($bookDestinationValue->book_value_id) || empty ($bookDestinationValue->book_value_id)) - { - $db->createCommand () - ->insert (BookValue::tableName (), [ - 'book_id' => $bookDestination->book_id, - 'book_value_title' => $filter, - 'book_value_alias' => Translite::rusencode ($filter), - ]) - ->execute (); - - $book_value_id = Yii::$app->db->lastInsertID; - } - else - { - $book_value_id = $bookDestinationValue->book_value_id; - } - - if (! empty ($MOD_ARRAY)) - { - foreach ($MOD_ARRAY as $id) - { - // + products_value - $db->createCommand (' - INSERT IGNORE mod_value - SET - mod_id = '.(int)$id.', - book_value_id = '.(int)$book_value_id.' - ') - ->execute (); - } - } - } - } - } - - // ==== special ==== - - if (! empty ($filters_extra)) - { - $bookSpecial = Book::find () - ->where ('book_alias=:book', [ - ':book' => 'special' - ]) - ->one (); - - foreach ($filters_extra as $filter) - { - if (! empty ($filter)) - { - $bookSpecialValue = BookValue::find () - ->where (' - book_id=:book - AND book_value_title=:value - AND book_value_alias=:alias - ', [ - ':book' => $bookSpecial->book_id, - ':value' => $filter, - ':alias' => Translite::rusencode ($filter), - ] - ) - ->one(); - - if (! isset ($bookSpecialValue->book_value_id) || empty ($bookSpecialValue->book_value_id)) - { - $db->createCommand () - ->insert (BookValue::tableName (), [ - 'book_id' => $bookSpecial->book_id, - 'book_value_title' => $filter, - 'book_value_alias' => Translite::rusencode ($filter), - ]) - ->execute (); - - $book_value_id = Yii::$app->db->lastInsertID; - } - else - { - $book_value_id = $bookSpecialValue->book_value_id; - } - - if (! empty ($MOD_ARRAY)) - { - foreach ($MOD_ARRAY as $id) - { - // + products_value - $db->createCommand (' - INSERT IGNORE mod_value - SET - mod_id = '.(int)$id.', - book_value_id = '.(int)$book_value_id.' - ') - ->execute (); - } - } - } - } - } - - // ==== year ==== - - if (! empty ($years)) - { - $bookYear = Book::find () - ->where ('book_alias=:book', [ - ':book' => 'year' - ]) - ->one (); - - foreach ($years as $filter) - { - if (! empty ($filter)) - { - $bookYearValue = BookValue::find () - ->where (' - book_id=:book - AND book_value_title=:value - AND book_value_alias=:alias - ', [ - ':book' => $bookYear->book_id, - ':value' => $filter, - ':alias' => Translite::rusencode ($filter), - ] - ) - ->one(); - - if (! isset ($bookYearValue->book_value_id) || empty ($bookYearValue->book_value_id)) - { - $db->createCommand () - ->insert (BookValue::tableName (), [ - 'book_id' => $bookYear->book_id, - 'book_value_title' => $filter, - 'book_value_alias' => Translite::rusencode ($filter), - ]) - ->execute (); - - $book_value_id = Yii::$app->db->lastInsertID; - } - else - { - $book_value_id = $bookYearValue->book_value_id; - } - - if (! empty ($MOD_ARRAY)) - { - foreach ($MOD_ARRAY as $id) - { - // + products_value - $db->createCommand (' - INSERT IGNORE mod_value - SET - mod_id = '.(int)$id.', - book_value_id = '.(int)$book_value_id.' - ') - ->execute (); - } - } - } - } - } - - // ==== $feature ==== - - if (! empty ($feature)) - { - foreach ($feature as $string) - { - $string = str_replace([':', '.'], '', $string); - - if (! empty ($string)) - { - list ($book_title, $value_title) = explode ('*', $string); - - $book_title = trim ($book_title); - $value_title = trim ($value_title); - - if (empty ($book_title) || empty ($value_title)) - { - CONTINUE; - } - - $bookFeature = Book::find () - ->where ('book_title=:book', [ - ':book' => $book_title - ]) - ->one (); - - if (! isset ($bookFeature->book_id) || empty ($bookFeature->book_id)) - { - $db->createCommand () - ->insert (Book::tableName (), [ - 'book_title' => $book_title, - 'book_alias' => Translite::rusencode ($book_title), - ]) - ->execute (); - - $book_id = Yii::$app->db->lastInsertID; - } - else - { - $book_id = $bookFeature->book_id; - } - - $bookFeatureValue = BookValue::find () - ->where (' - book_id=:book - AND book_value_title=:value - AND book_value_alias=:alias - ', [ - ':book' => $book_id, - ':value' => $value_title, - ':alias' => Translite::rusencode ($value_title), - ] - ) - ->one(); - - if (! isset ($bookFeatureValue->book_value_id) || empty ($bookFeatureValue->book_value_id)) - { - $db->createCommand () - ->insert (BookValue::tableName (), [ - 'book_id' => $book_id, - 'book_value_title' => $value_title, - 'book_value_alias' => Translite::rusencode ($value_title), - ]) - ->execute (); - - $book_value_id = Yii::$app->db->lastInsertID; - } - else - { - $book_value_id = $bookFeatureValue->book_value_id; - } - - if (! empty ($MOD_ARRAY)) - { - foreach ($MOD_ARRAY as $id) - { - // + products_value - $db->createCommand (' - INSERT IGNORE mod_value - SET - mod_id = '.(int)$id.', - book_value_id = '.(int)$book_value_id.' - ') - ->execute (); - } - } - } - } - }*/ - - // ==== IMPORTANT ==== - - // записуем ID обработанной записи - - $_product->save(); - var_dump("$j: Product {$_product->name} saved\n"); - if ($j > 100) { - var_dump("Dev OK"); - exit; - } + $this->layout = '/none'; + + if(!\Yii::$app->user->isGuest) { + return $this->goHome(); } - - fclose ($handle); + + $model = new LoginForm(); + if($model->load(Yii::$app->request->post()) && $model->login()) { + return $this->redirect(Url::to('/admin/site/index')); + } else { + return $this->render('login', [ + 'model' => $model, + ]); + } + } + + public function actionLogout() + { + Yii::$app->user->logout(); + + return $this->goHome(); } + } -} diff --git a/backend/controllers/SliderImageController.php b/backend/controllers/SliderImageController.php index ac48133..b82c0e4 100755 --- a/backend/controllers/SliderImageController.php +++ b/backend/controllers/SliderImageController.php @@ -108,7 +108,7 @@ return $this->render('create', [ 'slider_id' => $slider_id, 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, 'slider' => $slider, ]); } @@ -139,7 +139,7 @@ $slider = Slider::findOne($slider_id); return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, 'slider_id' => $slider_id, 'slider' => $slider, ]); diff --git a/backend/controllers/UserController.php b/backend/controllers/UserController.php index 802358c..d8c5aaf 100755 --- a/backend/controllers/UserController.php +++ b/backend/controllers/UserController.php @@ -1,161 +1,193 @@ [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], - ], - ], - 'access' => [ - 'class' => AccessControl::className(), - 'rules' => [ - [ - 'allow' => true, -// 'actions' => ['login', 'signup'], - 'roles' => ['admin'], + /** + * @inheritdoc + */ + public function behaviors() + { + + return [ + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], ], - [ -// 'allow' => true, -// 'actions' => ['logout'], -// 'roles' => ['@'], + ], + 'access' => [ + 'class' => AccessControl::className(), + 'rules' => [ + [ + 'allow' => true, + // 'actions' => ['login', 'signup'], + 'roles' => [ 'admin' ], + ], + [ + // 'allow' => true, + // 'actions' => ['logout'], + // 'roles' => ['@'], + ], ], ], - ], - ]; - } - - /** - * Lists all User models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new UserSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); - } - - /** - * Displays a single User model. - * @param integer $id - * @return mixed - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new User model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new User(); - if (Yii::$app->request->isAjax) { - Yii::$app->response->format = Response::FORMAT_JSON; - $model->load(Yii::$app->request->post()); - return ActiveForm::validate($model); - }else if ($model->load(Yii::$app->request->post()) && $model->validate()) { - $model->save(); - - foreach($model->role as $k => $role){ - $auth = Yii::$app->authManager; - $authorRole = $auth->getRole($role); - $auth->assign($authorRole, $model->id); + ]; + } + + /** + * Lists all User models. + * + * @return mixed + */ + public function actionIndex() + { + $searchModel = new UserSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render( + 'index', + [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ] + ); + } + + /** + * Displays a single User model. + * + * @param integer $id + * + * @return mixed + */ + public function actionView($id) + { + return $this->render( + 'view', + [ + 'model' => $this->findModel($id), + ] + ); + } + + /** + * Creates a new User model. + * If creation is successful, the browser will be redirected to the 'view' page. + * + * @return mixed + */ + public function actionCreate() + { + $model = new User(); + if (Yii::$app->request->isAjax) { + Yii::$app->response->format = Response::FORMAT_JSON; + $model->load(Yii::$app->request->post()); + return ActiveForm::validate($model); + } elseif ($model->load(Yii::$app->request->post()) && $model->validate()) { + $model->save(); + + foreach ($model->role as $k => $role) { + $auth = Yii::$app->authManager; + $authorRole = $auth->getRole($role); + $auth->assign($authorRole, $model->id); + } + + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); + } else { + return $this->render( + 'create', + [ + 'model' => $model, + ] + ); } - - return $this->redirect(['view', 'id' => $model->id]); - } else { - return $this->render('create', [ - 'model' => $model, - ]); } - } - - /** - * Updates an existing User 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 (Yii::$app->request->isAjax) { - Yii::$app->response->format = Response::FORMAT_JSON; - $model->load(Yii::$app->request->post()); - return ActiveForm::validate($model); - }else if ($model->load(Yii::$app->request->post()) && $model->validate()) { - - $model->save(); - - return $this->redirect(['view', 'id' => $model->id]); - } else { - return $this->render('create', [ - 'model' => $model, - ]); + + /** + * Updates an existing User 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 (Yii::$app->request->isAjax) { + Yii::$app->response->format = Response::FORMAT_JSON; + $model->load(Yii::$app->request->post()); + return ActiveForm::validate($model); + } elseif ($model->load(Yii::$app->request->post()) && $model->validate()) { + + $model->save(); + + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); + } else { + return $this->render( + 'create', + [ + 'model' => $model, + ] + ); + } } - } - - /** - * Deletes an existing User 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 User model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return User the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = User::findOne($id)) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); + + /** + * Deletes an existing User 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 User model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return User the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (( $model = User::findOne($id) ) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } } } -} diff --git a/backend/models/Label.php b/backend/models/Label.php index 78e5ed6..95954a9 100755 --- a/backend/models/Label.php +++ b/backend/models/Label.php @@ -10,22 +10,23 @@ /** * Class Label * * From language behavior * - * @property OrdersLabelLang $lang - * @property OrdersLabelLang[] $langs - * @property OrdersLabelLang $object_lang - * @property string $ownerKey - * @property string $langKey - * @property OrdersLabelLang[] $model_langs - * @property bool $transactionStatus - * @property integer $id - * @property string $label + * + * @property orderLabelLang $lang + * @property orderLabelLang[] $langs + * @property orderLabelLang $objectLang + * @property string $ownerKey + * @property string $langKey + * @property orderLabelLang[] $modelLangs + * @property bool $transactionStatus + * @property integer $id + * @property string $label * @method string getOwnerKey() * @method void setOwnerKey( string $value ) * @method string getLangKey() * @method void setLangKey( string $value ) * @method ActiveQuery getLangs() * @method ActiveQuery getLang( integer $language_id ) - * @method OrdersLabelLang[] generateLangs() + * @method orderLabelLang[] generateLangs() * @method void loadLangs( Request $request ) * @method bool linkLangs() * @method bool saveLangs() @@ -47,17 +48,17 @@ public static function tableName() { - return 'orders_label'; + return 'order_label'; } public function behaviors() { return [ 'language' => [ - 'class' => LanguageBehavior::className(), - 'object_lang' => OrdersLabelLang::className(), - 'ownerKey' => 'id', - 'langKey' => 'orders_label_id', + 'class' => LanguageBehavior::className(), + 'objectLang' => orderLabelLang::className(), + 'ownerKey' => 'id', + 'langKey' => 'order_label_id', ], ]; } diff --git a/backend/models/LabelSearch.php b/backend/models/LabelSearch.php index 8af7a64..c4da3b2 100755 --- a/backend/models/LabelSearch.php +++ b/backend/models/LabelSearch.php @@ -14,7 +14,7 @@ /** * @var string */ - public $name; + public $title; /** * @inheritdoc @@ -29,7 +29,7 @@ [ [ 'label', - 'name', + 'title', ], 'safe', ], @@ -59,43 +59,51 @@ // add conditions that should always apply here - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'sort' => [ - 'attributes' => [ - 'id', - 'label', - 'name' => [ - 'asc' => [ 'orders_label_lang.name' => SORT_ASC ], - 'desc' => [ 'orders_label_lang.name' => SORT_DESC ], + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'id', + 'label', + 'title' => [ + 'asc' => [ 'order_label_lang.title' => SORT_ASC ], + 'desc' => [ 'order_label_lang.title' => SORT_DESC ], + ], ], ], - ], - ]); + ] + ); $this->load($params); - if(!$this->validate()) { + 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, - ]); + $query->andFilterWhere( + [ + 'id' => $this->id, + ] + ); - $query->andFilterWhere([ - 'like', - 'label', - $this->label, - ]) - ->andFilterWhere([ - 'like', - 'orders_label_lang.name', - $this->name, - ]); + $query->andFilterWhere( + [ + 'like', + 'label', + $this->label, + ] + ) + ->andFilterWhere( + [ + 'like', + 'order_label_lang.title', + $this->title, + ] + ); return $dataProvider; } diff --git a/backend/models/LoginForm.php b/backend/models/LoginForm.php index 2e18535..b4643fe 100755 --- a/backend/models/LoginForm.php +++ b/backend/models/LoginForm.php @@ -14,7 +14,7 @@ class LoginForm extends Model public $password; public $rememberMe = true; - private $_user; + private $user; /** @@ -70,11 +70,11 @@ class LoginForm extends Model */ protected function getUser() { - if ($this->_user === null) { - $this->_user = User::findByUsername($this->username); + if ($this->user === null) { + $this->user = User::findByUsername($this->username); } - return $this->_user; + return $this->user; } /** diff --git a/backend/models/Order.php b/backend/models/Order.php new file mode 100755 index 0000000..5352140 --- /dev/null +++ b/backend/models/Order.php @@ -0,0 +1,91 @@ + '№ заказа', + 'name' => 'ФИО', + 'phone' => 'Телефон', + 'phone2' => 'Телефон 2', + 'adress' => 'Адрес', + 'body' => 'Сообщение', + 'reserve' => 'Резерв', + 'status' => 'Статус', + 'email' => 'E-mail', + 'total' => 'Сумма', + 'labels' => 'Метки', + 'label' => 'Метка', + 'comment' => 'Комментарий менеджера', + 'date_dedline' => 'Дедлайн', + 'numbercard' => '№ карточки', + 'delivery' => 'Доставка', + 'declaration' => 'Декларация №', + 'stock' => '№ склада', + 'consignment' => '№ накладной', + 'payment' => 'Способ оплаты', + 'insurance' => 'Страховка', + 'amount_imposed' => 'Сумма наложенного', + 'shipping_by' => 'Отправка за счет', + 'city' => 'Город', + ]; + } + + public function getUser() + { + return $this->hasOne(Customer::className(), [ 'id' => 'user_id' ]); + } + + } \ No newline at end of file diff --git a/backend/models/OrderLabelLang.php b/backend/models/OrderLabelLang.php new file mode 100755 index 0000000..455b275 --- /dev/null +++ b/backend/models/OrderLabelLang.php @@ -0,0 +1,108 @@ + 255, + ], + [ + [ + 'order_label_id', + 'language_id', + ], + 'unique', + 'targetAttribute' => [ + 'order_label_id', + 'language_id', + ], + 'message' => 'The combination of order Label ID and Language ID has already been taken.', + ], + [ + [ 'language_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Language::className(), + 'targetAttribute' => [ 'language_id' => 'id' ], + ], + [ + [ 'order_label_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Label::className(), + 'targetAttribute' => [ 'order_label_id' => 'id' ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'order_label_id' => Yii::t('app', 'order Label ID'), + 'language_id' => Yii::t('app', 'Language ID'), + 'title' => Yii::t('app', 'Name'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getLanguage() + { + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getLabel() + { + return $this->hasOne(Label::className(), [ 'id' => 'order_label_id' ]); + } + } diff --git a/backend/models/OrderProducts.php b/backend/models/OrderProducts.php new file mode 100755 index 0000000..7b536f3 --- /dev/null +++ b/backend/models/OrderProducts.php @@ -0,0 +1,46 @@ + 'Продукт', + 'name' => 'Вид', + 'art' => 'Артикул', + 'cost' => 'Цена за один', + 'count' => 'Кол.', + 'sum_cost' => 'Сумма', + ]; + } + + public function getMod() + { + return $this->hasOne(ProductVariant::className(), [ 'product_variant_id' => 'product_variant_id' ]); + } + } \ No newline at end of file diff --git a/backend/models/OrderSearch.php b/backend/models/OrderSearch.php new file mode 100755 index 0000000..6121103 --- /dev/null +++ b/backend/models/OrderSearch.php @@ -0,0 +1,96 @@ + $query, + 'sort'=> ['defaultOrder' => ['id'=>SORT_DESC]], + 'pagination' => [ + 'pageSize' => 20, + ] + ]); + + $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, + 'user_id' => $this->user_id, + 'total' => $this->total, + 'date_time' => $this->date_time, + 'date_dedline' => $this->date_dedline, + 'label' => $this->label, + 'pay' => $this->pay, + 'numbercard' => $this->numbercard, + 'amount_imposed' => $this->amount_imposed, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'phone', $this->phone]) + ->andFilterWhere(['like', 'phone2', $this->phone2]) + ->andFilterWhere(['like', 'email', $this->email]) + ->andFilterWhere(['like', 'adress', $this->adress]) + ->andFilterWhere(['like', 'body', $this->body]) + ->andFilterWhere(['like', 'reserve', $this->reserve]) + ->andFilterWhere(['like', 'status', $this->status]) + ->andFilterWhere(['like', 'comment', $this->comment]) + ->andFilterWhere(['like', 'delivery', $this->delivery]) + ->andFilterWhere(['like', 'declaration', $this->declaration]) + ->andFilterWhere(['like', 'stock', $this->stock]) + ->andFilterWhere(['like', 'consignment', $this->consignment]) + ->andFilterWhere(['like', 'payment', $this->payment]) + ->andFilterWhere(['like', 'insurance', $this->insurance]) + ->andFilterWhere(['like', 'shipping_by', $this->shipping_by]) + ->andFilterWhere(['like', 'city', $this->city]); + + return $dataProvider; + } +} diff --git a/backend/models/Orders.php b/backend/models/Orders.php deleted file mode 100755 index 99cc411..0000000 --- a/backend/models/Orders.php +++ /dev/null @@ -1,91 +0,0 @@ - '№ заказа', - 'name' => 'ФИО', - 'phone' => 'Телефон', - 'phone2' => 'Телефон 2', - 'adress' => 'Адрес', - 'body' => 'Сообщение', - 'reserve' => 'Резерв', - 'status' => 'Статус', - 'email' => 'E-mail', - 'total' => 'Сумма', - 'labels' => 'Метки', - 'label' => 'Метка', - 'comment' => 'Комментарий менеджера', - 'date_dedline' => 'Дедлайн', - 'numbercard' => '№ карточки', - 'delivery' => 'Доставка', - 'declaration' => 'Декларация №', - 'stock' => '№ склада', - 'consignment' => '№ накладной', - 'payment' => 'Способ оплаты', - 'insurance' => 'Страховка', - 'amount_imposed' => 'Сумма наложенного', - 'shipping_by' => 'Отправка за счет', - 'city' => 'Город', - ]; - } - - public function getUser() - { - return $this->hasOne(Customer::className(), [ 'id' => 'user_id' ]); - } - - } \ No newline at end of file diff --git a/backend/models/OrdersLabelLang.php b/backend/models/OrdersLabelLang.php deleted file mode 100755 index 7318871..0000000 --- a/backend/models/OrdersLabelLang.php +++ /dev/null @@ -1,107 +0,0 @@ - 255, - ], - [ - [ - 'orders_label_id', - 'language_id', - ], - 'unique', - 'targetAttribute' => [ - 'orders_label_id', - 'language_id', - ], - 'message' => 'The combination of Orders Label ID and Language ID has already been taken.', - ], - [ - [ 'language_id' ], - 'exist', - 'skipOnError' => true, - 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], - ], - [ - [ 'orders_label_id' ], - 'exist', - 'skipOnError' => true, - 'targetClass' => Label::className(), - 'targetAttribute' => [ 'orders_label_id' => 'id' ], - ], - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'orders_label_id' => Yii::t('app', 'Orders Label ID'), - 'language_id' => Yii::t('app', 'Language ID'), - 'name' => Yii::t('app', 'Name'), - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getLanguage() - { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getLabel() - { - return $this->hasOne(Label::className(), [ 'id' => 'orders_label_id' ]); - } - } diff --git a/backend/models/OrdersProducts.php b/backend/models/OrdersProducts.php deleted file mode 100755 index ebf8a57..0000000 --- a/backend/models/OrdersProducts.php +++ /dev/null @@ -1,45 +0,0 @@ - 'Продукт', - 'name' => 'Вид', - 'art' => 'Артикул', - 'cost' => 'Цена за один', - 'count' => 'Кол.', - 'sum_cost' => 'Сумма', - ]; - } - - public function getMod() - { - return $this->hasOne(ProductVariant::className(), [ 'product_variant_id' => 'mod_id' ]); - } - } \ No newline at end of file diff --git a/backend/models/OrdersSearch.php b/backend/models/OrdersSearch.php deleted file mode 100755 index 39c5a18..0000000 --- a/backend/models/OrdersSearch.php +++ /dev/null @@ -1,96 +0,0 @@ - $query, - 'sort'=> ['defaultOrder' => ['id'=>SORT_DESC]], - 'pagination' => [ - 'pageSize' => 20, - ] - ]); - - $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, - 'user_id' => $this->user_id, - 'total' => $this->total, - 'date_time' => $this->date_time, - 'date_dedline' => $this->date_dedline, - 'label' => $this->label, - 'pay' => $this->pay, - 'numbercard' => $this->numbercard, - 'amount_imposed' => $this->amount_imposed, - ]); - - $query->andFilterWhere(['like', 'name', $this->name]) - ->andFilterWhere(['like', 'phone', $this->phone]) - ->andFilterWhere(['like', 'phone2', $this->phone2]) - ->andFilterWhere(['like', 'email', $this->email]) - ->andFilterWhere(['like', 'adress', $this->adress]) - ->andFilterWhere(['like', 'body', $this->body]) - ->andFilterWhere(['like', 'reserve', $this->reserve]) - ->andFilterWhere(['like', 'status', $this->status]) - ->andFilterWhere(['like', 'comment', $this->comment]) - ->andFilterWhere(['like', 'delivery', $this->delivery]) - ->andFilterWhere(['like', 'declaration', $this->declaration]) - ->andFilterWhere(['like', 'stock', $this->stock]) - ->andFilterWhere(['like', 'consignment', $this->consignment]) - ->andFilterWhere(['like', 'payment', $this->payment]) - ->andFilterWhere(['like', 'insurance', $this->insurance]) - ->andFilterWhere(['like', 'shipping_by', $this->shipping_by]) - ->andFilterWhere(['like', 'city', $this->city]); - - return $dataProvider; - } -} diff --git a/backend/views/article/_form.php b/backend/views/article/_form.php index 83551bf..dd357b9 100755 --- a/backend/views/article/_form.php +++ b/backend/views/article/_form.php @@ -10,7 +10,7 @@ /** * @var View $this * @var Article $model - * @var ArticleLang[] $model_langs + * @var ArticleLang[] $modelLangs * @var ActiveForm $form */ ?> @@ -51,7 +51,7 @@ $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/article/_form_language', 'form' => $form, ]); diff --git a/backend/views/article/_form_language.php b/backend/views/article/_form_language.php index a5592a2..23e8014 100755 --- a/backend/views/article/_form_language.php +++ b/backend/views/article/_form_language.php @@ -13,11 +13,11 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']title') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']alias') +field($model_lang, '[' . $language->id . ']alias') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']body') +field($model_lang, '[' . $language->id . ']body') ->widget(CKEditor::className(), [ 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ 'preset' => 'full', @@ -27,7 +27,7 @@ ]), ]) ?> -field($model_lang, '[' . $language->language_id . ']body_preview') +field($model_lang, '[' . $language->id . ']body_preview') ->widget(CKEditor::className(), [ 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ 'preset' => 'full', @@ -37,17 +37,17 @@ ]), ]) ?> -field($model_lang, '[' . $language->language_id . ']meta_title') +field($model_lang, '[' . $language->id . ']meta_title') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']meta_keywords') +field($model_lang, '[' . $language->id . ']meta_keywords') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']meta_description') +field($model_lang, '[' . $language->id . ']meta_description') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']seo_text') +field($model_lang, '[' . $language->id . ']seo_text') ->textarea([ 'rows' => 6 ]) ?> -field($model_lang, '[' . $language->language_id . ']h1') +field($model_lang, '[' . $language->id . ']h1') ->textInput([ 'maxlength' => true ]) ?> diff --git a/backend/views/article/_search.php b/backend/views/article/_search.php deleted file mode 100755 index afb9cfc..0000000 --- a/backend/views/article/_search.php +++ /dev/null @@ -1,47 +0,0 @@ - - - diff --git a/backend/views/article/create.php b/backend/views/article/create.php index 4b777fb..4adfa7d 100755 --- a/backend/views/article/create.php +++ b/backend/views/article/create.php @@ -7,7 +7,7 @@ /** * @var View $this * @var Article $model - * @var ArticleLang[] $model_langs + * @var ArticleLang[] $modelLangs */ $this->title = \Yii::t('app', 'Create Article'); $this->params[ 'breadcrumbs' ][] = [ @@ -22,7 +22,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/article/update.php b/backend/views/article/update.php index 9ac32d8..8ff029a 100755 --- a/backend/views/article/update.php +++ b/backend/views/article/update.php @@ -7,7 +7,7 @@ /** * @var View $this * @var Article $model - * @var ArticleLang[] $model_langs + * @var ArticleLang[] $modelLangs */ $this->title = \Yii::t('app', 'Update Article') . ': ' . $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ @@ -29,7 +29,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/banner/_form.php b/backend/views/banner/_form.php index cade5cd..6585e99 100755 --- a/backend/views/banner/_form.php +++ b/backend/views/banner/_form.php @@ -12,7 +12,7 @@ * @var View $this * @var Banner $model * @var ActiveForm $form - * @var BannerLang[] $model_langs + * @var BannerLang[] $modelLangs */ ?> @@ -42,7 +42,7 @@ ] )) ?> $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/banner/_form_language', 'form' => $form, ]) ?> diff --git a/backend/views/banner/_form_language.php b/backend/views/banner/_form_language.php index 75ea9d5..966481a 100755 --- a/backend/views/banner/_form_language.php +++ b/backend/views/banner/_form_language.php @@ -11,12 +11,12 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']title') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']alt') +field($model_lang, '[' . $language->id . ']alt') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '['.$language->language_id.']image')->widget(\kartik\file\FileInput::className(), [ +field($model_lang, '['.$language->id.']image')->widget(\kartik\file\FileInput::className(), [ 'model' => $model_lang, 'attribute' => 'image', 'options' => [ diff --git a/backend/views/banner/_search.php b/backend/views/banner/_search.php deleted file mode 100755 index 4bc81e3..0000000 --- a/backend/views/banner/_search.php +++ /dev/null @@ -1,38 +0,0 @@ - - - diff --git a/backend/views/banner/create.php b/backend/views/banner/create.php index 3e97c14..d42053b 100755 --- a/backend/views/banner/create.php +++ b/backend/views/banner/create.php @@ -8,7 +8,7 @@ /** * @var View $this * @var Banner $model - * @var BannerLang[] $model_langs + * @var BannerLang[] $modelLangs */ $this->title = Yii::t('app', 'Create Banner'); @@ -24,7 +24,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/banner/index.php b/backend/views/banner/index.php index 424a0ea..43c66bb 100755 --- a/backend/views/banner/index.php +++ b/backend/views/banner/index.php @@ -23,7 +23,7 @@ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ - 'banner_id', + 'id', [ 'attribute' => 'url', 'content' => function($model) { diff --git a/backend/views/banner/update.php b/backend/views/banner/update.php index eb25ccf..81ccfc1 100755 --- a/backend/views/banner/update.php +++ b/backend/views/banner/update.php @@ -8,21 +8,21 @@ /** * @var View $this * @var Banner $model - * @var BannerLang[] $model_langs + * @var BannerLang[] $modelLangs */ $this->title = Yii::t('app', 'Update {modelClass}: ', [ 'modelClass' => 'Banner', - ]) . $model->banner_id; + ]) . $model->id; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Banners'), 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->banner_id, + 'label' => $model->id, 'url' => [ 'view', - 'id' => $model->banner_id, + 'id' => $model->id, ], ]; $this->params[ 'breadcrumbs' ][] = Yii::t('app', 'Update'); @@ -33,7 +33,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/banner/view.php b/backend/views/banner/view.php index d647be1..64e1bb5 100755 --- a/backend/views/banner/view.php +++ b/backend/views/banner/view.php @@ -21,11 +21,11 @@

$model->banner_id, + 'id' => $model->id, ], [ 'class' => 'btn btn-primary' ]) ?> $model->banner_id, + 'id' => $model->id, ], [ 'class' => 'btn btn-danger', 'data' => [ @@ -38,7 +38,7 @@ $model, 'attributes' => [ - 'banner_id', + 'id', [ 'attribute' => 'url', 'value' => Html::a($model->url, \Yii::$app->urlManagerFrontend->createUrl($model->url)), diff --git a/backend/views/bg/_form.php b/backend/views/bg/_form.php index 13eeadb..e6fef06 100755 --- a/backend/views/bg/_form.php +++ b/backend/views/bg/_form.php @@ -10,7 +10,7 @@ /** * @var View $this * @var Bg $model - * @var BgLang[] $model_langs + * @var BgLang[] $modelLangs * @var ActiveForm $form */ ?> @@ -50,7 +50,7 @@ ]); ?> $model_langs, + 'modelLangs' => $modelLangs, 'form' => $form, 'formView' => '@backend/views/bg/_form_language', ]) ?> diff --git a/backend/views/bg/_form_language.php b/backend/views/bg/_form_language.php index 40cbe15..13dbcc2 100755 --- a/backend/views/bg/_form_language.php +++ b/backend/views/bg/_form_language.php @@ -11,5 +11,5 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']title') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> \ No newline at end of file diff --git a/backend/views/bg/_search.php b/backend/views/bg/_search.php deleted file mode 100755 index 70a8e3a..0000000 --- a/backend/views/bg/_search.php +++ /dev/null @@ -1,33 +0,0 @@ - - -

diff --git a/backend/views/bg/create.php b/backend/views/bg/create.php index 4a9cce1..699a078 100755 --- a/backend/views/bg/create.php +++ b/backend/views/bg/create.php @@ -8,7 +8,7 @@ /** * @var View $this * @var Bg $model - * @var BgLang[] $model_langs + * @var BgLang[] $modelLangs */ $this->title = \Yii::t('app', 'Create Bg'); @@ -24,7 +24,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/bg/update.php b/backend/views/bg/update.php index 7753c93..d65a61a 100755 --- a/backend/views/bg/update.php +++ b/backend/views/bg/update.php @@ -8,7 +8,7 @@ /** * @var View $this * @var Bg $model - * @var BgLang[] $model_langs + * @var BgLang[] $modelLangs */ $this->title = \Yii::t('app', 'Update Bg: ') . $model->lang->title; @@ -31,7 +31,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/brand/_form.php b/backend/views/brand/_form.php index 9b16822..d7ba90e 100755 --- a/backend/views/brand/_form.php +++ b/backend/views/brand/_form.php @@ -11,7 +11,7 @@ * @var View $this * @var Brand $model * @var ActiveForm $form - * @var BrandLang[] $model_langs + * @var BrandLang[] $modelLangs */ ?> @@ -46,7 +46,7 @@ field($model, 'in_menu')->dropDownList([\Yii::t('product', 'No'), \Yii::t('product', 'Yes')]); ?> $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/brand/_form_language', 'form' => $form, ]) ?> diff --git a/backend/views/brand/_form_language.php b/backend/views/brand/_form_language.php index 6447ba1..9d4d675 100755 --- a/backend/views/brand/_form_language.php +++ b/backend/views/brand/_form_language.php @@ -11,20 +11,20 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']name') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']alias') +field($model_lang, '[' . $language->id . ']alias') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']meta_title') +field($model_lang, '[' . $language->id . ']meta_title') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']meta_robots') +field($model_lang, '[' . $language->id . ']meta_robots') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']meta_desc') +field($model_lang, '[' . $language->id . ']meta_description') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']seo_text') +field($model_lang, '[' . $language->id . ']seo_text') ->textarea([ 'rows' => 6 ]) ?> diff --git a/backend/views/brand/_search.php b/backend/views/brand/_search.php deleted file mode 100755 index 5173e77..0000000 --- a/backend/views/brand/_search.php +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/backend/views/brand/create.php b/backend/views/brand/create.php index 3872757..693b80b 100755 --- a/backend/views/brand/create.php +++ b/backend/views/brand/create.php @@ -8,7 +8,7 @@ /** * @var View $this * @var Brand $model - * @var BrandLang[] $model_langs + * @var BrandLang[] $modelLangs */ $this->title = Yii::t('product', 'Create Brand'); @@ -24,7 +24,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/brand/index.php b/backend/views/brand/index.php index 29a43c8..0e2d0be 100755 --- a/backend/views/brand/index.php +++ b/backend/views/brand/index.php @@ -27,10 +27,10 @@ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ - 'brand_id', + 'id', [ - 'attribute' => 'brand_name', - 'value' => 'lang.name', + 'attribute' => 'brandName', + 'value' => 'lang.title', ], 'imageUrl:image', [ diff --git a/backend/views/brand/update.php b/backend/views/brand/update.php index ee2ae53..e52b4f3 100755 --- a/backend/views/brand/update.php +++ b/backend/views/brand/update.php @@ -8,21 +8,21 @@ /** * @var View $this * @var Brand $model - * @var BrandLang[] $model_langs + * @var BrandLang[] $modelLangs */ $this->title = Yii::t('product', 'Update {modelClass}: ', [ 'modelClass' => 'Brand', - ]) . ' ' . $model->lang->name; + ]) . ' ' . $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('product', 'Brands'), 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->lang->name, + 'label' => $model->lang->title, 'url' => [ 'view', - 'id' => $model->brand_id, + 'id' => $model->id, ], ]; $this->params[ 'breadcrumbs' ][] = Yii::t('product', 'Update'); @@ -33,7 +33,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/brand/view.php b/backend/views/brand/view.php index f65bcdc..74e2556 100755 --- a/backend/views/brand/view.php +++ b/backend/views/brand/view.php @@ -10,7 +10,7 @@ * @var Brand $model */ - $this->title = $model->lang->name; + $this->title = $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('product', 'Brands'), 'url' => [ 'index' ], @@ -24,11 +24,11 @@

$model->brand_id, + 'id' => $model->id, ], [ 'class' => 'btn btn-primary' ]) ?> $model->brand_id, + 'id' => $model->id, ], [ 'class' => 'btn btn-danger', 'data' => [ @@ -41,8 +41,8 @@ $model, 'attributes' => [ - 'brand_id', - 'lang.name', + 'id', + 'lang.title', 'lang.alias', [ 'attribute' => 'in_menu', @@ -54,7 +54,7 @@ 'imageUrl:image', 'lang.meta_title', 'lang.meta_robots', - 'lang.meta_desc', + 'lang.meta_description', 'lang.seo_text', ], ]) ?> diff --git a/backend/views/category/_form.php b/backend/views/category/_form.php index 973ecb8..2e53316 100755 --- a/backend/views/category/_form.php +++ b/backend/views/category/_form.php @@ -10,7 +10,7 @@ /** * @var View $this * @var Category $model - * @var CategoryLang[] $model_langs + * @var CategoryLang[] $modelLangs * @var string[] $categories * @var ActiveForm $form */ @@ -27,7 +27,7 @@ ->dropDownList($categories, [ 'prompt' => Yii::t('rubrication', 'Root category'), 'options' => [ - $model->category_id => [ 'disabled' => true ], + $model->id => [ 'disabled' => true ], ], ]) ->label(Yii::t('product', 'Parent category')) ?> @@ -55,7 +55,7 @@ ->hint('Для корректного отображения на сайте, размер изображения должен быть 262x144 либо соблюдать соотношение сторон примерно 2:1'); ?> $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/category/_form_language', 'form' => $form, ]) ?> diff --git a/backend/views/category/_form_language.php b/backend/views/category/_form_language.php index 9e0c533..4f015d5 100755 --- a/backend/views/category/_form_language.php +++ b/backend/views/category/_form_language.php @@ -11,23 +11,23 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']name') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']alias') +field($model_lang, '[' . $language->id . ']alias') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']meta_title') +field($model_lang, '[' . $language->id . ']meta_title') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']meta_robots') +field($model_lang, '[' . $language->id . ']meta_robots') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']meta_desc') +field($model_lang, '[' . $language->id . ']meta_description') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']seo_text') +field($model_lang, '[' . $language->id . ']seo_text') ->textarea([ 'rows' => 6 ]) ?> -field($model_lang, '[' . $language->language_id . ']h1') +field($model_lang, '[' . $language->id . ']h1') ->textInput([ 'maxlength' => true ]) ?> \ No newline at end of file diff --git a/backend/views/category/_search.php b/backend/views/category/_search.php deleted file mode 100755 index 8d636bc..0000000 --- a/backend/views/category/_search.php +++ /dev/null @@ -1,35 +0,0 @@ - - -

diff --git a/backend/views/category/create.php b/backend/views/category/create.php index 4247e2c..34e31e7 100755 --- a/backend/views/category/create.php +++ b/backend/views/category/create.php @@ -8,7 +8,7 @@ /** * @var View $this * @var Category $model - * @var CategoryLang[] $model_langs + * @var CategoryLang[] $modelLangs * @var string[] $categories */ @@ -25,7 +25,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, 'categories' => $categories, ]) ?> diff --git a/backend/views/category/index.php b/backend/views/category/index.php index 3ffaf6f..fe3b6a1 100755 --- a/backend/views/category/index.php +++ b/backend/views/category/index.php @@ -24,9 +24,9 @@ 'filterModel' => $searchModel, 'columns' => [ [ 'class' => 'yii\grid\SerialColumn' ], - 'category_id', + 'id', [ - 'attribute' => 'category_name', + 'attribute' => 'brandName', 'content' => function($data) { /** * @var Category $data @@ -34,9 +34,9 @@ $op = []; foreach($data->getParents()->with('lang') ->all() as $parent) { - $op[] = $parent->lang->name; + $op[] = $parent->lang->title; } - $op[] = $data->lang->name; + $op[] = $data->lang->title; return implode(' → ', $op); }, ], diff --git a/backend/views/category/update.php b/backend/views/category/update.php index 0094434..4d8e305 100755 --- a/backend/views/category/update.php +++ b/backend/views/category/update.php @@ -8,22 +8,22 @@ /** * @var View $this * @var Category $model - * @var CategoryLang[] $model_langs + * @var CategoryLang[] $modelLangs * @var string[] $categories */ $this->title = Yii::t('product', 'Update {modelClass}: ', [ 'modelClass' => 'Category', - ]) . ' ' . $model->lang->name; + ]) . ' ' . $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('product', 'Categories'), 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->lang->name, + 'label' => $model->lang->title, 'url' => [ 'view', - 'id' => $model->category_id, + 'id' => $model->id, ], ]; $this->params[ 'breadcrumbs' ][] = Yii::t('product', 'Update'); @@ -34,7 +34,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, 'categories' => $categories, ]) ?> diff --git a/backend/views/category/view.php b/backend/views/category/view.php index 00c95a5..4e63298 100755 --- a/backend/views/category/view.php +++ b/backend/views/category/view.php @@ -11,7 +11,7 @@ * @var Category[] $tree */ - $this->title = $model->lang->name; + $this->title = $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('product', 'Categories'), 'url' => [ 'index' ], @@ -19,9 +19,9 @@ $this->params[ 'breadcrumbs' ][] = $this->title; $tree_links = []; foreach($tree as $item) { - $tree_links[] = Html::a($item->lang->name, [ + $tree_links[] = Html::a($item->lang->title, [ 'view', - 'id' => $item->category_id, + 'id' => $item->id, ]); } if(empty($tree_links)) { @@ -37,11 +37,11 @@

$model->category_id, + 'id' => $model->id, ], [ 'class' => 'btn btn-primary' ]) ?> $model->category_id, + 'id' => $model->id, ], [ 'class' => 'btn btn-danger', 'data' => [ @@ -52,7 +52,7 @@ 'btn btn-success' ]) ?> parent_id )) { - echo Html::a(Yii::t('product', 'Create category By {name}', [ 'name' => $model->parent->lang->name ]), [ 'category/create?parent=' . $model->parent->category_id ], [ 'class' => 'btn btn-success' ]); + echo Html::a(Yii::t('product', 'Create category By {title}', [ 'title' => $model->parent->lang->title ]), [ 'category/create?parent=' . $model->parent->id ], [ 'class' => 'btn btn-success' ]); } ?>

@@ -60,7 +60,7 @@ $model, 'attributes' => [ - 'category_id', + 'id', [ 'label' => \Yii::t('product', 'Category tree'), 'value' => $tree_string, @@ -70,7 +70,7 @@ 'lang.alias', 'lang.meta_title', 'lang.meta_robots', - 'lang.meta_desc', + 'lang.meta_description', 'lang.seo_text', 'lang.h1', ], diff --git a/backend/views/delivery/_form.php b/backend/views/delivery/_form.php index f048ff9..c621ae6 100755 --- a/backend/views/delivery/_form.php +++ b/backend/views/delivery/_form.php @@ -1,6 +1,6 @@ @@ -29,7 +29,7 @@ ->textInput() ?> $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/delivery/_form_language', 'form' => $form, ]) ?> diff --git a/backend/views/delivery/_form_language.php b/backend/views/delivery/_form_language.php index 745f719..766941c 100755 --- a/backend/views/delivery/_form_language.php +++ b/backend/views/delivery/_form_language.php @@ -1,18 +1,18 @@ -field($model_lang, '[' . $language->language_id . ']title') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']text') +field($model_lang, '[' . $language->id . ']text') ->textarea(); ?> diff --git a/backend/views/delivery/_search.php b/backend/views/delivery/_search.php deleted file mode 100755 index 92fed1c..0000000 --- a/backend/views/delivery/_search.php +++ /dev/null @@ -1,33 +0,0 @@ - - - diff --git a/backend/views/delivery/create.php b/backend/views/delivery/create.php index 4f0a208..24a5a88 100755 --- a/backend/views/delivery/create.php +++ b/backend/views/delivery/create.php @@ -1,14 +1,14 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, 'parent_items' => $parent_items, ]) ?> diff --git a/backend/views/delivery/index.php b/backend/views/delivery/index.php index 8d59ec9..d0568cf 100755 --- a/backend/views/delivery/index.php +++ b/backend/views/delivery/index.php @@ -33,7 +33,7 @@ 'value' => 'lang.title', ], [ - 'attribute' => 'parent_title', + 'attribute' => 'parentTitle', 'value' => 'parent.lang.title', ], 'value', diff --git a/backend/views/delivery/update.php b/backend/views/delivery/update.php index 6d5244c..bf1a62e 100755 --- a/backend/views/delivery/update.php +++ b/backend/views/delivery/update.php @@ -1,6 +1,6 @@ title = 'Update Delivery: ' . $model->lang->title; @@ -32,7 +32,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, 'parent_items' => $parent_items, ]) ?> diff --git a/backend/views/event/_form.php b/backend/views/event/_form.php index 472c404..74a5c6f 100755 --- a/backend/views/event/_form.php +++ b/backend/views/event/_form.php @@ -13,7 +13,7 @@ /** * @var View $this * @var Event $model - * @var EventLang[] $model_langs + * @var EventLang[] $modelLangs * @var ActiveForm $form */ ?> @@ -56,7 +56,7 @@ ]); ?> $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/event/_form_language', 'form' => $form, ]) ?> diff --git a/backend/views/event/_form_language.php b/backend/views/event/_form_language.php index 42e7a78..579c33c 100755 --- a/backend/views/event/_form_language.php +++ b/backend/views/event/_form_language.php @@ -13,13 +13,13 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']name') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']alias') +field($model_lang, '[' . $language->id . ']alias') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']body') +field($model_lang, '[' . $language->id . ']body') ->widget(CKEditor::className(), [ 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ 'preset' => 'full', @@ -29,14 +29,14 @@ ]), ]) ?> -field($model_lang, '[' . $language->language_id . ']meta_title') +field($model_lang, '[' . $language->id . ']meta_title') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']description') +field($model_lang, '[' . $language->id . ']meta_description') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']seo_text') +field($model_lang, '[' . $language->id . ']seo_text') ->textarea([ 'rows' => 6 ]) ?> -field($model_lang, '[' . $language->language_id . ']h1') +field($model_lang, '[' . $language->id . ']h1') ->textInput([ 'maxlength' => true ]) ?> \ No newline at end of file diff --git a/backend/views/event/_search.php b/backend/views/event/_search.php deleted file mode 100755 index c60ba39..0000000 --- a/backend/views/event/_search.php +++ /dev/null @@ -1,49 +0,0 @@ - - - diff --git a/backend/views/event/create.php b/backend/views/event/create.php index 9bccd33..45e8648 100755 --- a/backend/views/event/create.php +++ b/backend/views/event/create.php @@ -8,7 +8,7 @@ /** * @var View $this * @var Event $model - * @var EventLang[] $model_langs + * @var EventLang[] $modelLangs */ $this->title = Yii::t('app', 'Create Event'); @@ -24,7 +24,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/event/index.php b/backend/views/event/index.php index 396fb27..d70a087 100755 --- a/backend/views/event/index.php +++ b/backend/views/event/index.php @@ -24,7 +24,7 @@ 'filterModel' => $searchModel, 'columns' => [ [ 'class' => 'yii\grid\SerialColumn' ], - 'event_id', + 'id', 'imageUrl:image', [ 'class' => 'yii\grid\ActionColumn' ], ], diff --git a/backend/views/event/update.php b/backend/views/event/update.php index 33f5978..9f9e568 100755 --- a/backend/views/event/update.php +++ b/backend/views/event/update.php @@ -8,21 +8,21 @@ /** * @var View $this * @var Event $model - * @var EventLang[] $model_langs + * @var EventLang[] $modelLangs */ $this->title = Yii::t('app', 'Update {modelClass}: ', [ 'modelClass' => 'Event', - ]) . $model->event_id; + ]) . $model->id; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Events'), 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->event_id, + 'label' => $model->id, 'url' => [ 'view', - 'id' => $model->event_id, + 'id' => $model->id, ], ]; $this->params[ 'breadcrumbs' ][] = Yii::t('app', 'Update'); @@ -33,7 +33,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/event/view.php b/backend/views/event/view.php index 028cfd8..ab72bf3 100755 --- a/backend/views/event/view.php +++ b/backend/views/event/view.php @@ -6,7 +6,7 @@ /* @var $this yii\web\View */ /* @var $model common\models\Event */ - $this->title = $model->event_id; + $this->title = $model->id; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Events'), 'url' => [ 'index' ], @@ -20,11 +20,11 @@

$model->event_id, + 'id' => $model->id, ], [ 'class' => 'btn btn-primary' ]) ?> $model->event_id, + 'id' => $model->id, ], [ 'class' => 'btn btn-danger', 'data' => [ @@ -37,7 +37,7 @@ $model, 'attributes' => [ - 'event_id', + 'id', 'imageUrl:image', ], ]) ?> diff --git a/backend/views/feedback/index.php b/backend/views/feedback/index.php index fbe1921..d36ab4e 100755 --- a/backend/views/feedback/index.php +++ b/backend/views/feedback/index.php @@ -4,30 +4,33 @@ use yii\data\ActiveDataProvider; use yii\grid\GridView; use yii\web\View; + /** * @var ActiveDataProvider $dataProvider * @var FeedbackSearch $searchModel * @var View $this */ $this->title = 'Feedback'; - $this->params['breadcrumbs'][] = $this->title; + $this->params[ 'breadcrumbs' ][] = $this->title; ?>

title) ?>

- $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - 'feedback_id', - 'name', - 'phone', - 'date_add:date', - [ - 'class' => 'yii\grid\ActionColumn', - 'template' => '{delete}', + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + [ 'class' => 'yii\grid\SerialColumn' ], + 'id', + 'name', + 'phone', + 'created_at:date', + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{delete}', + ], ], - ], - ]); ?> + ] + ); ?>
\ No newline at end of file diff --git a/backend/views/label/_form.php b/backend/views/label/_form.php index d15ad5f..a4ccce0 100755 --- a/backend/views/label/_form.php +++ b/backend/views/label/_form.php @@ -1,7 +1,7 @@ @@ -22,7 +22,7 @@ field($model, 'label')->textInput(['maxlength' => true]) ?> $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/label/_form_language', 'form' => $form, ]) ?> diff --git a/backend/views/label/_form_language.php b/backend/views/label/_form_language.php index d5388b1..cb7fb16 100755 --- a/backend/views/label/_form_language.php +++ b/backend/views/label/_form_language.php @@ -1,15 +1,15 @@ -field($model_lang, '[' . $language->language_id . ']name') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> diff --git a/backend/views/label/_search.php b/backend/views/label/_search.php deleted file mode 100755 index b989f4f..0000000 --- a/backend/views/label/_search.php +++ /dev/null @@ -1,29 +0,0 @@ - - - diff --git a/backend/views/label/create.php b/backend/views/label/create.php index 19360d8..14439ed 100755 --- a/backend/views/label/create.php +++ b/backend/views/label/create.php @@ -1,14 +1,14 @@ title = 'Create Label'; @@ -21,7 +21,7 @@ $this->params['breadcrumbs'][] = $this->title; render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/label/index.php b/backend/views/label/index.php index 2fe14db..a4f9d03 100755 --- a/backend/views/label/index.php +++ b/backend/views/label/index.php @@ -30,8 +30,8 @@ 'id', 'label', [ - 'attribute' => 'name', - 'value' => 'lang.name', + 'attribute' => 'title', + 'value' => 'lang.title', ], [ 'class' => 'yii\grid\ActionColumn' ], ], diff --git a/backend/views/label/update.php b/backend/views/label/update.php index 5976b0d..bb488bb 100755 --- a/backend/views/label/update.php +++ b/backend/views/label/update.php @@ -1,23 +1,23 @@ title = 'Update Label: ' . $model->lang->name; + $this->title = 'Update Label: ' . $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => 'Labels', 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->lang->name, + 'label' => $model->lang->title, 'url' => [ 'view', 'id' => $model->id, @@ -31,7 +31,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/label/view.php b/backend/views/label/view.php index 10f0e4f..f517a6f 100755 --- a/backend/views/label/view.php +++ b/backend/views/label/view.php @@ -10,7 +10,7 @@ * @var Label $model */ - $this->title = $model->lang->name; + $this->title = $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => 'Labels', 'url' => [ 'index' ], @@ -45,7 +45,7 @@ 'label', [ 'label' => 'Name', - 'value' => $model->lang->name, + 'value' => $model->lang->title, ], ], ]) ?> diff --git a/backend/views/layouts/main-sidebar.php b/backend/views/layouts/main-sidebar.php index 3bbe6f9..15e30c7 100755 --- a/backend/views/layouts/main-sidebar.php +++ b/backend/views/layouts/main-sidebar.php @@ -9,9 +9,9 @@ use yii\widgets\Menu; $items = [ [ 'label' => 'Заказы', - 'url' => ['/orders/index'], + 'url' => ['/order/index'], 'template'=>' {label}', - 'options' => ['class'=>\Yii::$app->user->can('orders') ? '' :'hide'], + 'options' => ['class'=>\Yii::$app->user->can('order') ? '' :'hide'], ], [ 'label' => 'eCommerce', diff --git a/backend/views/order/_form.php b/backend/views/order/_form.php new file mode 100755 index 0000000..f925daf --- /dev/null +++ b/backend/views/order/_form.php @@ -0,0 +1,67 @@ + + + +
+
+ + + field($model, 'name') ?> + + field($model, 'phone') ?> + + field($model, 'phone2') ?> + + field($model, 'email') ?> + + field($model, 'numbercard') ?> + + field($model, 'body')->textArea(['rows' => '3']) ?> + + field($model, 'delivery')->dropDownList(ArrayHelper::map(Delivery::find()->asArray()->all(), 'id', 'title')) */ ?> + + field($model, 'declaration') ?> + + field($model, 'stock') ?> + + field($model, 'consignment') ?> +
+
+ + field($model, 'payment')->dropDownList(['Оплатить наличными'=>'Оплатить наличными','Оплатить на карту Приват Банка'=>'Оплатить на карту Приват Банка','Оплатить по безналичному расчету'=>'Оплатить по безналичному расчету','Оплатить Правекс-телеграф'=>'Оплатить Правекс-телеграф','Наложенным платежом'=>'Наложенным платежом'],['prompt'=>'...']); ?> + + field($model, 'insurance') ?> + + field($model, 'amount_imposed') ?> + + field($model, 'shipping_by') ?> + + field($model, 'city') ?> + + field($model, 'adress') ?> + + + field($model, 'total') ?> + + field($model, 'status')->dropDownList(['Нет'=>'Нет','Обработан'=>'Обработан','На комплектации'=>'На комплектации','Укомплектован'=>'Укомплектован','Доставка'=>'Доставка','Выполнен'=>'Выполнен','Резерв оплачен'=>'Резерв оплачен','Резерв неоплачен'=>'Резерв неоплачен'],['prompt'=>'...']); ?> + + field($model, 'comment')->textArea(['rows' => '3']) ?> +
+
+
+ isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + diff --git a/backend/views/order/add.php b/backend/views/order/add.php new file mode 100755 index 0000000..912df76 --- /dev/null +++ b/backend/views/order/add.php @@ -0,0 +1,30 @@ +title = 'Добавить товар в заказ'; +$this->params['breadcrumbs'][] = $this->title; +?> +

Добавить товар в заказ

+ + 'reg-form', + 'options' => ['class' => 'form-vertical','enctype' => 'multipart/form-data'], + 'fieldConfig' => [ + //'template' => "{label}\n
{input}
\n
{error}
", + //'labelOptions' => ['class' => 'col-lg-2 control-label'], + ], + ]); ?> + +field($model, 'art') ?> + +field($model, 'count') ?> + + field($model, 'order_id')->hiddenInput(['value'=>$_GET['order_id']])->label(false); ?> + +
+ 'btn btn-primary', 'name' => 'login-button']) ?> +
+ \ No newline at end of file diff --git a/backend/views/order/create.php b/backend/views/order/create.php new file mode 100755 index 0000000..7c29881 --- /dev/null +++ b/backend/views/order/create.php @@ -0,0 +1,19 @@ +title = 'Добавить товар в заказ'; +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> + +
+

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> +
+ diff --git a/backend/views/order/index.php b/backend/views/order/index.php new file mode 100755 index 0000000..911b7a9 --- /dev/null +++ b/backend/views/order/index.php @@ -0,0 +1,103 @@ +title = 'Заказы'; +$this->params['breadcrumbs'][] = $this->title; +?> +

Заказы

+

+ 'btn btn-success']) ?> +

+ + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + + [ + 'attribute' => 'id', + 'format' => 'raw', + 'options' => ['class' => 'btn btn-warning'], + 'value' => function($model){ + return Html::button($model->id, ['id'=>$model->id, 'class' => 'btn btn-warning']); + + } + + ], + [ + 'attribute' => 'date_time', + 'value'=>'date_time', + ], + + [ + 'attribute' => 'name', + 'value'=>'name', + 'format'=>'raw', + ], + [ + 'attribute' => 'phone', + 'value'=>'phone', + ], +// [ +// 'attribute' => 'total', +// 'value'=>'total', +// ], +// [ +// 'filter' => yii\helpers\ArrayHelper::map(Label::find()->orderBy('id')->asArray()->all(), 'id', 'label'), +// 'attribute' => 'label', +// 'value' => function ($model, $key, $index, $column) { +// return Html::activeDropDownList($model, 'label', +// yii\helpers\ArrayHelper::map(Label::find()->orderBy('id')->asArray()->all(), 'id', 'label'), +// [ +// 'prompt' => 'Нет', +// 'onchange' => "$.ajax({ +// url: \"/admin/order/labelupdate\", +// type: \"post\", +// data: { order_id: $model->id, label_id : this.value}, +// });" +// ] +// +// ); +// }, +// 'format' => 'raw', +// ], +// [ +// 'attribute' => 'pay', +// 'filter' => [ +// 0 => 'Нет',1=>'Да' +// ], +// 'value' => function ($model, $key, $index, $column) { +// return Html::activeDropDownList($model, 'pay',[0 => 'Нет',1=>'Да'], +// [ +// 'onchange' => "$.ajax({ +// url: \"/admin/order/payupdate\", +// type: \"post\", +// data: { order_id: $model->id, pay_id : this.value}, +// });" +// ] +// +// ); +// }, +// 'format' => 'raw', +// ], + [ + 'attribute' => 'status', + 'value'=>'status', + 'contentOptions'=>['style'=>'width: 5px;'] + ], + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{delete}', + 'contentOptions'=>['style'=>'width: 70px;'] + ], + ], +]) ?> + \ No newline at end of file diff --git a/backend/views/order/show.php b/backend/views/order/show.php new file mode 100755 index 0000000..8292288 --- /dev/null +++ b/backend/views/order/show.php @@ -0,0 +1,227 @@ +title = 'Заказ №'.$model->id; + // $this->params['breadcrumbs'][] = $this->title; +?> +
+ + + +
+ Заказ успешно сохранен! +
+ + + 'reg-form', + 'layout' => 'horizontal', + 'options' => [ 'enctype' => 'multipart/form-data' ], + 'fieldConfig' => [ + //'template' => "{label}\n
{input}
\n
{error}
", + //'labelOptions' => ['class' => 'col-lg-2 control-label'], + ], + 'action' => [ + 'order/show', + 'id' => $model->id, + ], + ] + ); ?> + +
+
+
+
Заказ №id ?>
+ + date_time ?> +
+ + field($model, 'date_dedline') + ->widget(DatePicker::className(), [ + 'pluginOptions' => [ + 'format' => 'dd-mm-yyyy', + 'todayHighlight' => true + ]]); */ ?> +
+
+ field($model, 'name') ?> + + + field($model, 'phone') ?> + + field($model, 'phone2'); */ ?> + + field($model, 'email') ?> + + field($model, 'numbercard'); */ ?> + + field($model, 'body')->textArea(['rows' => '3']); */ ?> +
+
+ field($model, 'delivery')->dropDownList(ArrayHelper::map(Delivery::find()->asArray()->all(), 'id', 'title')); */ ?> + + field($model, 'declaration'); */ ?> + + field($model, 'stock'); */ ?> + + field($model, 'consignment'); */ ?> + + field($model, 'payment')->dropDownList(['Оплатить наличными'=>'Оплатить наличными','Оплатить на карту Приват Банка'=>'Оплатить на карту Приват Банка','Оплатить по безналичному расчету'=>'Оплатить по безналичному расчету','Оплатить Правекс-телеграф'=>'Оплатить Правекс-телеграф','Наложенным платежом'=>'Наложенным платежом'],['prompt'=>'...']); */ ?> + + field($model, 'insurance'); */ ?> + + field($model, 'amount_imposed'); */ ?> + + field($model, 'shipping_by'); */ ?> + + field($model, 'city'); + +echo $form->field($model, 'adress'); + + + echo $form->field($model, 'total'); + + echo $form->field($model, 'status')->dropDownList(['Нет'=>'Нет','Обработан'=>'Обработан','На комплектации'=>'На комплектации','Укомплектован'=>'Укомплектован','Доставка'=>'Доставка','Выполнен'=>'Выполнен','Резерв оплачен'=>'Резерв оплачен','Резерв неоплачен'=>'Резерв неоплачен'],['prompt'=>'...']); */ ?> + + field($model, 'comment') + ->textArea([ 'rows' => '3' ]) ?> +
+
+
+ +
+   + + + $dataProvider, + 'columns' => [ + [ + 'attribute' => 'id', + 'value' => 'id', + 'contentOptions' => [ 'style' => 'width: 70px;' ], + ], + [ + 'attribute' => 'sku', + 'value' => 'sku', + 'contentOptions' => [ 'style' => 'width: 50px;' ], + ], + [ + 'attribute' => 'product_name', + 'value' => 'product_name', + 'contentOptions' => [ 'style' => 'max-width: 300px;' ], + ], + // [ + // 'attribute' => 'size', + // 'value'=>'mod.size', + // 'contentOptions'=>['style'=>'width: 100px;'] + // ], + // [ + // 'attribute' => 'size', + // 'value'=>'mod.color', + // 'contentOptions'=>['style'=>'width: 100px;'] + // ], + [ + 'attribute' => 'price', + 'value' => 'price', + 'contentOptions' => [ 'style' => 'width: 100px;' ], + ], + [ + 'attribute' => 'count', + 'value' => 'count', + 'contentOptions' => [ 'style' => 'width: 30px;' ], + ], + [ + 'attribute' => 'sum_cost', + 'value' => 'sum_cost', + 'contentOptions' => [ 'style' => 'width: 100px;' ], + ], + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{delete}', + 'contentOptions' => [ 'style' => 'width: 20px;' ], + 'buttons' => [ + 'delete' => function ($url, $model) { + return Html::a( + '', + [ + '/admin/order/delete_product', + 'id' => $model->id, + 'order_id' => $_GET[ 'id' ], + ], + [ + 'title' => "Удалить", + 'data-confirm' => 'Удалить?', + ] + ); + }, + ], + ], + + ], + ] + ) ?> +
+ 'btn btn-primary btn-lg btn-block', + 'name' => 'login-button', + ] + ) ?> +
+ + + +
+
+

Добавить товар в заказ

+ + false, + 'id' => 'add_mod', + 'options' => [ + 'class' => 'form-vertical', + 'enctype' => 'multipart/form-data', + ], + 'fieldConfig' => [ + //'template' => "{label}\n
{input}
\n
{error}
", + //'labelOptions' => ['class' => 'col-lg-2 control-label'], + ], + ] + ); ?> + + field($model_orderproduct, 'sku') ?> + + field($model_orderproduct, 'count') ?> + + field($model_orderproduct, 'order_id') + ->hiddenInput([ 'value' => $model->id ]) + ->label(false); ?> + +
+ 'btn btn-primary', + 'name' => 'login-button', + ] + ) ?> +
+ +
+
+ +
+ + + diff --git a/backend/views/order/update.php b/backend/views/order/update.php new file mode 100755 index 0000000..32cc4de --- /dev/null +++ b/backend/views/order/update.php @@ -0,0 +1,144 @@ +title = 'Заказ №'.$model->id; +$this->params['breadcrumbs'][] = $this->title; +?> +

Заказ №id?>

+ + +
+ Заказ успешно сохранен! +
+ + + 'reg-form', + 'layout' => 'horizontal', + 'options' => ['enctype' => 'multipart/form-data'], + 'fieldConfig' => [ + //'template' => "{label}\n
{input}
\n
{error}
", + //'labelOptions' => ['class' => 'col-lg-2 control-label'], + ], + ]); ?> + + +
+
+ + date_time?> +
+field($model,'date_dedline')->widget(\yii\jui\DatePicker::className(),['clientOptions' => [],'options' => ['class'=>'form-control','style'=>'width:150px;'],'dateFormat' => 'yyyy-MM-dd',]) ?> + +field($model, 'surname') ?> + +field($model, 'name') ?> + +field($model, 'patronymic') ?> + +field($model, 'phone') ?> + +field($model, 'phone2') ?> + +field($model, 'email') ?> + +field($model, 'numbercard') ?> + +field($model, 'delivery')->dropDownList(ArrayHelper::map(Delivery::find()->asArray()->all(), 'id', 'title')) ?> + +field($model, 'declaration') ?> + +field($model, 'stock') ?> + +field($model, 'consignment') ?> +
+
+field($model, 'payment')->dropDownList(['Оплатить наличными'=>'Оплатить наличными','Оплатить на карту Приват Банка'=>'Оплатить на карту Приват Банка','Оплатить по безналичному расчету'=>'Оплатить по безналичному расчету','Оплатить Правекс-телеграф'=>'Оплатить Правекс-телеграф','Наложенным платежом'=>'Наложенным платежом'],['prompt'=>'...']); ?> + +field($model, 'insurance') ?> + +field($model, 'amount_imposed') ?> + +field($model, 'shipping_by') ?> + +field($model, 'city') ?> + +field($model, 'adress') ?> + +field($model, 'body')->textArea(['rows' => '6']) ?> + +field($model, 'total') ?> + +field($model, 'status')->dropDownList(['Нет'=>'Нет','Обработан'=>'Обработан','На комплектации'=>'На комплектации','Укомплектован'=>'Укомплектован','Доставка'=>'Доставка','Выполнен'=>'Выполнен','Резерв оплачен'=>'Резерв оплачен','Резерв неоплачен'=>'Резерв неоплачен'],['prompt'=>'...']); ?> + +field($model, 'comment')->textArea(['rows' => '6']) ?> +
+
+ 'btn btn-primary btn-lg btn-block', 'name' => 'login-button']) ?> +
+ + +
+$model->id], ['class'=>'btn btn-success']) ?> + $dataProvider, + 'columns' => [ + [ + 'attribute' => 'id', + 'value'=>'id', + 'contentOptions'=>['style'=>'width: 70px;'] + ], + [ + 'attribute' => 'art', + 'value'=>'art', + 'contentOptions'=>['style'=>'width: 50px;'] + ], + [ + 'attribute' => 'product_name', + 'value'=>'product_name', + //'contentOptions'=>['style'=>'max-width: 300px;'] + ], + [ + 'attribute' => 'name', + 'value'=>'name', + //'contentOptions'=>['style'=>'max-width: 300px;'] + ], + [ + 'attribute' => 'cost', + 'value'=>'cost', + 'contentOptions'=>['style'=>'width: 100px;'] + ], + [ + 'attribute' => 'count', + 'value'=>'count', + 'contentOptions'=>['style'=>'width: 30px;'] + ], + [ + 'attribute' => 'sum_cost', + 'value'=>'sum_cost', + 'contentOptions'=>['style'=>'width: 100px;'] + ], + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{delete}', + 'contentOptions'=>['style'=>'width: 20px;'], + 'buttons' => [ + 'delete' => function ($url, $model) { + return Html::a('', ['/admin/order/delete_product','id'=>$model->id,'order_id'=>$_GET['id']], + [ + 'title' => "Удалить",'data-confirm'=>'Удалить?', + ]); + } + ], + ], + + ], +]) ?> + + + diff --git a/backend/views/orders/_form.php b/backend/views/orders/_form.php deleted file mode 100755 index a2e6c7c..0000000 --- a/backend/views/orders/_form.php +++ /dev/null @@ -1,68 +0,0 @@ - - - -
-
- - - field($model, 'name') ?> - - - field($model, 'phone') ?> - - field($model, 'phone2') ?> - - field($model, 'email') ?> - - field($model, 'numbercard') ?> - - field($model, 'body')->textArea(['rows' => '3']) ?> - - field($model, 'delivery')->dropDownList(ArrayHelper::map(Delivery::find()->asArray()->all(), 'id', 'title')) */ ?> - - field($model, 'declaration') ?> - - field($model, 'stock') ?> - - field($model, 'consignment') ?> -
-
- - field($model, 'payment')->dropDownList(['Оплатить наличными'=>'Оплатить наличными','Оплатить на карту Приват Банка'=>'Оплатить на карту Приват Банка','Оплатить по безналичному расчету'=>'Оплатить по безналичному расчету','Оплатить Правекс-телеграф'=>'Оплатить Правекс-телеграф','Наложенным платежом'=>'Наложенным платежом'],['prompt'=>'...']); ?> - - field($model, 'insurance') ?> - - field($model, 'amount_imposed') ?> - - field($model, 'shipping_by') ?> - - field($model, 'city') ?> - - field($model, 'adress') ?> - - - field($model, 'total') ?> - - field($model, 'status')->dropDownList(['Нет'=>'Нет','Обработан'=>'Обработан','На комплектации'=>'На комплектации','Укомплектован'=>'Укомплектован','Доставка'=>'Доставка','Выполнен'=>'Выполнен','Резерв оплачен'=>'Резерв оплачен','Резерв неоплачен'=>'Резерв неоплачен'],['prompt'=>'...']); ?> - - field($model, 'comment')->textArea(['rows' => '3']) ?> -
-
-
- isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> -
- - diff --git a/backend/views/orders/add.php b/backend/views/orders/add.php deleted file mode 100755 index 912df76..0000000 --- a/backend/views/orders/add.php +++ /dev/null @@ -1,30 +0,0 @@ -title = 'Добавить товар в заказ'; -$this->params['breadcrumbs'][] = $this->title; -?> -

Добавить товар в заказ

- - 'reg-form', - 'options' => ['class' => 'form-vertical','enctype' => 'multipart/form-data'], - 'fieldConfig' => [ - //'template' => "{label}\n
{input}
\n
{error}
", - //'labelOptions' => ['class' => 'col-lg-2 control-label'], - ], - ]); ?> - -field($model, 'art') ?> - -field($model, 'count') ?> - - field($model, 'order_id')->hiddenInput(['value'=>$_GET['order_id']])->label(false); ?> - -
- 'btn btn-primary', 'name' => 'login-button']) ?> -
- \ No newline at end of file diff --git a/backend/views/orders/create.php b/backend/views/orders/create.php deleted file mode 100755 index 15d213f..0000000 --- a/backend/views/orders/create.php +++ /dev/null @@ -1,19 +0,0 @@ -title = 'Добавить товар в заказ'; -$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> - -
-

title) ?>

- - render('_form', [ - 'model' => $model, - ]) ?> -
- diff --git a/backend/views/orders/index.php b/backend/views/orders/index.php deleted file mode 100755 index 6e5ef4a..0000000 --- a/backend/views/orders/index.php +++ /dev/null @@ -1,103 +0,0 @@ -title = 'Заказы'; -$this->params['breadcrumbs'][] = $this->title; -?> -

Заказы

-

- 'btn btn-success']) ?> -

- - $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - - [ - 'attribute' => 'id', - 'format' => 'raw', - 'options' => ['class' => 'btn btn-warning'], - 'value' => function($model){ - return Html::button($model->id, ['id'=>$model->id, 'class' => 'btn btn-warning']); - - } - - ], - [ - 'attribute' => 'date_time', - 'value'=>'date_time', - ], - - [ - 'attribute' => 'name', - 'value'=>'name', - 'format'=>'raw', - ], - [ - 'attribute' => 'phone', - 'value'=>'phone', - ], -// [ -// 'attribute' => 'total', -// 'value'=>'total', -// ], -// [ -// 'filter' => yii\helpers\ArrayHelper::map(Label::find()->orderBy('id')->asArray()->all(), 'id', 'label'), -// 'attribute' => 'label', -// 'value' => function ($model, $key, $index, $column) { -// return Html::activeDropDownList($model, 'label', -// yii\helpers\ArrayHelper::map(Label::find()->orderBy('id')->asArray()->all(), 'id', 'label'), -// [ -// 'prompt' => 'Нет', -// 'onchange' => "$.ajax({ -// url: \"/admin/orders/labelupdate\", -// type: \"post\", -// data: { order_id: $model->id, label_id : this.value}, -// });" -// ] -// -// ); -// }, -// 'format' => 'raw', -// ], -// [ -// 'attribute' => 'pay', -// 'filter' => [ -// 0 => 'Нет',1=>'Да' -// ], -// 'value' => function ($model, $key, $index, $column) { -// return Html::activeDropDownList($model, 'pay',[0 => 'Нет',1=>'Да'], -// [ -// 'onchange' => "$.ajax({ -// url: \"/admin/orders/payupdate\", -// type: \"post\", -// data: { order_id: $model->id, pay_id : this.value}, -// });" -// ] -// -// ); -// }, -// 'format' => 'raw', -// ], - [ - 'attribute' => 'status', - 'value'=>'status', - 'contentOptions'=>['style'=>'width: 5px;'] - ], - [ - 'class' => 'yii\grid\ActionColumn', - 'template' => '{delete}', - 'contentOptions'=>['style'=>'width: 70px;'] - ], - ], -]) ?> - \ No newline at end of file diff --git a/backend/views/orders/show.php b/backend/views/orders/show.php deleted file mode 100755 index eb43bb9..0000000 --- a/backend/views/orders/show.php +++ /dev/null @@ -1,197 +0,0 @@ -title = 'Заказ №'.$model->id; -// $this->params['breadcrumbs'][] = $this->title; -?> -
- - - - - -
- Заказ успешно сохранен! -
- - - 'reg-form', - 'layout' => 'horizontal', - 'options' => ['enctype' => 'multipart/form-data'], - 'fieldConfig' => [ - //'template' => "{label}\n
{input}
\n
{error}
", - //'labelOptions' => ['class' => 'col-lg-2 control-label'], - ], - 'action' => [ - 'orders/show', - 'id' => $model->id - ] - ]); ?> - -
-
-
-
Заказ №id?>
- - date_time?> -
- - field($model, 'date_dedline') - ->widget(DatePicker::className(), [ - 'pluginOptions' => [ - 'format' => 'dd-mm-yyyy', - 'todayHighlight' => true - ]]); */?> -
-
-field($model, 'name') ?> - - -field($model, 'phone') ?> - -field($model, 'phone2'); */ ?> - -field($model, 'email') ?> - -field($model, 'numbercard'); */ ?> - -field($model, 'body')->textArea(['rows' => '3']); */?> -
-
- field($model, 'delivery')->dropDownList(ArrayHelper::map(Delivery::find()->asArray()->all(), 'id', 'title')); */ ?> - - field($model, 'declaration'); */ ?> - - field($model, 'stock'); */ ?> - - field($model, 'consignment'); */ ?> - -field($model, 'payment')->dropDownList(['Оплатить наличными'=>'Оплатить наличными','Оплатить на карту Приват Банка'=>'Оплатить на карту Приват Банка','Оплатить по безналичному расчету'=>'Оплатить по безналичному расчету','Оплатить Правекс-телеграф'=>'Оплатить Правекс-телеграф','Наложенным платежом'=>'Наложенным платежом'],['prompt'=>'...']); */ ?> - -field($model, 'insurance'); */ ?> - -field($model, 'amount_imposed'); */ ?> - -field($model, 'shipping_by'); */ ?> - -field($model, 'city'); - -echo $form->field($model, 'adress'); - - - echo $form->field($model, 'total'); - - echo $form->field($model, 'status')->dropDownList(['Нет'=>'Нет','Обработан'=>'Обработан','На комплектации'=>'На комплектации','Укомплектован'=>'Укомплектован','Доставка'=>'Доставка','Выполнен'=>'Выполнен','Резерв оплачен'=>'Резерв оплачен','Резерв неоплачен'=>'Резерв неоплачен'],['prompt'=>'...']); */ ?> - -field($model, 'comment')->textArea(['rows' => '3']) ?> -
-
-
- -
-  - - - $dataProvider, - 'columns' => [ - [ - 'attribute' => 'id', - 'value'=>'id', - 'contentOptions'=>['style'=>'width: 70px;'] - ], - [ - 'attribute' => 'sku', - 'value'=>'sku', - 'contentOptions'=>['style'=>'width: 50px;'] - ], - [ - 'attribute' => 'product_name', - 'value'=>'product_name', - 'contentOptions'=>['style'=>'max-width: 300px;'] - ], -// [ -// 'attribute' => 'size', -// 'value'=>'mod.size', -// 'contentOptions'=>['style'=>'width: 100px;'] -// ], -// [ -// 'attribute' => 'size', -// 'value'=>'mod.color', -// 'contentOptions'=>['style'=>'width: 100px;'] -// ], - [ - 'attribute' => 'price', - 'value'=>'price', - 'contentOptions'=>['style'=>'width: 100px;'] - ], - [ - 'attribute' => 'count', - 'value'=>'count', - 'contentOptions'=>['style'=>'width: 30px;'] - ], - [ - 'attribute' => 'sum_cost', - 'value'=>'sum_cost', - 'contentOptions'=>['style'=>'width: 100px;'] - ], - [ - 'class' => 'yii\grid\ActionColumn', - 'template' => '{delete}', - 'contentOptions'=>['style'=>'width: 20px;'], - 'buttons' => [ - 'delete' => function ($url, $model) { - return Html::a('', ['/admin/orders/delete_product','id'=>$model->id,'order_id'=>$_GET['id']], - [ - 'title' => "Удалить",'data-confirm'=>'Удалить?', - ]); - } - ], - ], - - ], -]) ?> -
- 'btn btn-primary btn-lg btn-block', 'name' => 'login-button']) ?> -
- - - -
-
-

Добавить товар в заказ

- - false, - 'id' => 'add_mod', - 'options' => ['class' => 'form-vertical','enctype' => 'multipart/form-data'], - 'fieldConfig' => [ - //'template' => "{label}\n
{input}
\n
{error}
", - //'labelOptions' => ['class' => 'col-lg-2 control-label'], - ], - ]); ?> - - field($model_orderproducts, 'sku') ?> - - field($model_orderproducts, 'count') ?> - - field($model_orderproducts, 'order_id')->hiddenInput(['value'=>$model->id])->label(false); ?> - -
- 'btn btn-primary', 'name' => 'login-button']) ?> -
- -
- -
- - - diff --git a/backend/views/orders/update.php b/backend/views/orders/update.php deleted file mode 100755 index e255d66..0000000 --- a/backend/views/orders/update.php +++ /dev/null @@ -1,144 +0,0 @@ -title = 'Заказ №'.$model->id; -$this->params['breadcrumbs'][] = $this->title; -?> -

Заказ №id?>

- - -
- Заказ успешно сохранен! -
- - - 'reg-form', - 'layout' => 'horizontal', - 'options' => ['enctype' => 'multipart/form-data'], - 'fieldConfig' => [ - //'template' => "{label}\n
{input}
\n
{error}
", - //'labelOptions' => ['class' => 'col-lg-2 control-label'], - ], - ]); ?> - - -
-
- - date_time?> -
-field($model,'date_dedline')->widget(\yii\jui\DatePicker::className(),['clientOptions' => [],'options' => ['class'=>'form-control','style'=>'width:150px;'],'dateFormat' => 'yyyy-MM-dd',]) ?> - -field($model, 'surname') ?> - -field($model, 'name') ?> - -field($model, 'patronymic') ?> - -field($model, 'phone') ?> - -field($model, 'phone2') ?> - -field($model, 'email') ?> - -field($model, 'numbercard') ?> - -field($model, 'delivery')->dropDownList(ArrayHelper::map(Delivery::find()->asArray()->all(), 'id', 'title')) ?> - -field($model, 'declaration') ?> - -field($model, 'stock') ?> - -field($model, 'consignment') ?> -
-
-field($model, 'payment')->dropDownList(['Оплатить наличными'=>'Оплатить наличными','Оплатить на карту Приват Банка'=>'Оплатить на карту Приват Банка','Оплатить по безналичному расчету'=>'Оплатить по безналичному расчету','Оплатить Правекс-телеграф'=>'Оплатить Правекс-телеграф','Наложенным платежом'=>'Наложенным платежом'],['prompt'=>'...']); ?> - -field($model, 'insurance') ?> - -field($model, 'amount_imposed') ?> - -field($model, 'shipping_by') ?> - -field($model, 'city') ?> - -field($model, 'adress') ?> - -field($model, 'body')->textArea(['rows' => '6']) ?> - -field($model, 'total') ?> - -field($model, 'status')->dropDownList(['Нет'=>'Нет','Обработан'=>'Обработан','На комплектации'=>'На комплектации','Укомплектован'=>'Укомплектован','Доставка'=>'Доставка','Выполнен'=>'Выполнен','Резерв оплачен'=>'Резерв оплачен','Резерв неоплачен'=>'Резерв неоплачен'],['prompt'=>'...']); ?> - -field($model, 'comment')->textArea(['rows' => '6']) ?> -
-
- 'btn btn-primary btn-lg btn-block', 'name' => 'login-button']) ?> -
- - -
-$model->id], ['class'=>'btn btn-success']) ?> - $dataProvider, - 'columns' => [ - [ - 'attribute' => 'id', - 'value'=>'id', - 'contentOptions'=>['style'=>'width: 70px;'] - ], - [ - 'attribute' => 'art', - 'value'=>'art', - 'contentOptions'=>['style'=>'width: 50px;'] - ], - [ - 'attribute' => 'product_name', - 'value'=>'product_name', - //'contentOptions'=>['style'=>'max-width: 300px;'] - ], - [ - 'attribute' => 'name', - 'value'=>'name', - //'contentOptions'=>['style'=>'max-width: 300px;'] - ], - [ - 'attribute' => 'cost', - 'value'=>'cost', - 'contentOptions'=>['style'=>'width: 100px;'] - ], - [ - 'attribute' => 'count', - 'value'=>'count', - 'contentOptions'=>['style'=>'width: 30px;'] - ], - [ - 'attribute' => 'sum_cost', - 'value'=>'sum_cost', - 'contentOptions'=>['style'=>'width: 100px;'] - ], - [ - 'class' => 'yii\grid\ActionColumn', - 'template' => '{delete}', - 'contentOptions'=>['style'=>'width: 20px;'], - 'buttons' => [ - 'delete' => function ($url, $model) { - return Html::a('', ['/admin/orders/delete_product','id'=>$model->id,'order_id'=>$_GET['id']], - [ - 'title' => "Удалить",'data-confirm'=>'Удалить?', - ]); - } - ], - ], - - ], -]) ?> - - - diff --git a/backend/views/page/_form.php b/backend/views/page/_form.php index 95f9c0c..159e844 100755 --- a/backend/views/page/_form.php +++ b/backend/views/page/_form.php @@ -11,7 +11,7 @@ * @var View $this * @var Page $model * @var ActiveForm $form - * @var PageLang[] $model_langs + * @var PageLang[] $modelLangs */ ?> @@ -20,7 +20,7 @@ $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/page/_form_language', 'form' => $form, ]) ?> diff --git a/backend/views/page/_form_language.php b/backend/views/page/_form_language.php index 1ac5644..9c7e740 100755 --- a/backend/views/page/_form_language.php +++ b/backend/views/page/_form_language.php @@ -13,11 +13,11 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']title') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']alias') +field($model_lang, '[' . $language->id . ']alias') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']body') +field($model_lang, '[' . $language->id . ']body') ->widget(CKEditor::className(), [ 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ 'preset' => 'full', @@ -27,17 +27,17 @@ ]), ]) ?> -field($model_lang, '[' . $language->language_id . ']meta_title') +field($model_lang, '[' . $language->id . ']meta_title') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']meta_keywords') +field($model_lang, '[' . $language->id . ']meta_keywords') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']meta_description') +field($model_lang, '[' . $language->id . ']meta_description') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']seo_text') +field($model_lang, '[' . $language->id . ']seo_text') ->textarea([ 'rows' => 6 ]) ?> -field($model_lang, '[' . $language->language_id . ']h1') +field($model_lang, '[' . $language->id . ']h1') ->textInput([ 'maxlength' => true ]) ?> diff --git a/backend/views/page/_search.php b/backend/views/page/_search.php deleted file mode 100755 index 088e081..0000000 --- a/backend/views/page/_search.php +++ /dev/null @@ -1,43 +0,0 @@ - - - diff --git a/backend/views/page/create.php b/backend/views/page/create.php index 32a6703..a0344dd 100755 --- a/backend/views/page/create.php +++ b/backend/views/page/create.php @@ -8,7 +8,7 @@ /** * @var View $this * @var Page $model - * @var PageLang[] $model_langs + * @var PageLang[] $modelLangs */ $this->title = \Yii::t('app', 'Create Page'); $this->params[ 'breadcrumbs' ][] = [ @@ -23,7 +23,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/page/update.php b/backend/views/page/update.php index 0003988..c7f273a 100755 --- a/backend/views/page/update.php +++ b/backend/views/page/update.php @@ -8,7 +8,7 @@ /** * @var View $this * @var Page $model - * @var PageLang[] $model_langs + * @var PageLang[] $modelLangs */ $this->title = \Yii::t('app', 'Update Page') . ': ' . $model->lang->title; @@ -31,7 +31,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/seo-category/_form.php b/backend/views/seo-category/_form.php index 9b33ed4..9df2876 100755 --- a/backend/views/seo-category/_form.php +++ b/backend/views/seo-category/_form.php @@ -10,7 +10,7 @@ /** * @var View $this * @var SeoCategory $model - * @var SeoCategoryLang[] $model_langs + * @var SeoCategoryLang[] $modelLangs * @var ActiveForm $form */ ?> @@ -26,7 +26,7 @@ ->textInput() ?> $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/seo-category/_form_language', 'form' => $form, ]) ?> diff --git a/backend/views/seo-category/_form_language.php b/backend/views/seo-category/_form_language.php index e56c7a0..90b620c 100755 --- a/backend/views/seo-category/_form_language.php +++ b/backend/views/seo-category/_form_language.php @@ -11,5 +11,5 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']name') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> \ No newline at end of file diff --git a/backend/views/seo-category/_search.php b/backend/views/seo-category/_search.php deleted file mode 100755 index 9f4264f..0000000 --- a/backend/views/seo-category/_search.php +++ /dev/null @@ -1,33 +0,0 @@ - - - diff --git a/backend/views/seo-category/create.php b/backend/views/seo-category/create.php index 7dbcd09..a177323 100755 --- a/backend/views/seo-category/create.php +++ b/backend/views/seo-category/create.php @@ -8,7 +8,7 @@ /** * @var View $this * @var SeoCategory $model - * @var SeoCategoryLang[] $model_langs + * @var SeoCategoryLang[] $modelLangs */ $this->title = Yii::t('app', 'Create Seo Category'); @@ -24,7 +24,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/seo-category/index.php b/backend/views/seo-category/index.php index 25115de..ded2cf4 100755 --- a/backend/views/seo-category/index.php +++ b/backend/views/seo-category/index.php @@ -27,8 +27,8 @@ 'seo_category_id', 'controller', [ - 'attribute' => 'name', - 'value' => 'lang.name', + 'attribute' => 'title', + 'value' => 'lang.title', ], 'status', [ diff --git a/backend/views/seo-category/update.php b/backend/views/seo-category/update.php index fe6d98b..f5bbbab 100755 --- a/backend/views/seo-category/update.php +++ b/backend/views/seo-category/update.php @@ -8,18 +8,18 @@ /** * @var View $this * @var SeoCategory $model - * @var SeoCategoryLang[] $model_langs + * @var SeoCategoryLang[] $modelLangs */ $this->title = Yii::t('app', 'Update {modelClass}: ', [ 'modelClass' => 'Seo Category', - ]) . $model->lang->name; + ]) . $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Seo Categories'), 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->lang->name, + 'label' => $model->lang->title, 'url' => [ 'view', 'id' => $model->seo_category_id, @@ -33,7 +33,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/seo-dynamic/_form.php b/backend/views/seo-dynamic/_form.php index 39ef1c8..85fd5cc 100755 --- a/backend/views/seo-dynamic/_form.php +++ b/backend/views/seo-dynamic/_form.php @@ -10,7 +10,7 @@ /** * @var View $this * @var SeoDynamic $model - * @var SeoDynamicLang[] $model_langs + * @var SeoDynamicLang[] $modelLangs * @var int $seo_category_id * @var ActiveForm $form */ @@ -37,7 +37,7 @@ ->textInput() ?> $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/seo-dynamic/_form_language', 'form' => $form, ]) ?> diff --git a/backend/views/seo-dynamic/_form_language.php b/backend/views/seo-dynamic/_form_language.php index 527d754..db5b5f7 100755 --- a/backend/views/seo-dynamic/_form_language.php +++ b/backend/views/seo-dynamic/_form_language.php @@ -13,11 +13,11 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']name') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']title') +field($model_lang, '[' . $language->id . ']meta_title') ->textInput(); ?> -field($model_lang, '[' . $language->language_id . ']description') +field($model_lang, '[' . $language->id . ']meta_description') ->widget(CKEditor::className(), [ 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ 'preset' => 'full', @@ -27,7 +27,7 @@ ]), ]) ?> -field($model_lang, '[' . $language->language_id . ']seo_text') +field($model_lang, '[' . $language->id . ']seo_text') ->widget(CKEditor::className(), [ 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ 'preset' => 'full', @@ -36,10 +36,10 @@ ->createUrl('file/uploader/images-upload'), ]), ]) ?> -field($model_lang, '[' . $language->language_id . ']key') +field($model_lang, '[' . $language->id . ']key') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']h1') +field($model_lang, '[' . $language->id . ']h1') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']meta') +field($model_lang, '[' . $language->id . ']meta') ->textInput([ 'maxlength' => true ]) ?> \ No newline at end of file diff --git a/backend/views/seo-dynamic/_search.php b/backend/views/seo-dynamic/_search.php deleted file mode 100755 index 745abcd..0000000 --- a/backend/views/seo-dynamic/_search.php +++ /dev/null @@ -1,45 +0,0 @@ - - - diff --git a/backend/views/seo-dynamic/create.php b/backend/views/seo-dynamic/create.php index 26e9ebd..de1ba8b 100755 --- a/backend/views/seo-dynamic/create.php +++ b/backend/views/seo-dynamic/create.php @@ -10,7 +10,7 @@ /** * @var View $this * @var SeoDynamic $model - * @var SeoDynamicLang[] $model_langs + * @var SeoDynamicLang[] $modelLangs * @var SeoCategory $seo_category */ @@ -20,7 +20,7 @@ 'url' => [ '/seo-category/index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $seo_category->lang->name, + 'label' => $seo_category->lang->title, 'url' => [ 'index', 'seo_category_id' => $seo_category->seo_category_id, @@ -34,7 +34,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/seo-dynamic/index.php b/backend/views/seo-dynamic/index.php index d0f6cb6..eb7d1d6 100755 --- a/backend/views/seo-dynamic/index.php +++ b/backend/views/seo-dynamic/index.php @@ -12,7 +12,7 @@ * @var SeoCategory $seo_category */ $this->title = Yii::t('app', 'Seo Dynamics for {seo_category}', [ - 'seo_category' => $seo_category->lang->name, + 'seo_category' => $seo_category->lang->title, ]); $this->params[ 'breadcrumbs' ][] = [ 'label' => \Yii::t('app', 'Seo Categories'), @@ -37,8 +37,8 @@ [ 'class' => 'yii\grid\SerialColumn' ], 'seo_dynamic_id', [ - 'attribute' => 'name', - 'value' => 'lang.name', + 'attribute' => 'title', + 'value' => 'lang.title', ], 'action', 'fields', diff --git a/backend/views/seo-dynamic/update.php b/backend/views/seo-dynamic/update.php index 93e2365..de5e514 100755 --- a/backend/views/seo-dynamic/update.php +++ b/backend/views/seo-dynamic/update.php @@ -9,26 +9,26 @@ /** * @var View $this * @var SeoDynamic $model - * @var SeoDynamicLang[] $model_langs + * @var SeoDynamicLang[] $modelLangs * @var SeoCategory $seo_category */ $this->title = Yii::t('app', 'Update {modelClass}: ', [ 'modelClass' => 'Seo Dynamic', - ]) . $model->lang->name; + ]) . $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Seo Categories'), 'url' => [ '/seo-category/index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $seo_category->lang->name, + 'label' => $seo_category->lang->title, 'url' => [ 'index', 'seo_category_id' => $seo_category->seo_category_id, ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->lang->name, + 'label' => $model->lang->title, 'url' => [ 'view', 'seo_category_id' => $seo_category->seo_category_id, @@ -43,7 +43,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/seo-dynamic/view.php b/backend/views/seo-dynamic/view.php index ec774c0..bcc2798 100755 --- a/backend/views/seo-dynamic/view.php +++ b/backend/views/seo-dynamic/view.php @@ -9,13 +9,13 @@ * @var common\models\SeoDynamic $model * @var SeoCategory $seo_category */ - $this->title = $model->lang->name; + $this->title = $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Seo Categories'), 'url' => [ '/seo-category/index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $seo_category->lang->name, + 'label' => $seo_category->lang->title, 'url' => [ 'index', 'seo_category_id' => $seo_category->seo_category_id, @@ -52,22 +52,22 @@ 'seo_dynamic_id', [ 'label' => \Yii::t('app', 'Seo Category'), - 'value' => Html::a($seo_category->lang->name, [ + 'value' => Html::a($seo_category->lang->title, [ 'index', 'seo_category_id' => $seo_category->seo_category_id, ]), 'format' => 'html', ], - 'lang.name', + 'lang.title', 'action', 'fields', 'param', 'status', - 'lang.title', + 'lang.meta_title', 'lang.h1', 'lang.key', 'lang.meta', - 'lang.description', + 'lang.meta_description', 'lang.seo_text', ], ]) ?> diff --git a/backend/views/seo/_form.php b/backend/views/seo/_form.php index 6dde164..a9a3f85 100755 --- a/backend/views/seo/_form.php +++ b/backend/views/seo/_form.php @@ -10,7 +10,7 @@ /** * @var View $this * @var Seo $model - * @var SeoLang[] $model_langs + * @var SeoLang[] $modelLangs * @var ActiveForm $form */ ?> @@ -23,7 +23,7 @@ ->textInput([ 'maxlength' => true ]) ?> $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/seo/_form_language', 'form' => $form, ]) ?> diff --git a/backend/views/seo/_form_language.php b/backend/views/seo/_form_language.php index 67ee2bd..99dd468 100755 --- a/backend/views/seo/_form_language.php +++ b/backend/views/seo/_form_language.php @@ -13,10 +13,10 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']title') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']description') +field($model_lang, '[' . $language->id . ']meta_description') ->widget(CKEditor::className(), [ 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ 'preset' => 'full', @@ -26,7 +26,7 @@ ]), ]) ?> -field($model_lang, '[' . $language->language_id . ']seo_text') +field($model_lang, '[' . $language->id . ']seo_text') ->widget(CKEditor::className(), [ 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ 'preset' => 'full', @@ -36,8 +36,8 @@ ]), ]) ?> -field($model_lang, '[' . $language->language_id . ']h1') +field($model_lang, '[' . $language->id . ']h1') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']meta') +field($model_lang, '[' . $language->id . ']meta') ->textInput([ 'maxlength' => true ]) ?> \ No newline at end of file diff --git a/backend/views/seo/_search.php b/backend/views/seo/_search.php deleted file mode 100755 index fe3f629..0000000 --- a/backend/views/seo/_search.php +++ /dev/null @@ -1,39 +0,0 @@ - - - diff --git a/backend/views/seo/create.php b/backend/views/seo/create.php index 91d7680..20f8aa8 100755 --- a/backend/views/seo/create.php +++ b/backend/views/seo/create.php @@ -8,7 +8,7 @@ /** * @var View $this * @var Seo $model - * @var SeoLang[] $model_langs + * @var SeoLang[] $modelLangs */ $this->title = Yii::t('app', 'Create Seo'); @@ -24,7 +24,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/seo/index.php b/backend/views/seo/index.php index 1c541b6..4269597 100755 --- a/backend/views/seo/index.php +++ b/backend/views/seo/index.php @@ -30,8 +30,8 @@ 'value' => 'lang.title', ], [ - 'attribute' => 'description', - 'value' => 'lang.description', + 'attribute' => 'meta_description', + 'value' => 'lang.meta_description', ], [ 'attribute' => 'h1', diff --git a/backend/views/seo/update.php b/backend/views/seo/update.php index 83c8c89..965d036 100755 --- a/backend/views/seo/update.php +++ b/backend/views/seo/update.php @@ -8,7 +8,7 @@ /** * @var View $this * @var Seo $model - * @var SeoLang[] $model_langs + * @var SeoLang[] $modelLangs */ $this->title = Yii::t('app', 'Update {modelClass}: ', [ @@ -33,7 +33,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/seo/view.php b/backend/views/seo/view.php index e30c4a7..5ce7444 100755 --- a/backend/views/seo/view.php +++ b/backend/views/seo/view.php @@ -41,7 +41,7 @@ 'seo_id', 'url', 'lang.title', - 'lang.description', + 'lang.meta_description', 'lang.h1', 'lang.meta', 'lang.seo_text', diff --git a/backend/views/service/_form.php b/backend/views/service/_form.php index b9cd52a..5eddd16 100755 --- a/backend/views/service/_form.php +++ b/backend/views/service/_form.php @@ -10,7 +10,7 @@ /** * @var View $this * @var Service $model - * @var ServiceLang[] $model_langs + * @var ServiceLang[] $modelLangs * @var ActiveForm $form */ ?> @@ -45,7 +45,7 @@ ]); ?> $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/service/_form_language', 'form' => $form, ]) ?> diff --git a/backend/views/service/_form_language.php b/backend/views/service/_form_language.php index b2418c4..3eeced2 100755 --- a/backend/views/service/_form_language.php +++ b/backend/views/service/_form_language.php @@ -13,11 +13,11 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']name') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']alias') +field($model_lang, '[' . $language->id . ']alias') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']body') +field($model_lang, '[' . $language->id . ']body') ->widget(CKEditor::className(), [ 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ 'preset' => 'full', @@ -27,7 +27,7 @@ ]), ]) ?> -field($model_lang, '[' . $language->language_id . ']seo_text') +field($model_lang, '[' . $language->id . ']seo_text') ->widget(CKEditor::className(), [ 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ 'preset' => 'full', @@ -37,11 +37,11 @@ ]), ]) ?> -field($model_lang, '[' . $language->language_id . ']meta_title') +field($model_lang, '[' . $language->id . ']meta_title') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']description') +field($model_lang, '[' . $language->id . ']meta_description') ->textInput([ 'maxlength' => true ]) ?> -field($model_lang, '[' . $language->language_id . ']h1') +field($model_lang, '[' . $language->id . ']h1') ->textInput([ 'maxlength' => true ]) ?> \ No newline at end of file diff --git a/backend/views/service/_search.php b/backend/views/service/_search.php deleted file mode 100755 index 04ba9b1..0000000 --- a/backend/views/service/_search.php +++ /dev/null @@ -1,45 +0,0 @@ - - - diff --git a/backend/views/service/create.php b/backend/views/service/create.php index d7867b0..a0f8e27 100755 --- a/backend/views/service/create.php +++ b/backend/views/service/create.php @@ -8,7 +8,7 @@ /** * @var View $this * @var Service $model - * @var ServiceLang[] $model_langs + * @var ServiceLang[] $modelLangs */ $this->title = Yii::t('app', 'Create Service'); @@ -24,7 +24,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/service/update.php b/backend/views/service/update.php index 774c185..7dea7db 100755 --- a/backend/views/service/update.php +++ b/backend/views/service/update.php @@ -8,7 +8,7 @@ /** * @var View $this * @var Service $model - * @var ServiceLang[] $model_langs + * @var ServiceLang[] $modelLangs */ $this->title = Yii::t('app', 'Update {modelClass}: ', [ @@ -33,7 +33,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?> diff --git a/backend/views/site/login.php b/backend/views/site/login.php index 7d7d499..c0bf380 100755 --- a/backend/views/site/login.php +++ b/backend/views/site/login.php @@ -1,38 +1,44 @@ title = 'Login'; -$this->params['breadcrumbs'][] = $this->title; + /** + * @var yii\web\View $this + * @var yii\bootstrap\ActiveForm $form + * @var \common\models\LoginForm $model + */ + use yii\helpers\Html; + use yii\bootstrap\ActiveForm; + + $this->title = 'Login'; + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- - + +
-
+
+ +
управление интернет магазином
-title) ?> - - 'login-form']); ?> - - field($model, 'username')->textInput(['autofocus' => true]) ?> - - field($model, 'password')->passwordInput() ?> - - field($model, 'rememberMe')->checkbox() ?> - + 'login-form' ]); ?> + + field($model, 'username') + ->textInput([ 'autofocus' => true ]) ?> + + field($model, 'password') + ->passwordInput() ?> + + field($model, 'rememberMe') + ->checkbox() ?> +
- 'btn btn-primary', 'name' => 'login-button']) ?> + 'btn btn-primary', + 'name' => 'login-button', + ]) ?>
- +
diff --git a/backend/views/slider-image/_form.php b/backend/views/slider-image/_form.php index d1320f6..b5a5df8 100755 --- a/backend/views/slider-image/_form.php +++ b/backend/views/slider-image/_form.php @@ -12,7 +12,7 @@ /** * @var View $this * @var SliderImage $model - * @var SliderImageLang[] $model_langs + * @var SliderImageLang[] $modelLangs * @var Slider $slider * @var ActiveForm $form */ @@ -66,7 +66,7 @@ $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@backend/views/slider-image/_form_language', 'form' => $form, ]); diff --git a/backend/views/slider-image/_form_language.php b/backend/views/slider-image/_form_language.php index b2ca807..64b69c3 100755 --- a/backend/views/slider-image/_form_language.php +++ b/backend/views/slider-image/_form_language.php @@ -11,7 +11,7 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']title') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']alt') +field($model_lang, '[' . $language->id . ']alt') ->textInput([ 'maxlength' => true ]); ?> \ No newline at end of file diff --git a/backend/views/slider-image/_search.php b/backend/views/slider-image/_search.php deleted file mode 100755 index d9674e9..0000000 --- a/backend/views/slider-image/_search.php +++ /dev/null @@ -1,41 +0,0 @@ - - - diff --git a/backend/views/slider-image/create.php b/backend/views/slider-image/create.php index 53dd90c..fa38d29 100755 --- a/backend/views/slider-image/create.php +++ b/backend/views/slider-image/create.php @@ -10,7 +10,7 @@ /** * @var View $this * @var SliderImage $model - * @var SliderImageLang[] $model_langs + * @var SliderImageLang[] $modelLangs * @var Slider $slider * @var int $slider_id */ @@ -37,7 +37,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, 'slider' => $slider, ]) ?> diff --git a/backend/views/slider-image/update.php b/backend/views/slider-image/update.php index 9752500..a17b813 100755 --- a/backend/views/slider-image/update.php +++ b/backend/views/slider-image/update.php @@ -10,7 +10,7 @@ /** * @var View $this * @var SliderImage $model - * @var SliderImageLang[] $model_langs + * @var SliderImageLang[] $modelLangs * @var Slider $slider * @var int $slider_id */ @@ -47,7 +47,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, 'slider' => $slider, ]) ?> diff --git a/backend/views/slider/_search.php b/backend/views/slider/_search.php deleted file mode 100755 index 7e5731b..0000000 --- a/backend/views/slider/_search.php +++ /dev/null @@ -1,36 +0,0 @@ - - - diff --git a/backend/views/user/_search.php b/backend/views/user/_search.php deleted file mode 100755 index c1fbe51..0000000 --- a/backend/views/user/_search.php +++ /dev/null @@ -1,37 +0,0 @@ - - - diff --git a/backend/web/js/site.js b/backend/web/js/site.js index 067057b..6e01267 100755 --- a/backend/web/js/site.js +++ b/backend/web/js/site.js @@ -1,67 +1,72 @@ -$(document).ready(function(){ +$( + function() + { - var iii = true; - + var iii = true; + $('body').on( + 'click', '.btn-warning', function() + { - $('body').on('click','.btn-warning', function(){ + var testt = $(this); - var testt = $(this); + var id = $(this).attr('id'); - var id = $(this).attr('id'); + var ddd = document.getElementById('test_tr_class'); - var ddd = document.getElementById('test_tr_class'); + // $.post( "index.php?r=order%2Fupdate&id=1", function( data ) { - // $.post( "index.php?r=order%2Fupdate&id=1", function( data ) { + if(!ddd) + { - if (!ddd) { + testt.closest('tr').after( + '' + '' + 'data' + '' + '' + ); - testt.closest('tr').after( - '' + - '' + - 'data' + - '' + - '' - ); + loadShow(testt, id); - loadShow(testt,id); - - }else{ - document.getElementById('test_tr_class').remove(); - }; + } else + { + document.getElementById('test_tr_class').remove(); + } + ; - iii = false; - console.log(iii); + iii = false; + console.log(iii); + } + ); + function loadShow(testt, id) + { + $.post( + "/admin/order/show?id=" + id + '"', function(data) + { + $('#content_' + id).html(data); - }); + $('#add_mod').submit( + function() + { + $.ajax( + { + type : "POST", + url : "/admin/order/add?order_id=" + id, + data : $(this).serialize(), // serializes the form's elements. + success : function(data) + { + loadShow(testt, id); // show response from the php script. + } + } + ); + return false; + } + ); - function loadShow(testt,id){ - $.post( "/admin/orders/show?id=" + id + '"', function( data ) { + } + ); - $('#content_'+id).html(data); + } - $('#add_mod').submit(function() { - $.ajax({ - type: "POST", - url: "/admin/orders/add?order_id="+id, - data: $(this).serialize(), // serializes the form's elements. - success: function(data) - { - loadShow(testt,id); // show response from the php script. - } - }); - return false; - }); - - }); - - } - - - - - -}); \ No newline at end of file + } +); \ No newline at end of file diff --git a/backup_leha.sql b/backup_leha.sql new file mode 100644 index 0000000..503d395 --- /dev/null +++ b/backup_leha.sql @@ -0,0 +1,3996 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 9.2.15 +-- Dumped by pg_dump version 9.5.4 + +-- Started on 2016-10-28 16:08:16 EEST + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- TOC entry 1 (class 3079 OID 12648) +-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; + + +-- +-- TOC entry 3556 (class 0 OID 0) +-- Dependencies: 1 +-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; + + +SET search_path = public, pg_catalog; + +SET default_with_oids = false; + +-- +-- TOC entry 178 (class 1259 OID 25655) +-- Name: artbox_comment; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE artbox_comment ( + artbox_comment_id integer NOT NULL, + text text NOT NULL, + user_id integer, + username character varying(255), + email character varying(255), + date_add integer NOT NULL, + date_update integer NOT NULL, + date_delete integer, + status integer DEFAULT 1 NOT NULL, + artbox_comment_pid integer, + related_id integer, + ip character varying(255) NOT NULL, + info text, + entity character varying(255) DEFAULT ''::character varying NOT NULL, + entity_id integer DEFAULT 1 NOT NULL +); + + +-- +-- TOC entry 179 (class 1259 OID 25664) +-- Name: artbox_comment_artbox_comment_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE artbox_comment_artbox_comment_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3557 (class 0 OID 0) +-- Dependencies: 179 +-- Name: artbox_comment_artbox_comment_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE artbox_comment_artbox_comment_id_seq OWNED BY artbox_comment.artbox_comment_id; + + +-- +-- TOC entry 180 (class 1259 OID 25666) +-- Name: artbox_comment_rating; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE artbox_comment_rating ( + artbox_comment_rating_id integer NOT NULL, + date_add integer NOT NULL, + date_update integer NOT NULL, + user_id integer, + value double precision, + model character varying(255) NOT NULL, + model_id integer NOT NULL +); + + +-- +-- TOC entry 181 (class 1259 OID 25669) +-- Name: artbox_comment_rating_artbox_comment_rating_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE artbox_comment_rating_artbox_comment_rating_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3558 (class 0 OID 0) +-- Dependencies: 181 +-- Name: artbox_comment_rating_artbox_comment_rating_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE artbox_comment_rating_artbox_comment_rating_id_seq OWNED BY artbox_comment_rating.artbox_comment_rating_id; + + +-- +-- TOC entry 182 (class 1259 OID 25671) +-- Name: artbox_like; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE artbox_like ( + artbox_like_id integer NOT NULL, + artbox_comment_id integer NOT NULL, + user_id integer, + date_add integer NOT NULL, + is_like integer DEFAULT 1 NOT NULL +); + + +-- +-- TOC entry 183 (class 1259 OID 25675) +-- Name: artbox_like_artbox_like_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE artbox_like_artbox_like_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3559 (class 0 OID 0) +-- Dependencies: 183 +-- Name: artbox_like_artbox_like_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE artbox_like_artbox_like_id_seq OWNED BY artbox_like.artbox_like_id; + + +-- +-- TOC entry 184 (class 1259 OID 25677) +-- Name: article_to_rating; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE article_to_rating ( + article_to_rating_id integer NOT NULL, + articles_id integer NOT NULL, + value double precision DEFAULT 0 +); + + +-- +-- TOC entry 185 (class 1259 OID 25681) +-- Name: article_to_rating_article_to_rating_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE article_to_rating_article_to_rating_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3560 (class 0 OID 0) +-- Dependencies: 185 +-- Name: article_to_rating_article_to_rating_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE article_to_rating_article_to_rating_id_seq OWNED BY article_to_rating.article_to_rating_id; + + +-- +-- TOC entry 186 (class 1259 OID 25683) +-- Name: articles; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE articles ( + id integer NOT NULL, + image character varying(255) NOT NULL, + date integer +); + + +-- +-- TOC entry 187 (class 1259 OID 25689) +-- Name: articles_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE articles_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3561 (class 0 OID 0) +-- Dependencies: 187 +-- Name: articles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE articles_id_seq OWNED BY articles.id; + + +-- +-- TOC entry 260 (class 1259 OID 28413) +-- Name: articles_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE articles_lang ( + articles_id integer NOT NULL, + language_id integer NOT NULL, + title character varying(255) NOT NULL, + body text NOT NULL, + meta_title character varying(255), + meta_keywords character varying(255), + meta_description character varying(255), + seo_text text, + h1 character varying(255), + body_preview text, + alias character varying(255) +); + + +-- +-- TOC entry 169 (class 1259 OID 25051) +-- Name: auth_assignment; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE auth_assignment ( + item_name character varying(64) NOT NULL, + created_at integer, + user_id integer +); + + +-- +-- TOC entry 170 (class 1259 OID 25054) +-- Name: auth_item; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE auth_item ( + name character varying(64) NOT NULL, + type integer NOT NULL, + description text, + rule_name character varying(64), + data text, + created_at integer, + updated_at integer +); + + +-- +-- TOC entry 171 (class 1259 OID 25060) +-- Name: auth_item_child; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE auth_item_child ( + parent character varying(64) NOT NULL, + child character varying(64) NOT NULL +); + + +-- +-- TOC entry 172 (class 1259 OID 25063) +-- Name: auth_rule; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE auth_rule ( + name character varying(64) NOT NULL, + data text, + created_at integer, + updated_at integer +); + + +-- +-- TOC entry 188 (class 1259 OID 25691) +-- Name: banner; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE banner ( + banner_id integer NOT NULL, + url character varying(255), + status smallint +); + + +-- +-- TOC entry 189 (class 1259 OID 25697) +-- Name: banner_banner_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE banner_banner_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3562 (class 0 OID 0) +-- Dependencies: 189 +-- Name: banner_banner_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE banner_banner_id_seq OWNED BY banner.banner_id; + + +-- +-- TOC entry 262 (class 1259 OID 28496) +-- Name: banner_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE banner_lang ( + banner_id integer NOT NULL, + language_id integer NOT NULL, + alt character varying(255), + title character varying(255), + image character varying(255) +); + + +-- +-- TOC entry 190 (class 1259 OID 25699) +-- Name: bg; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE bg ( + id integer NOT NULL, + url character varying(250) NOT NULL, + image character varying(250) NOT NULL +); + + +-- +-- TOC entry 191 (class 1259 OID 25705) +-- Name: bg_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE bg_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3563 (class 0 OID 0) +-- Dependencies: 191 +-- Name: bg_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE bg_id_seq OWNED BY bg.id; + + +-- +-- TOC entry 263 (class 1259 OID 28513) +-- Name: bg_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE bg_lang ( + bg_id integer NOT NULL, + language_id integer NOT NULL, + title character varying(255) NOT NULL +); + + +-- +-- TOC entry 192 (class 1259 OID 25716) +-- Name: brand; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE brand ( + brand_id integer NOT NULL, + image character varying(255), + in_menu boolean, + remote_id character varying(255) +); + + +-- +-- TOC entry 193 (class 1259 OID 25722) +-- Name: brand_brand_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE brand_brand_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3564 (class 0 OID 0) +-- Dependencies: 193 +-- Name: brand_brand_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE brand_brand_id_seq OWNED BY brand.brand_id; + + +-- +-- TOC entry 264 (class 1259 OID 28533) +-- Name: brand_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE brand_lang ( + brand_id integer NOT NULL, + language_id integer NOT NULL, + name character varying(255) NOT NULL, + meta_title character varying(255), + meta_robots character varying(255), + meta_desc character varying(255), + seo_text text, + alias character varying(255) +); + + +-- +-- TOC entry 194 (class 1259 OID 25724) +-- Name: category; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE category ( + category_id integer NOT NULL, + parent_id integer DEFAULT 0 NOT NULL, + path integer[], + depth integer DEFAULT 0 NOT NULL, + image character varying(255), + product_unit_id integer, + remote_id character varying(255) +); + + +-- +-- TOC entry 195 (class 1259 OID 25733) +-- Name: category_category_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE category_category_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3565 (class 0 OID 0) +-- Dependencies: 195 +-- Name: category_category_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE category_category_id_seq OWNED BY category.category_id; + + +-- +-- TOC entry 265 (class 1259 OID 28550) +-- Name: category_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE category_lang ( + category_id integer NOT NULL, + language_id integer NOT NULL, + name character varying(255) NOT NULL, + meta_title character varying(255), + meta_robots character varying(255), + meta_desc character varying(255), + seo_text text, + h1 character varying(255), + alias character varying(255) +); + + +-- +-- TOC entry 259 (class 1259 OID 28345) +-- Name: certificate; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE certificate ( + certificate_id integer NOT NULL, + name character varying(255) NOT NULL, + link character varying(255) +); + + +-- +-- TOC entry 258 (class 1259 OID 28343) +-- Name: certificate_certificate_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE certificate_certificate_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3566 (class 0 OID 0) +-- Dependencies: 258 +-- Name: certificate_certificate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE certificate_certificate_id_seq OWNED BY certificate.certificate_id; + + +-- +-- TOC entry 196 (class 1259 OID 25745) +-- Name: customer; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE customer ( + id integer NOT NULL, + username character varying(255) NOT NULL, + password_hash character varying(255) NOT NULL, + name character varying(255), + surname character varying(255), + phone character varying(255), + gender character varying(32), + birth_day integer, + birth_month integer, + birth_year integer, + body text, + group_id integer, + email character varying(255), + auth_key character varying(32), + password_reset_token character varying(255), + status smallint, + created_at integer, + updated_at integer, + role character varying(255) +); + + +-- +-- TOC entry 197 (class 1259 OID 25752) +-- Name: customer_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE customer_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3567 (class 0 OID 0) +-- Dependencies: 197 +-- Name: customer_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE customer_id_seq OWNED BY customer.id; + + +-- +-- TOC entry 198 (class 1259 OID 25754) +-- Name: event; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE event ( + event_id integer NOT NULL, + image character varying(255), + created_at integer, + updated_at integer, + end_at integer +); + + +-- +-- TOC entry 199 (class 1259 OID 25760) +-- Name: event_event_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE event_event_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3568 (class 0 OID 0) +-- Dependencies: 199 +-- Name: event_event_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE event_event_id_seq OWNED BY event.event_id; + + +-- +-- TOC entry 266 (class 1259 OID 28588) +-- Name: event_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE event_lang ( + event_id integer NOT NULL, + language_id integer NOT NULL, + name character varying(255) NOT NULL, + body text NOT NULL, + meta_title character varying(255), + description character varying(255), + seo_text text, + h1 character varying(255), + alias character varying(255) +); + + +-- +-- TOC entry 200 (class 1259 OID 25762) +-- Name: feedback; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE feedback ( + feedback_id integer NOT NULL, + name character varying(255), + phone character varying(255) NOT NULL, + date_add integer, + ip character varying(255) +); + + +-- +-- TOC entry 201 (class 1259 OID 25768) +-- Name: feedback_feedback_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE feedback_feedback_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3569 (class 0 OID 0) +-- Dependencies: 201 +-- Name: feedback_feedback_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE feedback_feedback_id_seq OWNED BY feedback.feedback_id; + + +-- +-- TOC entry 173 (class 1259 OID 25136) +-- Name: language; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE language ( + language_id integer NOT NULL, + url character varying(255) NOT NULL, + local character varying(255) NOT NULL, + name character varying(255) NOT NULL, + "default" boolean DEFAULT false NOT NULL, + date_create integer NOT NULL, + date_update integer NOT NULL, + status boolean DEFAULT false NOT NULL +); + + +-- +-- TOC entry 174 (class 1259 OID 25143) +-- Name: language_language_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE language_language_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3570 (class 0 OID 0) +-- Dependencies: 174 +-- Name: language_language_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE language_language_id_seq OWNED BY language.language_id; + + +-- +-- TOC entry 175 (class 1259 OID 25145) +-- Name: migration; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE migration ( + version character varying(180) NOT NULL, + apply_time integer +); + + +-- +-- TOC entry 202 (class 1259 OID 25778) +-- Name: orders; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE orders ( + id integer NOT NULL, + user_id integer, + name character varying(255) NOT NULL, + phone character varying(255), + phone2 character varying(255), + email character varying(255), + adress character varying(255), + body text, + total double precision, + date_time timestamp(0) without time zone, + date_dedline date, + reserve character varying(255), + status character varying(255), + comment text, + label integer, + pay integer, + numbercard integer, + delivery integer, + declaration character varying(255), + stock character varying(255), + consignment character varying(255), + payment character varying(255), + insurance character varying(255), + amount_imposed double precision, + shipping_by character varying(255), + city character varying(255) +); + + +-- +-- TOC entry 203 (class 1259 OID 25784) +-- Name: orders_delivery; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE orders_delivery ( + id integer NOT NULL, + parent_id integer, + value integer, + sort integer +); + + +-- +-- TOC entry 204 (class 1259 OID 25790) +-- Name: orders_delivery_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE orders_delivery_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3571 (class 0 OID 0) +-- Dependencies: 204 +-- Name: orders_delivery_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE orders_delivery_id_seq OWNED BY orders_delivery.id; + + +-- +-- TOC entry 267 (class 1259 OID 28613) +-- Name: orders_delivery_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE orders_delivery_lang ( + orders_delivery_id integer NOT NULL, + language_id integer NOT NULL, + title character varying(255) NOT NULL, + text text NOT NULL +); + + +-- +-- TOC entry 205 (class 1259 OID 25792) +-- Name: orders_id_seq1; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE orders_id_seq1 + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3572 (class 0 OID 0) +-- Dependencies: 205 +-- Name: orders_id_seq1; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE orders_id_seq1 OWNED BY orders.id; + + +-- +-- TOC entry 206 (class 1259 OID 25794) +-- Name: orders_label; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE orders_label ( + id integer NOT NULL, + label character varying(255) +); + + +-- +-- TOC entry 207 (class 1259 OID 25800) +-- Name: orders_label_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE orders_label_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3573 (class 0 OID 0) +-- Dependencies: 207 +-- Name: orders_label_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE orders_label_id_seq OWNED BY orders_label.id; + + +-- +-- TOC entry 268 (class 1259 OID 28650) +-- Name: orders_label_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE orders_label_lang ( + orders_label_id integer NOT NULL, + language_id integer NOT NULL, + name character varying(255) NOT NULL +); + + +-- +-- TOC entry 208 (class 1259 OID 25802) +-- Name: orders_products; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE orders_products ( + id integer NOT NULL, + order_id integer NOT NULL, + mod_id integer, + product_name character varying(255), + name character varying(255), + sku character varying(255), + price double precision, + count integer, + sum_cost double precision +); + + +-- +-- TOC entry 209 (class 1259 OID 25808) +-- Name: orders_products_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE orders_products_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3574 (class 0 OID 0) +-- Dependencies: 209 +-- Name: orders_products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE orders_products_id_seq OWNED BY orders_products.id; + + +-- +-- TOC entry 210 (class 1259 OID 25810) +-- Name: page; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE page ( + id integer NOT NULL, + in_menu boolean DEFAULT false NOT NULL +); + + +-- +-- TOC entry 211 (class 1259 OID 25816) +-- Name: page_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE page_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3575 (class 0 OID 0) +-- Dependencies: 211 +-- Name: page_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE page_id_seq OWNED BY page.id; + + +-- +-- TOC entry 261 (class 1259 OID 28456) +-- Name: page_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE page_lang ( + page_id integer NOT NULL, + language_id integer NOT NULL, + title character varying(255) NOT NULL, + body text NOT NULL, + meta_title character varying(255), + meta_keywords character varying(255), + meta_description character varying(255), + seo_text text, + h1 character varying(255), + alias character varying(255) +); + + +-- +-- TOC entry 212 (class 1259 OID 25818) +-- Name: product; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product ( + product_id integer NOT NULL, + brand_id integer, + video text, + is_top boolean DEFAULT false, + akciya boolean DEFAULT false, + is_new boolean DEFAULT false, + remote_id character varying(255) +); + + +-- +-- TOC entry 213 (class 1259 OID 25827) +-- Name: product_category; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_category ( + product_id integer NOT NULL, + category_id integer NOT NULL +); + + +-- +-- TOC entry 257 (class 1259 OID 28326) +-- Name: product_certificate; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_certificate ( + product_certificate_id integer NOT NULL, + product_id integer NOT NULL, + link character varying(100) +); + + +-- +-- TOC entry 256 (class 1259 OID 28324) +-- Name: product_certificate_product_certificate_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_certificate_product_certificate_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3576 (class 0 OID 0) +-- Dependencies: 256 +-- Name: product_certificate_product_certificate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_certificate_product_certificate_id_seq OWNED BY product_certificate.product_certificate_id; + + +-- +-- TOC entry 214 (class 1259 OID 25830) +-- Name: product_image; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_image ( + product_variant_id integer, + image character varying(255), + alt character varying(255), + title character varying(255), + product_id integer NOT NULL, + product_image_id integer NOT NULL +); + + +-- +-- TOC entry 215 (class 1259 OID 25836) +-- Name: product_image_product_image_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_image_product_image_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3577 (class 0 OID 0) +-- Dependencies: 215 +-- Name: product_image_product_image_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_image_product_image_id_seq OWNED BY product_image.product_image_id; + + +-- +-- TOC entry 269 (class 1259 OID 28683) +-- Name: product_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_lang ( + product_id integer NOT NULL, + language_id integer NOT NULL, + name character varying(255) NOT NULL, + description text, + alias character varying(255) +); + + +-- +-- TOC entry 216 (class 1259 OID 25838) +-- Name: product_option; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_option ( + product_id integer NOT NULL, + option_id integer NOT NULL +); + + +-- +-- TOC entry 217 (class 1259 OID 25841) +-- Name: product_product_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_product_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3578 (class 0 OID 0) +-- Dependencies: 217 +-- Name: product_product_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_product_id_seq OWNED BY product.product_id; + + +-- +-- TOC entry 255 (class 1259 OID 28309) +-- Name: product_spec; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_spec ( + product_spec_id integer NOT NULL, + product_id integer NOT NULL, + tech_spec_link character varying(100), + tech_char_link character varying(100) +); + + +-- +-- TOC entry 270 (class 1259 OID 28700) +-- Name: product_spec_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_spec_lang ( + product_spec_id integer NOT NULL, + language_id integer NOT NULL, + tech_spec_text text, + instruction text +); + + +-- +-- TOC entry 254 (class 1259 OID 28307) +-- Name: product_spec_product_spec_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_spec_product_spec_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3579 (class 0 OID 0) +-- Dependencies: 254 +-- Name: product_spec_product_spec_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_spec_product_spec_id_seq OWNED BY product_spec.product_spec_id; + + +-- +-- TOC entry 218 (class 1259 OID 25843) +-- Name: product_stock; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_stock ( + product_id integer NOT NULL, + stock_id integer NOT NULL, + quantity integer NOT NULL, + product_variant_id integer NOT NULL +); + + +-- +-- TOC entry 219 (class 1259 OID 25846) +-- Name: stock; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE stock ( + stock_id integer NOT NULL, + remote_id character varying(255) +); + + +-- +-- TOC entry 220 (class 1259 OID 25849) +-- Name: product_stock_product_stock_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_stock_product_stock_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3580 (class 0 OID 0) +-- Dependencies: 220 +-- Name: product_stock_product_stock_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_stock_product_stock_id_seq OWNED BY stock.stock_id; + + +-- +-- TOC entry 253 (class 1259 OID 28276) +-- Name: product_to_project; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_to_project ( + product_to_project_id integer NOT NULL, + product_variant_id integer NOT NULL, + project_id integer NOT NULL +); + + +-- +-- TOC entry 252 (class 1259 OID 28274) +-- Name: product_to_project_product_to_project_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_to_project_product_to_project_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3581 (class 0 OID 0) +-- Dependencies: 252 +-- Name: product_to_project_product_to_project_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_to_project_product_to_project_id_seq OWNED BY product_to_project.product_to_project_id; + + +-- +-- TOC entry 221 (class 1259 OID 25851) +-- Name: product_to_rating; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_to_rating ( + product_to_rating_id integer NOT NULL, + product_id integer NOT NULL, + value double precision DEFAULT 0 +); + + +-- +-- TOC entry 222 (class 1259 OID 25855) +-- Name: product_to_rating_product_to_rating_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_to_rating_product_to_rating_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3582 (class 0 OID 0) +-- Dependencies: 222 +-- Name: product_to_rating_product_to_rating_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_to_rating_product_to_rating_id_seq OWNED BY product_to_rating.product_to_rating_id; + + +-- +-- TOC entry 223 (class 1259 OID 25857) +-- Name: product_unit; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_unit ( + product_unit_id integer NOT NULL, + is_default boolean +); + + +-- +-- TOC entry 271 (class 1259 OID 28723) +-- Name: product_unit_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_unit_lang ( + product_unit_id integer NOT NULL, + language_id integer NOT NULL, + name character varying(255) NOT NULL, + short character varying(255) +); + + +-- +-- TOC entry 224 (class 1259 OID 25860) +-- Name: product_unit_product_unit_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_unit_product_unit_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3583 (class 0 OID 0) +-- Dependencies: 224 +-- Name: product_unit_product_unit_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_unit_product_unit_id_seq OWNED BY product_unit.product_unit_id; + + +-- +-- TOC entry 225 (class 1259 OID 25862) +-- Name: product_variant; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_variant ( + product_variant_id integer NOT NULL, + product_id integer NOT NULL, + sku character varying(255) NOT NULL, + price double precision, + price_old double precision, + stock double precision, + product_unit_id integer, + remote_id character varying(255) +); + + +-- +-- TOC entry 272 (class 1259 OID 28741) +-- Name: product_variant_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_variant_lang ( + product_variant_id integer NOT NULL, + language_id integer NOT NULL, + name character varying(255) NOT NULL +); + + +-- +-- TOC entry 226 (class 1259 OID 25868) +-- Name: product_variant_option; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE product_variant_option ( + product_variant_id integer NOT NULL, + option_id integer NOT NULL +); + + +-- +-- TOC entry 227 (class 1259 OID 25871) +-- Name: product_variant_product_variant_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE product_variant_product_variant_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3584 (class 0 OID 0) +-- Dependencies: 227 +-- Name: product_variant_product_variant_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE product_variant_product_variant_id_seq OWNED BY product_variant.product_variant_id; + + +-- +-- TOC entry 249 (class 1259 OID 27421) +-- Name: project; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE project ( + project_id integer NOT NULL, + date_add integer NOT NULL +); + + +-- +-- TOC entry 251 (class 1259 OID 27432) +-- Name: project_image; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE project_image ( + project_image_id integer NOT NULL, + project_id integer NOT NULL, + image character varying(255), + alt character varying(255), + title character varying(255) +); + + +-- +-- TOC entry 250 (class 1259 OID 27430) +-- Name: project_image_project_image_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE project_image_project_image_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3585 (class 0 OID 0) +-- Dependencies: 250 +-- Name: project_image_project_image_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE project_image_project_image_id_seq OWNED BY project_image.project_image_id; + + +-- +-- TOC entry 273 (class 1259 OID 28757) +-- Name: project_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE project_lang ( + project_id integer NOT NULL, + language_id integer NOT NULL, + title character varying(255) NOT NULL, + description text, + alias character varying(255) +); + + +-- +-- TOC entry 248 (class 1259 OID 27419) +-- Name: project_project_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE project_project_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3586 (class 0 OID 0) +-- Dependencies: 248 +-- Name: project_project_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE project_project_id_seq OWNED BY project.project_id; + + +-- +-- TOC entry 228 (class 1259 OID 25885) +-- Name: seo; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE seo ( + seo_id integer NOT NULL, + url character varying(255) NOT NULL +); + + +-- +-- TOC entry 229 (class 1259 OID 25891) +-- Name: seo_category; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE seo_category ( + seo_category_id integer NOT NULL, + controller character varying(100), + status smallint +); + + +-- +-- TOC entry 275 (class 1259 OID 28813) +-- Name: seo_category_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE seo_category_lang ( + seo_category_id integer NOT NULL, + language_id integer NOT NULL, + name character varying(255) +); + + +-- +-- TOC entry 230 (class 1259 OID 25894) +-- Name: seo_category_seo_category_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE seo_category_seo_category_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3587 (class 0 OID 0) +-- Dependencies: 230 +-- Name: seo_category_seo_category_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE seo_category_seo_category_id_seq OWNED BY seo_category.seo_category_id; + + +-- +-- TOC entry 231 (class 1259 OID 25896) +-- Name: seo_dynamic; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE seo_dynamic ( + seo_dynamic_id integer NOT NULL, + seo_category_id integer, + action character varying(200), + fields character varying(255), + status smallint, + param character varying(255) +); + + +-- +-- TOC entry 276 (class 1259 OID 28827) +-- Name: seo_dynamic_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE seo_dynamic_lang ( + seo_dynamic_id integer NOT NULL, + language_id integer NOT NULL, + name character varying(255), + title text, + h1 character varying(255), + key character varying(255), + meta character varying(255), + description text, + seo_text text +); + + +-- +-- TOC entry 232 (class 1259 OID 25902) +-- Name: seo_dynamic_seo_dynamic_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE seo_dynamic_seo_dynamic_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3588 (class 0 OID 0) +-- Dependencies: 232 +-- Name: seo_dynamic_seo_dynamic_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE seo_dynamic_seo_dynamic_id_seq OWNED BY seo_dynamic.seo_dynamic_id; + + +-- +-- TOC entry 274 (class 1259 OID 28796) +-- Name: seo_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE seo_lang ( + seo_id integer NOT NULL, + language_id integer NOT NULL, + title character varying(255), + description text, + h1 character varying(255), + meta character varying(255), + seo_text text +); + + +-- +-- TOC entry 233 (class 1259 OID 25904) +-- Name: seo_seo_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE seo_seo_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3589 (class 0 OID 0) +-- Dependencies: 233 +-- Name: seo_seo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE seo_seo_id_seq OWNED BY seo.seo_id; + + +-- +-- TOC entry 234 (class 1259 OID 25906) +-- Name: service; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE service ( + service_id integer NOT NULL, + image character varying(255), + created_at integer, + updated_at integer +); + + +-- +-- TOC entry 277 (class 1259 OID 28895) +-- Name: service_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE service_lang ( + service_id integer NOT NULL, + language_id integer NOT NULL, + name character varying(255) NOT NULL, + body text NOT NULL, + seo_text text, + meta_title character varying(255), + description character varying(255), + h1 character varying(255), + alias character varying(255) +); + + +-- +-- TOC entry 235 (class 1259 OID 25912) +-- Name: service_service_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE service_service_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3590 (class 0 OID 0) +-- Dependencies: 235 +-- Name: service_service_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE service_service_id_seq OWNED BY service.service_id; + + +-- +-- TOC entry 236 (class 1259 OID 25914) +-- Name: share; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE share ( + id integer NOT NULL, + user_id integer, + product_id integer, + date_time timestamp without time zone, + date date +); + + +-- +-- TOC entry 237 (class 1259 OID 25917) +-- Name: share_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE share_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3591 (class 0 OID 0) +-- Dependencies: 237 +-- Name: share_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE share_id_seq OWNED BY share.id; + + +-- +-- TOC entry 238 (class 1259 OID 25919) +-- Name: slider; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE slider ( + slider_id integer NOT NULL, + speed integer, + duration integer, + title character varying(200), + status smallint, + width integer, + height integer +); + + +-- +-- TOC entry 239 (class 1259 OID 25922) +-- Name: slider_image; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE slider_image ( + slider_image_id integer NOT NULL, + slider_id integer NOT NULL, + image character varying(255), + url character varying(255), + status smallint, + sort integer +); + + +-- +-- TOC entry 278 (class 1259 OID 28929) +-- Name: slider_image_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE slider_image_lang ( + slider_image_id integer NOT NULL, + language_id integer NOT NULL, + title character varying(255), + alt character varying(255) +); + + +-- +-- TOC entry 240 (class 1259 OID 25928) +-- Name: slider_image_slider_image_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE slider_image_slider_image_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3592 (class 0 OID 0) +-- Dependencies: 240 +-- Name: slider_image_slider_image_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE slider_image_slider_image_id_seq OWNED BY slider_image.slider_image_id; + + +-- +-- TOC entry 241 (class 1259 OID 25930) +-- Name: slider_slider_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE slider_slider_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3593 (class 0 OID 0) +-- Dependencies: 241 +-- Name: slider_slider_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE slider_slider_id_seq OWNED BY slider.slider_id; + + +-- +-- TOC entry 281 (class 1259 OID 29090) +-- Name: stock_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE stock_lang ( + stock_id integer NOT NULL, + language_id integer NOT NULL, + name character varying(255) NOT NULL +); + + +-- +-- TOC entry 242 (class 1259 OID 25932) +-- Name: tax_group; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE tax_group ( + tax_group_id integer NOT NULL, + is_filter boolean DEFAULT false, + level integer, + sort integer DEFAULT 0, + display boolean DEFAULT true, + is_menu boolean, + remote_id character varying(255) +); + + +-- +-- TOC entry 279 (class 1259 OID 28963) +-- Name: tax_group_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE tax_group_lang ( + tax_group_id integer NOT NULL, + language_id integer NOT NULL, + name character varying(255) NOT NULL, + description text, + alias character varying(255) +); + + +-- +-- TOC entry 243 (class 1259 OID 25942) +-- Name: tax_group_tax_group_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE tax_group_tax_group_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3594 (class 0 OID 0) +-- Dependencies: 243 +-- Name: tax_group_tax_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE tax_group_tax_group_id_seq OWNED BY tax_group.tax_group_id; + + +-- +-- TOC entry 244 (class 1259 OID 25944) +-- Name: tax_group_to_category; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE tax_group_to_category ( + tax_group_to_category_id integer NOT NULL, + tax_group_id integer NOT NULL, + category_id integer NOT NULL +); + + +-- +-- TOC entry 245 (class 1259 OID 25947) +-- Name: tax_group_to_category_tax_group_to_category_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE tax_group_to_category_tax_group_to_category_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3595 (class 0 OID 0) +-- Dependencies: 245 +-- Name: tax_group_to_category_tax_group_to_category_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE tax_group_to_category_tax_group_to_category_id_seq OWNED BY tax_group_to_category.tax_group_to_category_id; + + +-- +-- TOC entry 246 (class 1259 OID 25952) +-- Name: tax_option; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE tax_option ( + tax_option_id bigint NOT NULL, + tax_group_id integer NOT NULL, + parent_id integer DEFAULT 0 NOT NULL, + depth integer, + sort integer DEFAULT 0, + path_int integer[], + image character varying(255), + remote_id character varying(255) +); + + +-- +-- TOC entry 280 (class 1259 OID 28997) +-- Name: tax_option_lang; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE tax_option_lang ( + tax_option_id integer NOT NULL, + language_id integer NOT NULL, + value character varying(255) NOT NULL, + alias character varying(255) +); + + +-- +-- TOC entry 247 (class 1259 OID 25961) +-- Name: tax_option_tax_option_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE tax_option_tax_option_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3596 (class 0 OID 0) +-- Dependencies: 247 +-- Name: tax_option_tax_option_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE tax_option_tax_option_id_seq OWNED BY tax_option.tax_option_id; + + +-- +-- TOC entry 176 (class 1259 OID 25311) +-- Name: user; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE "user" ( + id integer NOT NULL, + username character varying(255) NOT NULL, + auth_key character varying(32) NOT NULL, + password_hash character varying(255) NOT NULL, + password_reset_token character varying(255), + email character varying(255) NOT NULL, + status smallint DEFAULT 10 NOT NULL, + created_at integer NOT NULL, + updated_at integer NOT NULL +); + + +-- +-- TOC entry 177 (class 1259 OID 25318) +-- Name: user_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE user_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- TOC entry 3597 (class 0 OID 0) +-- Dependencies: 177 +-- Name: user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE user_id_seq OWNED BY "user".id; + + +-- +-- TOC entry 3148 (class 2604 OID 25997) +-- Name: artbox_comment_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY artbox_comment ALTER COLUMN artbox_comment_id SET DEFAULT nextval('artbox_comment_artbox_comment_id_seq'::regclass); + + +-- +-- TOC entry 3149 (class 2604 OID 25998) +-- Name: artbox_comment_rating_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY artbox_comment_rating ALTER COLUMN artbox_comment_rating_id SET DEFAULT nextval('artbox_comment_rating_artbox_comment_rating_id_seq'::regclass); + + +-- +-- TOC entry 3151 (class 2604 OID 25999) +-- Name: artbox_like_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY artbox_like ALTER COLUMN artbox_like_id SET DEFAULT nextval('artbox_like_artbox_like_id_seq'::regclass); + + +-- +-- TOC entry 3153 (class 2604 OID 26000) +-- Name: article_to_rating_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY article_to_rating ALTER COLUMN article_to_rating_id SET DEFAULT nextval('article_to_rating_article_to_rating_id_seq'::regclass); + + +-- +-- TOC entry 3154 (class 2604 OID 26001) +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY articles ALTER COLUMN id SET DEFAULT nextval('articles_id_seq'::regclass); + + +-- +-- TOC entry 3155 (class 2604 OID 26002) +-- Name: banner_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY banner ALTER COLUMN banner_id SET DEFAULT nextval('banner_banner_id_seq'::regclass); + + +-- +-- TOC entry 3156 (class 2604 OID 26003) +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bg ALTER COLUMN id SET DEFAULT nextval('bg_id_seq'::regclass); + + +-- +-- TOC entry 3157 (class 2604 OID 26005) +-- Name: brand_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY brand ALTER COLUMN brand_id SET DEFAULT nextval('brand_brand_id_seq'::regclass); + + +-- +-- TOC entry 3160 (class 2604 OID 26006) +-- Name: category_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY category ALTER COLUMN category_id SET DEFAULT nextval('category_category_id_seq'::regclass); + + +-- +-- TOC entry 3200 (class 2604 OID 28348) +-- Name: certificate_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY certificate ALTER COLUMN certificate_id SET DEFAULT nextval('certificate_certificate_id_seq'::regclass); + + +-- +-- TOC entry 3161 (class 2604 OID 26008) +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY customer ALTER COLUMN id SET DEFAULT nextval('customer_id_seq'::regclass); + + +-- +-- TOC entry 3162 (class 2604 OID 26009) +-- Name: event_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event ALTER COLUMN event_id SET DEFAULT nextval('event_event_id_seq'::regclass); + + +-- +-- TOC entry 3163 (class 2604 OID 26010) +-- Name: feedback_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY feedback ALTER COLUMN feedback_id SET DEFAULT nextval('feedback_feedback_id_seq'::regclass); + + +-- +-- TOC entry 3141 (class 2604 OID 25320) +-- Name: language_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY language ALTER COLUMN language_id SET DEFAULT nextval('language_language_id_seq'::regclass); + + +-- +-- TOC entry 3164 (class 2604 OID 26012) +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders ALTER COLUMN id SET DEFAULT nextval('orders_id_seq1'::regclass); + + +-- +-- TOC entry 3165 (class 2604 OID 26013) +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders_delivery ALTER COLUMN id SET DEFAULT nextval('orders_delivery_id_seq'::regclass); + + +-- +-- TOC entry 3166 (class 2604 OID 26014) +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders_label ALTER COLUMN id SET DEFAULT nextval('orders_label_id_seq'::regclass); + + +-- +-- TOC entry 3167 (class 2604 OID 26015) +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders_products ALTER COLUMN id SET DEFAULT nextval('orders_products_id_seq'::regclass); + + +-- +-- TOC entry 3168 (class 2604 OID 26016) +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY page ALTER COLUMN id SET DEFAULT nextval('page_id_seq'::regclass); + + +-- +-- TOC entry 3173 (class 2604 OID 26017) +-- Name: product_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product ALTER COLUMN product_id SET DEFAULT nextval('product_product_id_seq'::regclass); + + +-- +-- TOC entry 3199 (class 2604 OID 28329) +-- Name: product_certificate_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_certificate ALTER COLUMN product_certificate_id SET DEFAULT nextval('product_certificate_product_certificate_id_seq'::regclass); + + +-- +-- TOC entry 3174 (class 2604 OID 26018) +-- Name: product_image_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_image ALTER COLUMN product_image_id SET DEFAULT nextval('product_image_product_image_id_seq'::regclass); + + +-- +-- TOC entry 3198 (class 2604 OID 28312) +-- Name: product_spec_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_spec ALTER COLUMN product_spec_id SET DEFAULT nextval('product_spec_product_spec_id_seq'::regclass); + + +-- +-- TOC entry 3197 (class 2604 OID 28279) +-- Name: product_to_project_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_to_project ALTER COLUMN product_to_project_id SET DEFAULT nextval('product_to_project_product_to_project_id_seq'::regclass); + + +-- +-- TOC entry 3177 (class 2604 OID 26019) +-- Name: product_to_rating_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_to_rating ALTER COLUMN product_to_rating_id SET DEFAULT nextval('product_to_rating_product_to_rating_id_seq'::regclass); + + +-- +-- TOC entry 3178 (class 2604 OID 26020) +-- Name: product_unit_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_unit ALTER COLUMN product_unit_id SET DEFAULT nextval('product_unit_product_unit_id_seq'::regclass); + + +-- +-- TOC entry 3179 (class 2604 OID 26021) +-- Name: product_variant_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_variant ALTER COLUMN product_variant_id SET DEFAULT nextval('product_variant_product_variant_id_seq'::regclass); + + +-- +-- TOC entry 3195 (class 2604 OID 27424) +-- Name: project_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project ALTER COLUMN project_id SET DEFAULT nextval('project_project_id_seq'::regclass); + + +-- +-- TOC entry 3196 (class 2604 OID 27435) +-- Name: project_image_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project_image ALTER COLUMN project_image_id SET DEFAULT nextval('project_image_project_image_id_seq'::regclass); + + +-- +-- TOC entry 3180 (class 2604 OID 26024) +-- Name: seo_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo ALTER COLUMN seo_id SET DEFAULT nextval('seo_seo_id_seq'::regclass); + + +-- +-- TOC entry 3181 (class 2604 OID 26025) +-- Name: seo_category_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_category ALTER COLUMN seo_category_id SET DEFAULT nextval('seo_category_seo_category_id_seq'::regclass); + + +-- +-- TOC entry 3182 (class 2604 OID 26026) +-- Name: seo_dynamic_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_dynamic ALTER COLUMN seo_dynamic_id SET DEFAULT nextval('seo_dynamic_seo_dynamic_id_seq'::regclass); + + +-- +-- TOC entry 3183 (class 2604 OID 26027) +-- Name: service_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY service ALTER COLUMN service_id SET DEFAULT nextval('service_service_id_seq'::regclass); + + +-- +-- TOC entry 3184 (class 2604 OID 26028) +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY share ALTER COLUMN id SET DEFAULT nextval('share_id_seq'::regclass); + + +-- +-- TOC entry 3185 (class 2604 OID 26029) +-- Name: slider_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY slider ALTER COLUMN slider_id SET DEFAULT nextval('slider_slider_id_seq'::regclass); + + +-- +-- TOC entry 3186 (class 2604 OID 26030) +-- Name: slider_image_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY slider_image ALTER COLUMN slider_image_id SET DEFAULT nextval('slider_image_slider_image_id_seq'::regclass); + + +-- +-- TOC entry 3175 (class 2604 OID 26031) +-- Name: stock_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY stock ALTER COLUMN stock_id SET DEFAULT nextval('product_stock_product_stock_id_seq'::regclass); + + +-- +-- TOC entry 3190 (class 2604 OID 26032) +-- Name: tax_group_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_group ALTER COLUMN tax_group_id SET DEFAULT nextval('tax_group_tax_group_id_seq'::regclass); + + +-- +-- TOC entry 3191 (class 2604 OID 26033) +-- Name: tax_group_to_category_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_group_to_category ALTER COLUMN tax_group_to_category_id SET DEFAULT nextval('tax_group_to_category_tax_group_to_category_id_seq'::regclass); + + +-- +-- TOC entry 3194 (class 2604 OID 26034) +-- Name: tax_option_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_option ALTER COLUMN tax_option_id SET DEFAULT nextval('tax_option_tax_option_id_seq'::regclass); + + +-- +-- TOC entry 3144 (class 2604 OID 25321) +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY "user" ALTER COLUMN id SET DEFAULT nextval('user_id_seq'::regclass); + + +-- +-- TOC entry 3221 (class 2606 OID 26041) +-- Name: artbox_comment_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY artbox_comment + ADD CONSTRAINT artbox_comment_pkey PRIMARY KEY (artbox_comment_id); + + +-- +-- TOC entry 3223 (class 2606 OID 26043) +-- Name: artbox_comment_rating_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY artbox_comment_rating + ADD CONSTRAINT artbox_comment_rating_pkey PRIMARY KEY (artbox_comment_rating_id); + + +-- +-- TOC entry 3225 (class 2606 OID 26045) +-- Name: artbox_like_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY artbox_like + ADD CONSTRAINT artbox_like_pkey PRIMARY KEY (artbox_like_id); + + +-- +-- TOC entry 3228 (class 2606 OID 26047) +-- Name: article_to_rating_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY article_to_rating + ADD CONSTRAINT article_to_rating_pkey PRIMARY KEY (article_to_rating_id); + + +-- +-- TOC entry 3230 (class 2606 OID 26049) +-- Name: articles_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY articles + ADD CONSTRAINT articles_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3205 (class 2606 OID 25333) +-- Name: auth_item_child_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY auth_item_child + ADD CONSTRAINT auth_item_child_pkey PRIMARY KEY (parent, child); + + +-- +-- TOC entry 3202 (class 2606 OID 25335) +-- Name: auth_item_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY auth_item + ADD CONSTRAINT auth_item_pkey PRIMARY KEY (name); + + +-- +-- TOC entry 3207 (class 2606 OID 25337) +-- Name: auth_rule_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY auth_rule + ADD CONSTRAINT auth_rule_pkey PRIMARY KEY (name); + + +-- +-- TOC entry 3232 (class 2606 OID 26051) +-- Name: banner_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY banner + ADD CONSTRAINT banner_pkey PRIMARY KEY (banner_id); + + +-- +-- TOC entry 3234 (class 2606 OID 26053) +-- Name: bg_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bg + ADD CONSTRAINT bg_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3236 (class 2606 OID 26057) +-- Name: brand_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY brand + ADD CONSTRAINT brand_pkey PRIMARY KEY (brand_id); + + +-- +-- TOC entry 3239 (class 2606 OID 26059) +-- Name: category_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY category + ADD CONSTRAINT category_pkey PRIMARY KEY (category_id); + + +-- +-- TOC entry 3324 (class 2606 OID 28353) +-- Name: certificate_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY certificate + ADD CONSTRAINT certificate_pkey PRIMARY KEY (certificate_id); + + +-- +-- TOC entry 3242 (class 2606 OID 26063) +-- Name: customer_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY customer + ADD CONSTRAINT customer_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3244 (class 2606 OID 26065) +-- Name: event_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event + ADD CONSTRAINT event_pkey PRIMARY KEY (event_id); + + +-- +-- TOC entry 3246 (class 2606 OID 26067) +-- Name: feedback_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY feedback + ADD CONSTRAINT feedback_pkey PRIMARY KEY (feedback_id); + + +-- +-- TOC entry 3209 (class 2606 OID 25359) +-- Name: language_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY language + ADD CONSTRAINT language_pkey PRIMARY KEY (language_id); + + +-- +-- TOC entry 3211 (class 2606 OID 25361) +-- Name: migration_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY migration + ADD CONSTRAINT migration_pkey PRIMARY KEY (version); + + +-- +-- TOC entry 3250 (class 2606 OID 26071) +-- Name: orders_delivery_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders_delivery + ADD CONSTRAINT orders_delivery_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3252 (class 2606 OID 26073) +-- Name: orders_label_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders_label + ADD CONSTRAINT orders_label_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3248 (class 2606 OID 26075) +-- Name: orders_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders + ADD CONSTRAINT orders_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3255 (class 2606 OID 26077) +-- Name: orders_products_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders_products + ADD CONSTRAINT orders_products_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3257 (class 2606 OID 26079) +-- Name: page_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY page + ADD CONSTRAINT page_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3322 (class 2606 OID 28331) +-- Name: product_certificate_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_certificate + ADD CONSTRAINT product_certificate_pkey PRIMARY KEY (product_certificate_id); + + +-- +-- TOC entry 3265 (class 2606 OID 26087) +-- Name: product_image_id_pk; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_image + ADD CONSTRAINT product_image_id_pk PRIMARY KEY (product_image_id); + + +-- +-- TOC entry 3267 (class 2606 OID 26089) +-- Name: product_option_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_option + ADD CONSTRAINT product_option_pkey PRIMARY KEY (product_id, option_id); + + +-- +-- TOC entry 3260 (class 2606 OID 26091) +-- Name: product_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product + ADD CONSTRAINT product_pkey PRIMARY KEY (product_id); + + +-- +-- TOC entry 3320 (class 2606 OID 28317) +-- Name: product_spec_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_spec + ADD CONSTRAINT product_spec_pkey PRIMARY KEY (product_spec_id); + + +-- +-- TOC entry 3317 (class 2606 OID 28281) +-- Name: product_to_project_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_to_project + ADD CONSTRAINT product_to_project_pkey PRIMARY KEY (product_to_project_id); + + +-- +-- TOC entry 3274 (class 2606 OID 26093) +-- Name: product_to_rating_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_to_rating + ADD CONSTRAINT product_to_rating_pkey PRIMARY KEY (product_to_rating_id); + + +-- +-- TOC entry 3276 (class 2606 OID 26095) +-- Name: product_unit_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_unit + ADD CONSTRAINT product_unit_pkey PRIMARY KEY (product_unit_id); + + +-- +-- TOC entry 3283 (class 2606 OID 26097) +-- Name: product_variant_option_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_variant_option + ADD CONSTRAINT product_variant_option_pkey PRIMARY KEY (product_variant_id, option_id); + + +-- +-- TOC entry 3278 (class 2606 OID 26099) +-- Name: product_variant_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_variant + ADD CONSTRAINT product_variant_pkey PRIMARY KEY (product_variant_id); + + +-- +-- TOC entry 3315 (class 2606 OID 27440) +-- Name: project_image_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project_image + ADD CONSTRAINT project_image_pkey PRIMARY KEY (project_image_id); + + +-- +-- TOC entry 3313 (class 2606 OID 27429) +-- Name: project_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project + ADD CONSTRAINT project_pkey PRIMARY KEY (project_id); + + +-- +-- TOC entry 3287 (class 2606 OID 26105) +-- Name: seo_category_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_category + ADD CONSTRAINT seo_category_pkey PRIMARY KEY (seo_category_id); + + +-- +-- TOC entry 3289 (class 2606 OID 26107) +-- Name: seo_dynamic_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_dynamic + ADD CONSTRAINT seo_dynamic_pkey PRIMARY KEY (seo_dynamic_id); + + +-- +-- TOC entry 3285 (class 2606 OID 26109) +-- Name: seo_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo + ADD CONSTRAINT seo_pkey PRIMARY KEY (seo_id); + + +-- +-- TOC entry 3291 (class 2606 OID 26111) +-- Name: service_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY service + ADD CONSTRAINT service_pkey PRIMARY KEY (service_id); + + +-- +-- TOC entry 3295 (class 2606 OID 26113) +-- Name: share_id_pk; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY share + ADD CONSTRAINT share_id_pk PRIMARY KEY (id); + + +-- +-- TOC entry 3299 (class 2606 OID 26115) +-- Name: slider_image_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY slider_image + ADD CONSTRAINT slider_image_pkey PRIMARY KEY (slider_image_id); + + +-- +-- TOC entry 3297 (class 2606 OID 26117) +-- Name: slider_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY slider + ADD CONSTRAINT slider_pkey PRIMARY KEY (slider_id); + + +-- +-- TOC entry 3272 (class 2606 OID 26119) +-- Name: stock_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY stock + ADD CONSTRAINT stock_pkey PRIMARY KEY (stock_id); + + +-- +-- TOC entry 3302 (class 2606 OID 26121) +-- Name: tax_group_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_group + ADD CONSTRAINT tax_group_pkey PRIMARY KEY (tax_group_id); + + +-- +-- TOC entry 3306 (class 2606 OID 26123) +-- Name: tax_group_to_category_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_group_to_category + ADD CONSTRAINT tax_group_to_category_pkey PRIMARY KEY (tax_group_to_category_id); + + +-- +-- TOC entry 3308 (class 2606 OID 26125) +-- Name: tax_option_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_option + ADD CONSTRAINT tax_option_pkey PRIMARY KEY (tax_option_id); + + +-- +-- TOC entry 3213 (class 2606 OID 25429) +-- Name: user_email_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY "user" + ADD CONSTRAINT user_email_key UNIQUE (email); + + +-- +-- TOC entry 3215 (class 2606 OID 25431) +-- Name: user_password_reset_token_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY "user" + ADD CONSTRAINT user_password_reset_token_key UNIQUE (password_reset_token); + + +-- +-- TOC entry 3217 (class 2606 OID 25433) +-- Name: user_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY "user" + ADD CONSTRAINT user_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3219 (class 2606 OID 25435) +-- Name: user_username_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY "user" + ADD CONSTRAINT user_username_key UNIQUE (username); + + +-- +-- TOC entry 3226 (class 1259 OID 26136) +-- Name: artbox_like_unique; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX artbox_like_unique ON artbox_like USING btree (artbox_comment_id, user_id, is_like); + + +-- +-- TOC entry 3325 (class 1259 OID 29035) +-- Name: articles_lang_alias; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX articles_lang_alias ON articles_lang USING btree (alias); + + +-- +-- TOC entry 3326 (class 1259 OID 28419) +-- Name: articles_lang_article_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX articles_lang_article_language_key ON articles_lang USING btree (articles_id, language_id); + + +-- +-- TOC entry 3329 (class 1259 OID 28502) +-- Name: banner_lang_banner_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX banner_lang_banner_language_key ON banner_lang USING btree (banner_id, language_id); + + +-- +-- TOC entry 3330 (class 1259 OID 28516) +-- Name: bg_lang_bg_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX bg_lang_bg_language_key ON bg_lang USING btree (bg_id, language_id); + + +-- +-- TOC entry 3331 (class 1259 OID 29036) +-- Name: brand_lang_alias; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX brand_lang_alias ON brand_lang USING btree (alias); + + +-- +-- TOC entry 3332 (class 1259 OID 28539) +-- Name: brand_lang_brand_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX brand_lang_brand_language_key ON brand_lang USING btree (brand_id, language_id); + + +-- +-- TOC entry 3237 (class 1259 OID 29110) +-- Name: brand_remote_id_uindex; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX brand_remote_id_uindex ON brand USING btree (remote_id); + + +-- +-- TOC entry 3333 (class 1259 OID 29037) +-- Name: category_lang_alias; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX category_lang_alias ON category_lang USING btree (alias); + + +-- +-- TOC entry 3334 (class 1259 OID 28556) +-- Name: category_lang_category_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX category_lang_category_language_key ON category_lang USING btree (category_id, language_id); + + +-- +-- TOC entry 3240 (class 1259 OID 29119) +-- Name: category_remote_id_uindex; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX category_remote_id_uindex ON category USING btree (remote_id); + + +-- +-- TOC entry 3335 (class 1259 OID 29038) +-- Name: event_lang_alias; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX event_lang_alias ON event_lang USING btree (alias); + + +-- +-- TOC entry 3336 (class 1259 OID 28594) +-- Name: event_lang_event_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX event_lang_event_language_key ON event_lang USING btree (event_id, language_id); + + +-- +-- TOC entry 3253 (class 1259 OID 29219) +-- Name: fki_orders_products_product_variant_product_variant_id_fk; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX fki_orders_products_product_variant_product_variant_id_fk ON orders_products USING btree (mod_id); + + +-- +-- TOC entry 3258 (class 1259 OID 26138) +-- Name: fki_product_brand_fk; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX fki_product_brand_fk ON product USING btree (brand_id); + + +-- +-- TOC entry 3262 (class 1259 OID 26139) +-- Name: fki_product_id_fk; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX fki_product_id_fk ON product_image USING btree (product_id); + + +-- +-- TOC entry 3268 (class 1259 OID 26140) +-- Name: fki_product_stock_product_id_fkey; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX fki_product_stock_product_id_fkey ON product_stock USING btree (product_id); + + +-- +-- TOC entry 3269 (class 1259 OID 26141) +-- Name: fki_product_stock_product_variant_id_fkey; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX fki_product_stock_product_variant_id_fkey ON product_stock USING btree (product_variant_id); + + +-- +-- TOC entry 3270 (class 1259 OID 26142) +-- Name: fki_product_stock_stock_id_fkey; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX fki_product_stock_stock_id_fkey ON product_stock USING btree (stock_id); + + +-- +-- TOC entry 3263 (class 1259 OID 26143) +-- Name: fki_product_variant_id_fkey; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX fki_product_variant_id_fkey ON product_image USING btree (product_variant_id); + + +-- +-- TOC entry 3281 (class 1259 OID 26144) +-- Name: fki_product_variant_option_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX fki_product_variant_option_id ON product_variant_option USING btree (option_id); + + +-- +-- TOC entry 3292 (class 1259 OID 26146) +-- Name: fki_share_product_id_fkey; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX fki_share_product_id_fkey ON share USING btree (product_id); + + +-- +-- TOC entry 3293 (class 1259 OID 26147) +-- Name: fki_share_user_id_fkey; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX fki_share_user_id_fkey ON share USING btree (user_id); + + +-- +-- TOC entry 3203 (class 1259 OID 25448) +-- Name: idx-auth_item-type; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX "idx-auth_item-type" ON auth_item USING btree (type); + + +-- +-- TOC entry 3337 (class 1259 OID 28619) +-- Name: orders_delivery_lang_orders_delivery_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX orders_delivery_lang_orders_delivery_language_key ON orders_delivery_lang USING btree (orders_delivery_id, language_id); + + +-- +-- TOC entry 3338 (class 1259 OID 28653) +-- Name: orders_label_lang_orders_label_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX orders_label_lang_orders_label_language_key ON orders_label_lang USING btree (orders_label_id, language_id); + + +-- +-- TOC entry 3327 (class 1259 OID 29039) +-- Name: page_lang_alias; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX page_lang_alias ON page_lang USING btree (alias); + + +-- +-- TOC entry 3328 (class 1259 OID 28462) +-- Name: page_lang_page_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX page_lang_page_language_key ON page_lang USING btree (page_id, language_id); + + +-- +-- TOC entry 3339 (class 1259 OID 29040) +-- Name: product_lang_alias; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX product_lang_alias ON product_lang USING btree (alias); + + +-- +-- TOC entry 3340 (class 1259 OID 28689) +-- Name: product_lang_product_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX product_lang_product_language_key ON product_lang USING btree (product_id, language_id); + + +-- +-- TOC entry 3261 (class 1259 OID 29128) +-- Name: product_remote_id_uindex; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX product_remote_id_uindex ON product USING btree (remote_id); + + +-- +-- TOC entry 3341 (class 1259 OID 28706) +-- Name: product_spec_lang_product_spec_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX product_spec_lang_product_spec_language_key ON product_spec_lang USING btree (product_spec_id, language_id); + + +-- +-- TOC entry 3318 (class 1259 OID 28292) +-- Name: product_to_project_product_variant_id_project_id_uindex; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX product_to_project_product_variant_id_project_id_uindex ON product_to_project USING btree (product_variant_id, project_id); + + +-- +-- TOC entry 3342 (class 1259 OID 28729) +-- Name: product_unit_lang_product_unit_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX product_unit_lang_product_unit_language_key ON product_unit_lang USING btree (product_unit_id, language_id); + + +-- +-- TOC entry 3343 (class 1259 OID 28744) +-- Name: product_variant_lang_product_variant_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX product_variant_lang_product_variant_language_key ON product_variant_lang USING btree (product_variant_id, language_id); + + +-- +-- TOC entry 3279 (class 1259 OID 26148) +-- Name: product_variant_product_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX product_variant_product_id_index ON product_variant USING btree (product_id); + + +-- +-- TOC entry 3280 (class 1259 OID 29138) +-- Name: product_variant_remote_id_uindex; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX product_variant_remote_id_uindex ON product_variant USING btree (remote_id); + + +-- +-- TOC entry 3344 (class 1259 OID 29041) +-- Name: project_lang_alias; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX project_lang_alias ON project_lang USING btree (alias); + + +-- +-- TOC entry 3345 (class 1259 OID 28763) +-- Name: project_lang_project_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX project_lang_project_language_key ON project_lang USING btree (project_id, language_id); + + +-- +-- TOC entry 3347 (class 1259 OID 28816) +-- Name: seo_category_lang_seo_category_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX seo_category_lang_seo_category_language_key ON seo_category_lang USING btree (seo_category_id, language_id); + + +-- +-- TOC entry 3348 (class 1259 OID 28833) +-- Name: seo_dynamic_lang_seo_dynamic_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX seo_dynamic_lang_seo_dynamic_language_key ON seo_dynamic_lang USING btree (seo_dynamic_id, language_id); + + +-- +-- TOC entry 3346 (class 1259 OID 28802) +-- Name: seo_lang_seo_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX seo_lang_seo_language_key ON seo_lang USING btree (seo_id, language_id); + + +-- +-- TOC entry 3349 (class 1259 OID 29042) +-- Name: service_lang_alias; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX service_lang_alias ON service_lang USING btree (alias); + + +-- +-- TOC entry 3350 (class 1259 OID 28901) +-- Name: service_lang_service_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX service_lang_service_language_key ON service_lang USING btree (service_id, language_id); + + +-- +-- TOC entry 3351 (class 1259 OID 28935) +-- Name: slider_image_lang_slider_image_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX slider_image_lang_slider_image_language_key ON slider_image_lang USING btree (slider_image_id, language_id); + + +-- +-- TOC entry 3356 (class 1259 OID 29093) +-- Name: stock_lang_stock_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX stock_lang_stock_language_key ON stock_lang USING btree (stock_id, language_id); + + +-- +-- TOC entry 3300 (class 1259 OID 26150) +-- Name: tax_group_is_filter_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX tax_group_is_filter_index ON tax_group USING btree (is_filter); + + +-- +-- TOC entry 3352 (class 1259 OID 29043) +-- Name: tax_group_lang_alias; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX tax_group_lang_alias ON tax_group_lang USING btree (alias); + + +-- +-- TOC entry 3353 (class 1259 OID 28969) +-- Name: tax_group_lang_tax_group_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX tax_group_lang_tax_group_language_key ON tax_group_lang USING btree (tax_group_id, language_id); + + +-- +-- TOC entry 3303 (class 1259 OID 29155) +-- Name: tax_group_remote_id_uindex; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX tax_group_remote_id_uindex ON tax_group USING btree (remote_id); + + +-- +-- TOC entry 3304 (class 1259 OID 26151) +-- Name: tax_group_sort_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX tax_group_sort_index ON tax_group USING btree (sort); + + +-- +-- TOC entry 3354 (class 1259 OID 29044) +-- Name: tax_option_lang_alias; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX tax_option_lang_alias ON tax_option_lang USING btree (alias); + + +-- +-- TOC entry 3355 (class 1259 OID 29000) +-- Name: tax_option_lang_tax_option_language_key; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX tax_option_lang_tax_option_language_key ON tax_option_lang USING btree (tax_option_id, language_id); + + +-- +-- TOC entry 3309 (class 1259 OID 29163) +-- Name: tax_option_remote_id_uindex; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX tax_option_remote_id_uindex ON tax_option USING btree (remote_id); + + +-- +-- TOC entry 3310 (class 1259 OID 26153) +-- Name: tax_option_sort_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX tax_option_sort_index ON tax_option USING btree (sort); + + +-- +-- TOC entry 3311 (class 1259 OID 26154) +-- Name: tax_option_tax_group_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX tax_option_tax_group_id_index ON tax_option USING btree (tax_group_id); + + +-- +-- TOC entry 3365 (class 2606 OID 26157) +-- Name: artbox_comment_id_artbox_comment; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY artbox_like + ADD CONSTRAINT artbox_comment_id_artbox_comment FOREIGN KEY (artbox_comment_id) REFERENCES artbox_comment(artbox_comment_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3361 (class 2606 OID 26162) +-- Name: artbox_comment_pid_artbox_comment; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY artbox_comment + ADD CONSTRAINT artbox_comment_pid_artbox_comment FOREIGN KEY (artbox_comment_pid) REFERENCES artbox_comment(artbox_comment_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3367 (class 2606 OID 26167) +-- Name: article_to_rating_article; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY article_to_rating + ADD CONSTRAINT article_to_rating_article FOREIGN KEY (articles_id) REFERENCES articles(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3400 (class 2606 OID 28420) +-- Name: articles_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY articles_lang + ADD CONSTRAINT articles_fk FOREIGN KEY (articles_id) REFERENCES articles(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3357 (class 2606 OID 25473) +-- Name: auth_assignment_item_name_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY auth_assignment + ADD CONSTRAINT auth_assignment_item_name_fkey FOREIGN KEY (item_name) REFERENCES auth_item(name); + + +-- +-- TOC entry 3359 (class 2606 OID 25478) +-- Name: auth_item_child_child_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY auth_item_child + ADD CONSTRAINT auth_item_child_child_fkey FOREIGN KEY (child) REFERENCES auth_item(name); + + +-- +-- TOC entry 3360 (class 2606 OID 25483) +-- Name: auth_item_child_parent_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY auth_item_child + ADD CONSTRAINT auth_item_child_parent_fkey FOREIGN KEY (parent) REFERENCES auth_item(name); + + +-- +-- TOC entry 3358 (class 2606 OID 25488) +-- Name: auth_item_rule_name_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY auth_item + ADD CONSTRAINT auth_item_rule_name_fkey FOREIGN KEY (rule_name) REFERENCES auth_rule(name); + + +-- +-- TOC entry 3404 (class 2606 OID 28503) +-- Name: banner_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY banner_lang + ADD CONSTRAINT banner_fk FOREIGN KEY (banner_id) REFERENCES banner(banner_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3406 (class 2606 OID 28517) +-- Name: bg_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bg_lang + ADD CONSTRAINT bg_fk FOREIGN KEY (bg_id) REFERENCES bg(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3408 (class 2606 OID 28540) +-- Name: brand_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY brand_lang + ADD CONSTRAINT brand_fk FOREIGN KEY (brand_id) REFERENCES brand(brand_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3393 (class 2606 OID 27377) +-- Name: category_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_group_to_category + ADD CONSTRAINT category_fk FOREIGN KEY (category_id) REFERENCES category(category_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3410 (class 2606 OID 28557) +-- Name: category_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY category_lang + ADD CONSTRAINT category_fk FOREIGN KEY (category_id) REFERENCES category(category_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3368 (class 2606 OID 26177) +-- Name: category_product_unit_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY category + ADD CONSTRAINT category_product_unit_fkey FOREIGN KEY (product_unit_id) REFERENCES product_unit(product_unit_id); + + +-- +-- TOC entry 3412 (class 2606 OID 28595) +-- Name: event_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_lang + ADD CONSTRAINT event_fk FOREIGN KEY (event_id) REFERENCES event(event_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3375 (class 2606 OID 27402) +-- Name: fki_category_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_category + ADD CONSTRAINT fki_category_id FOREIGN KEY (category_id) REFERENCES category(category_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3374 (class 2606 OID 27397) +-- Name: fki_product_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_category + ADD CONSTRAINT fki_product_id FOREIGN KEY (product_id) REFERENCES product(product_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3394 (class 2606 OID 27382) +-- Name: fki_tax_option_tax_group_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_option + ADD CONSTRAINT fki_tax_option_tax_group_id FOREIGN KEY (tax_group_id) REFERENCES tax_group(tax_group_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3401 (class 2606 OID 28425) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY articles_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3403 (class 2606 OID 28468) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY page_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3405 (class 2606 OID 28508) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY banner_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3407 (class 2606 OID 28522) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY bg_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3409 (class 2606 OID 28545) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY brand_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3411 (class 2606 OID 28562) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY category_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3413 (class 2606 OID 28600) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY event_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3415 (class 2606 OID 28625) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders_delivery_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3417 (class 2606 OID 28659) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders_label_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3419 (class 2606 OID 28695) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3421 (class 2606 OID 28712) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_spec_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3423 (class 2606 OID 28735) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_unit_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3425 (class 2606 OID 28750) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_variant_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3427 (class 2606 OID 28769) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3429 (class 2606 OID 28808) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3431 (class 2606 OID 28822) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_category_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3433 (class 2606 OID 28839) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_dynamic_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3435 (class 2606 OID 28907) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY service_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3437 (class 2606 OID 28941) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY slider_image_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3439 (class 2606 OID 28975) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_group_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3441 (class 2606 OID 29006) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_option_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3443 (class 2606 OID 29099) +-- Name: language_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY stock_lang + ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT; + + +-- +-- TOC entry 3414 (class 2606 OID 28620) +-- Name: orders_delivery_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders_delivery_lang + ADD CONSTRAINT orders_delivery_fk FOREIGN KEY (orders_delivery_id) REFERENCES orders_delivery(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3416 (class 2606 OID 28654) +-- Name: orders_label_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders_label_lang + ADD CONSTRAINT orders_label_fk FOREIGN KEY (orders_label_id) REFERENCES orders_label(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3370 (class 2606 OID 27251) +-- Name: orders_orders_delivery_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders + ADD CONSTRAINT orders_orders_delivery_id_fk FOREIGN KEY (delivery) REFERENCES orders_delivery(id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- TOC entry 3369 (class 2606 OID 27239) +-- Name: orders_orders_label_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders + ADD CONSTRAINT orders_orders_label_id_fk FOREIGN KEY (label) REFERENCES orders_label(id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- TOC entry 3371 (class 2606 OID 27267) +-- Name: orders_products_orders_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders_products + ADD CONSTRAINT orders_products_orders_id_fk FOREIGN KEY (order_id) REFERENCES orders(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3372 (class 2606 OID 29220) +-- Name: orders_products_product_variant_product_variant_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY orders_products + ADD CONSTRAINT orders_products_product_variant_product_variant_id_fk FOREIGN KEY (mod_id) REFERENCES product_variant(product_variant_id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- TOC entry 3402 (class 2606 OID 28463) +-- Name: page_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY page_lang + ADD CONSTRAINT page_fk FOREIGN KEY (page_id) REFERENCES page(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3373 (class 2606 OID 27277) +-- Name: product_brand_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product + ADD CONSTRAINT product_brand_fk FOREIGN KEY (brand_id) REFERENCES brand(brand_id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- TOC entry 3399 (class 2606 OID 28332) +-- Name: product_certificate_product_product_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_certificate + ADD CONSTRAINT product_certificate_product_product_id_fk FOREIGN KEY (product_id) REFERENCES product(product_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3418 (class 2606 OID 28690) +-- Name: product_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_lang + ADD CONSTRAINT product_fk FOREIGN KEY (product_id) REFERENCES product(product_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3377 (class 2606 OID 27297) +-- Name: product_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_image + ADD CONSTRAINT product_id_fk FOREIGN KEY (product_id) REFERENCES product(product_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3378 (class 2606 OID 27302) +-- Name: product_option_product_product_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_option + ADD CONSTRAINT product_option_product_product_id_fk FOREIGN KEY (product_id) REFERENCES product(product_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3379 (class 2606 OID 27307) +-- Name: product_option_tax_option_tax_option_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_option + ADD CONSTRAINT product_option_tax_option_tax_option_id_fk FOREIGN KEY (option_id) REFERENCES tax_option(tax_option_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3420 (class 2606 OID 28707) +-- Name: product_spec_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_spec_lang + ADD CONSTRAINT product_spec_fk FOREIGN KEY (product_spec_id) REFERENCES product_spec(product_spec_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3398 (class 2606 OID 28318) +-- Name: product_spec_product_product_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_spec + ADD CONSTRAINT product_spec_product_product_id_fk FOREIGN KEY (product_id) REFERENCES product(product_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3382 (class 2606 OID 27317) +-- Name: product_stock_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_stock + ADD CONSTRAINT product_stock_product_id_fkey FOREIGN KEY (product_id) REFERENCES product(product_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3381 (class 2606 OID 27312) +-- Name: product_stock_product_variant_product_variant_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_stock + ADD CONSTRAINT product_stock_product_variant_product_variant_id_fk FOREIGN KEY (product_variant_id) REFERENCES product_variant(product_variant_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3380 (class 2606 OID 27194) +-- Name: product_stock_stock_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_stock + ADD CONSTRAINT product_stock_stock_id_fkey FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3396 (class 2606 OID 28282) +-- Name: product_to_project_product_variant_product_variant_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_to_project + ADD CONSTRAINT product_to_project_product_variant_product_variant_id_fk FOREIGN KEY (product_variant_id) REFERENCES product_variant(product_variant_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3397 (class 2606 OID 28287) +-- Name: product_to_project_project_project_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_to_project + ADD CONSTRAINT product_to_project_project_project_id_fk FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3383 (class 2606 OID 26247) +-- Name: product_to_rating_product; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_to_rating + ADD CONSTRAINT product_to_rating_product FOREIGN KEY (product_id) REFERENCES product(product_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3422 (class 2606 OID 28730) +-- Name: product_unit_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_unit_lang + ADD CONSTRAINT product_unit_fk FOREIGN KEY (product_unit_id) REFERENCES product_unit(product_unit_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3424 (class 2606 OID 28745) +-- Name: product_variant_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_variant_lang + ADD CONSTRAINT product_variant_fk FOREIGN KEY (product_variant_id) REFERENCES product_variant(product_variant_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3376 (class 2606 OID 27292) +-- Name: product_variant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_image + ADD CONSTRAINT product_variant_id_fkey FOREIGN KEY (product_variant_id) REFERENCES product_variant(product_variant_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3386 (class 2606 OID 27352) +-- Name: product_variant_option_product_variant_product_variant_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_variant_option + ADD CONSTRAINT product_variant_option_product_variant_product_variant_id_fk FOREIGN KEY (product_variant_id) REFERENCES product_variant(product_variant_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3387 (class 2606 OID 27357) +-- Name: product_variant_option_tax_option_tax_option_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_variant_option + ADD CONSTRAINT product_variant_option_tax_option_tax_option_id_fk FOREIGN KEY (option_id) REFERENCES tax_option(tax_option_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3384 (class 2606 OID 27342) +-- Name: product_variant_product_product_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_variant + ADD CONSTRAINT product_variant_product_product_id_fk FOREIGN KEY (product_id) REFERENCES product(product_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3385 (class 2606 OID 27347) +-- Name: product_variant_product_unit_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY product_variant + ADD CONSTRAINT product_variant_product_unit_fkey FOREIGN KEY (product_unit_id) REFERENCES product_unit(product_unit_id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- TOC entry 3426 (class 2606 OID 28764) +-- Name: project_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project_lang + ADD CONSTRAINT project_fk FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3395 (class 2606 OID 27441) +-- Name: project_image_project_project_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY project_image + ADD CONSTRAINT project_image_project_project_id_fk FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3362 (class 2606 OID 26272) +-- Name: related_id_artbox_comment; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY artbox_comment + ADD CONSTRAINT related_id_artbox_comment FOREIGN KEY (related_id) REFERENCES artbox_comment(artbox_comment_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3430 (class 2606 OID 28817) +-- Name: seo_category_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_category_lang + ADD CONSTRAINT seo_category_fk FOREIGN KEY (seo_category_id) REFERENCES seo_category(seo_category_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3388 (class 2606 OID 27362) +-- Name: seo_category_seo_dynamic_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_dynamic + ADD CONSTRAINT seo_category_seo_dynamic_fk FOREIGN KEY (seo_category_id) REFERENCES seo_category(seo_category_id) ON UPDATE CASCADE ON DELETE SET NULL; + + +-- +-- TOC entry 3432 (class 2606 OID 28834) +-- Name: seo_dynamic_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_dynamic_lang + ADD CONSTRAINT seo_dynamic_fk FOREIGN KEY (seo_dynamic_id) REFERENCES seo_dynamic(seo_dynamic_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3428 (class 2606 OID 28803) +-- Name: seo_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY seo_lang + ADD CONSTRAINT seo_fk FOREIGN KEY (seo_id) REFERENCES seo(seo_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3434 (class 2606 OID 28902) +-- Name: service_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY service_lang + ADD CONSTRAINT service_fk FOREIGN KEY (service_id) REFERENCES service(service_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3389 (class 2606 OID 26282) +-- Name: share_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY share + ADD CONSTRAINT share_product_id_fkey FOREIGN KEY (product_id) REFERENCES product(product_id); + + +-- +-- TOC entry 3390 (class 2606 OID 26287) +-- Name: share_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY share + ADD CONSTRAINT share_user_id_fkey FOREIGN KEY (user_id) REFERENCES customer(id); + + +-- +-- TOC entry 3436 (class 2606 OID 28936) +-- Name: slider_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY slider_image_lang + ADD CONSTRAINT slider_image_fk FOREIGN KEY (slider_image_id) REFERENCES slider_image(slider_image_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3391 (class 2606 OID 27367) +-- Name: slider_slider_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY slider_image + ADD CONSTRAINT slider_slider_image_fk FOREIGN KEY (slider_id) REFERENCES slider(slider_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3442 (class 2606 OID 29094) +-- Name: stock_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY stock_lang + ADD CONSTRAINT stock_fk FOREIGN KEY (stock_id) REFERENCES stock(stock_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3392 (class 2606 OID 27372) +-- Name: tax_group_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_group_to_category + ADD CONSTRAINT tax_group_fk FOREIGN KEY (tax_group_id) REFERENCES tax_group(tax_group_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3438 (class 2606 OID 28970) +-- Name: tax_group_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_group_lang + ADD CONSTRAINT tax_group_fk FOREIGN KEY (tax_group_id) REFERENCES tax_group(tax_group_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3440 (class 2606 OID 29001) +-- Name: tax_option_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY tax_option_lang + ADD CONSTRAINT tax_option_fk FOREIGN KEY (tax_option_id) REFERENCES tax_option(tax_option_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3363 (class 2606 OID 26312) +-- Name: user_id_user; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY artbox_comment + ADD CONSTRAINT user_id_user FOREIGN KEY (user_id) REFERENCES customer(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3366 (class 2606 OID 26317) +-- Name: user_id_user; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY artbox_like + ADD CONSTRAINT user_id_user FOREIGN KEY (user_id) REFERENCES customer(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- TOC entry 3364 (class 2606 OID 26322) +-- Name: user_id_user; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY artbox_comment_rating + ADD CONSTRAINT user_id_user FOREIGN KEY (user_id) REFERENCES customer(id) ON UPDATE CASCADE ON DELETE CASCADE; + + +-- Completed on 2016-10-28 16:08:21 EEST + +-- +-- PostgreSQL database dump complete +-- + diff --git a/common/behaviors/ArtBoxAccessBehavior.php b/common/behaviors/ArtBoxAccessBehavior.php index 44645f0..5305ecb 100755 --- a/common/behaviors/ArtBoxAccessBehavior.php +++ b/common/behaviors/ArtBoxAccessBehavior.php @@ -12,9 +12,9 @@ use yii\web\ForbiddenHttpException; class ArtBoxAccessBehavior extends AttributeBehavior { public $rules=[]; - - private $_rules = []; - + + private $ruleList = []; + public function events() { return [ @@ -70,7 +70,7 @@ class ArtBoxAccessBehavior extends AttributeBehavior { 'controllers' => [$controller], 'class' => 'yii\filters\AccessRule' ]; - $this->_rules[] = Yii::createObject(array_merge($option, $singleRule)); + $this->ruleList[] = Yii::createObject(array_merge($option, $singleRule)); } } @@ -80,7 +80,7 @@ class ArtBoxAccessBehavior extends AttributeBehavior { protected function cheсkByRule($action, $user, $request) { - foreach ($this->_rules as $rule) { + foreach ($this->ruleList as $rule) { if ($rule->allows($action, $user, $request)) return true; diff --git a/common/behaviors/SaveImgBehavior.php b/common/behaviors/SaveImgBehavior.php index 7772400..af9d3d8 100755 --- a/common/behaviors/SaveImgBehavior.php +++ b/common/behaviors/SaveImgBehavior.php @@ -17,7 +17,7 @@ public $fields; - public $is_language = false; + public $isLanguage = false; public function events() { @@ -35,7 +35,7 @@ foreach($this->fields as $field) { $field_name = $field[ 'name' ]; $name = $field_name; - if($this->is_language) { + if($this->isLanguage) { $name = '[' . $this->owner->language_id . ']' . $name; } diff --git a/common/behaviors/Slug.php b/common/behaviors/Slug.php index 8359a48..995a8da 100755 --- a/common/behaviors/Slug.php +++ b/common/behaviors/Slug.php @@ -13,12 +13,12 @@ /** * @var string */ - public $in_attribute = 'name'; + public $inAttribute = 'title'; /** * @var string */ - public $out_attribute = 'alias'; + public $outAttribute = 'alias'; /** * @var bool @@ -45,11 +45,11 @@ */ public function getSlug($event) { - if(!empty( $this->owner->{$this->in_attribute} )) { - if(empty( $this->owner->{$this->out_attribute} )) { - $this->owner->{$this->out_attribute} = $this->generateSlug($this->owner->{$this->in_attribute}); + if(!empty( $this->owner->{$this->inAttribute} )) { + if(empty( $this->owner->{$this->outAttribute} )) { + $this->owner->{$this->outAttribute} = $this->generateSlug($this->owner->{$this->inAttribute}); } else { - $this->owner->{$this->out_attribute} = $this->generateSlug($this->owner->{$this->out_attribute}); + $this->owner->{$this->outAttribute} = $this->generateSlug($this->owner->{$this->outAttribute}); } } } @@ -114,7 +114,7 @@ $owner = $this->owner; $query = $owner->find() ->where([ - $this->out_attribute => $slug, + $this->outAttribute => $slug, ]); if(!$owner->isNewRecord) { $pks = $owner->primaryKey(); diff --git a/common/components/artboxtree/ArtboxTreeBehavior.php b/common/components/artboxtree/ArtboxTreeBehavior.php index 5b946c9..b2248a2 100755 --- a/common/components/artboxtree/ArtboxTreeBehavior.php +++ b/common/components/artboxtree/ArtboxTreeBehavior.php @@ -298,7 +298,7 @@ class ArtboxTreeBehavior extends Behavior { * @param array $changedAttributes * @throws Exception */ - protected function _rebuildChildren($changedAttributes) + protected function rebuildChildren($changedAttributes) { $path = isset($changedAttributes[$this->keyNamePath]) ? $changedAttributes[$this->keyNamePath] : $this->owner->getAttribute($this->keyNamePath); $update = []; @@ -417,7 +417,7 @@ class ArtboxTreeBehavior extends Behavior { $path = '{'. implode(',', $path) .'}'; // rebuild children entities (recurcive) -// $this->_rebuildChildren([ +// $this->rebuildChildren([ // $this->keyNamePath => $path // ]); @@ -426,7 +426,7 @@ class ArtboxTreeBehavior extends Behavior { $this->owner->setAttribute($this->keyNameDepth, $depth); } - public function _recursiveRebuildChildren() { + public function recursiveRebuildChildren() { $children = $this->getChildrenAL()->all(); $root_path = explode(',', $this->owner->getAttribute($this->keyNamePath)); $root_depth = $this->owner->getAttribute($this->keyNameDepth); @@ -437,7 +437,7 @@ class ArtboxTreeBehavior extends Behavior { $path[] = $child->getAttribute($this->keyNameId); $depth = $root_depth + 1; - $child->_recursiveRebuildChildren(); + $child->recursiveRebuildChildren(); } } } \ No newline at end of file diff --git a/common/components/artboxtree/ArtboxTreeHelper.php b/common/components/artboxtree/ArtboxTreeHelper.php index 26877e7..f1b2d96 100755 --- a/common/components/artboxtree/ArtboxTreeHelper.php +++ b/common/components/artboxtree/ArtboxTreeHelper.php @@ -10,7 +10,7 @@ class ArtboxTreeHelper extends Object { { $result = []; - self::_recursiveTreeMap($result, $tree, $from, $to, $symbol); + self::recursiveTreeMap($result, $tree, $from, $to, $symbol); return $result; } @@ -32,7 +32,7 @@ class ArtboxTreeHelper extends Object { return empty($path) ? [] : explode(',', $path); } - protected static function _recursiveTreeMap(&$result, $tree, $from, $to, $symbol = '–') { + protected static function recursiveTreeMap(&$result, $tree, $from, $to, $symbol = '–') { foreach ($tree as $item) { $element = $item['item']; $key = ArrayHelper::getValue($element, $from); @@ -40,7 +40,7 @@ class ArtboxTreeHelper extends Object { $row = str_repeat($symbol, $element->depth+1) . $value; $result[$key] = $row; if (!empty($item['children'])) { - self::_recursiveTreeMap($result, $item['children'], $from, $to, $symbol); + self::recursiveTreeMap($result, $item['children'], $from, $to, $symbol); } } } diff --git a/common/components/artboxtree/ArtboxTreeQueryTrait.php b/common/components/artboxtree/ArtboxTreeQueryTrait.php index 017023e..3440ea1 100755 --- a/common/components/artboxtree/ArtboxTreeQueryTrait.php +++ b/common/components/artboxtree/ArtboxTreeQueryTrait.php @@ -1,94 +1,100 @@ modelClass; - self::$model = new $class; - } - return self::$model; - } - - public function getTree($group = null, $with = null) { - $model = $this->getModel(); - if ($group !== null) { - $this->andWhere([$model->keyNameGroup => $group]); + + public static $cacheTree = []; + + /** @var \yii\db\ActiveQuery $this */ + static $model; + + /* + * @return \yii\db\ActiveQuery + */ + private function getModel() + { + if(empty( self::$model )) { + $class = $this->modelClass; + self::$model = new $class; + } + return self::$model; } - if ($with) { - $this->with($with); + + public function getTree($group = NULL, $with = NULL) + { + $model = $this->getModel(); + if($group !== NULL) { + $this->andWhere([ $model->keyNameGroup => $group ]); + } + if($with) { + $this->with($with); + } + $data = $this->all(); + if(empty( $data )) { + return []; + } + + return $this->buildTree($data); } - $data = $this->all(); - if (empty($data)) - return []; - - return $this->buildTree($data); - } - - private function _recursiveRebuild($tree, $parentPath = null, $depth = 0) { - $model = $this->getModel(); - - foreach ($tree as $row) { - $path = (is_null($parentPath) ? '' : $parentPath . $model->delimiter) . $row['item']->getAttribute($model->keyNameId); - $row['item']->setAttribute($model->keyNamePath, $path); - $row['item']->setAttribute($model->keyNameDepth, $depth); - $row['item']->save(); - if (!empty($row['children'])) { - $this->_recursiveRebuild($row['children'], $path, $depth+1); + + private function recursiveRebuild($tree, $parentPath = NULL, $depth = 0) + { + $model = $this->getModel(); + + foreach($tree as $row) { + $path = ( is_null($parentPath) ? '' : $parentPath . $model->delimiter ) . $row[ 'item' ]->getAttribute($model->keyNameId); + $row[ 'item' ]->setAttribute($model->keyNamePath, $path); + $row[ 'item' ]->setAttribute($model->keyNameDepth, $depth); + $row[ 'item' ]->save(); + if(!empty( $row[ 'children' ] )) { + $this->recursiveRebuild($row[ 'children' ], $path, $depth + 1); + } } } - } - - /** - * @param int $group - */ - public function rebuildMP($group, $with = null) { - $tree = $this->getTree($group, $with); - - $this->_recursiveRebuild($tree); - } - - protected function buildTree(array $data, $parentId = 0) { - $model = $this->getModel(); - - $result = []; - foreach ($data as $element) { - if ($element[$model->keyNameParentId] == $parentId) { - $children = $this->buildTree($data, $element[$model->keyNameId]); - $result[] = [ - 'item' => $element, - 'children' => $children - ]; + + /** + * @param int $group + */ + public function rebuildMP($group, $with = NULL) + { + $tree = $this->getTree($group, $with); + + $this->recursiveRebuild($tree); + } + + protected function buildTree(array $data, $parentId = 0) + { + $model = $this->getModel(); + + $result = []; + foreach($data as $element) { + if($element[ $model->keyNameParentId ] == $parentId) { + $children = $this->buildTree($data, $element[ $model->keyNameId ]); + $result[] = [ + 'item' => $element, + 'children' => $children, + ]; + } } + return $result; } - return $result; - } - - public function normalizeTreeData(array $data, $parentId = null) - { - $model = $this->getModel(); - - $result = []; - foreach ($data as $element) { - if ($element[$model->keyNameParentId] == $parentId) { - $result[] = $element; - $children = $this->normalizeTreeData($data, $element[$model->keyNameId]); - if ($children) { - $result = array_merge($result, $children); + + public function normalizeTreeData(array $data, $parentId = NULL) + { + $model = $this->getModel(); + + $result = []; + foreach($data as $element) { + if($element[ $model->keyNameParentId ] == $parentId) { + $result[] = $element; + $children = $this->normalizeTreeData($data, $element[ $model->keyNameId ]); + if($children) { + $result = array_merge($result, $children); + } } } + return $result; } - return $result; - } -} \ No newline at end of file + } \ No newline at end of file diff --git a/common/components/artboxtree/ArtboxTreeWidget.php b/common/components/artboxtree/ArtboxTreeWidget.php index 4e74c5e..d24ed76 100755 --- a/common/components/artboxtree/ArtboxTreeWidget.php +++ b/common/components/artboxtree/ArtboxTreeWidget.php @@ -102,12 +102,12 @@ class ArtboxTreeWidget extends Widget * @param string $parentId * @return array */ - protected function _normalizeTreeData(array $data, $parentId = null) { + protected function normalizeTreeData(array $data, $parentId = null) { $result = []; foreach ($data as $element) { if ($element[$this->keyNameParentId] == $parentId) { $result[] = $element; - $children = $this->_normalizeTreeData($data, $element[$this->keyNameId]); + $children = $this->normalizeTreeData($data, $element[$this->keyNameId]); if ($children) { $result = array_merge($result, $children); } @@ -122,11 +122,11 @@ class ArtboxTreeWidget extends Widget * @param string $parentId * @return array */ - protected function _hierarchyTreeData(array $data, $parentId = null) { + protected function hierarchyTreeData(array $data, $parentId = null) { $result = []; foreach ($data as $element) { if ($element[$this->keyNameParentId] == $parentId) { - $children = $this->_hierarchyTreeData($data, $element[$this->keyNameId]); + $children = $this->hierarchyTreeData($data, $element[$this->keyNameId]); $result[] = [ 'item' => $element, 'children' => $children diff --git a/common/components/artboxtree/treelist/TreeListWidget.php b/common/components/artboxtree/treelist/TreeListWidget.php index a3e2165..a752c2c 100755 --- a/common/components/artboxtree/treelist/TreeListWidget.php +++ b/common/components/artboxtree/treelist/TreeListWidget.php @@ -8,7 +8,7 @@ use yii\helpers\ArrayHelper; class TreeListWidget extends \common\components\artboxtree\ArtboxTreeWidget { - public $displayField = 'name'; + public $displayField = 'title'; /** * Init the widget object. @@ -25,7 +25,7 @@ class TreeListWidget extends \common\components\artboxtree\ArtboxTreeWidget { if (!is_null($run)) return $run; - $models = $this->_hierarchyTreeData(array_values($this->dataProvider->getModels()), $this->rootParentId); + $models = $this->hierarchyTreeData(array_values($this->dataProvider->getModels()), $this->rootParentId); return $this->renderTreelist($models); } diff --git a/common/components/artboxtree/treemenu/TreeMenuWidget.php b/common/components/artboxtree/treemenu/TreeMenuWidget.php index 0b66cb8..f654293 100755 --- a/common/components/artboxtree/treemenu/TreeMenuWidget.php +++ b/common/components/artboxtree/treemenu/TreeMenuWidget.php @@ -8,7 +8,7 @@ use yii\helpers\ArrayHelper; class TreeMenuWidget extends \common\components\artboxtree\ArtboxTreeWidget { - public $displayField = 'name'; + public $displayField = 'title'; /** * Init the widget object. @@ -25,7 +25,7 @@ class TreeMenuWidget extends \common\components\artboxtree\ArtboxTreeWidget { if (!is_null($run)) return $run; - $models = $this->_hierarchyTreeData(array_values($this->dataProvider->getModels()), $this->rootParentId); + $models = $this->hierarchyTreeData(array_values($this->dataProvider->getModels()), $this->rootParentId); return $this->renderTreelist($models); } diff --git a/common/models/Article.php b/common/models/Article.php index 13bd646..f4b0dd3 100755 --- a/common/models/Article.php +++ b/common/models/Article.php @@ -12,17 +12,18 @@ /** * This is the model class for table "articles". - * @property integer $id - * @property integer $created_at - * @property string $image + * + * @property integer $id + * @property integer $created_at + * @property string $image * * From language behavior * - * @property ArticleLang $lang - * @property ArticleLang[] $langs - * @property ArticleLang $object_lang - * @property string $ownerKey - * @property string $langKey - * @property ArticleLang[] $model_langs - * @property bool $transactionStatus + * @property ArticleLang $lang + * @property ArticleLang[] $langs + * @property ArticleLang $objectLang + * @property string $ownerKey + * @property string $langKey + * @property ArticleLang[] $modelLangs + * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey( string $value ) * @method string getLangKey() @@ -36,8 +37,8 @@ * @method bool getTransactionStatus() * * End language behavior * * * From SaveImgBehavior - * @property string|null $imageFile - * @property string|null $imageUrl + * @property string|null $imageFile + * @property string|null $imageUrl * @method string|null getImageFile( int $field ) * @method string|null getImageUrl( int $field ) * * End SaveImgBehavior diff --git a/common/models/ArticleLang.php b/common/models/ArticleLang.php index e571694..d4610c8 100755 --- a/common/models/ArticleLang.php +++ b/common/models/ArticleLang.php @@ -46,9 +46,6 @@ return [ 'slug' => [ 'class' => 'common\behaviors\Slug', - 'in_attribute' => 'title', - 'out_attribute' => 'alias', - 'translit' => true, ], ]; } @@ -110,7 +107,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], + 'targetAttribute' => [ 'language_id' => 'id' ], ], ]; } @@ -148,6 +145,6 @@ */ public function getLanguage() { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } } diff --git a/common/models/Banner.php b/common/models/Banner.php index 7f73813..361cf69 100755 --- a/common/models/Banner.php +++ b/common/models/Banner.php @@ -10,16 +10,16 @@ /** * This is the model class for table "banner". - * @property integer $banner_id + * @property integer $id * @property string $url * @property integer $status * * From language behavior * * @property BannerLang $lang * @property BannerLang[] $langs - * @property BannerLang $object_lang + * @property BannerLang $objectLang * @property string $ownerKey * @property string $langKey - * @property BannerLang[] $model_langs + * @property BannerLang[] $modelLangs * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey( string $value ) @@ -78,7 +78,7 @@ public function attributeLabels() { return [ - 'banner_id' => Yii::t('app', 'banner_id'), + 'id' => Yii::t('app', 'id'), 'url' => Yii::t('app', 'url'), 'status' => Yii::t('app', 'status'), ]; diff --git a/common/models/BannerLang.php b/common/models/BannerLang.php index 26a78cf..bdab18d 100755 --- a/common/models/BannerLang.php +++ b/common/models/BannerLang.php @@ -47,7 +47,7 @@ return [ [ 'class' => SaveImgBehavior::className(), - 'is_language' => true, + 'isLanguage' => true, 'fields' => [ [ 'name' => 'image', @@ -90,14 +90,14 @@ 'exist', 'skipOnError' => true, 'targetClass' => Banner::className(), - 'targetAttribute' => [ 'banner_id' => 'banner_id' ], + 'targetAttribute' => [ 'banner_id' => 'id' ], ], [ [ 'language_id' ], 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], + 'targetAttribute' => [ 'language_id' => 'id' ], ], ]; } @@ -120,7 +120,7 @@ */ public function getBanner() { - return $this->hasOne(Banner::className(), [ 'banner_id' => 'banner_id' ]); + return $this->hasOne(Banner::className(), [ 'id' => 'banner_id' ]); } /** @@ -128,6 +128,6 @@ */ public function getLanguage() { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } } diff --git a/common/models/BannerSearch.php b/common/models/BannerSearch.php index b91d568..bbb27cb 100755 --- a/common/models/BannerSearch.php +++ b/common/models/BannerSearch.php @@ -21,7 +21,7 @@ return [ [ [ - 'banner_id', + 'id', 'status', ], 'integer', @@ -68,7 +68,7 @@ 'query' => $query, 'sort' => [ 'attributes' => [ - 'banner_id', + 'id', 'url', 'status', 'title' => [ @@ -89,7 +89,7 @@ // grid filtering conditions $query->andFilterWhere([ - 'banner_id' => $this->banner_id, + 'id' => $this->id, 'status' => $this->status, ]); diff --git a/common/models/Bg.php b/common/models/Bg.php index 06011c2..2f03701 100755 --- a/common/models/Bg.php +++ b/common/models/Bg.php @@ -18,10 +18,10 @@ * * From language behavior * * @property BgLang $lang * @property BgLang[] $langs - * @property BgLang $object_lang + * @property BgLang $objectLang * @property string $ownerKey * @property string $langKey - * @property BgLang[] $model_langs + * @property BgLang[] $modelLangs * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey( string $value ) diff --git a/common/models/BgLang.php b/common/models/BgLang.php index 3b7a197..7f0bf28 100755 --- a/common/models/BgLang.php +++ b/common/models/BgLang.php @@ -72,7 +72,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], + 'targetAttribute' => [ 'language_id' => 'id' ], ], ]; } @@ -102,6 +102,6 @@ */ public function getLanguage() { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } } diff --git a/common/models/Delivery.php b/common/models/Delivery.php index 4204ba8..4448d85 100755 --- a/common/models/Delivery.php +++ b/common/models/Delivery.php @@ -10,12 +10,12 @@ /** * Class Delivery * * From language behavior * - * @property OrdersDeliveryLang $lang - * @property OrdersDeliveryLang[] $langs - * @property OrdersDeliveryLang $object_lang + * @property orderDeliveryLang $lang + * @property orderDeliveryLang[] $langs + * @property orderDeliveryLang $objectLang * @property string $ownerKey * @property string $langKey - * @property OrdersDeliveryLang[] $model_langs + * @property orderDeliveryLang[] $modelLangs * @property integer $id * @property integer $parent_id * @property integer $sort @@ -28,7 +28,7 @@ * @method void setLangKey( string $value ) * @method ActiveQuery getLangs() * @method ActiveQuery getLang( integer $language_id ) - * @method OrdersDeliveryLang[] generateLangs() + * @method orderDeliveryLang[] generateLangs() * @method void loadLangs( Request $request ) * @method bool linkLangs() * @method bool saveLangs() @@ -43,18 +43,18 @@ return [ 'language' => [ 'class' => LanguageBehavior::className(), - 'object_lang' => OrdersDeliveryLang::className(), + 'objectLang' => orderDeliveryLang::className(), // optional, default to {TableLang}::className() 'ownerKey' => 'id', //optional, default to {Table}->primaryKey()[0] - 'langKey' => 'orders_delivery_id', + 'langKey' => 'order_delivery_id', ], ]; } public static function tableName() { - return 'orders_delivery'; + return 'order_delivery'; } public function rules() diff --git a/common/models/DeliverySearch.php b/common/models/DeliverySearch.php index 757ca05..387c0a2 100755 --- a/common/models/DeliverySearch.php +++ b/common/models/DeliverySearch.php @@ -19,7 +19,7 @@ /** * @var string */ - public $parent_title; + public $parentTitle; /** * @inheritdoc @@ -74,8 +74,8 @@ 'id', 'value', 'title' => [ - 'asc' => [ 'orders_delivery_lang.title' => SORT_ASC ], - 'desc' => [ 'orders_delivery_lang.title' => SORT_DESC ], + 'asc' => [ 'order_delivery_lang.title' => SORT_ASC ], + 'desc' => [ 'order_delivery_lang.title' => SORT_DESC ], ], ], ], @@ -97,7 +97,7 @@ ]) ->andFilterWhere([ 'like', - 'orders_delivery_lang.title', + 'order_delivery_lang.title', $this->title, ]); diff --git a/common/models/Event.php b/common/models/Event.php index 52d0bdf..42252eb 100755 --- a/common/models/Event.php +++ b/common/models/Event.php @@ -20,10 +20,10 @@ * * From language behavior * * @property EventLang $lang * @property EventLang[] $langs - * @property EventLang $object_lang + * @property EventLang $objectLang * @property string $ownerKey * @property string $langKey - * @property EventLang[] $model_langs + * @property EventLang[] $modelLangs * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey( string $value ) @@ -119,7 +119,7 @@ public function attributeLabels() { return [ - 'event_id' => Yii::t('app', 'event_id'), + 'id' => Yii::t('app', 'id'), 'image' => Yii::t('app', 'image'), 'created_at' => Yii::t('app', 'created_at'), 'updated_at' => Yii::t('app', 'updated_at'), diff --git a/common/models/EventLang.php b/common/models/EventLang.php index d14b5bf..e1a1f88 100755 --- a/common/models/EventLang.php +++ b/common/models/EventLang.php @@ -10,10 +10,10 @@ * This is the model class for table "event_lang". * @property integer $event_id * @property integer $language_id - * @property string $name + * @property string $title * @property string $body * @property string $meta_title - * @property string $description + * @property string $meta_description * @property string $seo_text * @property string $h1 * @property string $alias @@ -44,9 +44,6 @@ return [ 'slug' => [ 'class' => 'common\behaviors\Slug', - 'in_attribute' => 'name', - 'out_attribute' => 'alias', - 'translit' => true, ], ]; } @@ -59,7 +56,7 @@ return [ [ [ - 'name', + 'title', 'body', ], 'required', @@ -73,9 +70,9 @@ ], [ [ - 'name', + 'title', 'meta_title', - 'description', + 'meta_description', 'h1', 'alias', ], @@ -99,14 +96,14 @@ 'exist', 'skipOnError' => true, 'targetClass' => Event::className(), - 'targetAttribute' => [ 'event_id' => 'event_id' ], + 'targetAttribute' => [ 'event_id' => 'id' ], ], [ [ 'language_id' ], 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], + 'targetAttribute' => [ 'language_id' => 'id' ], ], ]; } @@ -119,10 +116,10 @@ return [ 'event_id' => Yii::t('app', 'event_id'), 'language_id' => Yii::t('app', 'language_id'), - 'name' => Yii::t('app', 'name'), + 'title' => Yii::t('app', 'name'), 'body' => Yii::t('app', 'body'), 'meta_title' => Yii::t('app', 'meta_title'), - 'description' => Yii::t('app', 'description'), + 'meta_description' => Yii::t('app', 'meta_description'), 'seo_text' => Yii::t('app', 'seo_text'), 'h1' => Yii::t('app', 'h1'), ]; @@ -133,7 +130,7 @@ */ public function getEvent() { - return $this->hasOne(Event::className(), [ 'event_id' => 'event_id' ]); + return $this->hasOne(Event::className(), [ 'id' => 'event_id' ]); } /** @@ -141,6 +138,6 @@ */ public function getLanguage() { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } } diff --git a/common/models/EventSearch.php b/common/models/EventSearch.php index a41fc36..ca16d07 100755 --- a/common/models/EventSearch.php +++ b/common/models/EventSearch.php @@ -19,7 +19,7 @@ return [ [ [ - 'event_id', + 'id', 'created_at', 'updated_at', 'end_at', @@ -71,7 +71,7 @@ // grid filtering conditions $query->andFilterWhere([ - 'event_id' => $this->event_id, + 'id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'end_at' => $this->end_at, diff --git a/common/models/Feedback.php b/common/models/Feedback.php index 06ff163..d28469c 100755 --- a/common/models/Feedback.php +++ b/common/models/Feedback.php @@ -9,10 +9,11 @@ /** * This is the model class for table "feedback". - * @property integer $feedback_id + * + * @property integer $id * @property string $name * @property string $phone - * @property integer $date_add + * @property integer $created_at * @property string $ip */ class Feedback extends ActiveRecord @@ -35,13 +36,16 @@ public function scenarios() { $scenarios = parent::scenarios(); - $scenarios = array_merge($scenarios, [ - self::SCENARIO_FEEDBACK => [ - 'name', - 'phone', - ], - self::SCENARIO_CALLBACK => [ 'phone' ], - ]); + $scenarios = array_merge( + $scenarios, + [ + self::SCENARIO_FEEDBACK => [ + 'name', + 'phone', + ], + self::SCENARIO_CALLBACK => [ 'phone' ], + ] + ); return $scenarios; } @@ -53,7 +57,6 @@ return [ [ 'class' => TimestampBehavior::className(), - 'createdAtAttribute' => 'date_add', 'updatedAtAttribute' => false, ], [ @@ -61,7 +64,7 @@ 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => 'ip', ], - 'value' => function($event) { + 'value' => function ($event) { return \Yii::$app->request->userIP; }, ], @@ -103,11 +106,11 @@ public function attributeLabels() { return [ - 'feedback_id' => Yii::t('app', 'feedback_id'), - 'name' => Yii::t('app', 'name'), - 'phone' => Yii::t('app', 'phone'), - 'date_add' => Yii::t('app', 'date_add'), - 'ip' => Yii::t('app', 'ip'), + 'id' => Yii::t('app', 'id'), + 'name' => Yii::t('app', 'name'), + 'phone' => Yii::t('app', 'phone'), + 'created_at' => Yii::t('app', 'created_at'), + 'ip' => Yii::t('app', 'ip'), ]; } } diff --git a/common/models/FeedbackSearch.php b/common/models/FeedbackSearch.php index f578091..a5b052c 100755 --- a/common/models/FeedbackSearch.php +++ b/common/models/FeedbackSearch.php @@ -14,7 +14,7 @@ { return [ [ - [ 'feedback_id' ], + [ 'id' ], 'integer', ], [ @@ -22,7 +22,7 @@ 'name', 'phone', 'ip', - 'date_add', + 'created_at', ], 'safe', ], @@ -50,38 +50,48 @@ // add conditions that should always apply here - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - ]); + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + ] + ); $this->load($params); - if(!$this->validate()) { + 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([ - 'feedback_id' => $this->feedback_id, - ]); + $query->andFilterWhere( + [ + 'id' => $this->id, + ] + ); - $query->andFilterWhere([ - 'like', - 'name', - $this->name, - ]) - ->andFilterWhere([ - 'like', - 'phone', - $this->phone, - ]) - ->andFilterWhere([ - 'like', - 'ip', - $this->ip, - ]); + $query->andFilterWhere( + [ + 'like', + 'name', + $this->name, + ] + ) + ->andFilterWhere( + [ + 'like', + 'phone', + $this->phone, + ] + ) + ->andFilterWhere( + [ + 'like', + 'ip', + $this->ip, + ] + ); return $dataProvider; } diff --git a/common/models/LoginForm.php b/common/models/LoginForm.php index fef05a6..c01c5dd 100755 --- a/common/models/LoginForm.php +++ b/common/models/LoginForm.php @@ -16,7 +16,7 @@ public $email; - private $_user; + private $user; /** * @inheritdoc @@ -86,11 +86,11 @@ */ protected function getUser() { - if($this->_user === NULL) { - $this->_user = Customer::findByEmail($this->email); + if($this->user === NULL) { + $this->user = Customer::findByEmail($this->email); } - return $this->_user; + return $this->user; } /** diff --git a/common/models/Order.php b/common/models/Order.php new file mode 100755 index 0000000..d7668f7 --- /dev/null +++ b/common/models/Order.php @@ -0,0 +1,274 @@ + [ 'phone' ], + ] + ); + return $scenarios; + } + + public function rules() + { + return [ + [ + [ + 'phone', + ], + 'required', + ], + [ + [ 'comment' ], + 'safe', + ], + [ + [ 'email' ], + 'email', + ], + [ + [ 'phone' ], + 'match', + 'pattern' => '/^\+38\(\d{3}\)\d{3}-\d{2}-\d{2}$/', + 'on' => self::SCENARIO_QUICK, + ], + [ + [ + 'name', + 'phone2', + 'numbercard', + 'body', + 'declaration', + 'stock', + 'consignment', + 'payment', + 'insurance', + 'amount_imposed', + 'shipping_by', + 'city', + 'adress', + 'total', + 'status', + ], + 'string', + 'max' => 255, + ], + ]; + } + + public function attributeLabels() + { + return [ + 'name' => Yii::t('app', 'order_name'), + 'phone' => Yii::t('app', 'order_phone'), + 'email' => Yii::t('app', 'order_email'), + 'comment' => Yii::t('app', 'order_comment'), + ]; + } + + public function beforeSave($insert) + { + $this->user_id = Yii::$app->user->id; + $this->date_time = new Expression('NOW()'); + return parent::beforeSave($insert); + } + + public function beforeDelete() + { + return parent::beforeDelete(); + } + + public function addBasket($product_variant_id, $count) + { + $session = new Session; + $session->open(); + $data = $session[ 'basket' ]; + $i = 0; + if (isset( $session[ 'basket' ] )) { + foreach ($session[ 'basket' ] as $key => $basket) { + if ($product_variant_id == $basket[ 'id' ]) { + $data[ $key ][ 'count' ] += $count; + $session[ 'basket' ] = $data; + $i++; + } + } + } + if ($i == 0) { + $data[] = [ + 'id' => $product_variant_id, + 'count' => $count, + ]; + $session[ 'basket' ] = $data; + } + } + + public function rowBasket() + { + $session = new Session; + $session->open(); + $cost = 0; + $count = 0; + if (isset( $session[ 'basket' ] ) && count($session[ 'basket' ])) { + foreach ($session[ 'basket' ] as $product) { + $count += $product[ 'count' ]; + } + } + + return (object) [ + 'cost' => $cost, + 'count' => $count, + ]; + } + + public function deleteBasketMod($id) + { + $session = new Session; + $session->open(); + $basket = $session[ 'basket' ]; + foreach ($basket as $key => $product) { + if ($id == $product[ 'id' ]) { + unset( $basket[ $key ] ); + } + } + $session[ 'basket' ] = $basket; + } + + public function updateBasket($row) + { + $session = new Session; + $session->open(); + //$data = array(); + if ($row[ 'count' ] > 0) { + $this->data[] = [ + 'id' => $row[ 'id' ], + 'count' => $row[ 'count' ], + ]; + } + $session[ 'basket' ] = $this->data; + } + + public function getBasketMods() + { + $session = new Session; + $session->open(); + $products = []; + if (empty( $session[ 'basket' ] )) { + return []; + } + foreach ($session[ 'basket' ] as $product) { + $row = ProductVariant::find() + ->select( + [ + 'product_variant.*', + 'product.name as productName', + 'product.alias', + ] + ) + ->where([ 'product_variant.product_variant_id' => $product[ 'id' ] ]) + ->leftJoin('product', 'product.id = product_variant.product_id') + ->one(); + $row->count = $product[ 'count' ]; + $row->sum_cost = $product[ 'count' ] * $row->price; + $products[] = $row; + } + + return $products; + } + + public function getSumCost() + { + $session = new Session; + $session->open(); + $cost = 0; + if (empty( $session[ 'basket' ] )) { + return false; + } + foreach ($session[ 'basket' ] as $product) { + $cost += ( $this->getModCost($product[ 'id' ]) * $product[ 'count' ] ); + } + + return $cost; + } + + private function getModCost($product_variant_id) + { + /** + * @var ProductVariant $mod + */ + $mod = ProductVariant::find() + ->where([ 'product_variant_id' => $product_variant_id ]) + ->one(); + + return $mod->price; + } + + public function clearBasket() + { + $session = new Session; + $session->open(); + $session[ 'basket' ] = null; + } + + public function getUser() + { + return $this->hasOne(User::className(), [ 'id' => 'user_id' ]); + } + + public function getProducts() + { + return $this->hasMany(orderProduct::className(), [ 'order_id' => 'id' ]); + } + } \ No newline at end of file diff --git a/common/models/OrderDeliveryLang.php b/common/models/OrderDeliveryLang.php new file mode 100755 index 0000000..56908d4 --- /dev/null +++ b/common/models/OrderDeliveryLang.php @@ -0,0 +1,120 @@ + 255, + ], + [ + [ + 'order_delivery_id', + 'language_id', + ], + 'unique', + 'targetAttribute' => [ + 'order_delivery_id', + 'language_id', + ], + 'message' => 'The combination of order Delivery ID and Language ID has already been taken.', + ], + [ + [ 'language_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Language::className(), + 'targetAttribute' => [ 'language_id' => 'id' ], + ], + [ + [ 'order_delivery_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Delivery::className(), + 'targetAttribute' => [ 'order_delivery_id' => 'id' ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'order_delivery_id' => Yii::t('app', 'order_delivery_id'), + 'language_id' => Yii::t('app', 'language_id'), + 'title' => Yii::t('app', 'title'), + 'text' => Yii::t('app', 'text'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getLanguage() + { + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getDelivery() + { + return $this->hasOne(Delivery::className(), [ 'id' => 'order_delivery_id' ]); + } + } diff --git a/common/models/OrderProduct.php b/common/models/OrderProduct.php new file mode 100755 index 0000000..a3e09de --- /dev/null +++ b/common/models/OrderProduct.php @@ -0,0 +1,56 @@ + Yii::t('app', 'product_name'), + 'name' => Yii::t('app', 'op_name'), + 'art' => Yii::t('app', 'art'), + 'cost' => Yii::t('app', 'cost'), + 'count' => Yii::t('app', 'count'), + 'sum_cost' => Yii::t('app', 'sum_cost'), + ]; + } + + public function getProductVariant() + { + return $this->hasOne(ProductVariant::className(), [ 'product_variant_id' => 'product_variant_id' ]); + } + } \ No newline at end of file diff --git a/common/models/OrderSearch.php b/common/models/OrderSearch.php new file mode 100755 index 0000000..265beb0 --- /dev/null +++ b/common/models/OrderSearch.php @@ -0,0 +1,102 @@ + $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, + 'user_id' => $this->user_id, + 'delivery' => $this->delivery, + 'payment' => $this->payment, + 'status' => $this->status, + ]); + + $query->andFilterWhere([ + 'like', + 'name', + $this->name, + ]) + ->andFilterWhere([ + 'like', + 'email', + $this->email, + ]) + ->andFilterWhere([ + 'like', + 'phone', + $this->phone, + ]); + + return $dataProvider; + } + } diff --git a/common/models/Orders.php b/common/models/Orders.php deleted file mode 100755 index 3924cfa..0000000 --- a/common/models/Orders.php +++ /dev/null @@ -1,268 +0,0 @@ - [ 'phone' ], - ]); - return $scenarios; - } - - public function rules() - { - return [ - [ - [ - 'phone', - ], - 'required', - ], - [ - [ 'comment' ], - 'safe', - ], - [ - [ 'email' ], - 'email', - ], - [ - [ 'phone' ], - 'match', - 'pattern' => '/^\+38\(\d{3}\)\d{3}-\d{2}-\d{2}$/', - 'on' => self::SCENARIO_QUICK, - ], - [ - [ - 'name', - 'phone2', - 'numbercard', - 'body', - 'declaration', - 'stock', - 'consignment', - 'payment', - 'insurance', - 'amount_imposed', - 'shipping_by', - 'city', - 'adress', - 'total', - 'status', - ], - 'string', - 'max' => 255, - ], - ]; - } - - public function attributeLabels() - { - return [ - 'name' => Yii::t('app', 'order_name'), - 'phone' => Yii::t('app', 'order_phone'), - 'email' => Yii::t('app', 'order_email'), - 'comment' => Yii::t('app', 'order_comment'), - ]; - } - - public function beforeSave($insert) - { - $this->user_id = Yii::$app->user->id; - $this->date_time = new Expression('NOW()'); - return parent::beforeSave($insert); - } - - public function beforeDelete() - { - return parent::beforeDelete(); - } - - public function addBasket($mod_id, $count) - { - $session = new Session; - $session->open(); - $data = $session[ 'basket' ]; - $i = 0; - if(isset( $session[ 'basket' ] )) { - foreach($session[ 'basket' ] as $key => $basket) { - if($mod_id == $basket[ 'id' ]) { - $data[ $key ][ 'count' ] += $count; - $session[ 'basket' ] = $data; - $i++; - } - } - } - if($i == 0) { - $data[] = [ - 'id' => $mod_id, - 'count' => $count, - ]; - $session[ 'basket' ] = $data; - } - } - - public function rowBasket() - { - $session = new Session; - $session->open(); - $cost = 0; - $count = 0; - if(isset( $session[ 'basket' ] ) && count($session[ 'basket' ])) { - foreach($session[ 'basket' ] as $product) { - $count += $product[ 'count' ]; - } - } - - return (object) [ - 'cost' => $cost, - 'count' => $count, - ]; - } - - public function deleteBasketMod($id) - { - $session = new Session; - $session->open(); - $basket = $session[ 'basket' ]; - foreach($basket as $key => $product) { - if($id == $product[ 'id' ]) { - unset( $basket[ $key ] ); - } - } - $session[ 'basket' ] = $basket; - } - - public function updateBasket($row) - { - $session = new Session; - $session->open(); - //$data = array(); - if($row[ 'count' ] > 0) { - $this->data[] = [ - 'id' => $row[ 'id' ], - 'count' => $row[ 'count' ], - ]; - } - $session[ 'basket' ] = $this->data; - } - - public function getBasketMods() - { - $session = new Session; - $session->open(); - $products = []; - if(empty( $session[ 'basket' ] )) { - return []; - } - foreach($session[ 'basket' ] as $product) { - $row = ProductVariant::find() - ->select([ - 'product_variant.*', - 'product.name as product_name', - 'product.alias', - ]) - ->where([ 'product_variant.product_variant_id' => $product[ 'id' ] ]) - ->leftJoin('product', 'product.product_id = product_variant.product_id') - ->one(); - $row->count = $product[ 'count' ]; - $row->sum_cost = $product[ 'count' ] * $row->price; - $products[] = $row; - } - - return $products; - } - - public function getSumCost() - { - $session = new Session; - $session->open(); - $cost = 0; - if(empty( $session[ 'basket' ] )) { - return false; - } - foreach($session[ 'basket' ] as $product) { - $cost += ( $this->getModCost($product[ 'id' ]) * $product[ 'count' ] ); - } - - return $cost; - } - - private function getModCost($mod_id) - { - /** - * @var ProductVariant $mod - */ - $mod = ProductVariant::find() - ->where([ 'product_variant_id' => $mod_id ]) - ->one(); - - return $mod->price; - } - - public function clearBasket() - { - $session = new Session; - $session->open(); - $session[ 'basket' ] = NULL; - } - - public function getUser() - { - return $this->hasOne(User::className(), [ 'id' => 'user_id' ]); - } - - public function getProducts() - { - return $this->hasMany(OrdersProducts::className(), [ 'order_id' => 'id' ]); - } - } \ No newline at end of file diff --git a/common/models/OrdersDeliveryLang.php b/common/models/OrdersDeliveryLang.php deleted file mode 100755 index 8e261ab..0000000 --- a/common/models/OrdersDeliveryLang.php +++ /dev/null @@ -1,119 +0,0 @@ - 255, - ], - [ - [ - 'orders_delivery_id', - 'language_id', - ], - 'unique', - 'targetAttribute' => [ - 'orders_delivery_id', - 'language_id', - ], - 'message' => 'The combination of Orders Delivery ID and Language ID has already been taken.', - ], - [ - [ 'language_id' ], - 'exist', - 'skipOnError' => true, - 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], - ], - [ - [ 'orders_delivery_id' ], - 'exist', - 'skipOnError' => true, - 'targetClass' => Delivery::className(), - 'targetAttribute' => [ 'orders_delivery_id' => 'id' ], - ], - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'orders_delivery_id' => Yii::t('app', 'orders_delivery_id'), - 'language_id' => Yii::t('app', 'language_id'), - 'title' => Yii::t('app', 'title'), - 'text' => Yii::t('app', 'text'), - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getLanguage() - { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getDelivery() - { - return $this->hasOne(Delivery::className(), [ 'id' => 'orders_delivery_id' ]); - } - } diff --git a/common/models/OrdersProducts.php b/common/models/OrdersProducts.php deleted file mode 100755 index 3c87eb5..0000000 --- a/common/models/OrdersProducts.php +++ /dev/null @@ -1,56 +0,0 @@ - Yii::t('app', 'product_name'), - 'name' => Yii::t('app', 'op_name'), - 'art' => Yii::t('app', 'art'), - 'cost' => Yii::t('app', 'cost'), - 'count' => Yii::t('app', 'count'), - 'sum_cost' => Yii::t('app', 'sum_cost'), - ]; - } - - public function getProductVariant() - { - return $this->hasOne(ProductVariant::className(), [ 'product_variant_id' => 'mod_id' ]); - } - } \ No newline at end of file diff --git a/common/models/OrdersSearch.php b/common/models/OrdersSearch.php deleted file mode 100755 index 2c3474a..0000000 --- a/common/models/OrdersSearch.php +++ /dev/null @@ -1,102 +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, - 'user_id' => $this->user_id, - 'delivery' => $this->delivery, - 'payment' => $this->payment, - 'status' => $this->status, - ]); - - $query->andFilterWhere([ - 'like', - 'name', - $this->name, - ]) - ->andFilterWhere([ - 'like', - 'email', - $this->email, - ]) - ->andFilterWhere([ - 'like', - 'phone', - $this->phone, - ]); - - return $dataProvider; - } - } diff --git a/common/models/Page.php b/common/models/Page.php index b65464e..f620885 100755 --- a/common/models/Page.php +++ b/common/models/Page.php @@ -15,10 +15,10 @@ * * From language behavior * * @property PageLang $lang * @property PageLang[] $langs - * @property PageLang $object_lang + * @property PageLang $objectLang * @property string $ownerKey * @property string $langKey - * @property PageLang[] $model_langs + * @property PageLang[] $modelLangs * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey( string $value ) diff --git a/common/models/PageLang.php b/common/models/PageLang.php index 9876149..29fc3eb 100755 --- a/common/models/PageLang.php +++ b/common/models/PageLang.php @@ -45,9 +45,6 @@ return [ 'slug' => [ 'class' => 'common\behaviors\Slug', - 'in_attribute' => 'title', - 'out_attribute' => 'alias', - 'translit' => true, ], ]; } @@ -101,7 +98,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], + 'targetAttribute' => [ 'language_id' => 'id' ], ], [ [ 'page_id' ], @@ -137,7 +134,7 @@ */ public function getLanguage() { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } /** diff --git a/common/models/ProductToRating.php b/common/models/ProductToRating.php index a7a11ce..1be8c1d 100755 --- a/common/models/ProductToRating.php +++ b/common/models/ProductToRating.php @@ -48,7 +48,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Product::className(), - 'targetAttribute' => [ 'product_id' => 'product_id' ], + 'targetAttribute' => [ 'product_id' => 'id' ], ], ]; } @@ -70,6 +70,6 @@ */ public function getProduct() { - return $this->hasOne(Product::className(), [ 'product_id' => 'product_id' ]); + return $this->hasOne(Product::className(), [ 'id' => 'product_id' ]); } } diff --git a/common/models/Seo.php b/common/models/Seo.php index c589efe..4d7d25f 100755 --- a/common/models/Seo.php +++ b/common/models/Seo.php @@ -15,10 +15,10 @@ * * From language behavior * * @property SeoLang $lang * @property SeoLang[] $langs - * @property SeoLang $object_lang + * @property SeoLang $objectLang * @property string $ownerKey * @property string $langKey - * @property SeoLang[] $model_langs + * @property SeoLang[] $modelLangs * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey( string $value ) diff --git a/common/models/SeoCategory.php b/common/models/SeoCategory.php index 6324192..7467905 100755 --- a/common/models/SeoCategory.php +++ b/common/models/SeoCategory.php @@ -16,10 +16,10 @@ * * From language behavior * * @property SeoCategoryLang $lang * @property SeoCategoryLang[] $langs - * @property SeoCategoryLang $object_lang + * @property SeoCategoryLang $objectLang * @property string $ownerKey * @property string $langKey - * @property SeoCategoryLang[] $model_langs + * @property SeoCategoryLang[] $modelLangs * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey( string $value ) diff --git a/common/models/SeoCategoryLang.php b/common/models/SeoCategoryLang.php index 1d78c86..d78bcbc 100755 --- a/common/models/SeoCategoryLang.php +++ b/common/models/SeoCategoryLang.php @@ -10,7 +10,7 @@ * This is the model class for table "seo_category_lang". * @property integer $seo_category_id * @property integer $language_id - * @property string $name + * @property string $title * @property Language $language * @property SeoCategory $seoCategory */ @@ -40,7 +40,7 @@ { return [ [ - [ 'name' ], + [ 'title' ], 'string', 'max' => 255, ], @@ -61,7 +61,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], + 'targetAttribute' => [ 'language_id' => 'id' ], ], [ [ 'seo_category_id' ], @@ -81,7 +81,7 @@ return [ 'seo_category_id' => Yii::t('app', 'seo_category_id'), 'language_id' => Yii::t('app', 'language_id'), - 'name' => Yii::t('app', 'name'), + 'title' => Yii::t('app', 'name'), ]; } @@ -90,7 +90,7 @@ */ public function getLanguage() { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } /** diff --git a/common/models/SeoCategorySearch.php b/common/models/SeoCategorySearch.php index 7ca58ee..57665cd 100755 --- a/common/models/SeoCategorySearch.php +++ b/common/models/SeoCategorySearch.php @@ -35,7 +35,7 @@ [ [ 'controller', - 'name', + 'title', ], 'safe', ], @@ -72,9 +72,9 @@ 'seo_category_id', 'controller', 'status', - 'name' => [ - 'asc' => [ 'seo_category_lang' => SORT_ASC ], - 'desc' => [ 'seo_category_lang' => SORT_DESC ], + 'title' => [ + 'asc' => [ 'seo_category_lang.title' => SORT_ASC ], + 'desc' => [ 'seo_category_lang.title' => SORT_DESC ], ], ], ], @@ -101,8 +101,8 @@ ]) ->andFilterWhere([ 'ilike', - 'seo_category_lang.name', - $this->name, + 'seo_category_lang.title', + $this->title, ]); return $dataProvider; diff --git a/common/models/SeoDynamic.php b/common/models/SeoDynamic.php index a985f24..bb62365 100755 --- a/common/models/SeoDynamic.php +++ b/common/models/SeoDynamic.php @@ -19,10 +19,10 @@ * * From language behavior * * @property SeoDynamicLang $lang * @property SeoDynamicLang[] $langs - * @property SeoDynamicLang $object_lang + * @property SeoDynamicLang $objectLang * @property string $ownerKey * @property string $langKey - * @property SeoDynamicLang[] $model_langs + * @property SeoDynamicLang[] $modelLangs * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey( string $value ) diff --git a/common/models/SeoDynamicLang.php b/common/models/SeoDynamicLang.php index 85a1f4b..6678570 100755 --- a/common/models/SeoDynamicLang.php +++ b/common/models/SeoDynamicLang.php @@ -10,12 +10,12 @@ * This is the model class for table "seo_dynamic_lang". * @property integer $seo_dynamic_id * @property integer $language_id - * @property string $name * @property string $title + * @property string $meta_title * @property string $h1 * @property string $key * @property string $meta - * @property string $description + * @property string $meta_description * @property string $seo_text * @property Language $language * @property SeoDynamic $seoDynamic @@ -47,15 +47,15 @@ return [ [ [ - 'title', - 'description', + 'meta_title', + 'meta_description', 'seo_text', ], 'string', ], [ [ - 'name', + 'title', 'h1', 'key', 'meta', @@ -80,7 +80,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], + 'targetAttribute' => [ 'language_id' => 'id' ], ], [ [ 'seo_dynamic_id' ], @@ -100,12 +100,12 @@ return [ 'seo_dynamic_id' => Yii::t('app', 'seo_dynamic_id'), 'language_id' => Yii::t('app', 'language_id'), - 'name' => Yii::t('app', 'name'), - 'title' => Yii::t('app', 'title'), + 'title' => Yii::t('app', 'name'), + 'meta_title' => Yii::t('app', 'title'), 'h1' => Yii::t('app', 'h1'), 'key' => Yii::t('app', 'key'), 'meta' => Yii::t('app', 'meta'), - 'description' => Yii::t('app', 'description'), + 'meta_description' => Yii::t('app', 'meta_description'), 'seo_text' => Yii::t('app', 'seo_text'), ]; } @@ -115,7 +115,7 @@ */ public function getLanguage() { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } /** diff --git a/common/models/SeoDynamicSearch.php b/common/models/SeoDynamicSearch.php index 07a1e3c..d592d88 100755 --- a/common/models/SeoDynamicSearch.php +++ b/common/models/SeoDynamicSearch.php @@ -36,7 +36,7 @@ [ 'action', 'fields', - 'name', + 'title', 'param', ], 'safe', @@ -77,9 +77,9 @@ 'fields', 'status', 'param', - 'name' => [ - 'asc' => [ 'seo_dynamic_lang.name' => SORT_ASC ], - 'desc' => [ 'seo_dynamic_lang.name' => SORT_DESC ], + 'title' => [ + 'asc' => [ 'seo_dynamic_lang.title' => SORT_ASC ], + 'desc' => [ 'seo_dynamic_lang.title' => SORT_DESC ], ], ], ], @@ -119,8 +119,8 @@ ]) ->andFilterWhere([ 'ilike', - 'seo_dynamic_lang.name', - $this->name, + 'seo_dynamic_lang.title', + $this->title, ]); return $dataProvider; diff --git a/common/models/SeoLang.php b/common/models/SeoLang.php index 8927512..e0b8bde 100755 --- a/common/models/SeoLang.php +++ b/common/models/SeoLang.php @@ -11,7 +11,7 @@ * @property integer $seo_id * @property integer $language_id * @property string $title - * @property string $description + * @property string $meta_description * @property string $h1 * @property string $meta * @property string $seo_text @@ -45,7 +45,7 @@ return [ [ [ - 'description', + 'meta_description', 'seo_text', ], 'string', @@ -76,7 +76,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], + 'targetAttribute' => [ 'language_id' => 'id' ], ], [ [ 'seo_id' ], @@ -97,7 +97,7 @@ 'seo_id' => Yii::t('app', 'seo_id'), 'language_id' => Yii::t('app', 'language_id'), 'title' => Yii::t('app', 'title'), - 'description' => Yii::t('app', 'description'), + 'meta_description' => Yii::t('app', 'meta_description'), 'h1' => Yii::t('app', 'h1'), 'meta' => Yii::t('app', 'meta'), 'seo_text' => Yii::t('app', 'seo_text'), @@ -109,7 +109,7 @@ */ public function getLanguage() { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } /** diff --git a/common/models/SeoSearch.php b/common/models/SeoSearch.php index 2a1d5c9..d73e065 100755 --- a/common/models/SeoSearch.php +++ b/common/models/SeoSearch.php @@ -13,13 +13,13 @@ public $title; - public $description; + public $meta_description; public $h1; public $meta; - public $seo_text; + public $seoText; public function behaviors() { @@ -40,7 +40,7 @@ [ 'url', 'title', - 'description', + 'meta_description', 'h1', 'meta', 'seo_text', @@ -83,9 +83,9 @@ 'asc' => [ 'seo_lang.title' => SORT_ASC ], 'desc' => [ 'seo_lang.title' => SORT_DESC ], ], - 'description' => [ - 'asc' => [ 'seo_lang.description' => SORT_ASC ], - 'desc' => [ 'seo_lang.description' => SORT_DESC ], + 'meta_description' => [ + 'asc' => [ 'seo_lang.meta_description' => SORT_ASC ], + 'desc' => [ 'seo_lang.meta_description' => SORT_DESC ], ], 'h1' => [ 'asc' => [ 'seo_lang.h1' => SORT_ASC ], @@ -128,8 +128,8 @@ ]) ->andFilterWhere([ 'ilike', - 'seo_lang.description', - $this->description, + 'seo_lang.meta_description', + $this->meta_description, ]) ->andFilterWhere([ 'ilike', @@ -144,7 +144,7 @@ ->andFilterWhere([ 'ilike', 'seo_lang.seo_text', - $this->seo_text, + $this->seoText, ]); return $dataProvider; diff --git a/common/models/Service.php b/common/models/Service.php index 91c35c5..30c2ed9 100755 --- a/common/models/Service.php +++ b/common/models/Service.php @@ -19,10 +19,10 @@ * * From language behavior * * @property ServiceLang $lang * @property ServiceLang[] $langs - * @property ServiceLang $object_lang + * @property ServiceLang $objectLang * @property string $ownerKey * @property string $langKey - * @property ServiceLang[] $model_langs + * @property ServiceLang[] $modelLangs * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey( string $value ) diff --git a/common/models/ServiceLang.php b/common/models/ServiceLang.php index 85325dd..42dcc78 100755 --- a/common/models/ServiceLang.php +++ b/common/models/ServiceLang.php @@ -10,11 +10,11 @@ * This is the model class for table "service_lang". * @property integer $service_id * @property integer $language_id - * @property string $name + * @property string $title * @property string $body * @property string $seo_text * @property string $meta_title - * @property string $description + * @property string $meta_description * @property string $h1 * @property Language $language * @property Service $service @@ -43,9 +43,6 @@ return [ 'slug' => [ 'class' => 'common\behaviors\Slug', - 'in_attribute' => 'name', - 'out_attribute' => 'alias', - 'translit' => true, ], ]; } @@ -58,7 +55,7 @@ return [ [ [ - 'name', + 'title', 'body', ], 'required', @@ -72,9 +69,9 @@ ], [ [ - 'name', + 'title', 'meta_title', - 'description', + 'meta_description', 'h1', ], 'string', @@ -97,7 +94,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], + 'targetAttribute' => [ 'language_id' => 'id' ], ], [ [ 'service_id' ], @@ -117,11 +114,11 @@ return [ 'service_id' => Yii::t('app', 'service_id'), 'language_id' => Yii::t('app', 'language_id'), - 'name' => Yii::t('app', 'name'), + 'title' => Yii::t('app', 'name'), 'body' => Yii::t('app', 'body'), 'seo_text' => Yii::t('app', 'seo_text'), 'meta_title' => Yii::t('app', 'meta_title'), - 'description' => Yii::t('app', 'description'), + 'meta_description' => Yii::t('app', 'meta_description'), 'h1' => Yii::t('app', 'h1'), ]; } @@ -131,7 +128,7 @@ */ public function getLanguage() { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } /** diff --git a/common/models/SliderImage.php b/common/models/SliderImage.php index 8217ff0..d20ae98 100755 --- a/common/models/SliderImage.php +++ b/common/models/SliderImage.php @@ -21,10 +21,10 @@ * * From language behavior * * @property SliderImageLang $lang * @property SliderImageLang[] $langs - * @property SliderImageLang $object_lang + * @property SliderImageLang $objectLang * @property string $ownerKey * @property string $langKey - * @property SliderImageLang[] $model_langs + * @property SliderImageLang[] $modelLangs * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey( string $value ) diff --git a/common/models/SliderImageLang.php b/common/models/SliderImageLang.php index cc7e9ce..3673edf 100755 --- a/common/models/SliderImageLang.php +++ b/common/models/SliderImageLang.php @@ -65,7 +65,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], + 'targetAttribute' => [ 'language_id' => 'id' ], ], [ [ 'slider_image_id' ], @@ -95,7 +95,7 @@ */ public function getLanguage() { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } /** diff --git a/common/modules/comment/migrations/m160724_162347_artbox_comment.php b/common/modules/comment/migrations/m160724_162347_artbox_comment.php index 89074da..5183e61 100755 --- a/common/modules/comment/migrations/m160724_162347_artbox_comment.php +++ b/common/modules/comment/migrations/m160724_162347_artbox_comment.php @@ -7,51 +7,94 @@ public function up() { - $this->createTable('{{%artbox_comment}}', [ - 'artbox_comment_id' => $this->primaryKey(), - 'text' => $this->text() - ->notNull(), - 'user_id' => $this->integer(), - 'username' => $this->string(), - 'email' => $this->string(), - 'date_add' => $this->integer() - ->notNull(), - 'date_update' => $this->integer() - ->notNull(), - 'date_delete' => $this->integer(), - 'status' => $this->integer() - ->notNull() - ->defaultValue(1), - 'artbox_comment_pid' => $this->integer(), - 'related_id' => $this->integer(), - 'ip' => $this->string() - ->notNull(), - 'info' => $this->text(), - ]); + $this->createTable( + '{{%artbox_comment}}', + [ + 'artbox_comment_id' => $this->primaryKey(), + 'text' => $this->text() + ->notNull(), + 'user_id' => $this->integer(), + 'username' => $this->string(), + 'email' => $this->string(), + 'created_at' => $this->integer() + ->notNull(), + 'updated_at' => $this->integer() + ->notNull(), + 'deleted_at' => $this->integer(), + 'status' => $this->integer() + ->notNull() + ->defaultValue(1), + 'artbox_comment_pid' => $this->integer(), + 'related_id' => $this->integer(), + 'ip' => $this->string() + ->notNull(), + 'info' => $this->text(), + ] + ); - $this->addForeignKey('user_id_user', '{{%artbox_comment}}', 'user_id', 'customer', 'id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('artbox_comment_pid_artbox_comment', '{{%artbox_comment}}', 'artbox_comment_pid', 'artbox_comment', 'artbox_comment_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('related_id_artbox_comment', '{{%artbox_comment}}', 'related_id', 'artbox_comment', 'artbox_comment_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey( + 'user_id_user', + '{{%artbox_comment}}', + 'user_id', + 'customer', + 'id', + 'CASCADE', + 'CASCADE' + ); + $this->addForeignKey( + 'artbox_comment_pid_artbox_comment', + '{{%artbox_comment}}', + 'artbox_comment_pid', + 'artbox_comment', + 'artbox_comment_id', + 'CASCADE', + 'CASCADE' + ); + $this->addForeignKey( + 'related_id_artbox_comment', + '{{%artbox_comment}}', + 'related_id', + 'artbox_comment', + 'artbox_comment_id', + 'CASCADE', + 'CASCADE' + ); - $this->createTable('{{%artbox_like}}', [ - 'artbox_like_id' => $this->primaryKey(), - 'artbox_comment_id' => $this->integer() - ->notNull(), - 'user_id' => $this->integer(), - 'date_add' => $this->integer() - ->notNull(), - 'is_like' => $this->integer() - ->notNull() - ->defaultValue(1), - ]); + $this->createTable( + '{{%artbox_like}}', + [ + 'artbox_like_id' => $this->primaryKey(), + 'artbox_comment_id' => $this->integer() + ->notNull(), + 'user_id' => $this->integer(), + 'created_at' => $this->integer() + ->notNull(), + 'is_like' => $this->integer() + ->notNull() + ->defaultValue(1), + ] + ); - $this->addForeignKey('artbox_comment_id_artbox_comment', '{{%artbox_like}}', 'artbox_comment_id', 'artbox_comment', 'artbox_comment_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('user_id_user', '{{%artbox_like}}', 'user_id', 'customer', 'id', 'CASCADE', 'CASCADE'); - $this->createIndex('artbox_like_unique', '{{%artbox_like}}', [ + $this->addForeignKey( + 'artbox_comment_id_artbox_comment', + '{{%artbox_like}}', 'artbox_comment_id', - 'user_id', - 'is_like', - ], true); + 'artbox_comment', + 'artbox_comment_id', + 'CASCADE', + 'CASCADE' + ); + $this->addForeignKey('user_id_user', '{{%artbox_like}}', 'user_id', 'customer', 'id', 'CASCADE', 'CASCADE'); + $this->createIndex( + 'artbox_like_unique', + '{{%artbox_like}}', + [ + 'artbox_comment_id', + 'user_id', + 'is_like', + ], + true + ); } diff --git a/common/modules/comment/migrations/m160726_211227_create_artbox_comment_rating.php b/common/modules/comment/migrations/m160726_211227_create_artbox_comment_rating.php index 2f0848e..bb1048f 100755 --- a/common/modules/comment/migrations/m160726_211227_create_artbox_comment_rating.php +++ b/common/modules/comment/migrations/m160726_211227_create_artbox_comment_rating.php @@ -7,20 +7,31 @@ public function up() { - $this->createTable('{{%artbox_comment_rating}}', [ - 'artbox_comment_rating_id' => $this->primaryKey(), - 'date_add' => $this->integer() - ->notNull(), - 'date_update' => $this->integer() - ->notNull(), - 'user_id' => $this->integer(), - 'value' => $this->float(), - 'model' => $this->string() - ->notNull(), - 'model_id' => $this->integer() - ->notNull(), - ]); - $this->addForeignKey('user_id_user', '{{%artbox_comment_rating}}', 'user_id', 'customer', 'id', 'CASCADE', 'CASCADE'); + $this->createTable( + '{{%artbox_comment_rating}}', + [ + 'artbox_comment_rating_id' => $this->primaryKey(), + 'created_at' => $this->integer() + ->notNull(), + 'updated_at' => $this->integer() + ->notNull(), + 'user_id' => $this->integer(), + 'value' => $this->float(), + 'model' => $this->string() + ->notNull(), + 'model_id' => $this->integer() + ->notNull(), + ] + ); + $this->addForeignKey( + 'user_id_user', + '{{%artbox_comment_rating}}', + 'user_id', + 'customer', + 'id', + 'CASCADE', + 'CASCADE' + ); } public function down() diff --git a/common/modules/comment/models/CommentModel.php b/common/modules/comment/models/CommentModel.php index 4785a75..7838ce7 100755 --- a/common/modules/comment/models/CommentModel.php +++ b/common/modules/comment/models/CommentModel.php @@ -12,14 +12,15 @@ /** * Class CommentModel + * * @property int $artbox_comment_id * @property string $text * @property int $user_id * @property string $username * @property string $email - * @property int $date_add - * @property int $date_update - * @property int $date_delete + * @property int $created_at + * @property int $updated_at + * @property int $deleted_at * @property int $status * @property int $artbox_comment_pid * @property int $related_id @@ -127,9 +128,7 @@ { return [ [ - 'class' => TimestampBehavior::className(), - 'createdAtAttribute' => 'date_add', - 'updatedAtAttribute' => 'date_update', + 'class' => TimestampBehavior::className(), ], [ 'class' => BlameableBehavior::className(), @@ -141,7 +140,7 @@ 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => 'ip', ], - 'value' => function($event) { + 'value' => function ($event) { return \Yii::$app->request->userIP; }, ], @@ -168,8 +167,8 @@ 'username' => \Yii::t('artbox-comment', 'Username'), 'email' => 'Email', 'date_add' => \Yii::t('artbox-comment', 'Date add'), - 'date_update' => \Yii::t('artbox-comment', 'Date update'), - 'date_delete' => \Yii::t('artbox-comment', 'Date delete'), + 'updated_at' => \Yii::t('artbox-comment', 'Date update'), + 'deleted_at' => \Yii::t('artbox-comment', 'Date delete'), 'status' => \Yii::t('artbox-comment', 'Status'), 'artbox_comment_pid' => \Yii::t('artbox-comment', 'Comment parent'), 'related_id' => \Yii::t('artbox-comment', 'Comment related'), @@ -180,88 +179,96 @@ ]; } - function setEntity(string $entity) + public function setEntity(string $entity) { $this->entity = $entity; } - function getEntity(): string + public function getEntity(): string { return $this->entity; } - static function getTree(string $entity, int $entityId): ActiveDataProvider + public static function getTree(string $entity, int $entityId): ActiveDataProvider { - return new ActiveDataProvider([ - 'query' => self::find() - ->with([ - 'children', - 'user', - 'children.user', - ]) - ->where([ - 'entity' => $entity, - 'entity_id' => $entityId, - 'status' => 1, - 'artbox_comment_pid' => NULL, - ]), - 'pagination' => [ - 'pageSize' => 20, - ], - 'sort' => [ - 'defaultOrder' => [ - 'date_add' => SORT_DESC, + return new ActiveDataProvider( + [ + 'query' => self::find() + ->with( + [ + 'children', + 'user', + 'children.user', + ] + ) + ->where( + [ + 'entity' => $entity, + 'entity_id' => $entityId, + 'status' => 1, + 'artbox_comment_pid' => null, + ] + ), + 'pagination' => [ + 'pageSize' => 20, ], - ], - ]); + 'sort' => [ + 'defaultOrder' => [ + 'created_at' => SORT_DESC, + ], + ], + ] + ); } - function deleteComment(): bool + public function deleteComment(): bool { - if(\Yii::$app->user->id != NULL && \Yii::$app->user->id == $this->user_id) { - if($this->delete()) { + if (\Yii::$app->user->id != null && \Yii::$app->user->id == $this->user_id) { + if ($this->delete()) { return true; } } return false; } - function setEntityId(int $entityId) + public function setEntityId(int $entityId) { $this->entityId = $entityId; } - function getEntityId(): int + public function getEntityId(): int { return $this->entityId; } - function getChildren() + public function getChildren() { return $this->hasMany(self::className(), [ 'artbox_comment_pid' => 'artbox_comment_id' ]) ->andFilterWhere([ 'status' => self::STATUS_ACTIVE ]) ->inverseOf('parent'); } - function getParent() + public function getParent() { return $this->hasOne(self::className(), [ 'artbox_comment_id' => 'artbox_comment_pid' ]) ->inverseOf('children'); } - function getUser() + public function getUser() { $module = \Yii::$app->getModule('artbox-comment'); return $this->hasOne($module->userIdentityClass, [ 'id' => 'user_id' ]); } - function getRating() + public function getRating() { return $this->hasOne(RatingModel::className(), [ 'model_id' => 'artbox_comment_id' ]) - ->andWhere([ - 'or', - [ 'artbox_comment_rating.model' => NULL ], - [ 'artbox_comment_rating.model' => self::className() ], - ]); + ->andWhere( + [ + 'or', + [ 'artbox_comment_rating.model' => null ], + [ 'artbox_comment_rating.model' => self::className() ], + ] + ); } } \ No newline at end of file diff --git a/common/modules/comment/models/CommentModelSearch.php b/common/modules/comment/models/CommentModelSearch.php index 16d9ec1..81df2fb 100755 --- a/common/modules/comment/models/CommentModelSearch.php +++ b/common/modules/comment/models/CommentModelSearch.php @@ -12,9 +12,9 @@ class CommentModelSearch extends CommentModel { - public $rating_value; + public $ratingValue; - public $children_count; + public $childrenCount; /** * @inheritdoc @@ -25,9 +25,9 @@ [ [ 'artbox_comment_id', - 'date_add', - 'date_update', - 'date_delete', + 'created_at', + 'updated_at', + 'deleted_at', 'status', 'artbox_comment_pid', 'related_id', @@ -37,14 +37,14 @@ ], [ [ - 'children_count', + 'childrenCount', ], 'integer', 'min' => 0, ], [ [ - 'rating_value', + 'ratingValue', ], 'number', 'min' => 1, @@ -67,10 +67,13 @@ public function attributeLabels() { - return array_merge(parent::attributeLabels(), [ - 'rating_value' => 'Рейтинг', - 'children_count' => 'Количество ответов', - ]); + return array_merge( + parent::attributeLabels(), + [ + 'ratingValue' => 'Рейтинг', + 'childrenCount' => 'Количество ответов', + ] + ); } /** @@ -92,109 +95,131 @@ public function search($params) { $query = CommentModel::find() - ->joinWith([ - 'rating', - 'user', - ]); + ->joinWith( + [ + 'rating', + 'user', + ] + ); // add conditions that should always apply here - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'sort' => [ - 'attributes' => [ - 'rating_value' => [ - 'asc' => [ 'artbox_comment_rating.value' => SORT_ASC ], - 'desc' => [ 'artbox_comment_rating.value' => SORT_DESC ], + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'ratingValue' => [ + 'asc' => [ 'artbox_comment_rating.value' => SORT_ASC ], + 'desc' => [ 'artbox_comment_rating.value' => SORT_DESC ], + ], + 'artbox_comment_id', + 'date_add', + 'text', + 'user_id', + 'status', + 'entity', + 'entity_id', + ], + 'defaultOrder' => [ + 'created_at' => SORT_DESC, ], - 'artbox_comment_id', - 'date_add', - 'text', - 'user_id', - 'status', - 'entity', - 'entity_id', - ], - 'defaultOrder' => [ - 'date_add' => SORT_DESC, ], - ], - ]); + ] + ); $this->load($params); - if(!$this->validate()) { + 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([ - 'artbox_comment_id' => $this->artbox_comment_id, - 'date_add' => $this->date_add, - 'date_update' => $this->date_update, - 'date_delete' => $this->date_delete, - 'artbox_comment.status' => $this->status, - 'artbox_comment_pid' => $this->artbox_comment_pid, - 'related_id' => $this->related_id, - 'entity_id' => $this->entity_id, - ]); + $query->andFilterWhere( + [ + 'artbox_comment_id' => $this->artbox_comment_id, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + 'deleted_at' => $this->deleted_at, + 'artbox_comment.status' => $this->status, + 'artbox_comment_pid' => $this->artbox_comment_pid, + 'related_id' => $this->related_id, + 'entity_id' => $this->entity_id, + ] + ); - $query->andFilterWhere([ - 'like', - 'text', - $this->text, - ]) - ->andFilterWhere([ - 'like', - 'username', - $this->username, - ]) - ->andFilterWhere([ - 'like', - 'email', - $this->email, - ]) - ->andFilterWhere([ - 'like', - 'ip', - $this->ip, - ]) - ->andFilterWhere([ - 'like', - 'entity', - $this->entity, - ]) - ->andFilterWhere([ - 'like', - 'info', - $this->info, - ]) - ->andFilterWhere([ - 'artbox_comment_rating.value' => $this->rating_value, - ]); + $query->andFilterWhere( + [ + 'like', + 'text', + $this->text, + ] + ) + ->andFilterWhere( + [ + 'like', + 'username', + $this->username, + ] + ) + ->andFilterWhere( + [ + 'like', + 'email', + $this->email, + ] + ) + ->andFilterWhere( + [ + 'like', + 'ip', + $this->ip, + ] + ) + ->andFilterWhere( + [ + 'like', + 'entity', + $this->entity, + ] + ) + ->andFilterWhere( + [ + 'like', + 'info', + $this->info, + ] + ) + ->andFilterWhere( + [ + 'artbox_comment_rating.value' => $this->ratingValue, + ] + ); - if(!empty( $this->user_id )) { - $query->andWhere([ - 'or', - [ 'artbox_comment.user_id' => (int) $this->user_id ], - [ - 'like', - 'user.username', - $this->user_id, - ], - [ - 'like', - 'artbox_comment.username', - $this->user_id, - ], + if (!empty( $this->user_id )) { + $query->andWhere( [ - 'like', - 'artbox_comment.email', - $this->user_id, - ], - ]); + 'or', + [ 'artbox_comment.user_id' => (int) $this->user_id ], + [ + 'like', + 'user.username', + $this->user_id, + ], + [ + 'like', + 'artbox_comment.username', + $this->user_id, + ], + [ + 'like', + 'artbox_comment.email', + $this->user_id, + ], + ] + ); } return $dataProvider; diff --git a/common/modules/comment/models/RatingModel.php b/common/modules/comment/models/RatingModel.php index d117e21..3039816 100755 --- a/common/modules/comment/models/RatingModel.php +++ b/common/modules/comment/models/RatingModel.php @@ -7,17 +7,18 @@ use yii\behaviors\BlameableBehavior; use yii\behaviors\TimestampBehavior; use yii\db\ActiveRecord; - + /** * This is the model class for table "artbox_comment_rating". - * @property integer $artbox_comment_rating_id - * @property string $date_add - * @property string $date_update - * @property integer $user_id - * @property integer $value - * @property string $model - * @property integer $model_id - * @property User $user + * + * @property integer $artbox_comment_rating_id + * @property string $created_at + * @property string $updated_at + * @property integer $user_id + * @property integer $value + * @property string $model + * @property integer $model_id + * @property User $user */ class RatingModel extends ActiveRecord { @@ -53,9 +54,7 @@ { return [ [ - 'class' => TimestampBehavior::className(), - 'createdAtAttribute' => 'date_add', - 'updatedAtAttribute' => 'date_update', + 'class' => TimestampBehavior::className(), ], [ 'class' => BlameableBehavior::className(), @@ -71,12 +70,12 @@ public function attributeLabels() { return [ - 'rating_id' => Yii::t('app', 'Rating ID'), - 'date_add' => Yii::t('app', 'Date Add'), - 'date_update' => Yii::t('app', 'Date Update'), - 'user_id' => Yii::t('app', 'User ID'), - 'entity' => Yii::t('app', 'Entity'), - 'value' => Yii::t('app', 'Value'), + 'rating_id' => Yii::t('app', 'Rating ID'), + 'date_add' => Yii::t('app', 'Date Add'), + 'updated_at' => Yii::t('app', 'Date Update'), + 'user_id' => Yii::t('app', 'User ID'), + 'entity' => Yii::t('app', 'Entity'), + 'value' => Yii::t('app', 'Value'), ]; } diff --git a/common/modules/comment/models/interfaces/CommentInterface.php b/common/modules/comment/models/interfaces/CommentInterface.php index 6dbe059..f98dd6a 100755 --- a/common/modules/comment/models/interfaces/CommentInterface.php +++ b/common/modules/comment/models/interfaces/CommentInterface.php @@ -11,14 +11,14 @@ interface CommentInterface { - function setEntity(string $entity); + public function setEntity(string $entity); - function getEntity(): string; + public function getEntity(): string; - function setEntityId(int $entityId); + public function setEntityId(int $entityId); - function getEntityId(): int; + public function getEntityId(): int; - static function getTree(string $entity, int $entityId): ActiveDataProvider; + public static function getTree(string $entity, int $entityId): ActiveDataProvider; } \ No newline at end of file diff --git a/common/modules/comment/todo b/common/modules/comment/todo index cae6e3f..f4aba09 100755 --- a/common/modules/comment/todo +++ b/common/modules/comment/todo @@ -30,9 +30,9 @@ text text user_id int foreign key username string email string -date_add int notNull -date_update int notNull -date_delete int notNull +created_at int notNull +updated_at int notNull +deleted_at int notNull status int notNull default(1) comment_pid int foreign_key related_id int foreign key @@ -43,7 +43,7 @@ info text artbox_comment_like_id primary_key artbox_comment_id int foreign key user_id int foreign key -date_add int notNull +created_at int notNull is_like int notNull default(1) Приколы: diff --git a/common/modules/comment/views/artbox_comment_item.php b/common/modules/comment/views/artbox_comment_item.php index 4f214a0..9510a97 100755 --- a/common/modules/comment/views/artbox_comment_item.php +++ b/common/modules/comment/views/artbox_comment_item.php @@ -20,7 +20,7 @@
date_add); + echo date('d.m.Y', $child->created_at); ?>
diff --git a/common/modules/comment/views/manage/index.php b/common/modules/comment/views/manage/index.php index d86bc64..44ac324 100755 --- a/common/modules/comment/views/manage/index.php +++ b/common/modules/comment/views/manage/index.php @@ -32,7 +32,7 @@ 'label' => 'Идентификатор', ], [ - 'attribute' => 'date_add', + 'attribute' => 'created_at', 'format' => [ 'date', 'php:d.m.Y', @@ -58,8 +58,7 @@ }, ], [ - 'attribute' => 'rating_value', - 'label' => $searchModel->getAttributeLabel('rating_value'), + 'attribute' => 'ratingValue', 'value' => function($model) { if(!empty( $model->rating )) { return $model->rating->value; @@ -70,8 +69,7 @@ 'entity', 'entity_id', [ - 'attribute' => 'children_count', - 'label' => $searchModel->getAttributeLabel('children_count'), + 'attribute' => 'childrenCount', 'value' => function($model) { return count($model->children); }, diff --git a/common/modules/file/FileUploadAsset.php b/common/modules/file/FileUploadAsset.php new file mode 100755 index 0000000..1f15894 --- /dev/null +++ b/common/modules/file/FileUploadAsset.php @@ -0,0 +1,43 @@ + + * @since 2.0 + */ +class FileUploadAsset extends AssetBundle +{ + + + /** + * @inheritdoc + */ + public function init() + { + parent::init(); + $this->sourcePath = __DIR__.'/assets'; + } + + public $css = [ + 'css/jquery.fileupload.css', + 'css/fileupload/style.css' + ]; + + public $js = [ + 'js/vendor/jquery.ui.widget.js', + 'js/jquery.iframe-transport.js', + 'js/jquery.fileupload.js' + ]; +} diff --git a/common/modules/file/Module.php b/common/modules/file/Module.php new file mode 100755 index 0000000..374e5f4 --- /dev/null +++ b/common/modules/file/Module.php @@ -0,0 +1,15 @@ +').prop('href', options.postMessage)[0], + target = loc.protocol + '//' + loc.host, + xhrUpload = options.xhr().upload; + return { + send: function (_, completeCallback) { + counter += 1; + var message = { + id: 'postmessage-transport-' + counter + }, + eventName = 'message.' + message.id; + iframe = $( + '' + ).bind('load', function () { + $.each(names, function (i, name) { + message[name] = options[name]; + }); + message.dataType = message.dataType.replace('postmessage ', ''); + $(window).bind(eventName, function (e) { + e = e.originalEvent; + var data = e.data, + ev; + if (e.origin === target && data.id === message.id) { + if (data.type === 'progress') { + ev = document.createEvent('Event'); + ev.initEvent(data.type, false, true); + $.extend(ev, data); + xhrUpload.dispatchEvent(ev); + } else { + completeCallback( + data.status, + data.statusText, + {postmessage: data.result}, + data.headers + ); + iframe.remove(); + $(window).unbind(eventName); + } + } + }); + iframe[0].contentWindow.postMessage( + message, + target + ); + }).appendTo(document.body); + }, + abort: function () { + if (iframe) { + iframe.remove(); + } + } + }; + } + }); + +})); diff --git a/common/modules/file/assets/js/cors/jquery.xdr-transport.js b/common/modules/file/assets/js/cors/jquery.xdr-transport.js new file mode 100755 index 0000000..d951827 --- /dev/null +++ b/common/modules/file/assets/js/cors/jquery.xdr-transport.js @@ -0,0 +1,89 @@ +/* + * jQuery XDomainRequest Transport Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + * + * Based on Julian Aubourg's ajaxHooks xdr.js: + * https://github.com/jaubourg/ajaxHooks/ + */ + +/* global define, require, window, XDomainRequest */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['jquery'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory(require('jquery')); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + if (window.XDomainRequest && !$.support.cors) { + $.ajaxTransport(function (s) { + if (s.crossDomain && s.async) { + if (s.timeout) { + s.xdrTimeout = s.timeout; + delete s.timeout; + } + var xdr; + return { + send: function (headers, completeCallback) { + var addParamChar = /\?/.test(s.url) ? '&' : '?'; + function callback(status, statusText, responses, responseHeaders) { + xdr.onload = xdr.onerror = xdr.ontimeout = $.noop; + xdr = null; + completeCallback(status, statusText, responses, responseHeaders); + } + xdr = new XDomainRequest(); + // XDomainRequest only supports GET and POST: + if (s.type === 'DELETE') { + s.url = s.url + addParamChar + '_method=DELETE'; + s.type = 'POST'; + } else if (s.type === 'PUT') { + s.url = s.url + addParamChar + '_method=PUT'; + s.type = 'POST'; + } else if (s.type === 'PATCH') { + s.url = s.url + addParamChar + '_method=PATCH'; + s.type = 'POST'; + } + xdr.open(s.type, s.url); + xdr.onload = function () { + callback( + 200, + 'OK', + {text: xdr.responseText}, + 'Content-Type: ' + xdr.contentType + ); + }; + xdr.onerror = function () { + callback(404, 'Not Found'); + }; + if (s.xdrTimeout) { + xdr.ontimeout = function () { + callback(0, 'timeout'); + }; + xdr.timeout = s.xdrTimeout; + } + xdr.send((s.hasContent && s.data) || null); + }, + abort: function () { + if (xdr) { + xdr.onerror = $.noop(); + xdr.abort(); + } + } + }; + } + }); + } +})); diff --git a/common/modules/file/assets/js/jquery.fileupload-angular.js b/common/modules/file/assets/js/jquery.fileupload-angular.js new file mode 100755 index 0000000..08bb488 --- /dev/null +++ b/common/modules/file/assets/js/jquery.fileupload-angular.js @@ -0,0 +1,425 @@ +/* + * jQuery File Upload AngularJS Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, angular */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'angular', + './jquery.fileupload-image', + './jquery.fileupload-audio', + './jquery.fileupload-video', + './jquery.fileupload-validate' + ], factory); + } else { + factory(); + } +}(function () { + 'use strict'; + + angular.module('blueimp.fileupload', []) + + // The fileUpload service provides configuration options + // for the fileUpload directive and default handlers for + // File Upload events: + .provider('fileUpload', function () { + var scopeEvalAsync = function (expression) { + var scope = angular.element(this) + .fileupload('option', 'scope'); + // Schedule a new $digest cycle if not already inside of one + // and evaluate the given expression: + scope.$evalAsync(expression); + }, + addFileMethods = function (scope, data) { + var files = data.files, + file = files[0]; + angular.forEach(files, function (file, index) { + file._index = index; + file.$state = function () { + return data.state(); + }; + file.$processing = function () { + return data.processing(); + }; + file.$progress = function () { + return data.progress(); + }; + file.$response = function () { + return data.response(); + }; + }); + file.$submit = function () { + if (!file.error) { + return data.submit(); + } + }; + file.$cancel = function () { + return data.abort(); + }; + }, + $config; + $config = this.defaults = { + handleResponse: function (e, data) { + var files = data.result && data.result.files; + if (files) { + data.scope.replace(data.files, files); + } else if (data.errorThrown || + data.textStatus === 'error') { + data.files[0].error = data.errorThrown || + data.textStatus; + } + }, + add: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var scope = data.scope, + filesCopy = []; + angular.forEach(data.files, function (file) { + filesCopy.push(file); + }); + scope.$parent.$applyAsync(function () { + addFileMethods(scope, data); + var method = scope.option('prependFiles') ? + 'unshift' : 'push'; + Array.prototype[method].apply(scope.queue, data.files); + }); + data.process(function () { + return scope.process(data); + }).always(function () { + scope.$parent.$applyAsync(function () { + addFileMethods(scope, data); + scope.replace(filesCopy, data.files); + }); + }).then(function () { + if ((scope.option('autoUpload') || + data.autoUpload) && + data.autoUpload !== false) { + data.submit(); + } + }); + }, + done: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var that = this; + data.scope.$apply(function () { + data.handleResponse.call(that, e, data); + }); + }, + fail: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var that = this, + scope = data.scope; + if (data.errorThrown === 'abort') { + scope.clear(data.files); + return; + } + scope.$apply(function () { + data.handleResponse.call(that, e, data); + }); + }, + stop: scopeEvalAsync, + processstart: scopeEvalAsync, + processstop: scopeEvalAsync, + getNumberOfFiles: function () { + var scope = this.scope; + return scope.queue.length - scope.processing(); + }, + dataType: 'json', + autoUpload: false + }; + this.$get = [ + function () { + return { + defaults: $config + }; + } + ]; + }) + + // Format byte numbers to readable presentations: + .provider('formatFileSizeFilter', function () { + var $config = { + // Byte units following the IEC format + // http://en.wikipedia.org/wiki/Kilobyte + units: [ + {size: 1000000000, suffix: ' GB'}, + {size: 1000000, suffix: ' MB'}, + {size: 1000, suffix: ' KB'} + ] + }; + this.defaults = $config; + this.$get = function () { + return function (bytes) { + if (!angular.isNumber(bytes)) { + return ''; + } + var unit = true, + i = 0, + prefix, + suffix; + while (unit) { + unit = $config.units[i]; + prefix = unit.prefix || ''; + suffix = unit.suffix || ''; + if (i === $config.units.length - 1 || bytes >= unit.size) { + return prefix + (bytes / unit.size).toFixed(2) + suffix; + } + i += 1; + } + }; + }; + }) + + // The FileUploadController initializes the fileupload widget and + // provides scope methods to control the File Upload functionality: + .controller('FileUploadController', [ + '$scope', '$element', '$attrs', '$window', 'fileUpload', + function ($scope, $element, $attrs, $window, fileUpload) { + var uploadMethods = { + progress: function () { + return $element.fileupload('progress'); + }, + active: function () { + return $element.fileupload('active'); + }, + option: function (option, data) { + if (arguments.length === 1) { + return $element.fileupload('option', option); + } + $element.fileupload('option', option, data); + }, + add: function (data) { + return $element.fileupload('add', data); + }, + send: function (data) { + return $element.fileupload('send', data); + }, + process: function (data) { + return $element.fileupload('process', data); + }, + processing: function (data) { + return $element.fileupload('processing', data); + } + }; + $scope.disabled = !$window.jQuery.support.fileInput; + $scope.queue = $scope.queue || []; + $scope.clear = function (files) { + var queue = this.queue, + i = queue.length, + file = files, + length = 1; + if (angular.isArray(files)) { + file = files[0]; + length = files.length; + } + while (i) { + i -= 1; + if (queue[i] === file) { + return queue.splice(i, length); + } + } + }; + $scope.replace = function (oldFiles, newFiles) { + var queue = this.queue, + file = oldFiles[0], + i, + j; + for (i = 0; i < queue.length; i += 1) { + if (queue[i] === file) { + for (j = 0; j < newFiles.length; j += 1) { + queue[i + j] = newFiles[j]; + } + return; + } + } + }; + $scope.applyOnQueue = function (method) { + var list = this.queue.slice(0), + i, + file; + for (i = 0; i < list.length; i += 1) { + file = list[i]; + if (file[method]) { + file[method](); + } + } + }; + $scope.submit = function () { + this.applyOnQueue('$submit'); + }; + $scope.cancel = function () { + this.applyOnQueue('$cancel'); + }; + // Add upload methods to the scope: + angular.extend($scope, uploadMethods); + // The fileupload widget will initialize with + // the options provided via "data-"-parameters, + // as well as those given via options object: + $element.fileupload(angular.extend( + {scope: $scope}, + fileUpload.defaults + )).on('fileuploadadd', function (e, data) { + data.scope = $scope; + }).on('fileuploadfail', function (e, data) { + if (data.errorThrown === 'abort') { + return; + } + if (data.dataType && + data.dataType.indexOf('json') === data.dataType.length - 4) { + try { + data.result = angular.fromJson(data.jqXHR.responseText); + } catch (ignore) {} + } + }).on([ + 'fileuploadadd', + 'fileuploadsubmit', + 'fileuploadsend', + 'fileuploaddone', + 'fileuploadfail', + 'fileuploadalways', + 'fileuploadprogress', + 'fileuploadprogressall', + 'fileuploadstart', + 'fileuploadstop', + 'fileuploadchange', + 'fileuploadpaste', + 'fileuploaddrop', + 'fileuploaddragover', + 'fileuploadchunksend', + 'fileuploadchunkdone', + 'fileuploadchunkfail', + 'fileuploadchunkalways', + 'fileuploadprocessstart', + 'fileuploadprocess', + 'fileuploadprocessdone', + 'fileuploadprocessfail', + 'fileuploadprocessalways', + 'fileuploadprocessstop' + ].join(' '), function (e, data) { + $scope.$parent.$applyAsync(function () { + if ($scope.$emit(e.type, data).defaultPrevented) { + e.preventDefault(); + } + }); + }).on('remove', function () { + // Remove upload methods from the scope, + // when the widget is removed: + var method; + for (method in uploadMethods) { + if (uploadMethods.hasOwnProperty(method)) { + delete $scope[method]; + } + } + }); + // Observe option changes: + $scope.$watch( + $attrs.fileUpload, + function (newOptions) { + if (newOptions) { + $element.fileupload('option', newOptions); + } + } + ); + } + ]) + + // Provide File Upload progress feedback: + .controller('FileUploadProgressController', [ + '$scope', '$attrs', '$parse', + function ($scope, $attrs, $parse) { + var fn = $parse($attrs.fileUploadProgress), + update = function () { + var progress = fn($scope); + if (!progress || !progress.total) { + return; + } + $scope.num = Math.floor( + progress.loaded / progress.total * 100 + ); + }; + update(); + $scope.$watch( + $attrs.fileUploadProgress + '.loaded', + function (newValue, oldValue) { + if (newValue !== oldValue) { + update(); + } + } + ); + } + ]) + + // Display File Upload previews: + .controller('FileUploadPreviewController', [ + '$scope', '$element', '$attrs', + function ($scope, $element, $attrs) { + $scope.$watch( + $attrs.fileUploadPreview + '.preview', + function (preview) { + $element.empty(); + if (preview) { + $element.append(preview); + } + } + ); + } + ]) + + .directive('fileUpload', function () { + return { + controller: 'FileUploadController', + scope: true + }; + }) + + .directive('fileUploadProgress', function () { + return { + controller: 'FileUploadProgressController', + scope: true + }; + }) + + .directive('fileUploadPreview', function () { + return { + controller: 'FileUploadPreviewController' + }; + }) + + // Enhance the HTML5 download attribute to + // allow drag&drop of files to the desktop: + .directive('download', function () { + return function (scope, elm) { + elm.on('dragstart', function (e) { + try { + e.originalEvent.dataTransfer.setData( + 'DownloadURL', + [ + 'application/octet-stream', + elm.prop('download'), + elm.prop('href') + ].join(':') + ); + } catch (ignore) {} + }); + }; + }); + +})); diff --git a/common/modules/file/assets/js/jquery.fileupload-audio.js b/common/modules/file/assets/js/jquery.fileupload-audio.js new file mode 100755 index 0000000..971658b --- /dev/null +++ b/common/modules/file/assets/js/jquery.fileupload-audio.js @@ -0,0 +1,112 @@ +/* + * jQuery File Upload Audio Preview Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window, document */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'load-image', + './jquery.fileupload-process' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('load-image') + ); + } else { + // Browser globals: + factory( + window.jQuery, + window.loadImage + ); + } +}(function ($, loadImage) { + 'use strict'; + + // Prepend to the default processQueue: + $.blueimp.fileupload.prototype.options.processQueue.unshift( + { + action: 'loadAudio', + // Use the action as prefix for the "@" options: + prefix: true, + fileTypes: '@', + maxFileSize: '@', + disabled: '@disableAudioPreview' + }, + { + action: 'setAudio', + name: '@audioPreviewName', + disabled: '@disableAudioPreview' + } + ); + + // The File Upload Audio Preview plugin extends the fileupload widget + // with audio preview functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // The regular expression for the types of audio files to load, + // matched against the file type: + loadAudioFileTypes: /^audio\/.*$/ + }, + + _audioElement: document.createElement('audio'), + + processActions: { + + // Loads the audio file given via data.files and data.index + // as audio element if the browser supports playing it. + // Accepts the options fileTypes (regular expression) + // and maxFileSize (integer) to limit the files to load: + loadAudio: function (data, options) { + if (options.disabled) { + return data; + } + var file = data.files[data.index], + url, + audio; + if (this._audioElement.canPlayType && + this._audioElement.canPlayType(file.type) && + ($.type(options.maxFileSize) !== 'number' || + file.size <= options.maxFileSize) && + (!options.fileTypes || + options.fileTypes.test(file.type))) { + url = loadImage.createObjectURL(file); + if (url) { + audio = this._audioElement.cloneNode(false); + audio.src = url; + audio.controls = true; + data.audio = audio; + return data; + } + } + return data; + }, + + // Sets the audio element as a property of the file object: + setAudio: function (data, options) { + if (data.audio && !options.disabled) { + data.files[data.index][options.name || 'preview'] = data.audio; + } + return data; + } + + } + + }); + +})); diff --git a/common/modules/file/assets/js/jquery.fileupload-image.js b/common/modules/file/assets/js/jquery.fileupload-image.js new file mode 100755 index 0000000..d445120 --- /dev/null +++ b/common/modules/file/assets/js/jquery.fileupload-image.js @@ -0,0 +1,321 @@ +/* + * jQuery File Upload Image Preview & Resize Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window, Blob */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'load-image', + 'load-image-meta', + 'load-image-exif', + 'load-image-ios', + 'canvas-to-blob', + './jquery.fileupload-process' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('load-image') + ); + } else { + // Browser globals: + factory( + window.jQuery, + window.loadImage + ); + } +}(function ($, loadImage) { + 'use strict'; + + // Prepend to the default processQueue: + $.blueimp.fileupload.prototype.options.processQueue.unshift( + { + action: 'loadImageMetaData', + disableImageHead: '@', + disableExif: '@', + disableExifThumbnail: '@', + disableExifSub: '@', + disableExifGps: '@', + disabled: '@disableImageMetaDataLoad' + }, + { + action: 'loadImage', + // Use the action as prefix for the "@" options: + prefix: true, + fileTypes: '@', + maxFileSize: '@', + noRevoke: '@', + disabled: '@disableImageLoad' + }, + { + action: 'resizeImage', + // Use "image" as prefix for the "@" options: + prefix: 'image', + maxWidth: '@', + maxHeight: '@', + minWidth: '@', + minHeight: '@', + crop: '@', + orientation: '@', + forceResize: '@', + disabled: '@disableImageResize' + }, + { + action: 'saveImage', + quality: '@imageQuality', + type: '@imageType', + disabled: '@disableImageResize' + }, + { + action: 'saveImageMetaData', + disabled: '@disableImageMetaDataSave' + }, + { + action: 'resizeImage', + // Use "preview" as prefix for the "@" options: + prefix: 'preview', + maxWidth: '@', + maxHeight: '@', + minWidth: '@', + minHeight: '@', + crop: '@', + orientation: '@', + thumbnail: '@', + canvas: '@', + disabled: '@disableImagePreview' + }, + { + action: 'setImage', + name: '@imagePreviewName', + disabled: '@disableImagePreview' + }, + { + action: 'deleteImageReferences', + disabled: '@disableImageReferencesDeletion' + } + ); + + // The File Upload Resize plugin extends the fileupload widget + // with image resize functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // The regular expression for the types of images to load: + // matched against the file type: + loadImageFileTypes: /^image\/(gif|jpeg|png|svg\+xml)$/, + // The maximum file size of images to load: + loadImageMaxFileSize: 10000000, // 10MB + // The maximum width of resized images: + imageMaxWidth: 1920, + // The maximum height of resized images: + imageMaxHeight: 1080, + // Defines the image orientation (1-8) or takes the orientation + // value from Exif data if set to true: + imageOrientation: false, + // Define if resized images should be cropped or only scaled: + imageCrop: false, + // Disable the resize image functionality by default: + disableImageResize: true, + // The maximum width of the preview images: + previewMaxWidth: 80, + // The maximum height of the preview images: + previewMaxHeight: 80, + // Defines the preview orientation (1-8) or takes the orientation + // value from Exif data if set to true: + previewOrientation: true, + // Create the preview using the Exif data thumbnail: + previewThumbnail: true, + // Define if preview images should be cropped or only scaled: + previewCrop: false, + // Define if preview images should be resized as canvas elements: + previewCanvas: true + }, + + processActions: { + + // Loads the image given via data.files and data.index + // as img element, if the browser supports the File API. + // Accepts the options fileTypes (regular expression) + // and maxFileSize (integer) to limit the files to load: + loadImage: function (data, options) { + if (options.disabled) { + return data; + } + var that = this, + file = data.files[data.index], + dfd = $.Deferred(); + if (($.type(options.maxFileSize) === 'number' && + file.size > options.maxFileSize) || + (options.fileTypes && + !options.fileTypes.test(file.type)) || + !loadImage( + file, + function (img) { + if (img.src) { + data.img = img; + } + dfd.resolveWith(that, [data]); + }, + options + )) { + return data; + } + return dfd.promise(); + }, + + // Resizes the image given as data.canvas or data.img + // and updates data.canvas or data.img with the resized image. + // Also stores the resized image as preview property. + // Accepts the options maxWidth, maxHeight, minWidth, + // minHeight, canvas and crop: + resizeImage: function (data, options) { + if (options.disabled || !(data.canvas || data.img)) { + return data; + } + options = $.extend({canvas: true}, options); + var that = this, + dfd = $.Deferred(), + img = (options.canvas && data.canvas) || data.img, + resolve = function (newImg) { + if (newImg && (newImg.width !== img.width || + newImg.height !== img.height || + options.forceResize)) { + data[newImg.getContext ? 'canvas' : 'img'] = newImg; + } + data.preview = newImg; + dfd.resolveWith(that, [data]); + }, + thumbnail; + if (data.exif) { + if (options.orientation === true) { + options.orientation = data.exif.get('Orientation'); + } + if (options.thumbnail) { + thumbnail = data.exif.get('Thumbnail'); + if (thumbnail) { + loadImage(thumbnail, resolve, options); + return dfd.promise(); + } + } + // Prevent orienting the same image twice: + if (data.orientation) { + delete options.orientation; + } else { + data.orientation = options.orientation; + } + } + if (img) { + resolve(loadImage.scale(img, options)); + return dfd.promise(); + } + return data; + }, + + // Saves the processed image given as data.canvas + // inplace at data.index of data.files: + saveImage: function (data, options) { + if (!data.canvas || options.disabled) { + return data; + } + var that = this, + file = data.files[data.index], + dfd = $.Deferred(); + if (data.canvas.toBlob) { + data.canvas.toBlob( + function (blob) { + if (!blob.name) { + if (file.type === blob.type) { + blob.name = file.name; + } else if (file.name) { + blob.name = file.name.replace( + /\.\w+$/, + '.' + blob.type.substr(6) + ); + } + } + // Don't restore invalid meta data: + if (file.type !== blob.type) { + delete data.imageHead; + } + // Store the created blob at the position + // of the original file in the files list: + data.files[data.index] = blob; + dfd.resolveWith(that, [data]); + }, + options.type || file.type, + options.quality + ); + } else { + return data; + } + return dfd.promise(); + }, + + loadImageMetaData: function (data, options) { + if (options.disabled) { + return data; + } + var that = this, + dfd = $.Deferred(); + loadImage.parseMetaData(data.files[data.index], function (result) { + $.extend(data, result); + dfd.resolveWith(that, [data]); + }, options); + return dfd.promise(); + }, + + saveImageMetaData: function (data, options) { + if (!(data.imageHead && data.canvas && + data.canvas.toBlob && !options.disabled)) { + return data; + } + var file = data.files[data.index], + blob = new Blob([ + data.imageHead, + // Resized images always have a head size of 20 bytes, + // including the JPEG marker and a minimal JFIF header: + this._blobSlice.call(file, 20) + ], {type: file.type}); + blob.name = file.name; + data.files[data.index] = blob; + return data; + }, + + // Sets the resized version of the image as a property of the + // file object, must be called after "saveImage": + setImage: function (data, options) { + if (data.preview && !options.disabled) { + data.files[data.index][options.name || 'preview'] = data.preview; + } + return data; + }, + + deleteImageReferences: function (data, options) { + if (!options.disabled) { + delete data.img; + delete data.canvas; + delete data.preview; + delete data.imageHead; + } + return data; + } + + } + + }); + +})); diff --git a/common/modules/file/assets/js/jquery.fileupload-jquery-ui.js b/common/modules/file/assets/js/jquery.fileupload-jquery-ui.js new file mode 100755 index 0000000..a6b2804 --- /dev/null +++ b/common/modules/file/assets/js/jquery.fileupload-jquery-ui.js @@ -0,0 +1,155 @@ +/* + * jQuery File Upload jQuery UI Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['jquery', './jquery.fileupload-ui'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory(require('jquery')); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + processdone: function (e, data) { + data.context.find('.start').button('enable'); + }, + progress: function (e, data) { + if (data.context) { + data.context.find('.progress').progressbar( + 'option', + 'value', + parseInt(data.loaded / data.total * 100, 10) + ); + } + }, + progressall: function (e, data) { + var $this = $(this); + $this.find('.fileupload-progress') + .find('.progress').progressbar( + 'option', + 'value', + parseInt(data.loaded / data.total * 100, 10) + ).end() + .find('.progress-extended').each(function () { + $(this).html( + ($this.data('blueimp-fileupload') || + $this.data('fileupload')) + ._renderExtendedProgress(data) + ); + }); + } + }, + + _renderUpload: function (func, files) { + var node = this._super(func, files), + showIconText = $(window).width() > 480; + node.find('.progress').empty().progressbar(); + node.find('.start').button({ + icons: {primary: 'ui-icon-circle-arrow-e'}, + text: showIconText + }); + node.find('.cancel').button({ + icons: {primary: 'ui-icon-cancel'}, + text: showIconText + }); + if (node.hasClass('fade')) { + node.hide(); + } + return node; + }, + + _renderDownload: function (func, files) { + var node = this._super(func, files), + showIconText = $(window).width() > 480; + node.find('.delete').button({ + icons: {primary: 'ui-icon-trash'}, + text: showIconText + }); + if (node.hasClass('fade')) { + node.hide(); + } + return node; + }, + + _startHandler: function (e) { + $(e.currentTarget).button('disable'); + this._super(e); + }, + + _transition: function (node) { + var deferred = $.Deferred(); + if (node.hasClass('fade')) { + node.fadeToggle( + this.options.transitionDuration, + this.options.transitionEasing, + function () { + deferred.resolveWith(node); + } + ); + } else { + deferred.resolveWith(node); + } + return deferred; + }, + + _create: function () { + this._super(); + this.element + .find('.fileupload-buttonbar') + .find('.fileinput-button').each(function () { + var input = $(this).find('input:file').detach(); + $(this) + .button({icons: {primary: 'ui-icon-plusthick'}}) + .append(input); + }) + .end().find('.start') + .button({icons: {primary: 'ui-icon-circle-arrow-e'}}) + .end().find('.cancel') + .button({icons: {primary: 'ui-icon-cancel'}}) + .end().find('.delete') + .button({icons: {primary: 'ui-icon-trash'}}) + .end().find('.progress').progressbar(); + }, + + _destroy: function () { + this.element + .find('.fileupload-buttonbar') + .find('.fileinput-button').each(function () { + var input = $(this).find('input:file').detach(); + $(this) + .button('destroy') + .append(input); + }) + .end().find('.start') + .button('destroy') + .end().find('.cancel') + .button('destroy') + .end().find('.delete') + .button('destroy') + .end().find('.progress').progressbar('destroy'); + this._super(); + } + + }); + +})); diff --git a/common/modules/file/assets/js/jquery.fileupload-process.js b/common/modules/file/assets/js/jquery.fileupload-process.js new file mode 100755 index 0000000..aa7acec --- /dev/null +++ b/common/modules/file/assets/js/jquery.fileupload-process.js @@ -0,0 +1,175 @@ +/* + * jQuery File Upload Processing Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2012, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + './jquery.fileupload' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory(require('jquery')); + } else { + // Browser globals: + factory( + window.jQuery + ); + } +}(function ($) { + 'use strict'; + + var originalAdd = $.blueimp.fileupload.prototype.options.add; + + // The File Upload Processing plugin extends the fileupload widget + // with file processing functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // The list of processing actions: + processQueue: [ + /* + { + action: 'log', + type: 'debug' + } + */ + ], + add: function (e, data) { + var $this = $(this); + data.process(function () { + return $this.fileupload('process', data); + }); + originalAdd.call(this, e, data); + } + }, + + processActions: { + /* + log: function (data, options) { + console[options.type]( + 'Processing "' + data.files[data.index].name + '"' + ); + } + */ + }, + + _processFile: function (data, originalData) { + var that = this, + dfd = $.Deferred().resolveWith(that, [data]), + chain = dfd.promise(); + this._trigger('process', null, data); + $.each(data.processQueue, function (i, settings) { + var func = function (data) { + if (originalData.errorThrown) { + return $.Deferred() + .rejectWith(that, [originalData]).promise(); + } + return that.processActions[settings.action].call( + that, + data, + settings + ); + }; + chain = chain.pipe(func, settings.always && func); + }); + chain + .done(function () { + that._trigger('processdone', null, data); + that._trigger('processalways', null, data); + }) + .fail(function () { + that._trigger('processfail', null, data); + that._trigger('processalways', null, data); + }); + return chain; + }, + + // Replaces the settings of each processQueue item that + // are strings starting with an "@", using the remaining + // substring as key for the option map, + // e.g. "@autoUpload" is replaced with options.autoUpload: + _transformProcessQueue: function (options) { + var processQueue = []; + $.each(options.processQueue, function () { + var settings = {}, + action = this.action, + prefix = this.prefix === true ? action : this.prefix; + $.each(this, function (key, value) { + if ($.type(value) === 'string' && + value.charAt(0) === '@') { + settings[key] = options[ + value.slice(1) || (prefix ? prefix + + key.charAt(0).toUpperCase() + key.slice(1) : key) + ]; + } else { + settings[key] = value; + } + + }); + processQueue.push(settings); + }); + options.processQueue = processQueue; + }, + + // Returns the number of files currently in the processsing queue: + processing: function () { + return this._processing; + }, + + // Processes the files given as files property of the data parameter, + // returns a Promise object that allows to bind callbacks: + process: function (data) { + var that = this, + options = $.extend({}, this.options, data); + if (options.processQueue && options.processQueue.length) { + this._transformProcessQueue(options); + if (this._processing === 0) { + this._trigger('processstart'); + } + $.each(data.files, function (index) { + var opts = index ? $.extend({}, options) : options, + func = function () { + if (data.errorThrown) { + return $.Deferred() + .rejectWith(that, [data]).promise(); + } + return that._processFile(opts, data); + }; + opts.index = index; + that._processing += 1; + that._processingQueue = that._processingQueue.pipe(func, func) + .always(function () { + that._processing -= 1; + if (that._processing === 0) { + that._trigger('processstop'); + } + }); + }); + } + return this._processingQueue; + }, + + _create: function () { + this._super(); + this._processing = 0; + this._processingQueue = $.Deferred().resolveWith(this) + .promise(); + } + + }); + +})); diff --git a/common/modules/file/assets/js/jquery.fileupload-ui.js b/common/modules/file/assets/js/jquery.fileupload-ui.js new file mode 100755 index 0000000..26eacb3 --- /dev/null +++ b/common/modules/file/assets/js/jquery.fileupload-ui.js @@ -0,0 +1,710 @@ +/* + * jQuery File Upload User Interface Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'tmpl', + './jquery.fileupload-image', + './jquery.fileupload-audio', + './jquery.fileupload-video', + './jquery.fileupload-validate' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('tmpl') + ); + } else { + // Browser globals: + factory( + window.jQuery, + window.tmpl + ); + } +}(function ($, tmpl) { + 'use strict'; + + $.blueimp.fileupload.prototype._specialOptions.push( + 'filesContainer', + 'uploadTemplateId', + 'downloadTemplateId' + ); + + // The UI version extends the file upload widget + // and adds complete user interface interaction: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // By default, files added to the widget are uploaded as soon + // as the user clicks on the start buttons. To enable automatic + // uploads, set the following option to true: + autoUpload: false, + // The ID of the upload template: + uploadTemplateId: 'template-upload', + // The ID of the download template: + downloadTemplateId: 'template-download', + // The container for the list of files. If undefined, it is set to + // an element with class "files" inside of the widget element: + filesContainer: undefined, + // By default, files are appended to the files container. + // Set the following option to true, to prepend files instead: + prependFiles: false, + // The expected data type of the upload response, sets the dataType + // option of the $.ajax upload requests: + dataType: 'json', + + // Error and info messages: + messages: { + unknownError: 'Unknown error' + }, + + // Function returning the current number of files, + // used by the maxNumberOfFiles validation: + getNumberOfFiles: function () { + return this.filesContainer.children() + .not('.processing').length; + }, + + // Callback to retrieve the list of files from the server response: + getFilesFromResponse: function (data) { + if (data.result && $.isArray(data.result.files)) { + return data.result.files; + } + return []; + }, + + // The add callback is invoked as soon as files are added to the fileupload + // widget (via file input selection, drag & drop or add API call). + // See the basic file upload widget for more information: + add: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var $this = $(this), + that = $this.data('blueimp-fileupload') || + $this.data('fileupload'), + options = that.options; + data.context = that._renderUpload(data.files) + .data('data', data) + .addClass('processing'); + options.filesContainer[ + options.prependFiles ? 'prepend' : 'append' + ](data.context); + that._forceReflow(data.context); + that._transition(data.context); + data.process(function () { + return $this.fileupload('process', data); + }).always(function () { + data.context.each(function (index) { + $(this).find('.size').text( + that._formatFileSize(data.files[index].size) + ); + }).removeClass('processing'); + that._renderPreviews(data); + }).done(function () { + data.context.find('.start').prop('disabled', false); + if ((that._trigger('added', e, data) !== false) && + (options.autoUpload || data.autoUpload) && + data.autoUpload !== false) { + data.submit(); + } + }).fail(function () { + if (data.files.error) { + data.context.each(function (index) { + var error = data.files[index].error; + if (error) { + $(this).find('.error').text(error); + } + }); + } + }); + }, + // Callback for the start of each file upload request: + send: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var that = $(this).data('blueimp-fileupload') || + $(this).data('fileupload'); + if (data.context && data.dataType && + data.dataType.substr(0, 6) === 'iframe') { + // Iframe Transport does not support progress events. + // In lack of an indeterminate progress bar, we set + // the progress to 100%, showing the full animated bar: + data.context + .find('.progress').addClass( + !$.support.transition && 'progress-animated' + ) + .attr('aria-valuenow', 100) + .children().first().css( + 'width', + '100%' + ); + } + return that._trigger('sent', e, data); + }, + // Callback for successful uploads: + done: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var that = $(this).data('blueimp-fileupload') || + $(this).data('fileupload'), + getFilesFromResponse = data.getFilesFromResponse || + that.options.getFilesFromResponse, + files = getFilesFromResponse(data), + template, + deferred; + if (data.context) { + data.context.each(function (index) { + var file = files[index] || + {error: 'Empty file upload result'}; + deferred = that._addFinishedDeferreds(); + that._transition($(this)).done( + function () { + var node = $(this); + template = that._renderDownload([file]) + .replaceAll(node); + that._forceReflow(template); + that._transition(template).done( + function () { + data.context = $(this); + that._trigger('completed', e, data); + that._trigger('finished', e, data); + deferred.resolve(); + } + ); + } + ); + }); + } else { + template = that._renderDownload(files)[ + that.options.prependFiles ? 'prependTo' : 'appendTo' + ](that.options.filesContainer); + that._forceReflow(template); + deferred = that._addFinishedDeferreds(); + that._transition(template).done( + function () { + data.context = $(this); + that._trigger('completed', e, data); + that._trigger('finished', e, data); + deferred.resolve(); + } + ); + } + }, + // Callback for failed (abort or error) uploads: + fail: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var that = $(this).data('blueimp-fileupload') || + $(this).data('fileupload'), + template, + deferred; + if (data.context) { + data.context.each(function (index) { + if (data.errorThrown !== 'abort') { + var file = data.files[index]; + file.error = file.error || data.errorThrown || + data.i18n('unknownError'); + deferred = that._addFinishedDeferreds(); + that._transition($(this)).done( + function () { + var node = $(this); + template = that._renderDownload([file]) + .replaceAll(node); + that._forceReflow(template); + that._transition(template).done( + function () { + data.context = $(this); + that._trigger('failed', e, data); + that._trigger('finished', e, data); + deferred.resolve(); + } + ); + } + ); + } else { + deferred = that._addFinishedDeferreds(); + that._transition($(this)).done( + function () { + $(this).remove(); + that._trigger('failed', e, data); + that._trigger('finished', e, data); + deferred.resolve(); + } + ); + } + }); + } else if (data.errorThrown !== 'abort') { + data.context = that._renderUpload(data.files)[ + that.options.prependFiles ? 'prependTo' : 'appendTo' + ](that.options.filesContainer) + .data('data', data); + that._forceReflow(data.context); + deferred = that._addFinishedDeferreds(); + that._transition(data.context).done( + function () { + data.context = $(this); + that._trigger('failed', e, data); + that._trigger('finished', e, data); + deferred.resolve(); + } + ); + } else { + that._trigger('failed', e, data); + that._trigger('finished', e, data); + that._addFinishedDeferreds().resolve(); + } + }, + // Callback for upload progress events: + progress: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var progress = Math.floor(data.loaded / data.total * 100); + if (data.context) { + data.context.each(function () { + $(this).find('.progress') + .attr('aria-valuenow', progress) + .children().first().css( + 'width', + progress + '%' + ); + }); + } + }, + // Callback for global upload progress events: + progressall: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var $this = $(this), + progress = Math.floor(data.loaded / data.total * 100), + globalProgressNode = $this.find('.fileupload-progress'), + extendedProgressNode = globalProgressNode + .find('.progress-extended'); + if (extendedProgressNode.length) { + extendedProgressNode.html( + ($this.data('blueimp-fileupload') || $this.data('fileupload')) + ._renderExtendedProgress(data) + ); + } + globalProgressNode + .find('.progress') + .attr('aria-valuenow', progress) + .children().first().css( + 'width', + progress + '%' + ); + }, + // Callback for uploads start, equivalent to the global ajaxStart event: + start: function (e) { + if (e.isDefaultPrevented()) { + return false; + } + var that = $(this).data('blueimp-fileupload') || + $(this).data('fileupload'); + that._resetFinishedDeferreds(); + that._transition($(this).find('.fileupload-progress')).done( + function () { + that._trigger('started', e); + } + ); + }, + // Callback for uploads stop, equivalent to the global ajaxStop event: + stop: function (e) { + if (e.isDefaultPrevented()) { + return false; + } + var that = $(this).data('blueimp-fileupload') || + $(this).data('fileupload'), + deferred = that._addFinishedDeferreds(); + $.when.apply($, that._getFinishedDeferreds()) + .done(function () { + that._trigger('stopped', e); + }); + that._transition($(this).find('.fileupload-progress')).done( + function () { + $(this).find('.progress') + .attr('aria-valuenow', '0') + .children().first().css('width', '0%'); + $(this).find('.progress-extended').html(' '); + deferred.resolve(); + } + ); + }, + processstart: function (e) { + if (e.isDefaultPrevented()) { + return false; + } + $(this).addClass('fileupload-processing'); + }, + processstop: function (e) { + if (e.isDefaultPrevented()) { + return false; + } + $(this).removeClass('fileupload-processing'); + }, + // Callback for file deletion: + destroy: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var that = $(this).data('blueimp-fileupload') || + $(this).data('fileupload'), + removeNode = function () { + that._transition(data.context).done( + function () { + $(this).remove(); + that._trigger('destroyed', e, data); + } + ); + }; + if (data.url) { + data.dataType = data.dataType || that.options.dataType; + $.ajax(data).done(removeNode).fail(function () { + that._trigger('destroyfailed', e, data); + }); + } else { + removeNode(); + } + } + }, + + _resetFinishedDeferreds: function () { + this._finishedUploads = []; + }, + + _addFinishedDeferreds: function (deferred) { + if (!deferred) { + deferred = $.Deferred(); + } + this._finishedUploads.push(deferred); + return deferred; + }, + + _getFinishedDeferreds: function () { + return this._finishedUploads; + }, + + // Link handler, that allows to download files + // by drag & drop of the links to the desktop: + _enableDragToDesktop: function () { + var link = $(this), + url = link.prop('href'), + name = link.prop('download'), + type = 'application/octet-stream'; + link.bind('dragstart', function (e) { + try { + e.originalEvent.dataTransfer.setData( + 'DownloadURL', + [type, name, url].join(':') + ); + } catch (ignore) {} + }); + }, + + _formatFileSize: function (bytes) { + if (typeof bytes !== 'number') { + return ''; + } + if (bytes >= 1000000000) { + return (bytes / 1000000000).toFixed(2) + ' GB'; + } + if (bytes >= 1000000) { + return (bytes / 1000000).toFixed(2) + ' MB'; + } + return (bytes / 1000).toFixed(2) + ' KB'; + }, + + _formatBitrate: function (bits) { + if (typeof bits !== 'number') { + return ''; + } + if (bits >= 1000000000) { + return (bits / 1000000000).toFixed(2) + ' Gbit/s'; + } + if (bits >= 1000000) { + return (bits / 1000000).toFixed(2) + ' Mbit/s'; + } + if (bits >= 1000) { + return (bits / 1000).toFixed(2) + ' kbit/s'; + } + return bits.toFixed(2) + ' bit/s'; + }, + + _formatTime: function (seconds) { + var date = new Date(seconds * 1000), + days = Math.floor(seconds / 86400); + days = days ? days + 'd ' : ''; + return days + + ('0' + date.getUTCHours()).slice(-2) + ':' + + ('0' + date.getUTCMinutes()).slice(-2) + ':' + + ('0' + date.getUTCSeconds()).slice(-2); + }, + + _formatPercentage: function (floatValue) { + return (floatValue * 100).toFixed(2) + ' %'; + }, + + _renderExtendedProgress: function (data) { + return this._formatBitrate(data.bitrate) + ' | ' + + this._formatTime( + (data.total - data.loaded) * 8 / data.bitrate + ) + ' | ' + + this._formatPercentage( + data.loaded / data.total + ) + ' | ' + + this._formatFileSize(data.loaded) + ' / ' + + this._formatFileSize(data.total); + }, + + _renderTemplate: function (func, files) { + if (!func) { + return $(); + } + var result = func({ + files: files, + formatFileSize: this._formatFileSize, + options: this.options + }); + if (result instanceof $) { + return result; + } + return $(this.options.templatesContainer).html(result).children(); + }, + + _renderPreviews: function (data) { + data.context.find('.preview').each(function (index, elm) { + $(elm).append(data.files[index].preview); + }); + }, + + _renderUpload: function (files) { + return this._renderTemplate( + this.options.uploadTemplate, + files + ); + }, + + _renderDownload: function (files) { + return this._renderTemplate( + this.options.downloadTemplate, + files + ).find('a[download]').each(this._enableDragToDesktop).end(); + }, + + _startHandler: function (e) { + e.preventDefault(); + var button = $(e.currentTarget), + template = button.closest('.template-upload'), + data = template.data('data'); + button.prop('disabled', true); + if (data && data.submit) { + data.submit(); + } + }, + + _cancelHandler: function (e) { + e.preventDefault(); + var template = $(e.currentTarget) + .closest('.template-upload,.template-download'), + data = template.data('data') || {}; + data.context = data.context || template; + if (data.abort) { + data.abort(); + } else { + data.errorThrown = 'abort'; + this._trigger('fail', e, data); + } + }, + + _deleteHandler: function (e) { + e.preventDefault(); + var button = $(e.currentTarget); + this._trigger('destroy', e, $.extend({ + context: button.closest('.template-download'), + type: 'DELETE' + }, button.data())); + }, + + _forceReflow: function (node) { + return $.support.transition && node.length && + node[0].offsetWidth; + }, + + _transition: function (node) { + var dfd = $.Deferred(); + if ($.support.transition && node.hasClass('fade') && node.is(':visible')) { + node.bind( + $.support.transition.end, + function (e) { + // Make sure we don't respond to other transitions events + // in the container element, e.g. from button elements: + if (e.target === node[0]) { + node.unbind($.support.transition.end); + dfd.resolveWith(node); + } + } + ).toggleClass('in'); + } else { + node.toggleClass('in'); + dfd.resolveWith(node); + } + return dfd; + }, + + _initButtonBarEventHandlers: function () { + var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'), + filesList = this.options.filesContainer; + this._on(fileUploadButtonBar.find('.start'), { + click: function (e) { + e.preventDefault(); + filesList.find('.start').click(); + } + }); + this._on(fileUploadButtonBar.find('.cancel'), { + click: function (e) { + e.preventDefault(); + filesList.find('.cancel').click(); + } + }); + this._on(fileUploadButtonBar.find('.delete'), { + click: function (e) { + e.preventDefault(); + filesList.find('.toggle:checked') + .closest('.template-download') + .find('.delete').click(); + fileUploadButtonBar.find('.toggle') + .prop('checked', false); + } + }); + this._on(fileUploadButtonBar.find('.toggle'), { + change: function (e) { + filesList.find('.toggle').prop( + 'checked', + $(e.currentTarget).is(':checked') + ); + } + }); + }, + + _destroyButtonBarEventHandlers: function () { + this._off( + this.element.find('.fileupload-buttonbar') + .find('.start, .cancel, .delete'), + 'click' + ); + this._off( + this.element.find('.fileupload-buttonbar .toggle'), + 'change.' + ); + }, + + _initEventHandlers: function () { + this._super(); + this._on(this.options.filesContainer, { + 'click .start': this._startHandler, + 'click .cancel': this._cancelHandler, + 'click .delete': this._deleteHandler + }); + this._initButtonBarEventHandlers(); + }, + + _destroyEventHandlers: function () { + this._destroyButtonBarEventHandlers(); + this._off(this.options.filesContainer, 'click'); + this._super(); + }, + + _enableFileInputButton: function () { + this.element.find('.fileinput-button input') + .prop('disabled', false) + .parent().removeClass('disabled'); + }, + + _disableFileInputButton: function () { + this.element.find('.fileinput-button input') + .prop('disabled', true) + .parent().addClass('disabled'); + }, + + _initTemplates: function () { + var options = this.options; + options.templatesContainer = this.document[0].createElement( + options.filesContainer.prop('nodeName') + ); + if (tmpl) { + if (options.uploadTemplateId) { + options.uploadTemplate = tmpl(options.uploadTemplateId); + } + if (options.downloadTemplateId) { + options.downloadTemplate = tmpl(options.downloadTemplateId); + } + } + }, + + _initFilesContainer: function () { + var options = this.options; + if (options.filesContainer === undefined) { + options.filesContainer = this.element.find('.files'); + } else if (!(options.filesContainer instanceof $)) { + options.filesContainer = $(options.filesContainer); + } + }, + + _initSpecialOptions: function () { + this._super(); + this._initFilesContainer(); + this._initTemplates(); + }, + + _create: function () { + this._super(); + this._resetFinishedDeferreds(); + if (!$.support.fileInput) { + this._disableFileInputButton(); + } + }, + + enable: function () { + var wasDisabled = false; + if (this.options.disabled) { + wasDisabled = true; + } + this._super(); + if (wasDisabled) { + this.element.find('input, button').prop('disabled', false); + this._enableFileInputButton(); + } + }, + + disable: function () { + if (!this.options.disabled) { + this.element.find('input, button').prop('disabled', true); + this._disableFileInputButton(); + } + this._super(); + } + + }); + +})); diff --git a/common/modules/file/assets/js/jquery.fileupload-validate.js b/common/modules/file/assets/js/jquery.fileupload-validate.js new file mode 100755 index 0000000..b771386 --- /dev/null +++ b/common/modules/file/assets/js/jquery.fileupload-validate.js @@ -0,0 +1,122 @@ +/* + * jQuery File Upload Validation Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/* global define, require, window */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + './jquery.fileupload-process' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory(require('jquery')); + } else { + // Browser globals: + factory( + window.jQuery + ); + } +}(function ($) { + 'use strict'; + + // Append to the default processQueue: + $.blueimp.fileupload.prototype.options.processQueue.push( + { + action: 'validate', + // Always trigger this action, + // even if the previous action was rejected: + always: true, + // Options taken from the global options map: + acceptFileTypes: '@', + maxFileSize: '@', + minFileSize: '@', + maxNumberOfFiles: '@', + disabled: '@disableValidation' + } + ); + + // The File Upload Validation plugin extends the fileupload widget + // with file validation functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + /* + // The regular expression for allowed file types, matches + // against either file type or file name: + acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, + // The maximum allowed file size in bytes: + maxFileSize: 10000000, // 10 MB + // The minimum allowed file size in bytes: + minFileSize: undefined, // No minimal file size + // The limit of files to be uploaded: + maxNumberOfFiles: 10, + */ + + // Function returning the current number of files, + // has to be overriden for maxNumberOfFiles validation: + getNumberOfFiles: $.noop, + + // Error and info messages: + messages: { + maxNumberOfFiles: 'Maximum number of files exceeded', + acceptFileTypes: 'File type not allowed', + maxFileSize: 'File is too large', + minFileSize: 'File is too small' + } + }, + + processActions: { + + validate: function (data, options) { + if (options.disabled) { + return data; + } + var dfd = $.Deferred(), + settings = this.options, + file = data.files[data.index], + fileSize; + if (options.minFileSize || options.maxFileSize) { + fileSize = file.size; + } + if ($.type(options.maxNumberOfFiles) === 'number' && + (settings.getNumberOfFiles() || 0) + data.files.length > + options.maxNumberOfFiles) { + file.error = settings.i18n('maxNumberOfFiles'); + } else if (options.acceptFileTypes && + !(options.acceptFileTypes.test(file.type) || + options.acceptFileTypes.test(file.name))) { + file.error = settings.i18n('acceptFileTypes'); + } else if (fileSize > options.maxFileSize) { + file.error = settings.i18n('maxFileSize'); + } else if ($.type(fileSize) === 'number' && + fileSize < options.minFileSize) { + file.error = settings.i18n('minFileSize'); + } else { + delete file.error; + } + if (file.error || data.files.error) { + data.files.error = true; + dfd.rejectWith(this, [data]); + } else { + dfd.resolveWith(this, [data]); + } + return dfd.promise(); + } + + } + + }); + +})); diff --git a/common/modules/file/assets/js/jquery.fileupload-video.js b/common/modules/file/assets/js/jquery.fileupload-video.js new file mode 100755 index 0000000..1416e26 --- /dev/null +++ b/common/modules/file/assets/js/jquery.fileupload-video.js @@ -0,0 +1,112 @@ +/* + * jQuery File Upload Video Preview Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window, document */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'load-image', + './jquery.fileupload-process' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('load-image') + ); + } else { + // Browser globals: + factory( + window.jQuery, + window.loadImage + ); + } +}(function ($, loadImage) { + 'use strict'; + + // Prepend to the default processQueue: + $.blueimp.fileupload.prototype.options.processQueue.unshift( + { + action: 'loadVideo', + // Use the action as prefix for the "@" options: + prefix: true, + fileTypes: '@', + maxFileSize: '@', + disabled: '@disableVideoPreview' + }, + { + action: 'setVideo', + name: '@videoPreviewName', + disabled: '@disableVideoPreview' + } + ); + + // The File Upload Video Preview plugin extends the fileupload widget + // with video preview functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // The regular expression for the types of video files to load, + // matched against the file type: + loadVideoFileTypes: /^video\/.*$/ + }, + + _videoElement: document.createElement('video'), + + processActions: { + + // Loads the video file given via data.files and data.index + // as video element if the browser supports playing it. + // Accepts the options fileTypes (regular expression) + // and maxFileSize (integer) to limit the files to load: + loadVideo: function (data, options) { + if (options.disabled) { + return data; + } + var file = data.files[data.index], + url, + video; + if (this._videoElement.canPlayType && + this._videoElement.canPlayType(file.type) && + ($.type(options.maxFileSize) !== 'number' || + file.size <= options.maxFileSize) && + (!options.fileTypes || + options.fileTypes.test(file.type))) { + url = loadImage.createObjectURL(file); + if (url) { + video = this._videoElement.cloneNode(false); + video.src = url; + video.controls = true; + data.video = video; + return data; + } + } + return data; + }, + + // Sets the video element as a property of the file object: + setVideo: function (data, options) { + if (data.video && !options.disabled) { + data.files[data.index][options.name || 'preview'] = data.video; + } + return data; + } + + } + + }); + +})); diff --git a/common/modules/file/assets/js/jquery.fileupload.js b/common/modules/file/assets/js/jquery.fileupload.js new file mode 100755 index 0000000..68d1c4a --- /dev/null +++ b/common/modules/file/assets/js/jquery.fileupload.js @@ -0,0 +1,1477 @@ +/* + * jQuery File Upload Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window, document, location, Blob, FormData */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'jquery.ui.widget' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('./vendor/jquery.ui.widget') + ); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + + // Detect file input support, based on + // http://viljamis.com/blog/2012/file-upload-support-on-mobile/ + $.support.fileInput = !(new RegExp( + // Handle devices which give false positives for the feature detection: + '(Android (1\\.[0156]|2\\.[01]))' + + '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' + + '|(w(eb)?OSBrowser)|(webOS)' + + '|(Kindle/(1\\.0|2\\.[05]|3\\.0))' + ).test(window.navigator.userAgent) || + // Feature detection for all other devices: + $('').prop('disabled')); + + // The FileReader API is not actually used, but works as feature detection, + // as some Safari versions (5?) support XHR file uploads via the FormData API, + // but not non-multipart XHR file uploads. + // window.XMLHttpRequestUpload is not available on IE10, so we check for + // window.ProgressEvent instead to detect XHR2 file upload capability: + $.support.xhrFileUpload = !!(window.ProgressEvent && window.FileReader); + $.support.xhrFormDataFileUpload = !!window.FormData; + + // Detect support for Blob slicing (required for chunked uploads): + $.support.blobSlice = window.Blob && (Blob.prototype.slice || + Blob.prototype.webkitSlice || Blob.prototype.mozSlice); + + // Helper function to create drag handlers for dragover/dragenter/dragleave: + function getDragHandler(type) { + var isDragOver = type === 'dragover'; + return function (e) { + e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; + var dataTransfer = e.dataTransfer; + if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 && + this._trigger( + type, + $.Event(type, {delegatedEvent: e}) + ) !== false) { + e.preventDefault(); + if (isDragOver) { + dataTransfer.dropEffect = 'copy'; + } + } + }; + } + + // The fileupload widget listens for change events on file input fields defined + // via fileInput setting and paste or drop events of the given dropZone. + // In addition to the default jQuery Widget methods, the fileupload widget + // exposes the "add" and "send" methods, to add or directly send files using + // the fileupload API. + // By default, files added via file input selection, paste, drag & drop or + // "add" method are uploaded immediately, but it is possible to override + // the "add" callback option to queue file uploads. + $.widget('blueimp.fileupload', { + + options: { + // The drop target element(s), by the default the complete document. + // Set to null to disable drag & drop support: + dropZone: $(document), + // The paste target element(s), by the default undefined. + // Set to a DOM node or jQuery object to enable file pasting: + pasteZone: undefined, + // The file input field(s), that are listened to for change events. + // If undefined, it is set to the file input fields inside + // of the widget element on plugin initialization. + // Set to null to disable the change listener. + fileInput: undefined, + // By default, the file input field is replaced with a clone after + // each input field change event. This is required for iframe transport + // queues and allows change events to be fired for the same file + // selection, but can be disabled by setting the following option to false: + replaceFileInput: true, + // The parameter name for the file form data (the request argument name). + // If undefined or empty, the name property of the file input field is + // used, or "files[]" if the file input name property is also empty, + // can be a string or an array of strings: + paramName: undefined, + // By default, each file of a selection is uploaded using an individual + // request for XHR type uploads. Set to false to upload file + // selections in one request each: + singleFileUploads: true, + // To limit the number of files uploaded with one XHR request, + // set the following option to an integer greater than 0: + limitMultiFileUploads: undefined, + // The following option limits the number of files uploaded with one + // XHR request to keep the request size under or equal to the defined + // limit in bytes: + limitMultiFileUploadSize: undefined, + // Multipart file uploads add a number of bytes to each uploaded file, + // therefore the following option adds an overhead for each file used + // in the limitMultiFileUploadSize configuration: + limitMultiFileUploadSizeOverhead: 512, + // Set the following option to true to issue all file upload requests + // in a sequential order: + sequentialUploads: false, + // To limit the number of concurrent uploads, + // set the following option to an integer greater than 0: + limitConcurrentUploads: undefined, + // Set the following option to true to force iframe transport uploads: + forceIframeTransport: false, + // Set the following option to the location of a redirect url on the + // origin server, for cross-domain iframe transport uploads: + redirect: undefined, + // The parameter name for the redirect url, sent as part of the form + // data and set to 'redirect' if this option is empty: + redirectParamName: undefined, + // Set the following option to the location of a postMessage window, + // to enable postMessage transport uploads: + postMessage: undefined, + // By default, XHR file uploads are sent as multipart/form-data. + // The iframe transport is always using multipart/form-data. + // Set to false to enable non-multipart XHR uploads: + multipart: true, + // To upload large files in smaller chunks, set the following option + // to a preferred maximum chunk size. If set to 0, null or undefined, + // or the browser does not support the required Blob API, files will + // be uploaded as a whole. + maxChunkSize: undefined, + // When a non-multipart upload or a chunked multipart upload has been + // aborted, this option can be used to resume the upload by setting + // it to the size of the already uploaded bytes. This option is most + // useful when modifying the options object inside of the "add" or + // "send" callbacks, as the options are cloned for each file upload. + uploadedBytes: undefined, + // By default, failed (abort or error) file uploads are removed from the + // global progress calculation. Set the following option to false to + // prevent recalculating the global progress data: + recalculateProgress: true, + // Interval in milliseconds to calculate and trigger progress events: + progressInterval: 100, + // Interval in milliseconds to calculate progress bitrate: + bitrateInterval: 500, + // By default, uploads are started automatically when adding files: + autoUpload: true, + + // Error and info messages: + messages: { + uploadedBytes: 'Uploaded bytes exceed file size' + }, + + // Translation function, gets the message key to be translated + // and an object with context specific data as arguments: + i18n: function (message, context) { + message = this.messages[message] || message.toString(); + if (context) { + $.each(context, function (key, value) { + message = message.replace('{' + key + '}', value); + }); + } + return message; + }, + + // Additional form data to be sent along with the file uploads can be set + // using this option, which accepts an array of objects with name and + // value properties, a function returning such an array, a FormData + // object (for XHR file uploads), or a simple object. + // The form of the first fileInput is given as parameter to the function: + formData: function (form) { + return form.serializeArray(); + }, + + // The add callback is invoked as soon as files are added to the fileupload + // widget (via file input selection, drag & drop, paste or add API call). + // If the singleFileUploads option is enabled, this callback will be + // called once for each file in the selection for XHR file uploads, else + // once for each file selection. + // + // The upload starts when the submit method is invoked on the data parameter. + // The data object contains a files property holding the added files + // and allows you to override plugin options as well as define ajax settings. + // + // Listeners for this callback can also be bound the following way: + // .bind('fileuploadadd', func); + // + // data.submit() returns a Promise object and allows to attach additional + // handlers using jQuery's Deferred callbacks: + // data.submit().done(func).fail(func).always(func); + add: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + if (data.autoUpload || (data.autoUpload !== false && + $(this).fileupload('option', 'autoUpload'))) { + data.process().done(function () { + data.submit(); + }); + } + }, + + // Other callbacks: + + // Callback for the submit event of each file upload: + // submit: function (e, data) {}, // .bind('fileuploadsubmit', func); + + // Callback for the start of each file upload request: + // send: function (e, data) {}, // .bind('fileuploadsend', func); + + // Callback for successful uploads: + // done: function (e, data) {}, // .bind('fileuploaddone', func); + + // Callback for failed (abort or error) uploads: + // fail: function (e, data) {}, // .bind('fileuploadfail', func); + + // Callback for completed (success, abort or error) requests: + // always: function (e, data) {}, // .bind('fileuploadalways', func); + + // Callback for upload progress events: + // progress: function (e, data) {}, // .bind('fileuploadprogress', func); + + // Callback for global upload progress events: + // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func); + + // Callback for uploads start, equivalent to the global ajaxStart event: + // start: function (e) {}, // .bind('fileuploadstart', func); + + // Callback for uploads stop, equivalent to the global ajaxStop event: + // stop: function (e) {}, // .bind('fileuploadstop', func); + + // Callback for change events of the fileInput(s): + // change: function (e, data) {}, // .bind('fileuploadchange', func); + + // Callback for paste events to the pasteZone(s): + // paste: function (e, data) {}, // .bind('fileuploadpaste', func); + + // Callback for drop events of the dropZone(s): + // drop: function (e, data) {}, // .bind('fileuploaddrop', func); + + // Callback for dragover events of the dropZone(s): + // dragover: function (e) {}, // .bind('fileuploaddragover', func); + + // Callback for the start of each chunk upload request: + // chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func); + + // Callback for successful chunk uploads: + // chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func); + + // Callback for failed (abort or error) chunk uploads: + // chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func); + + // Callback for completed (success, abort or error) chunk upload requests: + // chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func); + + // The plugin options are used as settings object for the ajax calls. + // The following are jQuery ajax settings required for the file uploads: + processData: false, + contentType: false, + cache: false, + timeout: 0 + }, + + // A list of options that require reinitializing event listeners and/or + // special initialization code: + _specialOptions: [ + 'fileInput', + 'dropZone', + 'pasteZone', + 'multipart', + 'forceIframeTransport' + ], + + _blobSlice: $.support.blobSlice && function () { + var slice = this.slice || this.webkitSlice || this.mozSlice; + return slice.apply(this, arguments); + }, + + _BitrateTimer: function () { + this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime()); + this.loaded = 0; + this.bitrate = 0; + this.getBitrate = function (now, loaded, interval) { + var timeDiff = now - this.timestamp; + if (!this.bitrate || !interval || timeDiff > interval) { + this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8; + this.loaded = loaded; + this.timestamp = now; + } + return this.bitrate; + }; + }, + + _isXHRUpload: function (options) { + return !options.forceIframeTransport && + ((!options.multipart && $.support.xhrFileUpload) || + $.support.xhrFormDataFileUpload); + }, + + _getFormData: function (options) { + var formData; + if ($.type(options.formData) === 'function') { + return options.formData(options.form); + } + if ($.isArray(options.formData)) { + return options.formData; + } + if ($.type(options.formData) === 'object') { + formData = []; + $.each(options.formData, function (name, value) { + formData.push({name: name, value: value}); + }); + return formData; + } + return []; + }, + + _getTotal: function (files) { + var total = 0; + $.each(files, function (index, file) { + total += file.size || 1; + }); + return total; + }, + + _initProgressObject: function (obj) { + var progress = { + loaded: 0, + total: 0, + bitrate: 0 + }; + if (obj._progress) { + $.extend(obj._progress, progress); + } else { + obj._progress = progress; + } + }, + + _initResponseObject: function (obj) { + var prop; + if (obj._response) { + for (prop in obj._response) { + if (obj._response.hasOwnProperty(prop)) { + delete obj._response[prop]; + } + } + } else { + obj._response = {}; + } + }, + + _onProgress: function (e, data) { + if (e.lengthComputable) { + var now = ((Date.now) ? Date.now() : (new Date()).getTime()), + loaded; + if (data._time && data.progressInterval && + (now - data._time < data.progressInterval) && + e.loaded !== e.total) { + return; + } + data._time = now; + loaded = Math.floor( + e.loaded / e.total * (data.chunkSize || data._progress.total) + ) + (data.uploadedBytes || 0); + // Add the difference from the previously loaded state + // to the global loaded counter: + this._progress.loaded += (loaded - data._progress.loaded); + this._progress.bitrate = this._bitrateTimer.getBitrate( + now, + this._progress.loaded, + data.bitrateInterval + ); + data._progress.loaded = data.loaded = loaded; + data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate( + now, + loaded, + data.bitrateInterval + ); + // Trigger a custom progress event with a total data property set + // to the file size(s) of the current upload and a loaded data + // property calculated accordingly: + this._trigger( + 'progress', + $.Event('progress', {delegatedEvent: e}), + data + ); + // Trigger a global progress event for all current file uploads, + // including ajax calls queued for sequential file uploads: + this._trigger( + 'progressall', + $.Event('progressall', {delegatedEvent: e}), + this._progress + ); + } + }, + + _initProgressListener: function (options) { + var that = this, + xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr(); + // Accesss to the native XHR object is required to add event listeners + // for the upload progress event: + if (xhr.upload) { + $(xhr.upload).bind('progress', function (e) { + var oe = e.originalEvent; + // Make sure the progress event properties get copied over: + e.lengthComputable = oe.lengthComputable; + e.loaded = oe.loaded; + e.total = oe.total; + that._onProgress(e, options); + }); + options.xhr = function () { + return xhr; + }; + } + }, + + _isInstanceOf: function (type, obj) { + // Cross-frame instanceof check + return Object.prototype.toString.call(obj) === '[object ' + type + ']'; + }, + + _initXHRData: function (options) { + var that = this, + formData, + file = options.files[0], + // Ignore non-multipart setting if not supported: + multipart = options.multipart || !$.support.xhrFileUpload, + paramName = $.type(options.paramName) === 'array' ? + options.paramName[0] : options.paramName; + options.headers = $.extend({}, options.headers); + if (options.contentRange) { + options.headers['Content-Range'] = options.contentRange; + } + if (!multipart || options.blob || !this._isInstanceOf('File', file)) { + options.headers['Content-Disposition'] = 'attachment; filename="' + + encodeURI(file.name) + '"'; + } + if (!multipart) { + options.contentType = file.type || 'application/octet-stream'; + options.data = options.blob || file; + } else if ($.support.xhrFormDataFileUpload) { + if (options.postMessage) { + // window.postMessage does not allow sending FormData + // objects, so we just add the File/Blob objects to + // the formData array and let the postMessage window + // create the FormData object out of this array: + formData = this._getFormData(options); + if (options.blob) { + formData.push({ + name: paramName, + value: options.blob + }); + } else { + $.each(options.files, function (index, file) { + formData.push({ + name: ($.type(options.paramName) === 'array' && + options.paramName[index]) || paramName, + value: file + }); + }); + } + } else { + if (that._isInstanceOf('FormData', options.formData)) { + formData = options.formData; + } else { + formData = new FormData(); + $.each(this._getFormData(options), function (index, field) { + formData.append(field.name, field.value); + }); + } + if (options.blob) { + formData.append(paramName, options.blob, file.name); + } else { + $.each(options.files, function (index, file) { + // This check allows the tests to run with + // dummy objects: + if (that._isInstanceOf('File', file) || + that._isInstanceOf('Blob', file)) { + formData.append( + ($.type(options.paramName) === 'array' && + options.paramName[index]) || paramName, + file, + file.uploadName || file.name + ); + } + }); + } + } + options.data = formData; + } + // Blob reference is not needed anymore, free memory: + options.blob = null; + }, + + _initIframeSettings: function (options) { + var targetHost = $('').prop('href', options.url).prop('host'); + // Setting the dataType to iframe enables the iframe transport: + options.dataType = 'iframe ' + (options.dataType || ''); + // The iframe transport accepts a serialized array as form data: + options.formData = this._getFormData(options); + // Add redirect url to form data on cross-domain uploads: + if (options.redirect && targetHost && targetHost !== location.host) { + options.formData.push({ + name: options.redirectParamName || 'redirect', + value: options.redirect + }); + } + }, + + _initDataSettings: function (options) { + if (this._isXHRUpload(options)) { + if (!this._chunkedUpload(options, true)) { + if (!options.data) { + this._initXHRData(options); + } + this._initProgressListener(options); + } + if (options.postMessage) { + // Setting the dataType to postmessage enables the + // postMessage transport: + options.dataType = 'postmessage ' + (options.dataType || ''); + } + } else { + this._initIframeSettings(options); + } + }, + + _getParamName: function (options) { + var fileInput = $(options.fileInput), + paramName = options.paramName; + if (!paramName) { + paramName = []; + fileInput.each(function () { + var input = $(this), + name = input.prop('name') || 'files[]', + i = (input.prop('files') || [1]).length; + while (i) { + paramName.push(name); + i -= 1; + } + }); + if (!paramName.length) { + paramName = [fileInput.prop('name') || 'files[]']; + } + } else if (!$.isArray(paramName)) { + paramName = [paramName]; + } + return paramName; + }, + + _initFormSettings: function (options) { + // Retrieve missing options from the input field and the + // associated form, if available: + if (!options.form || !options.form.length) { + options.form = $(options.fileInput.prop('form')); + // If the given file input doesn't have an associated form, + // use the default widget file input's form: + if (!options.form.length) { + options.form = $(this.options.fileInput.prop('form')); + } + } + options.paramName = this._getParamName(options); + if (!options.url) { + options.url = options.form.prop('action') || location.href; + } + // The HTTP request method must be "POST" or "PUT": + options.type = (options.type || + ($.type(options.form.prop('method')) === 'string' && + options.form.prop('method')) || '' + ).toUpperCase(); + if (options.type !== 'POST' && options.type !== 'PUT' && + options.type !== 'PATCH') { + options.type = 'POST'; + } + if (!options.formAcceptCharset) { + options.formAcceptCharset = options.form.attr('accept-charset'); + } + }, + + _getAJAXSettings: function (data) { + var options = $.extend({}, this.options, data); + this._initFormSettings(options); + this._initDataSettings(options); + return options; + }, + + // jQuery 1.6 doesn't provide .state(), + // while jQuery 1.8+ removed .isRejected() and .isResolved(): + _getDeferredState: function (deferred) { + if (deferred.state) { + return deferred.state(); + } + if (deferred.isResolved()) { + return 'resolved'; + } + if (deferred.isRejected()) { + return 'rejected'; + } + return 'pending'; + }, + + // Maps jqXHR callbacks to the equivalent + // methods of the given Promise object: + _enhancePromise: function (promise) { + promise.success = promise.done; + promise.error = promise.fail; + promise.complete = promise.always; + return promise; + }, + + // Creates and returns a Promise object enhanced with + // the jqXHR methods abort, success, error and complete: + _getXHRPromise: function (resolveOrReject, context, args) { + var dfd = $.Deferred(), + promise = dfd.promise(); + context = context || this.options.context || promise; + if (resolveOrReject === true) { + dfd.resolveWith(context, args); + } else if (resolveOrReject === false) { + dfd.rejectWith(context, args); + } + promise.abort = dfd.promise; + return this._enhancePromise(promise); + }, + + // Adds convenience methods to the data callback argument: + _addConvenienceMethods: function (e, data) { + var that = this, + getPromise = function (args) { + return $.Deferred().resolveWith(that, args).promise(); + }; + data.process = function (resolveFunc, rejectFunc) { + if (resolveFunc || rejectFunc) { + data._processQueue = this._processQueue = + (this._processQueue || getPromise([this])).pipe( + function () { + if (data.errorThrown) { + return $.Deferred() + .rejectWith(that, [data]).promise(); + } + return getPromise(arguments); + } + ).pipe(resolveFunc, rejectFunc); + } + return this._processQueue || getPromise([this]); + }; + data.submit = function () { + if (this.state() !== 'pending') { + data.jqXHR = this.jqXHR = + (that._trigger( + 'submit', + $.Event('submit', {delegatedEvent: e}), + this + ) !== false) && that._onSend(e, this); + } + return this.jqXHR || that._getXHRPromise(); + }; + data.abort = function () { + if (this.jqXHR) { + return this.jqXHR.abort(); + } + this.errorThrown = 'abort'; + that._trigger('fail', null, this); + return that._getXHRPromise(false); + }; + data.state = function () { + if (this.jqXHR) { + return that._getDeferredState(this.jqXHR); + } + if (this._processQueue) { + return that._getDeferredState(this._processQueue); + } + }; + data.processing = function () { + return !this.jqXHR && this._processQueue && that + ._getDeferredState(this._processQueue) === 'pending'; + }; + data.progress = function () { + return this._progress; + }; + data.response = function () { + return this._response; + }; + }, + + // Parses the Range header from the server response + // and returns the uploaded bytes: + _getUploadedBytes: function (jqXHR) { + var range = jqXHR.getResponseHeader('Range'), + parts = range && range.split('-'), + upperBytesPos = parts && parts.length > 1 && + parseInt(parts[1], 10); + return upperBytesPos && upperBytesPos + 1; + }, + + // Uploads a file in multiple, sequential requests + // by splitting the file up in multiple blob chunks. + // If the second parameter is true, only tests if the file + // should be uploaded in chunks, but does not invoke any + // upload requests: + _chunkedUpload: function (options, testOnly) { + options.uploadedBytes = options.uploadedBytes || 0; + var that = this, + file = options.files[0], + fs = file.size, + ub = options.uploadedBytes, + mcs = options.maxChunkSize || fs, + slice = this._blobSlice, + dfd = $.Deferred(), + promise = dfd.promise(), + jqXHR, + upload; + if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) || + options.data) { + return false; + } + if (testOnly) { + return true; + } + if (ub >= fs) { + file.error = options.i18n('uploadedBytes'); + return this._getXHRPromise( + false, + options.context, + [null, 'error', file.error] + ); + } + // The chunk upload method: + upload = function () { + // Clone the options object for each chunk upload: + var o = $.extend({}, options), + currentLoaded = o._progress.loaded; + o.blob = slice.call( + file, + ub, + ub + mcs, + file.type + ); + // Store the current chunk size, as the blob itself + // will be dereferenced after data processing: + o.chunkSize = o.blob.size; + // Expose the chunk bytes position range: + o.contentRange = 'bytes ' + ub + '-' + + (ub + o.chunkSize - 1) + '/' + fs; + // Process the upload data (the blob and potential form data): + that._initXHRData(o); + // Add progress listeners for this chunk upload: + that._initProgressListener(o); + jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) || + that._getXHRPromise(false, o.context)) + .done(function (result, textStatus, jqXHR) { + ub = that._getUploadedBytes(jqXHR) || + (ub + o.chunkSize); + // Create a progress event if no final progress event + // with loaded equaling total has been triggered + // for this chunk: + if (currentLoaded + o.chunkSize - o._progress.loaded) { + that._onProgress($.Event('progress', { + lengthComputable: true, + loaded: ub - o.uploadedBytes, + total: ub - o.uploadedBytes + }), o); + } + options.uploadedBytes = o.uploadedBytes = ub; + o.result = result; + o.textStatus = textStatus; + o.jqXHR = jqXHR; + that._trigger('chunkdone', null, o); + that._trigger('chunkalways', null, o); + if (ub < fs) { + // File upload not yet complete, + // continue with the next chunk: + upload(); + } else { + dfd.resolveWith( + o.context, + [result, textStatus, jqXHR] + ); + } + }) + .fail(function (jqXHR, textStatus, errorThrown) { + o.jqXHR = jqXHR; + o.textStatus = textStatus; + o.errorThrown = errorThrown; + that._trigger('chunkfail', null, o); + that._trigger('chunkalways', null, o); + dfd.rejectWith( + o.context, + [jqXHR, textStatus, errorThrown] + ); + }); + }; + this._enhancePromise(promise); + promise.abort = function () { + return jqXHR.abort(); + }; + upload(); + return promise; + }, + + _beforeSend: function (e, data) { + if (this._active === 0) { + // the start callback is triggered when an upload starts + // and no other uploads are currently running, + // equivalent to the global ajaxStart event: + this._trigger('start'); + // Set timer for global bitrate progress calculation: + this._bitrateTimer = new this._BitrateTimer(); + // Reset the global progress values: + this._progress.loaded = this._progress.total = 0; + this._progress.bitrate = 0; + } + // Make sure the container objects for the .response() and + // .progress() methods on the data object are available + // and reset to their initial state: + this._initResponseObject(data); + this._initProgressObject(data); + data._progress.loaded = data.loaded = data.uploadedBytes || 0; + data._progress.total = data.total = this._getTotal(data.files) || 1; + data._progress.bitrate = data.bitrate = 0; + this._active += 1; + // Initialize the global progress values: + this._progress.loaded += data.loaded; + this._progress.total += data.total; + }, + + _onDone: function (result, textStatus, jqXHR, options) { + var total = options._progress.total, + response = options._response; + if (options._progress.loaded < total) { + // Create a progress event if no final progress event + // with loaded equaling total has been triggered: + this._onProgress($.Event('progress', { + lengthComputable: true, + loaded: total, + total: total + }), options); + } + response.result = options.result = result; + response.textStatus = options.textStatus = textStatus; + response.jqXHR = options.jqXHR = jqXHR; + this._trigger('done', null, options); + }, + + _onFail: function (jqXHR, textStatus, errorThrown, options) { + var response = options._response; + if (options.recalculateProgress) { + // Remove the failed (error or abort) file upload from + // the global progress calculation: + this._progress.loaded -= options._progress.loaded; + this._progress.total -= options._progress.total; + } + response.jqXHR = options.jqXHR = jqXHR; + response.textStatus = options.textStatus = textStatus; + response.errorThrown = options.errorThrown = errorThrown; + this._trigger('fail', null, options); + }, + + _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) { + // jqXHRorResult, textStatus and jqXHRorError are added to the + // options object via done and fail callbacks + this._trigger('always', null, options); + }, + + _onSend: function (e, data) { + if (!data.submit) { + this._addConvenienceMethods(e, data); + } + var that = this, + jqXHR, + aborted, + slot, + pipe, + options = that._getAJAXSettings(data), + send = function () { + that._sending += 1; + // Set timer for bitrate progress calculation: + options._bitrateTimer = new that._BitrateTimer(); + jqXHR = jqXHR || ( + ((aborted || that._trigger( + 'send', + $.Event('send', {delegatedEvent: e}), + options + ) === false) && + that._getXHRPromise(false, options.context, aborted)) || + that._chunkedUpload(options) || $.ajax(options) + ).done(function (result, textStatus, jqXHR) { + that._onDone(result, textStatus, jqXHR, options); + }).fail(function (jqXHR, textStatus, errorThrown) { + that._onFail(jqXHR, textStatus, errorThrown, options); + }).always(function (jqXHRorResult, textStatus, jqXHRorError) { + that._onAlways( + jqXHRorResult, + textStatus, + jqXHRorError, + options + ); + that._sending -= 1; + that._active -= 1; + if (options.limitConcurrentUploads && + options.limitConcurrentUploads > that._sending) { + // Start the next queued upload, + // that has not been aborted: + var nextSlot = that._slots.shift(); + while (nextSlot) { + if (that._getDeferredState(nextSlot) === 'pending') { + nextSlot.resolve(); + break; + } + nextSlot = that._slots.shift(); + } + } + if (that._active === 0) { + // The stop callback is triggered when all uploads have + // been completed, equivalent to the global ajaxStop event: + that._trigger('stop'); + } + }); + return jqXHR; + }; + this._beforeSend(e, options); + if (this.options.sequentialUploads || + (this.options.limitConcurrentUploads && + this.options.limitConcurrentUploads <= this._sending)) { + if (this.options.limitConcurrentUploads > 1) { + slot = $.Deferred(); + this._slots.push(slot); + pipe = slot.pipe(send); + } else { + this._sequence = this._sequence.pipe(send, send); + pipe = this._sequence; + } + // Return the piped Promise object, enhanced with an abort method, + // which is delegated to the jqXHR object of the current upload, + // and jqXHR callbacks mapped to the equivalent Promise methods: + pipe.abort = function () { + aborted = [undefined, 'abort', 'abort']; + if (!jqXHR) { + if (slot) { + slot.rejectWith(options.context, aborted); + } + return send(); + } + return jqXHR.abort(); + }; + return this._enhancePromise(pipe); + } + return send(); + }, + + _onAdd: function (e, data) { + var that = this, + result = true, + options = $.extend({}, this.options, data), + files = data.files, + filesLength = files.length, + limit = options.limitMultiFileUploads, + limitSize = options.limitMultiFileUploadSize, + overhead = options.limitMultiFileUploadSizeOverhead, + batchSize = 0, + paramName = this._getParamName(options), + paramNameSet, + paramNameSlice, + fileSet, + i, + j = 0; + if (!filesLength) { + return false; + } + if (limitSize && files[0].size === undefined) { + limitSize = undefined; + } + if (!(options.singleFileUploads || limit || limitSize) || + !this._isXHRUpload(options)) { + fileSet = [files]; + paramNameSet = [paramName]; + } else if (!(options.singleFileUploads || limitSize) && limit) { + fileSet = []; + paramNameSet = []; + for (i = 0; i < filesLength; i += limit) { + fileSet.push(files.slice(i, i + limit)); + paramNameSlice = paramName.slice(i, i + limit); + if (!paramNameSlice.length) { + paramNameSlice = paramName; + } + paramNameSet.push(paramNameSlice); + } + } else if (!options.singleFileUploads && limitSize) { + fileSet = []; + paramNameSet = []; + for (i = 0; i < filesLength; i = i + 1) { + batchSize += files[i].size + overhead; + if (i + 1 === filesLength || + ((batchSize + files[i + 1].size + overhead) > limitSize) || + (limit && i + 1 - j >= limit)) { + fileSet.push(files.slice(j, i + 1)); + paramNameSlice = paramName.slice(j, i + 1); + if (!paramNameSlice.length) { + paramNameSlice = paramName; + } + paramNameSet.push(paramNameSlice); + j = i + 1; + batchSize = 0; + } + } + } else { + paramNameSet = paramName; + } + data.originalFiles = files; + $.each(fileSet || files, function (index, element) { + var newData = $.extend({}, data); + newData.files = fileSet ? element : [element]; + newData.paramName = paramNameSet[index]; + that._initResponseObject(newData); + that._initProgressObject(newData); + that._addConvenienceMethods(e, newData); + result = that._trigger( + 'add', + $.Event('add', {delegatedEvent: e}), + newData + ); + return result; + }); + return result; + }, + + _replaceFileInput: function (data) { + var input = data.fileInput, + inputClone = input.clone(true), + restoreFocus = input.is(document.activeElement); + // Add a reference for the new cloned file input to the data argument: + data.fileInputClone = inputClone; + $('
').append(inputClone)[0].reset(); + // Detaching allows to insert the fileInput on another form + // without loosing the file input value: + input.after(inputClone).detach(); + // If the fileInput had focus before it was detached, + // restore focus to the inputClone. + if (restoreFocus) { + inputClone.focus(); + } + // Avoid memory leaks with the detached file input: + $.cleanData(input.unbind('remove')); + // Replace the original file input element in the fileInput + // elements set with the clone, which has been copied including + // event handlers: + this.options.fileInput = this.options.fileInput.map(function (i, el) { + if (el === input[0]) { + return inputClone[0]; + } + return el; + }); + // If the widget has been initialized on the file input itself, + // override this.element with the file input clone: + if (input[0] === this.element[0]) { + this.element = inputClone; + } + }, + + _handleFileTreeEntry: function (entry, path) { + var that = this, + dfd = $.Deferred(), + errorHandler = function (e) { + if (e && !e.entry) { + e.entry = entry; + } + // Since $.when returns immediately if one + // Deferred is rejected, we use resolve instead. + // This allows valid files and invalid items + // to be returned together in one set: + dfd.resolve([e]); + }, + successHandler = function (entries) { + that._handleFileTreeEntries( + entries, + path + entry.name + '/' + ).done(function (files) { + dfd.resolve(files); + }).fail(errorHandler); + }, + readEntries = function () { + dirReader.readEntries(function (results) { + if (!results.length) { + successHandler(entries); + } else { + entries = entries.concat(results); + readEntries(); + } + }, errorHandler); + }, + dirReader, entries = []; + path = path || ''; + if (entry.isFile) { + if (entry._file) { + // Workaround for Chrome bug #149735 + entry._file.relativePath = path; + dfd.resolve(entry._file); + } else { + entry.file(function (file) { + file.relativePath = path; + dfd.resolve(file); + }, errorHandler); + } + } else if (entry.isDirectory) { + dirReader = entry.createReader(); + readEntries(); + } else { + // Return an empy list for file system items + // other than files or directories: + dfd.resolve([]); + } + return dfd.promise(); + }, + + _handleFileTreeEntries: function (entries, path) { + var that = this; + return $.when.apply( + $, + $.map(entries, function (entry) { + return that._handleFileTreeEntry(entry, path); + }) + ).pipe(function () { + return Array.prototype.concat.apply( + [], + arguments + ); + }); + }, + + _getDroppedFiles: function (dataTransfer) { + dataTransfer = dataTransfer || {}; + var items = dataTransfer.items; + if (items && items.length && (items[0].webkitGetAsEntry || + items[0].getAsEntry)) { + return this._handleFileTreeEntries( + $.map(items, function (item) { + var entry; + if (item.webkitGetAsEntry) { + entry = item.webkitGetAsEntry(); + if (entry) { + // Workaround for Chrome bug #149735: + entry._file = item.getAsFile(); + } + return entry; + } + return item.getAsEntry(); + }) + ); + } + return $.Deferred().resolve( + $.makeArray(dataTransfer.files) + ).promise(); + }, + + _getSingleFileInputFiles: function (fileInput) { + fileInput = $(fileInput); + var entries = fileInput.prop('webkitEntries') || + fileInput.prop('entries'), + files, + value; + if (entries && entries.length) { + return this._handleFileTreeEntries(entries); + } + files = $.makeArray(fileInput.prop('files')); + if (!files.length) { + value = fileInput.prop('value'); + if (!value) { + return $.Deferred().resolve([]).promise(); + } + // If the files property is not available, the browser does not + // support the File API and we add a pseudo File object with + // the input value as name with path information removed: + files = [{name: value.replace(/^.*\\/, '')}]; + } else if (files[0].name === undefined && files[0].fileName) { + // File normalization for Safari 4 and Firefox 3: + $.each(files, function (index, file) { + file.name = file.fileName; + file.size = file.fileSize; + }); + } + return $.Deferred().resolve(files).promise(); + }, + + _getFileInputFiles: function (fileInput) { + if (!(fileInput instanceof $) || fileInput.length === 1) { + return this._getSingleFileInputFiles(fileInput); + } + return $.when.apply( + $, + $.map(fileInput, this._getSingleFileInputFiles) + ).pipe(function () { + return Array.prototype.concat.apply( + [], + arguments + ); + }); + }, + + _onChange: function (e) { + var that = this, + data = { + fileInput: $(e.target), + form: $(e.target.form) + }; + this._getFileInputFiles(data.fileInput).always(function (files) { + data.files = files; + if (that.options.replaceFileInput) { + that._replaceFileInput(data); + } + if (that._trigger( + 'change', + $.Event('change', {delegatedEvent: e}), + data + ) !== false) { + that._onAdd(e, data); + } + }); + }, + + _onPaste: function (e) { + var items = e.originalEvent && e.originalEvent.clipboardData && + e.originalEvent.clipboardData.items, + data = {files: []}; + if (items && items.length) { + $.each(items, function (index, item) { + var file = item.getAsFile && item.getAsFile(); + if (file) { + data.files.push(file); + } + }); + if (this._trigger( + 'paste', + $.Event('paste', {delegatedEvent: e}), + data + ) !== false) { + this._onAdd(e, data); + } + } + }, + + _onDrop: function (e) { + e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; + var that = this, + dataTransfer = e.dataTransfer, + data = {}; + if (dataTransfer && dataTransfer.files && dataTransfer.files.length) { + e.preventDefault(); + this._getDroppedFiles(dataTransfer).always(function (files) { + data.files = files; + if (that._trigger( + 'drop', + $.Event('drop', {delegatedEvent: e}), + data + ) !== false) { + that._onAdd(e, data); + } + }); + } + }, + + _onDragOver: getDragHandler('dragover'), + + _onDragEnter: getDragHandler('dragenter'), + + _onDragLeave: getDragHandler('dragleave'), + + _initEventHandlers: function () { + if (this._isXHRUpload(this.options)) { + this._on(this.options.dropZone, { + dragover: this._onDragOver, + drop: this._onDrop, + // event.preventDefault() on dragenter is required for IE10+: + dragenter: this._onDragEnter, + // dragleave is not required, but added for completeness: + dragleave: this._onDragLeave + }); + this._on(this.options.pasteZone, { + paste: this._onPaste + }); + } + if ($.support.fileInput) { + this._on(this.options.fileInput, { + change: this._onChange + }); + } + }, + + _destroyEventHandlers: function () { + this._off(this.options.dropZone, 'dragenter dragleave dragover drop'); + this._off(this.options.pasteZone, 'paste'); + this._off(this.options.fileInput, 'change'); + }, + + _setOption: function (key, value) { + var reinit = $.inArray(key, this._specialOptions) !== -1; + if (reinit) { + this._destroyEventHandlers(); + } + this._super(key, value); + if (reinit) { + this._initSpecialOptions(); + this._initEventHandlers(); + } + }, + + _initSpecialOptions: function () { + var options = this.options; + if (options.fileInput === undefined) { + options.fileInput = this.element.is('input[type="file"]') ? + this.element : this.element.find('input[type="file"]'); + } else if (!(options.fileInput instanceof $)) { + options.fileInput = $(options.fileInput); + } + if (!(options.dropZone instanceof $)) { + options.dropZone = $(options.dropZone); + } + if (!(options.pasteZone instanceof $)) { + options.pasteZone = $(options.pasteZone); + } + }, + + _getRegExp: function (str) { + var parts = str.split('/'), + modifiers = parts.pop(); + parts.shift(); + return new RegExp(parts.join('/'), modifiers); + }, + + _isRegExpOption: function (key, value) { + return key !== 'url' && $.type(value) === 'string' && + /^\/.*\/[igm]{0,3}$/.test(value); + }, + + _initDataAttributes: function () { + var that = this, + options = this.options, + data = this.element.data(); + // Initialize options set via HTML5 data-attributes: + $.each( + this.element[0].attributes, + function (index, attr) { + var key = attr.name.toLowerCase(), + value; + if (/^data-/.test(key)) { + // Convert hyphen-ated key to camelCase: + key = key.slice(5).replace(/-[a-z]/g, function (str) { + return str.charAt(1).toUpperCase(); + }); + value = data[key]; + if (that._isRegExpOption(key, value)) { + value = that._getRegExp(value); + } + options[key] = value; + } + } + ); + }, + + _create: function () { + this._initDataAttributes(); + this._initSpecialOptions(); + this._slots = []; + this._sequence = this._getXHRPromise(true); + this._sending = this._active = 0; + this._initProgressObject(this); + this._initEventHandlers(); + }, + + // This method is exposed to the widget API and allows to query + // the number of active uploads: + active: function () { + return this._active; + }, + + // This method is exposed to the widget API and allows to query + // the widget upload progress. + // It returns an object with loaded, total and bitrate properties + // for the running uploads: + progress: function () { + return this._progress; + }, + + // This method is exposed to the widget API and allows adding files + // using the fileupload API. The data parameter accepts an object which + // must have a files property and can contain additional options: + // .fileupload('add', {files: filesList}); + add: function (data) { + var that = this; + if (!data || this.options.disabled) { + return; + } + if (data.fileInput && !data.files) { + this._getFileInputFiles(data.fileInput).always(function (files) { + data.files = files; + that._onAdd(null, data); + }); + } else { + data.files = $.makeArray(data.files); + this._onAdd(null, data); + } + }, + + // This method is exposed to the widget API and allows sending files + // using the fileupload API. The data parameter accepts an object which + // must have a files or fileInput property and can contain additional options: + // .fileupload('send', {files: filesList}); + // The method returns a Promise object for the file upload call. + send: function (data) { + if (data && !this.options.disabled) { + if (data.fileInput && !data.files) { + var that = this, + dfd = $.Deferred(), + promise = dfd.promise(), + jqXHR, + aborted; + promise.abort = function () { + aborted = true; + if (jqXHR) { + return jqXHR.abort(); + } + dfd.reject(null, 'abort', 'abort'); + return promise; + }; + this._getFileInputFiles(data.fileInput).always( + function (files) { + if (aborted) { + return; + } + if (!files.length) { + dfd.reject(); + return; + } + data.files = files; + jqXHR = that._onSend(null, data); + jqXHR.then( + function (result, textStatus, jqXHR) { + dfd.resolve(result, textStatus, jqXHR); + }, + function (jqXHR, textStatus, errorThrown) { + dfd.reject(jqXHR, textStatus, errorThrown); + } + ); + } + ); + return this._enhancePromise(promise); + } + data.files = $.makeArray(data.files); + if (data.files.length) { + return this._onSend(null, data); + } + } + return this._getXHRPromise(false, data && data.context); + } + + }); + +})); diff --git a/common/modules/file/assets/js/jquery.iframe-transport.js b/common/modules/file/assets/js/jquery.iframe-transport.js new file mode 100755 index 0000000..b63a16f --- /dev/null +++ b/common/modules/file/assets/js/jquery.iframe-transport.js @@ -0,0 +1,217 @@ +/* + * jQuery Iframe Transport Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/* global define, require, window, document */ + +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['jquery'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory(require('jquery')); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + + // Helper variable to create unique names for the transport iframes: + var counter = 0; + + // The iframe transport accepts four additional options: + // options.fileInput: a jQuery collection of file input fields + // options.paramName: the parameter name for the file form data, + // overrides the name property of the file input field(s), + // can be a string or an array of strings. + // options.formData: an array of objects with name and value properties, + // equivalent to the return data of .serializeArray(), e.g.: + // [{name: 'a', value: 1}, {name: 'b', value: 2}] + // options.initialIframeSrc: the URL of the initial iframe src, + // by default set to "javascript:false;" + $.ajaxTransport('iframe', function (options) { + if (options.async) { + // javascript:false as initial iframe src + // prevents warning popups on HTTPS in IE6: + /*jshint scripturl: true */ + var initialIframeSrc = options.initialIframeSrc || 'javascript:false;', + /*jshint scripturl: false */ + form, + iframe, + addParamChar; + return { + send: function (_, completeCallback) { + form = $('
'); + form.attr('accept-charset', options.formAcceptCharset); + addParamChar = /\?/.test(options.url) ? '&' : '?'; + // XDomainRequest only supports GET and POST: + if (options.type === 'DELETE') { + options.url = options.url + addParamChar + '_method=DELETE'; + options.type = 'POST'; + } else if (options.type === 'PUT') { + options.url = options.url + addParamChar + '_method=PUT'; + options.type = 'POST'; + } else if (options.type === 'PATCH') { + options.url = options.url + addParamChar + '_method=PATCH'; + options.type = 'POST'; + } + // IE versions below IE8 cannot set the name property of + // elements that have already been added to the DOM, + // so we set the name along with the iframe HTML markup: + counter += 1; + iframe = $( + '' + ).bind('load', function () { + var fileInputClones, + paramNames = $.isArray(options.paramName) ? + options.paramName : [options.paramName]; + iframe + .unbind('load') + .bind('load', function () { + var response; + // Wrap in a try/catch block to catch exceptions thrown + // when trying to access cross-domain iframe contents: + try { + response = iframe.contents(); + // Google Chrome and Firefox do not throw an + // exception when calling iframe.contents() on + // cross-domain requests, so we unify the response: + if (!response.length || !response[0].firstChild) { + throw new Error(); + } + } catch (e) { + response = undefined; + } + // The complete callback returns the + // iframe content document as response object: + completeCallback( + 200, + 'success', + {'iframe': response} + ); + // Fix for IE endless progress bar activity bug + // (happens on form submits to iframe targets): + $('') + .appendTo(form); + window.setTimeout(function () { + // Removing the form in a setTimeout call + // allows Chrome's developer tools to display + // the response result + form.remove(); + }, 0); + }); + form + .prop('target', iframe.prop('name')) + .prop('action', options.url) + .prop('method', options.type); + if (options.formData) { + $.each(options.formData, function (index, field) { + $('') + .prop('name', field.name) + .val(field.value) + .appendTo(form); + }); + } + if (options.fileInput && options.fileInput.length && + options.type === 'POST') { + fileInputClones = options.fileInput.clone(); + // Insert a clone for each file input field: + options.fileInput.after(function (index) { + return fileInputClones[index]; + }); + if (options.paramName) { + options.fileInput.each(function (index) { + $(this).prop( + 'name', + paramNames[index] || options.paramName + ); + }); + } + // Appending the file input fields to the hidden form + // removes them from their original location: + form + .append(options.fileInput) + .prop('enctype', 'multipart/form-data') + // enctype must be set as encoding for IE: + .prop('encoding', 'multipart/form-data'); + // Remove the HTML5 form attribute from the input(s): + options.fileInput.removeAttr('form'); + } + form.submit(); + // Insert the file input fields at their original location + // by replacing the clones with the originals: + if (fileInputClones && fileInputClones.length) { + options.fileInput.each(function (index, input) { + var clone = $(fileInputClones[index]); + // Restore the original name and form properties: + $(input) + .prop('name', clone.prop('name')) + .attr('form', clone.attr('form')); + clone.replaceWith(input); + }); + } + }); + form.append(iframe).appendTo(document.body); + }, + abort: function () { + if (iframe) { + // javascript:false as iframe src aborts the request + // and prevents warning popups on HTTPS in IE6. + // concat is used to avoid the "Script URL" JSLint error: + iframe + .unbind('load') + .prop('src', initialIframeSrc); + } + if (form) { + form.remove(); + } + } + }; + } + }); + + // The iframe transport returns the iframe content document as response. + // The following adds converters from iframe to text, json, html, xml + // and script. + // Please note that the Content-Type for JSON responses has to be text/plain + // or text/html, if the browser doesn't include application/json in the + // Accept header, else IE will show a download dialog. + // The Content-Type for XML responses on the other hand has to be always + // application/xml or text/xml, so IE properly parses the XML response. + // See also + // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation + $.ajaxSetup({ + converters: { + 'iframe text': function (iframe) { + return iframe && $(iframe[0].body).text(); + }, + 'iframe json': function (iframe) { + return iframe && $.parseJSON($(iframe[0].body).text()); + }, + 'iframe html': function (iframe) { + return iframe && $(iframe[0].body).html(); + }, + 'iframe xml': function (iframe) { + var xmlDoc = iframe && iframe[0]; + return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc : + $.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) || + $(xmlDoc.body).html()); + }, + 'iframe script': function (iframe) { + return iframe && $.globalEval($(iframe[0].body).text()); + } + } + }); + +})); diff --git a/common/modules/file/assets/js/vendor/jquery.ui.widget.js b/common/modules/file/assets/js/vendor/jquery.ui.widget.js new file mode 100755 index 0000000..113c1f0 --- /dev/null +++ b/common/modules/file/assets/js/vendor/jquery.ui.widget.js @@ -0,0 +1,572 @@ +/*! jQuery UI - v1.11.4+CommonJS - 2015-08-28 +* http://jqueryui.com +* Includes: widget.js +* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ + +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ "jquery" ], factory ); + + } else if ( typeof exports === "object" ) { + + // Node/CommonJS + factory( require( "jquery" ) ); + + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { +/*! + * jQuery UI Widget 1.11.4 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/jQuery.widget/ + */ + + +var widget_uuid = 0, + widget_slice = Array.prototype.slice; + +$.cleanData = (function( orig ) { + return function( elems ) { + var events, elem, i; + for ( i = 0; (elem = elems[i]) != null; i++ ) { + try { + + // Only trigger remove when necessary to save time + events = $._data( elem, "events" ); + if ( events && events.remove ) { + $( elem ).triggerHandler( "remove" ); + } + + // http://bugs.jquery.com/ticket/8235 + } catch ( e ) {} + } + orig( elems ); + }; +})( $.cleanData ); + +$.widget = function( name, base, prototype ) { + var fullName, existingConstructor, constructor, basePrototype, + // proxiedPrototype allows the provided prototype to remain unmodified + // so that it can be used as a mixin for multiple widgets (#8876) + proxiedPrototype = {}, + namespace = name.split( "." )[ 0 ]; + + name = name.split( "." )[ 1 ]; + fullName = namespace + "-" + name; + + if ( !prototype ) { + prototype = base; + base = $.Widget; + } + + // create selector for plugin + $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { + return !!$.data( elem, fullName ); + }; + + $[ namespace ] = $[ namespace ] || {}; + existingConstructor = $[ namespace ][ name ]; + constructor = $[ namespace ][ name ] = function( options, element ) { + // allow instantiation without "new" keyword + if ( !this._createWidget ) { + return new constructor( options, element ); + } + + // allow instantiation without initializing for simple inheritance + // must use "new" keyword (the code above always passes args) + if ( arguments.length ) { + this._createWidget( options, element ); + } + }; + // extend with the existing constructor to carry over any static properties + $.extend( constructor, existingConstructor, { + version: prototype.version, + // copy the object used to create the prototype in case we need to + // redefine the widget later + _proto: $.extend( {}, prototype ), + // track widgets that inherit from this widget in case this widget is + // redefined after a widget inherits from it + _childConstructors: [] + }); + + basePrototype = new base(); + // we need to make the options hash a property directly on the new instance + // otherwise we'll modify the options hash on the prototype that we're + // inheriting from + basePrototype.options = $.widget.extend( {}, basePrototype.options ); + $.each( prototype, function( prop, value ) { + if ( !$.isFunction( value ) ) { + proxiedPrototype[ prop ] = value; + return; + } + proxiedPrototype[ prop ] = (function() { + var _super = function() { + return base.prototype[ prop ].apply( this, arguments ); + }, + _superApply = function( args ) { + return base.prototype[ prop ].apply( this, args ); + }; + return function() { + var __super = this._super, + __superApply = this._superApply, + returnValue; + + this._super = _super; + this._superApply = _superApply; + + returnValue = value.apply( this, arguments ); + + this._super = __super; + this._superApply = __superApply; + + return returnValue; + }; + })(); + }); + constructor.prototype = $.widget.extend( basePrototype, { + // TODO: remove support for widgetEventPrefix + // always use the name + a colon as the prefix, e.g., draggable:start + // don't prefix for widgets that aren't DOM-based + widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name + }, proxiedPrototype, { + constructor: constructor, + namespace: namespace, + widgetName: name, + widgetFullName: fullName + }); + + // If this widget is being redefined then we need to find all widgets that + // are inheriting from it and redefine all of them so that they inherit from + // the new version of this widget. We're essentially trying to replace one + // level in the prototype chain. + if ( existingConstructor ) { + $.each( existingConstructor._childConstructors, function( i, child ) { + var childPrototype = child.prototype; + + // redefine the child widget using the same prototype that was + // originally used, but inherit from the new version of the base + $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); + }); + // remove the list of existing child constructors from the old constructor + // so the old child constructors can be garbage collected + delete existingConstructor._childConstructors; + } else { + base._childConstructors.push( constructor ); + } + + $.widget.bridge( name, constructor ); + + return constructor; +}; + +$.widget.extend = function( target ) { + var input = widget_slice.call( arguments, 1 ), + inputIndex = 0, + inputLength = input.length, + key, + value; + for ( ; inputIndex < inputLength; inputIndex++ ) { + for ( key in input[ inputIndex ] ) { + value = input[ inputIndex ][ key ]; + if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { + // Clone objects + if ( $.isPlainObject( value ) ) { + target[ key ] = $.isPlainObject( target[ key ] ) ? + $.widget.extend( {}, target[ key ], value ) : + // Don't extend strings, arrays, etc. with objects + $.widget.extend( {}, value ); + // Copy everything else by reference + } else { + target[ key ] = value; + } + } + } + } + return target; +}; + +$.widget.bridge = function( name, object ) { + var fullName = object.prototype.widgetFullName || name; + $.fn[ name ] = function( options ) { + var isMethodCall = typeof options === "string", + args = widget_slice.call( arguments, 1 ), + returnValue = this; + + if ( isMethodCall ) { + this.each(function() { + var methodValue, + instance = $.data( this, fullName ); + if ( options === "instance" ) { + returnValue = instance; + return false; + } + if ( !instance ) { + return $.error( "cannot call methods on " + name + " prior to initialization; " + + "attempted to call method '" + options + "'" ); + } + if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { + return $.error( "no such method '" + options + "' for " + name + " widget instance" ); + } + methodValue = instance[ options ].apply( instance, args ); + if ( methodValue !== instance && methodValue !== undefined ) { + returnValue = methodValue && methodValue.jquery ? + returnValue.pushStack( methodValue.get() ) : + methodValue; + return false; + } + }); + } else { + + // Allow multiple hashes to be passed on init + if ( args.length ) { + options = $.widget.extend.apply( null, [ options ].concat(args) ); + } + + this.each(function() { + var instance = $.data( this, fullName ); + if ( instance ) { + instance.option( options || {} ); + if ( instance._init ) { + instance._init(); + } + } else { + $.data( this, fullName, new object( options, this ) ); + } + }); + } + + return returnValue; + }; +}; + +$.Widget = function( /* options, element */ ) {}; +$.Widget._childConstructors = []; + +$.Widget.prototype = { + widgetName: "widget", + widgetEventPrefix: "", + defaultElement: "
", + options: { + disabled: false, + + // callbacks + create: null + }, + _createWidget: function( options, element ) { + element = $( element || this.defaultElement || this )[ 0 ]; + this.element = $( element ); + this.uuid = widget_uuid++; + this.eventNamespace = "." + this.widgetName + this.uuid; + + this.bindings = $(); + this.hoverable = $(); + this.focusable = $(); + + if ( element !== this ) { + $.data( element, this.widgetFullName, this ); + this._on( true, this.element, { + remove: function( event ) { + if ( event.target === element ) { + this.destroy(); + } + } + }); + this.document = $( element.style ? + // element within the document + element.ownerDocument : + // element is window or document + element.document || element ); + this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); + } + + this.options = $.widget.extend( {}, + this.options, + this._getCreateOptions(), + options ); + + this._create(); + this._trigger( "create", null, this._getCreateEventData() ); + this._init(); + }, + _getCreateOptions: $.noop, + _getCreateEventData: $.noop, + _create: $.noop, + _init: $.noop, + + destroy: function() { + this._destroy(); + // we can probably remove the unbind calls in 2.0 + // all event bindings should go through this._on() + this.element + .unbind( this.eventNamespace ) + .removeData( this.widgetFullName ) + // support: jquery <1.6.3 + // http://bugs.jquery.com/ticket/9413 + .removeData( $.camelCase( this.widgetFullName ) ); + this.widget() + .unbind( this.eventNamespace ) + .removeAttr( "aria-disabled" ) + .removeClass( + this.widgetFullName + "-disabled " + + "ui-state-disabled" ); + + // clean up events and states + this.bindings.unbind( this.eventNamespace ); + this.hoverable.removeClass( "ui-state-hover" ); + this.focusable.removeClass( "ui-state-focus" ); + }, + _destroy: $.noop, + + widget: function() { + return this.element; + }, + + option: function( key, value ) { + var options = key, + parts, + curOption, + i; + + if ( arguments.length === 0 ) { + // don't return a reference to the internal hash + return $.widget.extend( {}, this.options ); + } + + if ( typeof key === "string" ) { + // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } + options = {}; + parts = key.split( "." ); + key = parts.shift(); + if ( parts.length ) { + curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); + for ( i = 0; i < parts.length - 1; i++ ) { + curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; + curOption = curOption[ parts[ i ] ]; + } + key = parts.pop(); + if ( arguments.length === 1 ) { + return curOption[ key ] === undefined ? null : curOption[ key ]; + } + curOption[ key ] = value; + } else { + if ( arguments.length === 1 ) { + return this.options[ key ] === undefined ? null : this.options[ key ]; + } + options[ key ] = value; + } + } + + this._setOptions( options ); + + return this; + }, + _setOptions: function( options ) { + var key; + + for ( key in options ) { + this._setOption( key, options[ key ] ); + } + + return this; + }, + _setOption: function( key, value ) { + this.options[ key ] = value; + + if ( key === "disabled" ) { + this.widget() + .toggleClass( this.widgetFullName + "-disabled", !!value ); + + // If the widget is becoming disabled, then nothing is interactive + if ( value ) { + this.hoverable.removeClass( "ui-state-hover" ); + this.focusable.removeClass( "ui-state-focus" ); + } + } + + return this; + }, + + enable: function() { + return this._setOptions({ disabled: false }); + }, + disable: function() { + return this._setOptions({ disabled: true }); + }, + + _on: function( suppressDisabledCheck, element, handlers ) { + var delegateElement, + instance = this; + + // no suppressDisabledCheck flag, shuffle arguments + if ( typeof suppressDisabledCheck !== "boolean" ) { + handlers = element; + element = suppressDisabledCheck; + suppressDisabledCheck = false; + } + + // no element argument, shuffle and use this.element + if ( !handlers ) { + handlers = element; + element = this.element; + delegateElement = this.widget(); + } else { + element = delegateElement = $( element ); + this.bindings = this.bindings.add( element ); + } + + $.each( handlers, function( event, handler ) { + function handlerProxy() { + // allow widgets to customize the disabled handling + // - disabled as an array instead of boolean + // - disabled class as method for disabling individual parts + if ( !suppressDisabledCheck && + ( instance.options.disabled === true || + $( this ).hasClass( "ui-state-disabled" ) ) ) { + return; + } + return ( typeof handler === "string" ? instance[ handler ] : handler ) + .apply( instance, arguments ); + } + + // copy the guid so direct unbinding works + if ( typeof handler !== "string" ) { + handlerProxy.guid = handler.guid = + handler.guid || handlerProxy.guid || $.guid++; + } + + var match = event.match( /^([\w:-]*)\s*(.*)$/ ), + eventName = match[1] + instance.eventNamespace, + selector = match[2]; + if ( selector ) { + delegateElement.delegate( selector, eventName, handlerProxy ); + } else { + element.bind( eventName, handlerProxy ); + } + }); + }, + + _off: function( element, eventName ) { + eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + + this.eventNamespace; + element.unbind( eventName ).undelegate( eventName ); + + // Clear the stack to avoid memory leaks (#10056) + this.bindings = $( this.bindings.not( element ).get() ); + this.focusable = $( this.focusable.not( element ).get() ); + this.hoverable = $( this.hoverable.not( element ).get() ); + }, + + _delay: function( handler, delay ) { + function handlerProxy() { + return ( typeof handler === "string" ? instance[ handler ] : handler ) + .apply( instance, arguments ); + } + var instance = this; + return setTimeout( handlerProxy, delay || 0 ); + }, + + _hoverable: function( element ) { + this.hoverable = this.hoverable.add( element ); + this._on( element, { + mouseenter: function( event ) { + $( event.currentTarget ).addClass( "ui-state-hover" ); + }, + mouseleave: function( event ) { + $( event.currentTarget ).removeClass( "ui-state-hover" ); + } + }); + }, + + _focusable: function( element ) { + this.focusable = this.focusable.add( element ); + this._on( element, { + focusin: function( event ) { + $( event.currentTarget ).addClass( "ui-state-focus" ); + }, + focusout: function( event ) { + $( event.currentTarget ).removeClass( "ui-state-focus" ); + } + }); + }, + + _trigger: function( type, event, data ) { + var prop, orig, + callback = this.options[ type ]; + + data = data || {}; + event = $.Event( event ); + event.type = ( type === this.widgetEventPrefix ? + type : + this.widgetEventPrefix + type ).toLowerCase(); + // the original event may come from any element + // so we need to reset the target on the new event + event.target = this.element[ 0 ]; + + // copy original event properties over to the new event + orig = event.originalEvent; + if ( orig ) { + for ( prop in orig ) { + if ( !( prop in event ) ) { + event[ prop ] = orig[ prop ]; + } + } + } + + this.element.trigger( event, data ); + return !( $.isFunction( callback ) && + callback.apply( this.element[0], [ event ].concat( data ) ) === false || + event.isDefaultPrevented() ); + } +}; + +$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { + $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { + if ( typeof options === "string" ) { + options = { effect: options }; + } + var hasOptions, + effectName = !options ? + method : + options === true || typeof options === "number" ? + defaultEffect : + options.effect || defaultEffect; + options = options || {}; + if ( typeof options === "number" ) { + options = { duration: options }; + } + hasOptions = !$.isEmptyObject( options ); + options.complete = callback; + if ( options.delay ) { + element.delay( options.delay ); + } + if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { + element[ method ]( options ); + } else if ( effectName !== method && element[ effectName ] ) { + element[ effectName ]( options.duration, options.easing, callback ); + } else { + element.queue(function( next ) { + $( this )[ method ](); + if ( callback ) { + callback.call( element[ 0 ] ); + } + next(); + }); + } + }; +}); + +var widget = $.widget; + + + +})); diff --git a/common/modules/file/config.php b/common/modules/file/config.php new file mode 100755 index 0000000..c1d2298 --- /dev/null +++ b/common/modules/file/config.php @@ -0,0 +1,3 @@ +$w){ + return true; + }else if($height >$h) { + return true; + } + return false; + } + + + private function getUserPath(){ + if(isset(Yii::$app->user->id)){ + return 'user_'.Yii::$app->user->id; + }else { + return 'guest'; + } + } + + private function resizeImg($w, $h, $imageAlias,$imageAliasSave){ + $img = Image::getImagine()->open(Yii::getAlias($imageAlias)); + + $size = $img->getSize(); + + $width = $size->getWidth(); + $height = $size->getHeight(); + + $e_width = $w/$h; + $e_height = $h/$w; + + $e1_width = $width/$height; + $e1_height = $height/$width; + + + + if($e_width<$e1_width){ + + $new_width = $width*($e_width/$e1_width); + + $y = 0; + $x = $width/ 2-($new_width/2); + $width = $new_width; + + }else { + + $new_height = $height*($e_height/$e1_height); + $x = 0; + $y = $height/2-($new_height/2); + $height = $new_height; + } + + + + + Image::crop($imageAlias, $width, $height,[$x,$y]) + ->save(Yii::getAlias($imageAliasSave), ['quality' => + 100]); + + + $imagine = new Imagine(); + $imagine->open($imageAliasSave) + ->resize(new Box($w, $h)) + ->save($imageAliasSave, array('flatten' => false)); + + + + } + + private function deleteImages($old_img){ + + if(!empty($old_img) && file_exists($_SERVER['DOCUMENT_ROOT'].$old_img)){ + + $rootDir = explode("/", $old_img); + + $row = $_SERVER['DOCUMENT_ROOT'].'/'.$rootDir[1].'/'.$rootDir[2].'/'.$rootDir[3].'/'; + + $allFiles = scandir($row); + + $allFiles = array_slice($allFiles, 2); + + foreach($allFiles as $oldFile){ + + unlink($row.$oldFile); + + } + + } + } + + public function actionDeleteImage(){ + + $this->enableCsrfValidation = false; + + $request = Yii::$app->request->post(); + + if($request){ + if ($request['old_img']) { + $this->deleteImages($request['old_img']); + } + if(isset($request['action']) && $request['action']=='save'){ + $object = str_replace('-', '\\',$request['model']); + $model = new $object; + $model = $model->findOne($request['id']); + $model->$request['field'] = $request['new_url']; + $model->save(); + } + } + + } + + + public function actionDownloadPhoto() + { + + $model = new ImageSizerForm(); + + $request = Yii::$app->request->post(); + + if ($request) { + + $model->multi = isset($request['multi'])? 1 : 0; + + $model->file = UploadedFile::getInstance($model, 'file'); + + $md5_file = md5_file($model->file->tempName).rand(1, 1000); + + $imgDir = Yii::getAlias('@storage/'.$this->getUserPath().'/'.$md5_file.'/'); + + $imageOrigAlias = Yii::getAlias($imgDir.'original'.'.'.$model->file->extension); + + if(!is_dir($imgDir)) { + mkdir($imgDir, 0755, true); + } + + $model->file->saveAs($imageOrigAlias); + + + if(isset($request['size'] )){ + + $request['size'] = ArrayHelper::toArray(json_decode($request['size'])); + + foreach($request['size'] as $size){ + if($size['width'] && $size['height']){ + + $imageAlias = Yii::getAlias($imgDir.$size['width'].'x'.$size['height'].'.'.$model->file->extension); + + $imageLink = '/storage/'.$this->getUserPath().'/'.$md5_file.'/'.$size['width'].'x'.$size['height'].'.'.$model->file->extension; + + $this->resizeImg($size['width'], $size['height'], $imageOrigAlias,$imageAlias); + + } + } + + } else { + + $imageLink = '/storage/'.$this->getUserPath().'/'.$md5_file.'/'.'original'.'.'.$model->file->extension; + + } + + + if($model->multi){ + $view = $this->renderPartial('/_gallery_item', [ + 'item' => ['image'=>$imageLink], + 'field'=>$request['field'] + ]); + return json_encode(['link'=>$imageLink, + 'view' =>$view, + + ]); + + + } else { + $view = $this->renderPartial('/_one_item', [ + 'item' => ['image'=>$imageLink], + 'field'=>$request['field'] + ]); + return json_encode(['link'=>$imageLink, + 'view' =>$view, + ]); + } + + + } + } + + + public function getex($filename) { + $array = explode(".", $filename); + return array_pop($array); + } + + + public function actionImagesUpload(){ + + if($_FILES['upload']) + { + if (($_FILES['upload'] == "none") OR (empty($_FILES['upload']['name'])) ) + { + $message = "Вы не выбрали файл"; + } + else if ($_FILES['upload']["size"] == 0 OR $_FILES['upload']["size"] > 2050000) + { + $message = "Размер файла не соответствует нормам"; + } + else if (($_FILES['upload']["type"] != "image/jpeg") AND ($_FILES['upload']["type"] != "image/jpeg") AND ($_FILES['upload']["type"] != "image/png") AND ($_FILES['upload']['type'] != 'image/gif')) + { + $message = "Допускается загрузка только картинок JPG и PNG."; + } + else if (!is_uploaded_file($_FILES['upload']["tmp_name"])) + { + $message = "Что-то пошло не так. Попытайтесь загрузить файл ещё раз."; + } + else{ + $filename = $_FILES['upload']['name']; + $name =$_FILES['upload']['name'].'.'.$this->getex($filename); + + $path = "../../storage/".$this->getUserPath()."/images/"; + if(!is_dir($path)) { + mkdir($path, 0755, true); + } + + + + move_uploaded_file($_FILES['upload']['tmp_name'], $path.$name); + + $full_path = '/storage/'.$this->getUserPath().'/images/'.$name; + + $message = "Файл ".$_FILES['upload']['name']." загружен"; + + + } + $callback = $_REQUEST['CKEditorFuncNum']; + echo ''; + } + } + + +} \ No newline at end of file diff --git a/common/modules/file/models/ImageSizerForm.php b/common/modules/file/models/ImageSizerForm.php new file mode 100755 index 0000000..b891ab0 --- /dev/null +++ b/common/modules/file/models/ImageSizerForm.php @@ -0,0 +1,38 @@ + 255], + [['model', 'form',], 'string'], + [['file','img','price_list'], 'file'], + ]; + } +} \ No newline at end of file diff --git a/common/modules/file/views/_gallery_item.php b/common/modules/file/views/_gallery_item.php new file mode 100755 index 0000000..9aea75e --- /dev/null +++ b/common/modules/file/views/_gallery_item.php @@ -0,0 +1,9 @@ + + +
+ + +
\ No newline at end of file diff --git a/common/modules/file/views/_one_item.php b/common/modules/file/views/_one_item.php new file mode 100755 index 0000000..fed9ba9 --- /dev/null +++ b/common/modules/file/views/_one_item.php @@ -0,0 +1,17 @@ + + +
+ +
+ + +
+ + 'thumbnail']) ?> + +
+ diff --git a/common/modules/file/widgets/ImageUploader.php b/common/modules/file/widgets/ImageUploader.php new file mode 100755 index 0000000..ec7545b --- /dev/null +++ b/common/modules/file/widgets/ImageUploader.php @@ -0,0 +1,63 @@ +render('image_sizer', + [ + 'model'=>$this->model, + 'size' => $this->size, + 'field' => $this->field, + 'height' => $this->height, + 'width' => $this->width, + 'multi' => $this->multi, + 'name' => $this->name, + 'remover' => $this->remover + ]); + + } + + public function getGallery(){ + if($this->gallery){ + $array = explode(",", $this->gallery); + if(count($array) > 1){ + array_pop($array); + } + return $array; + } else { + return array(); + } + + } + +} \ No newline at end of file diff --git a/common/modules/file/widgets/views/image_sizer.php b/common/modules/file/widgets/views/image_sizer.php new file mode 100755 index 0000000..eb63a87 --- /dev/null +++ b/common/modules/file/widgets/views/image_sizer.php @@ -0,0 +1,203 @@ +tableSchema->primaryKey[0]; + +?> + + +
+ + "{$field}_picture_link"]) ?> + + + + + + +
+
+ + $field): ?> + + + + $field):?> + $field),'#',['class'=>'thumbnail']) ?> + +
+
+ +
+
+ + + + + $field, 'data-url'=>Yii::$app->getUrlManager()->createUrl('file/uploader/download-photo')]);?> + +
+ + + + + + + + + + + + + + + + + + $field, 'data-url'=>Yii::$app->getUrlManager()->createUrl('file/uploader/download-photo'), 'multiple'=> 'multiple' ]);?> + + + "{$field}_picture_link"]) ?> + + + + +
+ context->getGallery() as $image){ + echo $this->render('@common/modules/file/views/_gallery_item', [ 'item' => ['image'=>$image]]); + } + ?> +
+ + + diff --git a/common/modules/language/behaviors/LanguageBehavior.php b/common/modules/language/behaviors/LanguageBehavior.php index 7267e5a..b59057e 100755 --- a/common/modules/language/behaviors/LanguageBehavior.php +++ b/common/modules/language/behaviors/LanguageBehavior.php @@ -21,28 +21,28 @@ { /** - * @var ActiveRecord $object_lang Empty language model for $owner + * @var ActiveRecord $objectLang Empty language model for $owner */ - public $object_lang; + public $objectLang; /** - * @var ActiveRecord[] $model_langs + * @var ActiveRecord[] $modelLangs */ - public $model_langs = []; + public $modelLangs = []; - private $_owner_key; + private $ownerKey; - private $_lang_key; + private $langKey; /** - * @var Transaction $_transaction + * @var Transaction $transaction */ - private $_transaction; + private $transaction; /** - * @var bool $_transaction_status + * @var bool $transactionStatus */ - private $_transaction_status = false; + private $transactionStatus = false; public function events() { @@ -60,8 +60,8 @@ */ public function getOwnerKey():string { - if(!empty( $this->_owner_key )) { - return $this->_owner_key; + if(!empty( $this->ownerKey )) { + return $this->ownerKey; } else { return $this->owner->primaryKey()[ 0 ]; } @@ -74,7 +74,7 @@ */ public function setOwnerKey(string $value) { - $this->_owner_key = $value; + $this->ownerKey = $value; } /** @@ -83,8 +83,8 @@ */ public function getLangKey():string { - if(!empty( $this->_lang_key )) { - return $this->_lang_key; + if(!empty( $this->langKey )) { + return $this->langKey; } else { $owner = $this->owner; return $owner::getTableSchema()->name . '_id'; @@ -98,7 +98,7 @@ */ public function setLangKey(string $value) { - $this->_lang_key = $value; + $this->langKey = $value; } /** @@ -110,17 +110,17 @@ */ public function attach($owner) { - if(empty( $this->object_lang )) { - $this->object_lang = $owner::className() . 'Lang'; - } elseif(!is_string($this->object_lang)) { + if(empty( $this->objectLang )) { + $this->objectLang = $owner::className() . 'Lang'; + } elseif(!is_string($this->objectLang)) { throw new InvalidConfigException('Object lang must be fully classified namespaced classname'); } try { - $this->object_lang = \Yii::createObject($this->object_lang); + $this->objectLang = \Yii::createObject($this->objectLang); } catch(\ReflectionException $exception) { throw new InvalidConfigException('Object lang must be fully classified namespaced classname'); } - if(( !$owner instanceof ActiveRecord ) || ( !$this->object_lang instanceof ActiveRecord )) { + if(( !$owner instanceof ActiveRecord ) || ( !$this->objectLang instanceof ActiveRecord )) { throw new InvalidConfigException('Object lang must be fully classified namespaced classname'); } parent::attach($owner); @@ -132,9 +132,9 @@ */ public function getLangs() { - $object_lang = $this->object_lang; + $objectLang = $this->objectLang; $owner = $this->owner; - return $owner->hasMany($object_lang::className(), [ $this->getLangKey() => $this->getOwnerKey() ]) + return $owner->hasMany($objectLang::className(), [ $this->getLangKey() => $this->getOwnerKey() ]) ->indexBy('language_id'); } @@ -149,12 +149,12 @@ public function getLang(int $language_id = NULL) { if(empty( $language_id )) { - $language_id = Language::getCurrent()->language_id; + $language_id = Language::getCurrent()->id; } - $object_lang = $this->object_lang; - $table_name = $object_lang::getTableSchema()->name; + $objectLang = $this->objectLang; + $table_name = $objectLang::getTableSchema()->name; $owner = $this->owner; - return $owner->hasOne($object_lang::className(), [ $this->getLangKey() => $this->getOwnerKey() ]) + return $owner->hasOne($objectLang::className(), [ $this->getLangKey() => $this->getOwnerKey() ]) ->where([ $table_name . '.language_id' => $language_id ]); } @@ -168,10 +168,10 @@ $owner = $this->owner; $languages = Language::find() ->where([ 'status' => true ]) - ->orderBy([ 'language_id' => SORT_ASC ]) + ->orderBy([ 'id' => SORT_ASC ]) ->asArray() ->column(); - $object_lang = $this->object_lang; + $objectLang = $this->objectLang; $owner_key = $this->getOwnerKey(); $langs = []; if(!$owner->isNewRecord) { @@ -183,13 +183,13 @@ foreach($languages as $language) { if(!array_key_exists($language, $langs)) { $langs[ $language ] = \Yii::createObject([ - 'class' => $object_lang::className(), + 'class' => $objectLang::className(), 'language_id' => $language, $this->getLangKey() => ( $owner->isNewRecord ? NULL : $owner->$owner_key ), ]); } } - $this->model_langs = $langs; + $this->modelLangs = $langs; } /** @@ -199,10 +199,10 @@ */ public function loadLangs(Request $request) { - foreach($request->post($this->object_lang->formName(), []) as $lang => $value) { - if(!empty( $this->model_langs[ $lang ] )) { - $this->model_langs[ $lang ]->attributes = $value; - $this->model_langs[ $lang ]->language_id = $lang; + foreach($request->post($this->objectLang->formName(), []) as $lang => $value) { + if(!empty( $this->modelLangs[ $lang ] )) { + $this->modelLangs[ $lang ]->attributes = $value; + $this->modelLangs[ $lang ]->language_id = $lang; } } } @@ -220,8 +220,8 @@ // } $lang_key = $this->getLangKey(); $owner_key = $this->getOwnerKey(); - $model_langs = $this->model_langs; - foreach($model_langs as $model_lang) { + $modelLangs = $this->modelLangs; + foreach($modelLangs as $model_lang) { $model_lang->$lang_key = $owner->$owner_key; } return true; @@ -234,8 +234,8 @@ public function saveLangs() { $success = true; - $model_langs = $this->model_langs; - foreach($model_langs as $model_lang) { + $modelLangs = $this->modelLangs; + foreach($modelLangs as $model_lang) { if($model_lang->save() === false) { $success = false; } @@ -250,7 +250,7 @@ */ $owner = $this->owner; $db = $owner::getDb(); - $this->_transaction = $db->beginTransaction(); + $this->transaction = $db->beginTransaction(); if($owner->hasAttribute('remote_id') && empty( $owner->remote_id )) { $owner->remote_id = strval(microtime(true) * 10000); } @@ -258,17 +258,17 @@ public function afterSave($event) { - if(!empty( $this->model_langs )) { + if(!empty( $this->modelLangs )) { if($this->linkLangs() && $this->saveLangs()) { - $this->_transaction->commit(); - $this->_transaction_status = true; + $this->transaction->commit(); + $this->transactionStatus = true; } else { - $this->_transaction->rollBack(); - $this->_transaction_status = false; + $this->transaction->rollBack(); + $this->transactionStatus = false; } } else { - $this->_transaction->commit(); - $this->_transaction_status = true; + $this->transaction->commit(); + $this->transactionStatus = true; } } @@ -277,6 +277,6 @@ */ public function getTransactionStatus():bool { - return $this->_transaction_status; + return $this->transactionStatus; } } \ No newline at end of file diff --git a/common/modules/language/components/LanguageRequest.php b/common/modules/language/components/LanguageRequest.php index 382ab69..dc31a2a 100755 --- a/common/modules/language/components/LanguageRequest.php +++ b/common/modules/language/components/LanguageRequest.php @@ -9,24 +9,24 @@ class LanguageRequest extends Request { - private $_language_url; + private $languageUrl; public function getLanguageUrl() { - if($this->_language_url === NULL) { - $this->_language_url = $this->getUrl(); + if($this->languageUrl === NULL) { + $this->languageUrl = $this->getUrl(); - $url_list = explode('/', $this->_language_url); + $url_list = explode('/', $this->languageUrl); $language_url = isset( $url_list[ 1 ] ) ? $url_list[ 1 ] : NULL; Language::setCurrent($language_url); - if($language_url !== NULL && $language_url === Language::getCurrent()->url && strpos($this->_language_url, Language::getCurrent()->url) === 1) { - $this->_language_url = substr($this->_language_url, strlen(Language::getCurrent()->url) + 1); + if($language_url !== NULL && $language_url === Language::getCurrent()->url && strpos($this->languageUrl, Language::getCurrent()->url) === 1) { + $this->languageUrl = substr($this->languageUrl, strlen(Language::getCurrent()->url) + 1); } } - return $this->_language_url; + return $this->languageUrl; } protected function resolvePathInfo() diff --git a/common/modules/language/migrations/m160829_104745_create_table_language.php b/common/modules/language/migrations/m160829_104745_create_table_language.php index be16514..051d84e 100755 --- a/common/modules/language/migrations/m160829_104745_create_table_language.php +++ b/common/modules/language/migrations/m160829_104745_create_table_language.php @@ -7,22 +7,25 @@ public function up() { - $this->createTable('{{%language}}', [ - 'language_id' => $this->primaryKey(), - 'url' => $this->string() - ->notNull(), - 'local' => $this->string() - ->notNull(), - 'name' => $this->string() - ->notNull(), - 'default' => $this->boolean() - ->notNull() - ->defaultValue(false), - 'date_create' => $this->integer() - ->notNull(), - 'date_update' => $this->integer() - ->notNull(), - ]); + $this->createTable( + '{{%language}}', + [ + 'id' => $this->primaryKey(), + 'url' => $this->string() + ->notNull(), + 'local' => $this->string() + ->notNull(), + 'name' => $this->string() + ->notNull(), + 'default' => $this->boolean() + ->notNull() + ->defaultValue(false), + 'created_at' => $this->integer() + ->notNull(), + 'updated_at' => $this->integer() + ->notNull(), + ] + ); } public function down() diff --git a/common/modules/language/migrations/m160829_105345_add_default_languages.php b/common/modules/language/migrations/m160829_105345_add_default_languages.php index 91fba66..d6d3a67 100755 --- a/common/modules/language/migrations/m160829_105345_add_default_languages.php +++ b/common/modules/language/migrations/m160829_105345_add_default_languages.php @@ -7,43 +7,50 @@ public function up() { - $this->batchInsert('{{%language}}', [ - 'language_id', - 'url', - 'local', - 'name', - 'default', - 'date_create', - 'date_update', - ], [ + $this->batchInsert( + '{{%language}}', [ - 1, - 'en', - 'en-EN', - 'English', - 0, - time(), - time(), + 'id', + 'url', + 'local', + 'name', + 'default', + 'created_at', + 'updated_at', ], [ - 2, - 'ru', - 'ru-RU', - 'Русский', - 1, - time(), - time(), - ], - ]); + [ + 1, + 'en', + 'en-EN', + 'English', + 0, + time(), + time(), + ], + [ + 2, + 'ru', + 'ru-RU', + 'Русский', + 1, + time(), + time(), + ], + ] + ); } public function down() { - $this->delete('{{%language}}', [ - 'language_id' => [ - 1, - 2, - ], - ]); + $this->delete( + '{{%language}}', + [ + 'id' => [ + 1, + 2, + ], + ] + ); } } diff --git a/common/modules/language/migrations/m160901_140639_add_ukrainian_language.php b/common/modules/language/migrations/m160901_140639_add_ukrainian_language.php index 8b6c4d4..e3c40a5 100755 --- a/common/modules/language/migrations/m160901_140639_add_ukrainian_language.php +++ b/common/modules/language/migrations/m160901_140639_add_ukrainian_language.php @@ -7,29 +7,33 @@ public function up() { - $this->batchInsert('{{%language}}', [ - 'language_id', - 'url', - 'local', - 'name', - 'default', - 'date_create', - 'date_update', - ], [ + $this->batchInsert( + '{{%language}}', [ - 3, - 'ua', - 'ua-UA', - 'Українська', - 0, - time(), - time(), + 'id', + 'url', + 'local', + 'name', + 'default', + 'created_at', + 'updated_at', ], - ]); + [ + [ + 3, + 'ua', + 'ua-UA', + 'Українська', + 0, + time(), + time(), + ], + ] + ); } public function down() { - $this->delete('{{%language}}', [ 'language_id' => [ 3 ] ]); + $this->delete('{{%language}}', [ 'id' => [ 3 ] ]); } } diff --git a/common/modules/language/models/Language.php b/common/modules/language/models/Language.php index c2c29e9..2de4a9c 100755 --- a/common/modules/language/models/Language.php +++ b/common/modules/language/models/Language.php @@ -7,13 +7,14 @@ /** * This is the model class for table "language". - * @property integer $language_id + * + * @property integer $id * @property string $url * @property string $local * @property string $name * @property boolean $default - * @property integer $date_create - * @property integer $date_update + * @property integer $created_at + * @property integer $updated_at */ class Language extends ActiveRecord { @@ -21,7 +22,7 @@ /** * @var null|self */ - public static $current = NULL; + public static $current = null; /** * @inheritdoc @@ -41,11 +42,11 @@ 'class' => 'yii\behaviors\TimestampBehavior', 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => [ - 'date_create', - 'date_update', + 'created_at', + 'updated_at', ], ActiveRecord::EVENT_BEFORE_UPDATE => [ - 'date_update', + 'updated_at', ], ], ], @@ -63,8 +64,8 @@ 'url', 'local', 'name', - 'date_create', - 'date_update', + 'created_at', + 'updated_at', ], 'required', ], @@ -74,8 +75,8 @@ ], [ [ - 'date_create', - 'date_update', + 'created_at', + 'updated_at', ], 'integer', ], @@ -97,23 +98,24 @@ public function attributeLabels() { return [ - 'language_id' => Yii::t('app', 'Language ID'), + 'id' => Yii::t('app', 'Language ID'), 'url' => Yii::t('app', 'Url'), 'local' => Yii::t('app', 'Local'), 'name' => Yii::t('app', 'Name'), 'default' => Yii::t('app', 'Default'), - 'date_create' => Yii::t('app', 'Date Create'), - 'date_update' => Yii::t('app', 'Date Update'), + 'created_at' => Yii::t('app', 'Date Create'), + 'updated_at' => Yii::t('app', 'Date Update'), ]; } /** * Get current language + * * @return null|Language */ public static function getCurrent() { - if(self::$current === NULL) { + if (self::$current === null) { self::$current = self::getDefaultLanguage(); } return self::$current; @@ -124,15 +126,16 @@ * * @param null|string $url Language url param */ - public static function setCurrent($url = NULL) + public static function setCurrent($url = null) { $language = self::getLanguageByUrl($url); - self::$current = ( $language === NULL ) ? self::getDefaultLanguage() : $language; + self::$current = ( $language === null ) ? self::getDefaultLanguage() : $language; Yii::$app->language = self::$current->local; } /** * Get default language + * * @return null|Language */ public static function getDefaultLanguage() @@ -153,10 +156,10 @@ * * @return null|Language */ - public static function getLanguageByUrl($url = NULL) + public static function getLanguageByUrl($url = null) { - if($url === NULL) { - return NULL; + if ($url === null) { + return null; } else { /** * @var null|Language $language @@ -164,8 +167,8 @@ $language = self::find() ->where([ 'url' => $url ]) ->one(); - if($language === NULL) { - return NULL; + if ($language === null) { + return null; } else { return $language; } diff --git a/common/modules/language/readme.txt b/common/modules/language/readme.txt index bc0b380..d4118b6 100755 --- a/common/modules/language/readme.txt +++ b/common/modules/language/readme.txt @@ -41,7 +41,7 @@ public function behaviors() { return [ 'language' => [ 'class' => LanguageBehavior::className(), - 'object_lang' => {TableLang}::className() // optional, default to {TableLang}::className() + 'objectLang' => {TableLang}::className() // optional, default to {TableLang}::className() 'ownerKey' => {Table}->id //optional, default to {Table}->primaryKey()[0] 'langKey' => {TableLang}->table_id //optional, default to {Table}->tableName().'_id' ], @@ -51,10 +51,10 @@ public function behaviors() { * * From language behavior * * @property {TableLang} $lang * @property {TableLang}[] $langs - * @property {TableLang} $object_lang + * @property {TableLang} $objectLang * @property string $ownerKey * @property string $langKey - * @property {TableLang}[] $model_langs + * @property {TableLang}[] $modelLangs * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey(string $value) @@ -79,7 +79,7 @@ public function behaviors() { 5. Добавить поля в форму (к примеру через Bootstrap Tabs). В наличии: LanguageForm::widget([ - 'model_langs' => {TableLang}[], + 'modelLangs' => {TableLang}[], 'formView' => string, 'form' => ActiveForm, ]); diff --git a/common/modules/language/widgets/LanguageForm.php b/common/modules/language/widgets/LanguageForm.php index 9afab8c..bbd2c97 100755 --- a/common/modules/language/widgets/LanguageForm.php +++ b/common/modules/language/widgets/LanguageForm.php @@ -12,9 +12,9 @@ { /** - * @var ActiveRecord[] $model_langs + * @var ActiveRecord[] $modelLangs */ - public $model_langs = []; + public $modelLangs = []; /** * @var string $formView @@ -22,14 +22,14 @@ public $formView; /** - * @var string $id_prefix + * @var string $idPrefix */ - public $id_prefix = 'lang'; + public $idPrefix = 'lang'; /** * @var ActiveForm $form */ - private $_form; + private $form; /** * @var Language[] $languages @@ -42,7 +42,7 @@ if($this->formView === NULL) { throw new InvalidConfigException('Form view must be set'); } - if(empty( $this->model_langs ) || !is_array($this->model_langs)) { + if(empty( $this->modelLangs ) || !is_array($this->modelLangs)) { throw new InvalidConfigException('Language models must be passed'); } if(empty( $this->getForm() )) { @@ -51,7 +51,7 @@ $this->languages = Language::find() ->where([ 'status' => true ]) ->orderBy([ 'default' => SORT_DESC ]) - ->indexBy('language_id') + ->indexBy('id') ->all(); } @@ -60,19 +60,19 @@ return $this->render('language_form_frame', [ 'languages' => $this->languages, 'form_view' => $this->formView, - 'model_langs' => $this->model_langs, + 'modelLangs' => $this->modelLangs, 'form' => $this->getForm(), - 'id_prefix' => $this->id_prefix, + 'idPrefix' => $this->idPrefix, ]); } public function getForm(): ActiveForm { - return $this->_form; + return $this->form; } public function setForm(ActiveForm $value) { - $this->_form = $value; + $this->form = $value; } } \ No newline at end of file diff --git a/common/modules/language/widgets/LanguagePicker.php b/common/modules/language/widgets/LanguagePicker.php index 399f04d..324ad84 100755 --- a/common/modules/language/widgets/LanguagePicker.php +++ b/common/modules/language/widgets/LanguagePicker.php @@ -20,8 +20,8 @@ 'languages' => Language::find() ->where([ '!=', - 'language_id', - Language::getCurrent()->language_id, + 'id', + Language::getCurrent()->id, ]) ->all(), ]); diff --git a/common/modules/language/widgets/views/language_form_frame.php b/common/modules/language/widgets/views/language_form_frame.php index d1d3ce2..6907059 100755 --- a/common/modules/language/widgets/views/language_form_frame.php +++ b/common/modules/language/widgets/views/language_form_frame.php @@ -8,10 +8,10 @@ /** * @var Language[] $languages * @var string $form_view - * @var ActiveRecord $model_langs + * @var ActiveRecord $modelLangs * @var ActiveForm $form * @var View $this - * @var string $id_prefix + * @var string $idPrefix */ ?>
@@ -21,13 +21,13 @@
diff --git a/common/modules/product/views/product-unit/index.php b/common/modules/product/views/product-unit/index.php index 6832fa7..2ffa3e7 100755 --- a/common/modules/product/views/product-unit/index.php +++ b/common/modules/product/views/product-unit/index.php @@ -36,8 +36,8 @@ ], ], [ - 'attribute' => 'name', - 'value' => 'lang.name', + 'attribute' => 'title', + 'value' => 'lang.title', ], 'lang.short', [ 'class' => 'yii\grid\ActionColumn' ], diff --git a/common/modules/product/views/product-unit/update.php b/common/modules/product/views/product-unit/update.php index 0c676b8..d299575 100755 --- a/common/modules/product/views/product-unit/update.php +++ b/common/modules/product/views/product-unit/update.php @@ -8,18 +8,18 @@ /** * @var View $this * @var ProductUnit $model - * @var ProductUnitLang[] $model_langs + * @var ProductUnitLang[] $modelLangs */ $this->title = Yii::t('product', 'Update {modelClass}: ', [ 'modelClass' => 'Product Unit', - ]) . $model->lang->name; + ]) . $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('product', 'Product Units'), 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->lang->name, + 'label' => $model->lang->title, 'url' => [ 'view', 'id' => $model->product_unit_id, @@ -33,7 +33,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?>
diff --git a/common/modules/product/views/product-unit/view.php b/common/modules/product/views/product-unit/view.php index 0c29ac9..732ae11 100755 --- a/common/modules/product/views/product-unit/view.php +++ b/common/modules/product/views/product-unit/view.php @@ -10,7 +10,7 @@ * @var ProductUnit $model */ - $this->title = $model->lang->name; + $this->title = $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('product', 'Product Units'), 'url' => [ 'index' ], @@ -43,7 +43,7 @@ 'attributes' => [ 'product_unit_id', 'is_default:boolean', - 'lang.name', + 'lang.title', 'lang.short', ], ]) ?> diff --git a/common/modules/product/views/variant/_form.php b/common/modules/product/views/variant/_form.php index 18f3512..94d8cb5 100755 --- a/common/modules/product/views/variant/_form.php +++ b/common/modules/product/views/variant/_form.php @@ -17,7 +17,7 @@ /** * @var View $this * @var ProductVariant $model - * @var ProductVariantLang[] $model_langs + * @var ProductVariantLang[] $modelLangs * @var ActiveQuery $groups * @var ProductStock[] $stocks * @var ActiveForm $form @@ -41,10 +41,12 @@ $(".dynamicform_wrapper").on("limitReached", function(e, item) { ?>
- 'dynamic-form', - 'options' => [ 'enctype' => 'multipart/form-data' ], - ]); ?> + 'dynamic-form', + 'options' => [ 'enctype' => 'multipart/form-data' ], + ] + ); ?> field($model, 'product_id') ->hiddenInput() @@ -57,56 +59,63 @@ $(".dynamicform_wrapper").on("limitReached", function(e, item) { field($model, 'price_old') ->textarea(); ?> field($model, 'imagesUpload[]') - ->widget(\kartik\file\FileInput::className(), [ - 'language' => 'ru', - 'options' => [ - 'accept' => 'image/*', - 'multiple' => true, - ], - 'pluginOptions' => [ - 'allowedFileExtensions' => [ - 'jpg', - 'gif', - 'png', + ->widget( + \kartik\file\FileInput::className(), + [ + 'language' => 'ru', + 'options' => [ + 'accept' => 'image/*', + 'multiple' => true, ], - 'initialPreview' => !empty( $model->imagesHTML ) ? $model->imagesHTML : [], - 'initialPreviewConfig' => $model->imagesConfig, - 'overwriteInitial' => false, - 'showRemove' => false, - 'showUpload' => false, - 'uploadAsync' => !empty( $model->product_variant_id ), - 'previewFileType' => 'image', - ], - ]); ?> + 'pluginOptions' => [ + 'allowedFileExtensions' => [ + 'jpg', + 'gif', + 'png', + ], + 'initialPreview' => !empty( $model->imagesHTML ) ? $model->imagesHTML : [], + 'initialPreviewConfig' => $model->imagesConfig, + 'overwriteInitial' => false, + 'showRemove' => false, + 'showUpload' => false, + 'uploadAsync' => !empty( $model->product_variant_id ), + 'previewFileType' => 'image', + ], + ] + ); ?> - $model_langs, - 'formView' => '@common/modules/product/views/variant/_form_language', - 'form' => $form, - ]) ?> + $modelLangs, + 'formView' => '@common/modules/product/views/variant/_form_language', + 'form' => $form, + ] + ) ?> - 'dynamicform_wrapper', - // required: only alphanumeric characters plus "_" [A-Za-z0-9_] - 'widgetBody' => '.container-items', - // required: css class selector - 'widgetItem' => '.item', - // required: css class - 'limit' => 10, - // the maximum times, an element can be added (default 999) - 'min' => 0, - // 0 or 1 (default 1) - 'insertButton' => '.add-item', - // css class - 'deleteButton' => '.remove-item', - // css class - 'model' => $stocks[ 0 ], - 'formId' => 'dynamic-form', - 'formFields' => [ - 'quantity', - 'name', - ], - ]); ?> + 'dynamicform_wrapper', + // required: only alphanumeric characters plus "_" [A-Za-z0-9_] + 'widgetBody' => '.container-items', + // required: css class selector + 'widgetItem' => '.item', + // required: css class + 'limit' => 10, + // the maximum times, an element can be added (default 999) + 'min' => 0, + // 0 or 1 (default 1) + 'insertButton' => '.add-item', + // css class + 'deleteButton' => '.remove-item', + // css class + 'model' => $stocks[ 0 ], + 'formId' => 'dynamic-form', + 'formFields' => [ + 'quantity', + 'title', + ], + ] + ); ?>
@@ -119,12 +128,12 @@ $(".dynamicform_wrapper").on("limitReached", function(e, item) {
- $stock): ?> + $stock): ?>
isNewRecord) { + if (!$stock->isNewRecord) { echo Html::activeHiddenInput($stock, "[{$i}]stock_id"); } ?> @@ -134,7 +143,7 @@ $(".dynamicform_wrapper").on("limitReached", function(e, item) { ->textInput([ 'maxlength' => true ]) ?>
- field($stock, "[{$i}]name") + field($stock, "[{$i}]title") ->textInput([ 'maxlength' => true ]) ?>
@@ -151,32 +160,49 @@ $(".dynamicform_wrapper").on("limitReached", function(e, item) { field($model, 'product_unit_id') - ->dropDownList(ArrayHelper::map(ProductUnit::find() - ->with('lang') - ->all(), 'product_unit_id', 'lang.name'), [ - 'prompt' => Yii::t('product', 'Unit'), - ]) + ->dropDownList( + ArrayHelper::map( + ProductUnit::find() + ->with('lang') + ->all(), + 'id', + 'lang.title' + ), + [ + 'prompt' => Yii::t('product', 'Unit'), + ] + ) ->label(Yii::t('product', 'Unit')) ?> - with('lang') - ->all() as $group) { + with('lang') + ->all() as $group) { /** * @var TaxGroup $group */ echo $form->field($model, 'options') - ->checkboxList(ArrayHelper::map($group->getOptions() - ->with('lang') - ->all(), 'tax_option_id', 'lang.value'), [ - 'multiple' => true, - 'unselect' => NULL, - ]) - ->label($group->lang->name); + ->checkboxList( + ArrayHelper::map( + $group->getOptions() + ->with('lang') + ->all(), + 'tax_option_id', + 'lang.value' + ), + [ + 'multiple' => true, + 'unselect' => null, + ] + ) + ->label($group->lang->title); } } ?>
- isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?> + isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), + [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ] + ) ?>
diff --git a/common/modules/product/views/variant/_form_language.php b/common/modules/product/views/variant/_form_language.php index e109e1b..4c180a8 100755 --- a/common/modules/product/views/variant/_form_language.php +++ b/common/modules/product/views/variant/_form_language.php @@ -11,5 +11,5 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']name') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> \ No newline at end of file diff --git a/common/modules/product/views/variant/create.php b/common/modules/product/views/variant/create.php index 3a90c1b..cc6b3f4 100755 --- a/common/modules/product/views/variant/create.php +++ b/common/modules/product/views/variant/create.php @@ -11,7 +11,7 @@ /** * @var View $this * @var ProductVariant $model - * @var ProductVariantLang[] $model_langs + * @var ProductVariantLang[] $modelLangs * @var ActiveQuery $groups * @var ProductStock[] $stocks * @var Product $product @@ -22,17 +22,17 @@ 'url' => [ '/product/manage/index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $product->lang->name, + 'label' => $product->lang->title, 'url' => [ '/product/manage/view', - 'id' => $product->product_id, + 'id' => $product->id, ], ]; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('product', 'Variants'), 'url' => [ 'index', - 'product_id' => $product->product_id, + 'product_id' => $product->id, ], ]; $this->params[ 'breadcrumbs' ][] = $this->title; @@ -41,12 +41,15 @@

title) ?>

- render('_form', [ - 'model' => $model, - 'model_langs' => $model_langs, - 'groups' => $groups, - 'stocks' => $stocks, - 'product' => $product, - ]) ?> + render( + '_form', + [ + 'model' => $model, + 'modelLangs' => $modelLangs, + 'groups' => $groups, + 'stocks' => $stocks, + 'product' => $product, + ] + ) ?>
diff --git a/common/modules/product/views/variant/index.php b/common/modules/product/views/variant/index.php index edfabcf..727cd59 100755 --- a/common/modules/product/views/variant/index.php +++ b/common/modules/product/views/variant/index.php @@ -15,16 +15,16 @@ * @var Product $product */ - $this->title = Yii::t('product', 'Variants for ') . $product->lang->name; + $this->title = Yii::t('product', 'Variants for ') . $product->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('product', 'Products'), 'url' => [ '/product/manage/index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $product->lang->name, + 'label' => $product->lang->title, 'url' => [ '/product/manage/view', - 'id' => $product->product_id, + 'id' => $product->id, ], ]; $this->params[ 'breadcrumbs' ][] = \Yii::t('product', 'Variants'); @@ -34,61 +34,87 @@

title) ?>

- $product->product_id, - ]), [ 'class' => 'btn btn-success' ]) ?> + $product->id, + ] + ), + [ 'class' => 'btn btn-success' ] + ) ?>

- $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - 'product_variant_id', - [ - 'attribute' => 'variant_name', - 'value' => 'lang.name', - ], - 'sku', - 'price', - 'price_old', - 'stock', - 'image.imageUrl:image', - [ - 'class' => 'yii\grid\ActionColumn', - 'buttons' => [ - 'view' => function($url, $model) { - return Html::a('', Url::to([ - 'view', - 'product_id' => $model->product_id, - 'id' => $model->product_variant_id, - ]), [ - 'title' => \Yii::t('app', "Просмотр"), - ]); - }, - 'update' => function($url, $model) { - return Html::a('', Url::to([ - 'update', - 'product_id' => $model->product_id, - 'id' => $model->product_variant_id, - ]), [ - 'title' => \Yii::t('app', "Редактировать"), - ]); - }, - 'delete' => function($url, $model) { - - return Html::a('', Url::to([ - 'delete', - 'product_id' => $model->product_id, - 'id' => $model->product_variant_id, - ]), [ - 'title' => Yii::t('yii', 'Delete'), - 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'), - 'data-method' => 'post', - ]); - - }, + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + 'product_variant_id', + [ + 'attribute' => 'variantName', + 'value' => 'lang.title', + ], + 'sku', + 'price', + 'price_old', + 'stock', + 'image.imageUrl:image', + [ + 'class' => 'yii\grid\ActionColumn', + 'buttons' => [ + 'view' => function ($url, $model) { + return Html::a( + '', + Url::to( + [ + 'view', + 'product_id' => $model->product_id, + 'id' => $model->product_variant_id, + ] + ), + [ + 'title' => \Yii::t('app', "Просмотр"), + ] + ); + }, + 'update' => function ($url, $model) { + return Html::a( + '', + Url::to( + [ + 'update', + 'product_id' => $model->product_id, + 'id' => $model->product_variant_id, + ] + ), + [ + 'title' => \Yii::t('app', "Редактировать"), + ] + ); + }, + 'delete' => function ($url, $model) { + + return Html::a( + '', + Url::to( + [ + 'delete', + 'product_id' => $model->product_id, + 'id' => $model->product_variant_id, + ] + ), + [ + 'title' => Yii::t('yii', 'Delete'), + 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'), + 'data-method' => 'post', + ] + ); + + }, + ], ], ], - ], - ]); ?> + ] + ); ?>
diff --git a/common/modules/product/views/variant/update.php b/common/modules/product/views/variant/update.php index 2abda8a..b4d8000 100755 --- a/common/modules/product/views/variant/update.php +++ b/common/modules/product/views/variant/update.php @@ -12,38 +12,46 @@ /** * @var View $this * @var ProductVariant $model - * @var ProductVariantLang[] $model_langs + * @var ProductVariantLang[] $modelLangs * @var ActiveQuery $groups * @var ProductStock[] $stocks * @var Product $product */ - $this->title = Yii::t('product', 'Update {modelClass}: ', [ - 'modelClass' => 'Product', - ]) . ' ' . $model->lang->name; + $this->title = Yii::t( + 'product', + 'Update {modelClass}: ', + [ + 'modelClass' => 'Product', + ] + ) . ' ' . $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('product', 'Products'), 'url' => [ '/product/manage/index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->product->lang->name, + 'label' => $model->product->lang->title, 'url' => [ '/product/manage/view', - 'id' => $model->product->product_id, + 'id' => $model->product->id, ], ]; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('product', 'Variants'), - 'url' => Url::to([ - 'index', - 'product_id' => $model->product->product_id, - ]), + 'url' => Url::to( + [ + 'index', + 'product_id' => $model->product->id, + ] + ), ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => Yii::t('product', $model->lang->name), - 'url' => Url::to([ - 'view', - 'id' => $model->product_variant_id, - ]), + 'label' => Yii::t('product', $model->lang->title), + 'url' => Url::to( + [ + 'view', + 'id' => $model->product_variant_id, + ] + ), ]; $this->params[ 'breadcrumbs' ][] = Yii::t('product', 'Update'); ?> @@ -51,12 +59,15 @@

title) ?>

- render('_form', [ - 'model' => $model, - 'model_langs' => $model_langs, - 'groups' => $groups, - 'stocks' => $stocks, - 'product' => $product, - ]) ?> + render( + '_form', + [ + 'model' => $model, + 'modelLangs' => $modelLangs, + 'groups' => $groups, + 'stocks' => $stocks, + 'product' => $product, + ] + ) ?>
diff --git a/common/modules/product/views/variant/view.php b/common/modules/product/views/variant/view.php index f666b45..aa05ea8 100755 --- a/common/modules/product/views/variant/view.php +++ b/common/modules/product/views/variant/view.php @@ -12,30 +12,30 @@ * @var TaxGroup[] $properties */ - $this->title = $model->lang->name; + $this->title = $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('product', 'Products'), 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->product->lang->name, + 'label' => $model->product->lang->title, 'url' => [ 'view', - 'id' => $model->product->product_id, + 'id' => $model->product->id, ], ]; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('product', 'Variants'), - 'url' => [ '/product/variant?product_id=' . $model->product->product_id ], + 'url' => [ '/product/variant?product_id=' . $model->product->id ], ]; $this->params[ 'breadcrumbs' ][] = $this->title; $properties_string = ''; - foreach($properties as $property) { + foreach ($properties as $property) { $options_string = ''; - foreach($property->options as $option) { + foreach ($property->options as $option) { $options_string .= Html::tag('li', $option->lang->value); } - $properties_string .= Html::tag('p', $property->lang->name) . Html::tag('ul', $options_string); + $properties_string .= Html::tag('p', $property->lang->title) . Html::tag('ul', $options_string); } ?>
@@ -43,47 +43,60 @@

title) ?>

- $model->product_variant_id, - ], [ 'class' => 'btn btn-primary' ]) ?> - $model->product_variant_id, - ], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'), - 'method' => 'post', + $model->product_variant_id, ], - ]) ?> -

- - $model, - 'attributes' => [ - 'product_variant_id', - 'lang.name', - 'sku', - 'price', - 'price_old', - 'stock', - 'productUnit.lang.name', + [ 'class' => 'btn btn-primary' ] + ) ?> + 'product_id', - 'value' => Html::a($model->product->fullname, [ - '/product/manage/view', - 'id' => $model->product_id, - ]), - 'format' => 'html', + 'delete', + 'id' => $model->product_variant_id, ], - 'image.imageUrl:image', [ - 'label' => \Yii::t('app', 'Properties'), - 'value' => $properties_string, - 'format' => 'html', + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ] + ) ?> +

+ + $model, + 'attributes' => [ + 'product_variant_id', + 'lang.title', + 'sku', + 'price', + 'price_old', + 'stock', + 'productUnit.lang.title', + [ + 'attribute' => 'product_id', + 'value' => Html::a( + $model->product->fullname, + [ + '/product/manage/view', + 'id' => $model->id, + ] + ), + 'format' => 'html', + ], + 'image.imageUrl:image', + [ + 'label' => \Yii::t('app', 'Properties'), + 'value' => $properties_string, + 'format' => 'html', + ], ], - ], - ]) ?> + ] + ) ?>
diff --git a/common/modules/product/widgets/views/brandsCarousel.php b/common/modules/product/widgets/views/brandsCarousel.php index 427e51d..600a469 100755 --- a/common/modules/product/widgets/views/brandsCarousel.php +++ b/common/modules/product/widgets/views/brandsCarousel.php @@ -12,7 +12,7 @@ diff --git a/common/modules/product/widgets/views/product_smart.php b/common/modules/product/widgets/views/product_smart.php index 3392303..d7987cb 100755 --- a/common/modules/product/widgets/views/product_smart.php +++ b/common/modules/product/widgets/views/product_smart.php @@ -11,7 +11,7 @@
- lang->name, Url::to([ + lang->title, Url::to([ 'catalog/product', 'product' => $product->lang->alias, ]), [ 'class' => 'btn-product-details' ]) ?> @@ -22,8 +22,8 @@ 'product' => $product->lang->alias, ]) ?>"> enabledVariants[ 0 ]->imageUrl, 'list', [ - 'alt' => $product->category->lang->name . ' ' . $product->fullname, - 'title' => $product->category->lang->name . ' ' . $product->fullname, + 'alt' => $product->category->lang->title . ' ' . $product->fullname, + 'title' => $product->category->lang->title . ' ' . $product->fullname, 'class' => 'selected', ]) ?> @@ -55,11 +55,11 @@
    -
  • Бренд: brand->lang->name ?>
  • +
  • Бренд: brand->lang->title ?>
  • - getActiveProperties($product->category->category_id) as $group): ?> + getActiveProperties($product->category->id) as $group): ?>
  • - name ?> _options as $option ) : ?> value ?> + title ?> options as $option ) : ?> value ?>
  • diff --git a/common/modules/product/widgets/views/submenu.php b/common/modules/product/widgets/views/submenu.php index 1fe7fee..d6950b4 100755 --- a/common/modules/product/widgets/views/submenu.php +++ b/common/modules/product/widgets/views/submenu.php @@ -7,7 +7,7 @@ ?> diff --git a/common/modules/rubrication/controllers/TaxGroupController.php b/common/modules/rubrication/controllers/TaxGroupController.php index efc7f95..ac267d9 100755 --- a/common/modules/rubrication/controllers/TaxGroupController.php +++ b/common/modules/rubrication/controllers/TaxGroupController.php @@ -78,7 +78,7 @@ } return $this->render('create', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, ]); } @@ -106,7 +106,7 @@ } return $this->render('update', [ 'model' => $model, - 'model_langs' => $model->model_langs, + 'modelLangs' => $model->modelLangs, 'level' => $level, ]); } diff --git a/common/modules/rubrication/controllers/TaxOptionController.php b/common/modules/rubrication/controllers/TaxOptionController.php index 4f6d7ca..e85c9e2 100755 --- a/common/modules/rubrication/controllers/TaxOptionController.php +++ b/common/modules/rubrication/controllers/TaxOptionController.php @@ -34,6 +34,7 @@ /** * Lists all TaxOption models. + * * @return mixed */ public function actionIndex() @@ -61,6 +62,7 @@ /** * Creates a new TaxOption model. * If creation is successful, the browser will be redirected to the 'view' page. + * * @return mixed */ public function actionCreate() @@ -74,8 +76,8 @@ $model->loadLangs(\Yii::$app->request); if($model->save() && $model->transactionStatus) { return is_null(Yii::$app->request->post('create_and_new')) ? $this->redirect([ - 'view', - 'id' => $model->tax_option_id, + 'index', + 'group' => $group->tax_group_id, ]) : $this->redirect(array_merge([ 'create' ], Yii::$app->request->queryParams)); } } @@ -83,9 +85,9 @@ $model->parent_id = Yii::$app->request->queryParams[ 'parent' ]; } return $this->render('create', [ - 'model' => $model, - 'model_langs' => $model->model_langs, - 'group' => $group, + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'group' => $group, ]); } @@ -108,15 +110,15 @@ // ->rebuildMP($model->tax_group_id); if($model->save() && $model->transactionStatus) { return $this->redirect([ - 'view', - 'id' => $model->tax_option_id, + 'index', + 'group' => $group->tax_group_id, ]); } } return $this->render('update', [ - 'model' => $model, - 'model_langs' => $model->model_langs, - 'group' => $group, + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'group' => $group, ]); } diff --git a/common/modules/rubrication/models/TaxGroup.php b/common/modules/rubrication/models/TaxGroup.php index bf9fdeb..092dc77 100755 --- a/common/modules/rubrication/models/TaxGroup.php +++ b/common/modules/rubrication/models/TaxGroup.php @@ -24,10 +24,10 @@ * * From language behavior * * @property TaxGroupLang $lang * @property TaxGroupLang[] $langs - * @property TaxGroupLang $object_lang + * @property TaxGroupLang $objectLang * @property string $ownerKey * @property string $langKey - * @property TaxGroupLang[] $model_langs + * @property TaxGroupLang[] $modelLangs * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey( string $value ) @@ -46,9 +46,9 @@ { /** - * @var TaxOption[] $_options + * @var TaxOption[] $options */ - public $_options = []; + public $options = []; /** * @inheritdoc @@ -114,7 +114,7 @@ public function getCategories() { - return $this->hasMany(Category::className(), [ 'category_id' => 'category_id' ]) + return $this->hasMany(Category::className(), [ 'id' => 'category_id' ]) ->viaTable('tax_group_to_category', [ 'tax_group_id' => 'tax_group_id' ]); } @@ -156,7 +156,7 @@ /** * @var TaxGroupLang $lang */ - $lang = $this->getLang($default_lang->language_id) + $lang = $this->getLang($default_lang->id) ->one(); return $lang->alias; } diff --git a/common/modules/rubrication/models/TaxGroupLang.php b/common/modules/rubrication/models/TaxGroupLang.php index 117498b..443420d 100755 --- a/common/modules/rubrication/models/TaxGroupLang.php +++ b/common/modules/rubrication/models/TaxGroupLang.php @@ -10,7 +10,7 @@ * This is the model class for table "tax_group_lang". * @property integer $tax_group_id * @property integer $language_id - * @property string $name + * @property string $title * @property string $alias * @property string $description * @property Language $language @@ -40,9 +40,6 @@ return [ 'slug' => [ 'class' => 'common\behaviors\Slug', - 'in_attribute' => 'name', - 'out_attribute' => 'alias', - 'translit' => true, ], ]; } @@ -54,7 +51,7 @@ { return [ [ - [ 'name' ], + [ 'title' ], 'required', ], [ @@ -63,7 +60,7 @@ ], [ [ - 'name', + 'title', 'alias', ], 'string', @@ -86,7 +83,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], + 'targetAttribute' => [ 'language_id' => 'id' ], ], [ [ 'tax_group_id' ], @@ -106,7 +103,7 @@ return [ 'tax_group_id' => Yii::t('app', 'Tax Group ID'), 'language_id' => Yii::t('app', 'Language ID'), - 'name' => Yii::t('app', 'Name'), + 'title' => Yii::t('app', 'Name'), 'description' => Yii::t('app', 'Description'), 'alias' => Yii::t('app', 'Alias'), ]; @@ -117,7 +114,7 @@ */ public function getLanguage() { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } /** diff --git a/common/modules/rubrication/models/TaxGroupToCategory.php b/common/modules/rubrication/models/TaxGroupToCategory.php index 90e232f..8d1fe9d 100755 --- a/common/modules/rubrication/models/TaxGroupToCategory.php +++ b/common/modules/rubrication/models/TaxGroupToCategory.php @@ -49,7 +49,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Category::className(), - 'targetAttribute' => [ 'category_id' => 'category_id' ], + 'targetAttribute' => [ 'category_id' => 'id' ], ], [ [ 'tax_group_id' ], @@ -78,7 +78,7 @@ */ public function getCategory() { - return $this->hasOne(Category::className(), [ 'category_id' => 'category_id' ]); + return $this->hasOne(Category::className(), [ 'id' => 'category_id' ]); } /** diff --git a/common/modules/rubrication/models/TaxOption.php b/common/modules/rubrication/models/TaxOption.php index 23d22bf..ce088c1 100755 --- a/common/modules/rubrication/models/TaxOption.php +++ b/common/modules/rubrication/models/TaxOption.php @@ -14,6 +14,7 @@ /** * This is the model class for table "{{%tax_option}}". + * * @property string $tax_option_id * @property integer $tax_group_id * @property integer $parent_id @@ -30,10 +31,10 @@ * * From language behavior * * @property TaxOptionLang $lang * @property TaxOptionLang[] $langs - * @property TaxOptionLang $object_lang + * @property TaxOptionLang $objectLang * @property string $ownerKey * @property string $langKey - * @property TaxOptionLang[] $model_langs + * @property TaxOptionLang[] $modelLangs * @property bool $transactionStatus * @method string getOwnerKey() * @method void setOwnerKey( string $value ) @@ -57,7 +58,7 @@ class TaxOption extends ActiveRecord { - public $_items_count; + public $itemsCount; /** * @inheritdoc @@ -163,8 +164,8 @@ public function beforeSave($insert) { - if(parent::beforeSave($insert)) { - if(empty( $this->parent_id )) { + if (parent::beforeSave($insert)) { + if (empty( $this->parent_id )) { $this->parent_id = 0; } return true; @@ -174,7 +175,7 @@ public function getProducts() { - return $this->hasMany(Product::className(), [ 'product_id' => 'product_id' ]) + return $this->hasMany(Product::className(), [ 'id' => 'product_id' ]) ->viaTable('product_option', [ 'option_id' => 'tax_option_id' ]); } diff --git a/common/modules/rubrication/models/TaxOptionLang.php b/common/modules/rubrication/models/TaxOptionLang.php index 764b945..eedc843 100755 --- a/common/modules/rubrication/models/TaxOptionLang.php +++ b/common/modules/rubrication/models/TaxOptionLang.php @@ -39,9 +39,7 @@ return [ 'slug' => [ 'class' => 'common\behaviors\Slug', - 'in_attribute' => 'value', - 'out_attribute' => 'alias', - 'translit' => true, + 'inAttribute' => 'value', ], ]; } @@ -81,7 +79,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'language_id' ], + 'targetAttribute' => [ 'language_id' => 'id' ], ], [ [ 'tax_option_id' ], @@ -111,7 +109,7 @@ */ public function getLanguage() { - return $this->hasOne(Language::className(), [ 'language_id' => 'language_id' ]); + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); } /** diff --git a/common/modules/rubrication/views/tax-group/_form.php b/common/modules/rubrication/views/tax-group/_form.php index 9831032..b5b52c4 100755 --- a/common/modules/rubrication/views/tax-group/_form.php +++ b/common/modules/rubrication/views/tax-group/_form.php @@ -12,7 +12,7 @@ /** * @var View $this * @var TaxGroup $model - * @var TaxGroupLang[] $model_langs + * @var TaxGroupLang[] $modelLangs * @var ActiveForm $form */ ?> @@ -22,7 +22,7 @@ [ 'enctype' => 'multipart/form-data' ] ]); ?> field($model, 'categories') - ->dropDownList(ArtboxTreeHelper::treeMap(ProductHelper::getCategories(), 'category_id', 'lang.name'), [ + ->dropDownList(ArtboxTreeHelper::treeMap(ProductHelper::getCategories(), 'id', 'lang.title'), [ 'multiple' => true, ]) ->label('Use in the following categories') ?> @@ -41,7 +41,7 @@ $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@common/modules/rubrication/views/tax-group/_form_language', 'form' => $form, ]); diff --git a/common/modules/rubrication/views/tax-group/_form_language.php b/common/modules/rubrication/views/tax-group/_form_language.php index 9c52182..219d079 100755 --- a/common/modules/rubrication/views/tax-group/_form_language.php +++ b/common/modules/rubrication/views/tax-group/_form_language.php @@ -11,9 +11,9 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']name') +field($model_lang, '[' . $language->id . ']title') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']alias') +field($model_lang, '[' . $language->id . ']alias') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']description') +field($model_lang, '[' . $language->id . ']description') ->textarea([ 'rows' => 6 ]) ?> \ No newline at end of file diff --git a/common/modules/rubrication/views/tax-group/create.php b/common/modules/rubrication/views/tax-group/create.php index 8b0a309..87deed9 100755 --- a/common/modules/rubrication/views/tax-group/create.php +++ b/common/modules/rubrication/views/tax-group/create.php @@ -8,7 +8,7 @@ /** * @var View $this * @var TaxGroup $model - * @var TaxGroupLang[] $model_langs + * @var TaxGroupLang[] $modelLangs */ $this->title = Yii::t('rubrication', 'Create Tax Group'); $this->params[ 'breadcrumbs' ][] = [ @@ -23,7 +23,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?>
diff --git a/common/modules/rubrication/views/tax-group/index.php b/common/modules/rubrication/views/tax-group/index.php index 0195342..e947f20 100755 --- a/common/modules/rubrication/views/tax-group/index.php +++ b/common/modules/rubrication/views/tax-group/index.php @@ -32,7 +32,7 @@ [ 'class' => 'yii\grid\SerialColumn' ], 'tax_group_id', 'is_filter:boolean', - 'lang.name', + 'lang.title', [ 'label' => \Yii::t('rubrication', 'Options count'), 'value' => function($model) { diff --git a/common/modules/rubrication/views/tax-group/update.php b/common/modules/rubrication/views/tax-group/update.php index 85286c4..eb23d3d 100755 --- a/common/modules/rubrication/views/tax-group/update.php +++ b/common/modules/rubrication/views/tax-group/update.php @@ -8,13 +8,13 @@ /** * @var View $this * @var TaxGroup $model - * @var TaxGroupLang[] $model_langs + * @var TaxGroupLang[] $modelLangs * @var int $level */ $this->title = Yii::t('rubrication', 'Update {modelClass}: ', [ 'modelClass' => 'Tax Group', - ]) . ' ' . $model->lang->name; + ]) . ' ' . $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => $level ? Yii::t('rubrication', 'Modification Groups') : Yii::t('rubrication', 'Product Groups'), 'url' => [ @@ -30,7 +30,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, ]) ?>
diff --git a/common/modules/rubrication/views/tax-option/_form.php b/common/modules/rubrication/views/tax-option/_form.php index 82a3353..e3d9008 100755 --- a/common/modules/rubrication/views/tax-option/_form.php +++ b/common/modules/rubrication/views/tax-option/_form.php @@ -13,7 +13,7 @@ * @var common\modules\rubrication\models\TaxOption $model * @var yii\widgets\ActiveForm $form * @var TaxGroup $group - * @var TaxOptionLang[] $model_langs + * @var TaxOptionLang[] $modelLangs */ ?> @@ -58,7 +58,7 @@ $model_langs, + 'modelLangs' => $modelLangs, 'formView' => '@common/modules/rubrication/views/tax-option/_form_language', 'form' => $form, ]); diff --git a/common/modules/rubrication/views/tax-option/_form_language.php b/common/modules/rubrication/views/tax-option/_form_language.php index 28ef000..dd9d395 100755 --- a/common/modules/rubrication/views/tax-option/_form_language.php +++ b/common/modules/rubrication/views/tax-option/_form_language.php @@ -11,7 +11,7 @@ * @var View $this */ ?> -field($model_lang, '[' . $language->language_id . ']value') +field($model_lang, '[' . $language->id . ']value') ->textInput([ 'maxlength' => true ]); ?> -field($model_lang, '[' . $language->language_id . ']alias') +field($model_lang, '[' . $language->id . ']alias') ->textInput([ 'maxlength' => true ]); ?> diff --git a/common/modules/rubrication/views/tax-option/create.php b/common/modules/rubrication/views/tax-option/create.php index 3979c7b..79eab4f 100755 --- a/common/modules/rubrication/views/tax-option/create.php +++ b/common/modules/rubrication/views/tax-option/create.php @@ -8,7 +8,7 @@ * @var yii\web\View $this * @var common\modules\rubrication\models\TaxOption $model * @var TaxGroup $group - * @var TaxOptionLang[] $model_langs + * @var TaxOptionLang[] $modelLangs */ $this->title = Yii::t('rubrication', 'Create Tax Option'); $this->params[ 'breadcrumbs' ][] = [ @@ -19,7 +19,7 @@ ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $group->lang->name, + 'label' => $group->lang->title, 'url' => [ 'tax-group/update', 'id' => $group->tax_group_id, @@ -27,7 +27,7 @@ ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => Yii::t('rubrication', 'Options for group {group}', [ 'group' => $group->lang->name ]), + 'label' => Yii::t('rubrication', 'Options for group {group}', [ 'group' => $group->lang->title ]), 'url' => [ 'index', 'group' => $group->tax_group_id, @@ -42,7 +42,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, 'group' => $group, ]) ?> diff --git a/common/modules/rubrication/views/tax-option/index.php b/common/modules/rubrication/views/tax-option/index.php index 85ca46c..55de6e4 100755 --- a/common/modules/rubrication/views/tax-option/index.php +++ b/common/modules/rubrication/views/tax-option/index.php @@ -12,7 +12,7 @@ * @var TaxGroup $group */ - $this->title = Yii::t('rubrication', 'Options for group {group}', [ 'group' => $group->lang->name ]); + $this->title = Yii::t('rubrication', 'Options for group {group}', [ 'group' => $group->lang->title ]); $this->params[ 'breadcrumbs' ][] = [ 'label' => $group->level ? Yii::t('rubrication', 'Modification Groups') : Yii::t('rubrication', 'Product Groups'), 'url' => [ @@ -21,7 +21,7 @@ ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $group->lang->name, + 'label' => $group->lang->title, 'url' => [ 'tax-group/update', 'id' => $group->tax_group_id, diff --git a/common/modules/rubrication/views/tax-option/update.php b/common/modules/rubrication/views/tax-option/update.php index d0d6613..eb5b3ae 100755 --- a/common/modules/rubrication/views/tax-option/update.php +++ b/common/modules/rubrication/views/tax-option/update.php @@ -8,7 +8,7 @@ * @var yii\web\View $this * @var common\modules\rubrication\models\TaxOption $model * @var TaxGroup $group - * @var TaxOptionLang[] $model_langs + * @var TaxOptionLang[] $modelLangs */ $this->title = Yii::t('rubrication', 'Update {modelClass}: ', [ 'modelClass' => 'Tax Option', @@ -21,7 +21,7 @@ ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $group->lang->name, + 'label' => $group->lang->title, 'url' => [ 'tax-group/update', 'id' => $group->tax_group_id, @@ -29,7 +29,7 @@ ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => Yii::t('rubrication', 'Options for group {group}', [ 'group' => $group->lang->name ]), + 'label' => Yii::t('rubrication', 'Options for group {group}', [ 'group' => $group->lang->title ]), 'url' => [ 'index', 'group' => $group->tax_group_id, @@ -44,7 +44,7 @@ render('_form', [ 'model' => $model, - 'model_langs' => $model_langs, + 'modelLangs' => $modelLangs, 'group' => $group, ]) ?> diff --git a/common/modules/rubrication/views/tax-option/view.php b/common/modules/rubrication/views/tax-option/view.php index ae159fb..fb95b63 100755 --- a/common/modules/rubrication/views/tax-option/view.php +++ b/common/modules/rubrication/views/tax-option/view.php @@ -25,7 +25,7 @@ ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => Yii::t('rubrication', Yii::t('rubrication', 'Options of {name}', [ 'name' => $group->tax_group_id ])), + 'label' => Yii::t('rubrication', Yii::t('rubrication', 'Options of {title}', [ 'title' => $group->tax_group_id ])), 'url' => [ 'index', 'group' => $group->tax_group_id, @@ -54,7 +54,7 @@ ]) ?> tax_group_id ], [ 'class' => 'btn btn-success' ]) ?> parent_id )) : ?> - $model->parent->tax_option_id ]), [ 'tax-option/create?group=' . $model->tax_group_id . '&parent=' . $model->parent->tax_option_id ], [ 'class' => 'btn btn-success' ]) ?> + $model->parent->tax_option_id ]), [ 'tax-option/create?group=' . $model->tax_group_id . '&parent=' . $model->parent->tax_option_id ], [ 'class' => 'btn btn-success' ]) ?>

diff --git a/common/translation/ru/app.php b/common/translation/ru/app.php index fdd7f58..29f9ecd 100755 --- a/common/translation/ru/app.php +++ b/common/translation/ru/app.php @@ -49,7 +49,6 @@ 'user_id' => 'User ID', 'name' => 'Название', 'link' => 'Ссылка', - 'date_add' => 'Дата добавления', 'user_add_id' => 'User Add ID', 'view_count' => 'Количество просмотров', 'description' => 'Описание', @@ -104,12 +103,12 @@ 'bg_id' => '', 'feedback_id' => 'Feedback ID', 'ip' => 'IP', - 'product_name' => 'Продукт', + 'productName' => 'Продукт', 'op_name' => 'Вид', 'art' => 'Артикул', 'cost' => 'Цена за один', 'count' => 'Кол.', - 'sum_cost' => 'Сумма', + 'sumCost' => 'Сумма', 'in_menu' => 'Show in menu', 'page_id' => 'Page ID', 'meta_keywords' => 'Meta Keywords', @@ -136,7 +135,7 @@ 'template_location_title' => 'Template Location Title', 'is_slider' => 'Is Slider', 'is_banner' => 'Is Banner', - 'orders_delivery_id' => 'Orders Delivery ID', + 'order_delivery_id' => 'order Delivery ID', 'text' => 'Text', 'emailis' => 'Такой email уже есть.', 'меню' => 'меню', diff --git a/common/translation/ua/app.php b/common/translation/ua/app.php index f93fb31..e49e1c0 100755 --- a/common/translation/ua/app.php +++ b/common/translation/ua/app.php @@ -49,7 +49,6 @@ 'user_id' => 'User ID', 'name' => 'Назва', 'link' => 'Посилання', - 'date_add' => 'Дата додавання', 'user_add_id' => 'User Add ID', 'view_count' => 'Кількість переглядів', 'description' => 'Опис', @@ -104,12 +103,12 @@ 'bg_id' => '', 'feedback_id' => 'Feedback ID', 'ip' => 'IP', - 'product_name' => 'Продукт', + 'productName' => 'Продукт', 'op_name' => 'Вид', 'art' => 'Артикул', 'cost' => 'Цена за один', 'count' => 'Кол.', - 'sum_cost' => 'Сумма', + 'sumCost' => 'Сумма', 'in_menu' => 'Show in menu', 'page_id' => 'Page ID', 'meta_keywords' => 'Meta Keywords', @@ -136,7 +135,7 @@ 'template_location_title' => 'Template Location Title', 'is_slider' => 'Is Slider', 'is_banner' => 'Is Banner', - 'orders_delivery_id' => 'Orders Delivery ID', + 'order_delivery_id' => 'order Delivery ID', 'text' => 'Text', 'emailis' => 'Такой email уже есть.', 'меню' => 'меню', diff --git a/common/widgets/views/basket_modal.php b/common/widgets/views/basket_modal.php index bceb0b8..bde7d58 100755 --- a/common/widgets/views/basket_modal.php +++ b/common/widgets/views/basket_modal.php @@ -18,11 +18,11 @@ product->image )) : ?> - <?= $item[ 'item' ]->product->image->alt ? $item[ 'item' ]->product->image->alt : $item[ 'item' ]->product->name ?> + <?= $item[ 'item' ]->product->image->alt ? $item[ 'item' ]->product->image->alt : $item[ 'item' ]->product->title ?>
- product->name . ' ' . $item[ 'item' ]->name ?> + product->title . ' ' . $item[ 'item' ]->title ?>
@@ -50,6 +50,6 @@
'close' ]) ?> - 'button' ]); ?> + 'button' ]); ?>
diff --git a/console/controllers/SiteMapController.php b/console/controllers/SiteMapController.php index 6552ae3..842c2f1 100755 --- a/console/controllers/SiteMapController.php +++ b/console/controllers/SiteMapController.php @@ -161,7 +161,7 @@ class SiteMapController extends Controller foreach($this->getCategories() as $category){ foreach ($this->getBrands($category) as $brand) { - if($this->checkFilter($category, ['brands' => [$brand->brand_id]])){ + if($this->checkFilter($category, ['brands' => [$brand->id]])){ $url = Url::to(['catalog/category', 'category' => $category, 'filters' => ['brands' => [$brand->alias]]]) ; $this->createRow($url , 0.8, $content); } @@ -198,7 +198,7 @@ class SiteMapController extends Controller // } // // foreach ($this->getBrands($category) as $brand) { -// if($this->checkFilter($category, ['brands' => [$brand->brand_id], $filter1['group_alias'] => [$filter1['option_alias']]] )){ +// if($this->checkFilter($category, ['brands' => [$brand->id], $filter1['group_alias'] => [$filter1['option_alias']]] )){ // $url = Url::to(['catalog/category', 'category' => $category, 'filters' => ['brands' => [$brand->alias],$filter1['group_alias'] => [$filter1['option_alias']]]]); // $this->createRow($url , 0.7,$content); // } diff --git a/console/migrations/m160926_122456_create_articles_lang_table.php b/console/migrations/m160926_122456_create_articles_lang_table.php index fc6c538..93094d5 100755 --- a/console/migrations/m160926_122456_create_articles_lang_table.php +++ b/console/migrations/m160926_122456_create_articles_lang_table.php @@ -36,7 +36,7 @@ ], true); $this->addForeignKey('article_fk', 'article_lang', 'article_id', 'article', 'id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'articles_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'articles_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160928_100918_create_page_lang_table.php b/console/migrations/m160928_100918_create_page_lang_table.php index 8e5e91f..f67320c 100755 --- a/console/migrations/m160928_100918_create_page_lang_table.php +++ b/console/migrations/m160928_100918_create_page_lang_table.php @@ -34,7 +34,7 @@ class m160928_100918_create_page_lang_table extends Migration ], true); $this->addForeignKey('page_fk', 'page_lang', 'page_id', 'page', 'id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'page_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'page_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160928_104529_create_banner_lang_table.php b/console/migrations/m160928_104529_create_banner_lang_table.php index 4dc16aa..4a7e0a1 100755 --- a/console/migrations/m160928_104529_create_banner_lang_table.php +++ b/console/migrations/m160928_104529_create_banner_lang_table.php @@ -27,8 +27,8 @@ 'language_id', ], true); - $this->addForeignKey('banner_fk', 'banner_lang', 'banner_id', 'banner', 'banner_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'banner_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('banner_fk', 'banner_lang', 'banner_id', 'banner', 'id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('language_fk', 'banner_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160928_112124_create_bg_lang_table.php b/console/migrations/m160928_112124_create_bg_lang_table.php index 388af18..8d67233 100755 --- a/console/migrations/m160928_112124_create_bg_lang_table.php +++ b/console/migrations/m160928_112124_create_bg_lang_table.php @@ -26,7 +26,7 @@ class m160928_112124_create_bg_lang_table extends Migration ], true); $this->addForeignKey('bg_fk', 'bg_lang', 'bg_id', 'bg', 'id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'bg_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'bg_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160928_122509_create_brand_lang_table.php b/console/migrations/m160928_122509_create_brand_lang_table.php index 6f6b22b..fb5854f 100755 --- a/console/migrations/m160928_122509_create_brand_lang_table.php +++ b/console/migrations/m160928_122509_create_brand_lang_table.php @@ -18,11 +18,11 @@ ->notNull(), 'language_id' => $this->integer() ->notNull(), - 'name' => $this->string() + 'title' => $this->string() ->notNull(), 'meta_title' => $this->string(), 'meta_robots' => $this->string(), - 'meta_desc' => $this->string(), + 'meta_description' => $this->string(), 'seo_text' => $this->text(), ]); @@ -31,8 +31,8 @@ 'language_id', ], true); - $this->addForeignKey('brand_fk', 'brand_lang', 'brand_id', 'brand', 'brand_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'brand_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('brand_fk', 'brand_lang', 'brand_id', 'brand', 'id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('language_fk', 'brand_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160928_133403_create_category_lang_table.php b/console/migrations/m160928_133403_create_category_lang_table.php index 7a9ac1d..9c9fa8f 100755 --- a/console/migrations/m160928_133403_create_category_lang_table.php +++ b/console/migrations/m160928_133403_create_category_lang_table.php @@ -17,11 +17,11 @@ class m160928_133403_create_category_lang_table extends Migration ->notNull(), 'language_id' => $this->integer() ->notNull(), - 'name' => $this->string() + 'title' => $this->string() ->notNull(), 'meta_title' => $this->string(), 'meta_robots' => $this->string(), - 'meta_desc' => $this->string(), + 'meta_description' => $this->string(), 'seo_text' => $this->text(), 'h1' => $this->string(), ]); @@ -30,8 +30,8 @@ class m160928_133403_create_category_lang_table extends Migration 'language_id', ], true); - $this->addForeignKey('category_fk', 'category_lang', 'category_id', 'category', 'category_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'category_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('category_fk', 'category_lang', 'category_id', 'category', 'id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('language_fk', 'category_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160928_161047_create_event_lang_table.php b/console/migrations/m160928_161047_create_event_lang_table.php index 76f54f5..7a142c4 100755 --- a/console/migrations/m160928_161047_create_event_lang_table.php +++ b/console/migrations/m160928_161047_create_event_lang_table.php @@ -17,12 +17,12 @@ class m160928_161047_create_event_lang_table extends Migration ->notNull(), 'language_id' => $this->integer() ->notNull(), - 'name' => $this->string() + 'title' => $this->string() ->notNull(), 'body' => $this->text() ->notNull(), 'meta_title' => $this->string(), - 'description' => $this->string(), + 'meta_description' => $this->string(), 'seo_text' => $this->text(), 'h1' => $this->string(), ]); @@ -31,8 +31,8 @@ class m160928_161047_create_event_lang_table extends Migration 'language_id', ], true); - $this->addForeignKey('event_fk', 'event_lang', 'event_id', 'event', 'event_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'event_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('event_fk', 'event_lang', 'event_id', 'event', 'id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('language_fk', 'event_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160929_135920_create_order_delivery_lang_table.php b/console/migrations/m160929_135920_create_order_delivery_lang_table.php new file mode 100755 index 0000000..816e446 --- /dev/null +++ b/console/migrations/m160929_135920_create_order_delivery_lang_table.php @@ -0,0 +1,66 @@ +createTable( + 'order_delivery_lang', + [ + 'order_delivery_id' => $this->integer() + ->notNull(), + 'language_id' => $this->integer() + ->notNull(), + 'title' => $this->string() + ->notNull(), + 'text' => $this->text() + ->notNull(), + ] + ); + $this->createIndex( + 'order_delivery_lang_order_delivery_language_key', + 'order_delivery_lang', + [ + 'order_delivery_id', + 'language_id', + ], + true + ); + + $this->addForeignKey( + 'order_delivery_fk', + 'order_delivery_lang', + 'order_delivery_id', + 'order_delivery', + 'id', + 'CASCADE', + 'CASCADE' + ); + $this->addForeignKey( + 'language_fk', + 'order_delivery_lang', + 'language_id', + 'language', + 'id', + 'RESTRICT', + 'CASCADE' + ); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropTable('order_delivery'); + } + } diff --git a/console/migrations/m160929_135920_create_orders_delivery_lang_table.php b/console/migrations/m160929_135920_create_orders_delivery_lang_table.php deleted file mode 100755 index 1422852..0000000 --- a/console/migrations/m160929_135920_create_orders_delivery_lang_table.php +++ /dev/null @@ -1,42 +0,0 @@ -createTable('orders_delivery_lang', [ - 'orders_delivery_id' => $this->integer() - ->notNull(), - 'language_id' => $this->integer() - ->notNull(), - 'title' => $this->string() - ->notNull(), - 'text' => $this->text() - ->notNull(), - ]); - $this->createIndex('orders_delivery_lang_orders_delivery_language_key', 'orders_delivery_lang', [ - 'orders_delivery_id', - 'language_id', - ], true); - - $this->addForeignKey('orders_delivery_fk', 'orders_delivery_lang', 'orders_delivery_id', 'orders_delivery', 'id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'orders_delivery_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); - } - - /** - * @inheritdoc - */ - public function down() - { - $this->dropTable('orders_delivery'); - } - } diff --git a/console/migrations/m160929_142458_create_order_label_lang_table.php b/console/migrations/m160929_142458_create_order_label_lang_table.php new file mode 100755 index 0000000..c55b63b --- /dev/null +++ b/console/migrations/m160929_142458_create_order_label_lang_table.php @@ -0,0 +1,64 @@ +createTable( + 'order_label_lang', + [ + 'order_label_id' => $this->integer() + ->notNull(), + 'language_id' => $this->integer() + ->notNull(), + 'title' => $this->string() + ->notNull(), + ] + ); + $this->createIndex( + 'order_label_lang_order_label_language_key', + 'order_label_lang', + [ + 'order_label_id', + 'language_id', + ], + true + ); + + $this->addForeignKey( + 'order_label_fk', + 'order_label_lang', + 'order_label_id', + 'order_label', + 'id', + 'CASCADE', + 'CASCADE' + ); + $this->addForeignKey( + 'language_fk', + 'order_label_lang', + 'language_id', + 'language', + 'id', + 'RESTRICT', + 'CASCADE' + ); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropTable('order_label_lang'); + } + } diff --git a/console/migrations/m160929_142458_create_orders_label_lang_table.php b/console/migrations/m160929_142458_create_orders_label_lang_table.php deleted file mode 100755 index 754d294..0000000 --- a/console/migrations/m160929_142458_create_orders_label_lang_table.php +++ /dev/null @@ -1,40 +0,0 @@ -createTable('orders_label_lang', [ - 'orders_label_id' => $this->integer() - ->notNull(), - 'language_id' => $this->integer() - ->notNull(), - 'name' => $this->string() - ->notNull(), - ]); - $this->createIndex('orders_label_lang_orders_label_language_key', 'orders_label_lang', [ - 'orders_label_id', - 'language_id', - ], true); - - $this->addForeignKey('orders_label_fk', 'orders_label_lang', 'orders_label_id', 'orders_label', 'id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'orders_label_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); - } - - /** - * @inheritdoc - */ - public function down() - { - $this->dropTable('orders_label_lang'); - } - } diff --git a/console/migrations/m160929_144357_create_product_lang_table.php b/console/migrations/m160929_144357_create_product_lang_table.php index 7d87855..86237f9 100755 --- a/console/migrations/m160929_144357_create_product_lang_table.php +++ b/console/migrations/m160929_144357_create_product_lang_table.php @@ -1,40 +1,48 @@ createTable('product_lang', [ - 'product_id' => $this->integer() - ->notNull(), - 'language_id' => $this->integer() - ->notNull(), - 'name' => $this->string() - ->notNull(), - 'description' => $this->text(), - ]); - $this->createIndex('product_lang_product_language_key', 'product_lang', [ - 'product_id', - 'language_id', - ], true); - $this->addForeignKey('product_fk', 'product_lang', 'product_id', 'product', 'product_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'product_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); - } - + use yii\db\Migration; + /** - * @inheritdoc + * Handles the creation for table `product_lang`. */ - public function down() + class m160929_144357_create_product_lang_table extends Migration { - $this->dropTable('product_lang'); + /** + * @inheritdoc + */ + public function up() + { + $this->createTable( + 'product_lang', + [ + 'product_id' => $this->integer() + ->notNull(), + 'language_id' => $this->integer() + ->notNull(), + 'title' => $this->string() + ->notNull(), + 'description' => $this->text(), + ] + ); + $this->createIndex( + 'product_lang_product_language_key', + 'product_lang', + [ + 'product_id', + 'language_id', + ], + true + ); + + $this->addForeignKey('product_fk', 'product_lang', 'product_id', 'product', 'id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('language_fk', 'product_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropTable('product_lang'); + } } -} diff --git a/console/migrations/m160929_155222_create_product_spec_lang_table.php b/console/migrations/m160929_155222_create_product_spec_lang_table.php index 9005842..cd0ae04 100755 --- a/console/migrations/m160929_155222_create_product_spec_lang_table.php +++ b/console/migrations/m160929_155222_create_product_spec_lang_table.php @@ -27,7 +27,7 @@ ], true); $this->addForeignKey('product_spec_fk', 'product_spec_lang', 'product_spec_id', 'product_spec', 'product_spec_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'product_spec_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'product_spec_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160929_173535_create_product_unit_lang_table.php b/console/migrations/m160929_173535_create_product_unit_lang_table.php index e1707fa..8ae8e58 100755 --- a/console/migrations/m160929_173535_create_product_unit_lang_table.php +++ b/console/migrations/m160929_173535_create_product_unit_lang_table.php @@ -18,7 +18,7 @@ ->notNull(), 'language_id' => $this->integer() ->notNull(), - 'name' => $this->string() + 'title' => $this->string() ->notNull(), 'short' => $this->string(), ]); @@ -29,7 +29,7 @@ ], true); $this->addForeignKey('product_unit_fk', 'product_unit_lang', 'product_unit_id', 'product_unit', 'product_unit_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'product_unit_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'product_unit_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160929_175821_create_product_variant_lang_table.php b/console/migrations/m160929_175821_create_product_variant_lang_table.php index 36e78c2..9a31c14 100755 --- a/console/migrations/m160929_175821_create_product_variant_lang_table.php +++ b/console/migrations/m160929_175821_create_product_variant_lang_table.php @@ -18,7 +18,7 @@ ->notNull(), 'language_id' => $this->integer() ->notNull(), - 'name' => $this->string() + 'title' => $this->string() ->notNull(), ]); $this->createIndex('product_variant_lang_product_variant_language_key', 'product_variant_lang', [ @@ -27,7 +27,7 @@ ], true); $this->addForeignKey('product_variant_fk', 'product_variant_lang', 'product_variant_id', 'product_variant', 'product_variant_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'product_variant_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'product_variant_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160930_082350_create_project_lang_table.php b/console/migrations/m160930_082350_create_project_lang_table.php index 447dec1..c4e2608 100755 --- a/console/migrations/m160930_082350_create_project_lang_table.php +++ b/console/migrations/m160930_082350_create_project_lang_table.php @@ -28,7 +28,7 @@ ], true); $this->addForeignKey('project_fk', 'project_lang', 'project_id', 'project', 'project_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'project_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'project_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160930_100954_create_seo_lang_table.php b/console/migrations/m160930_100954_create_seo_lang_table.php index 2dd6843..3b4f28c 100755 --- a/console/migrations/m160930_100954_create_seo_lang_table.php +++ b/console/migrations/m160930_100954_create_seo_lang_table.php @@ -19,7 +19,7 @@ 'language_id' => $this->integer() ->notNull(), 'title' => $this->string(), - 'description' => $this->text(), + 'meta_description' => $this->text(), 'h1' => $this->string(), 'meta' => $this->string(), 'seo_text' => $this->text(), @@ -30,13 +30,13 @@ ], true); $this->addForeignKey('seo_fk', 'seo_lang', 'seo_id', 'seo', 'seo_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'seo_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'seo_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); $this->createTable('seo_category_lang', [ 'seo_category_id' => $this->integer() ->notNull(), 'language_id' => $this->integer() ->notNull(), - 'name' => $this->string(), + 'title' => $this->string(), ]); $this->createIndex('seo_category_lang_seo_category_language_key', 'seo_category_lang', [ 'seo_category_id', @@ -44,18 +44,18 @@ ], true); $this->addForeignKey('seo_category_fk', 'seo_category_lang', 'seo_category_id', 'seo_category', 'seo_category_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'seo_category_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'seo_category_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); $this->createTable('seo_dynamic_lang', [ 'seo_dynamic_id' => $this->integer() ->notNull(), 'language_id' => $this->integer() ->notNull(), - 'name' => $this->string(), - 'title' => $this->text(), + 'title' => $this->string(), + 'meta_title' => $this->text(), 'h1' => $this->string(), 'key' => $this->string(), 'meta' => $this->string(), - 'description' => $this->text(), + 'meta_description' => $this->text(), 'seo_text' => $this->text(), ]); $this->createIndex('seo_dynamic_lang_seo_dynamic_language_key', 'seo_dynamic_lang', [ @@ -64,7 +64,7 @@ ], true); $this->addForeignKey('seo_dynamic_fk', 'seo_dynamic_lang', 'seo_dynamic_id', 'seo_dynamic', 'seo_dynamic_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'seo_dynamic_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'seo_dynamic_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160930_133757_create_service_lang_table.php b/console/migrations/m160930_133757_create_service_lang_table.php index e285a9a..327a554 100755 --- a/console/migrations/m160930_133757_create_service_lang_table.php +++ b/console/migrations/m160930_133757_create_service_lang_table.php @@ -18,13 +18,13 @@ ->notNull(), 'language_id' => $this->integer() ->notNull(), - 'name' => $this->string() + 'title' => $this->string() ->notNull(), 'body' => $this->text() ->notNull(), 'seo_text' => $this->text(), 'meta_title' => $this->string(), - 'description' => $this->string(), + 'meta_description' => $this->string(), 'h1' => $this->string(), ]); $this->createIndex('service_lang_service_language_key', 'service_lang', [ @@ -33,7 +33,7 @@ ], true); $this->addForeignKey('service_fk', 'service_lang', 'service_id', 'service', 'service_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'service_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'service_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160930_142752_create_slider_image_lang_table.php b/console/migrations/m160930_142752_create_slider_image_lang_table.php index 04c7e17..e19f38f 100755 --- a/console/migrations/m160930_142752_create_slider_image_lang_table.php +++ b/console/migrations/m160930_142752_create_slider_image_lang_table.php @@ -27,7 +27,7 @@ ], true); $this->addForeignKey('slider_image_fk', 'slider_image_lang', 'slider_image_id', 'slider_image', 'slider_image_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'slider_image_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'slider_image_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160930_145734_create_tax_group_lang_table.php b/console/migrations/m160930_145734_create_tax_group_lang_table.php index ee9d54d..957a282 100755 --- a/console/migrations/m160930_145734_create_tax_group_lang_table.php +++ b/console/migrations/m160930_145734_create_tax_group_lang_table.php @@ -18,7 +18,7 @@ ->notNull(), 'language_id' => $this->integer() ->notNull(), - 'name' => $this->string() + 'title' => $this->string() ->notNull(), 'description' => $this->text(), ]); @@ -28,7 +28,7 @@ ], true); $this->addForeignKey('tax_group_fk', 'tax_group_lang', 'tax_group_id', 'tax_group', 'tax_group_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'tax_group_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'tax_group_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m160930_151832_create_tax_option_lang_table.php b/console/migrations/m160930_151832_create_tax_option_lang_table.php index 7d9e0ad..0c906ff 100755 --- a/console/migrations/m160930_151832_create_tax_option_lang_table.php +++ b/console/migrations/m160930_151832_create_tax_option_lang_table.php @@ -26,7 +26,7 @@ class m160930_151832_create_tax_option_lang_table extends Migration ], true); $this->addForeignKey('tax_option_fk', 'tax_option_lang', 'tax_option_id', 'tax_option', 'tax_option_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'tax_option_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'tax_option_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/console/migrations/m161011_104931_create_stock_lang_table.php b/console/migrations/m161011_104931_create_stock_lang_table.php index f47a7da..1732357 100755 --- a/console/migrations/m161011_104931_create_stock_lang_table.php +++ b/console/migrations/m161011_104931_create_stock_lang_table.php @@ -17,7 +17,7 @@ class m161011_104931_create_stock_lang_table extends Migration ->notNull(), 'language_id' => $this->integer() ->notNull(), - 'name' => $this->string() + 'title' => $this->string() ->notNull(), ]); $this->createIndex('stock_lang_stock_language_key', 'stock_lang', [ @@ -26,7 +26,7 @@ class m161011_104931_create_stock_lang_table extends Migration ], true); $this->addForeignKey('stock_fk', 'stock_lang', 'stock_id', 'stock', 'stock_id', 'CASCADE', 'CASCADE'); - $this->addForeignKey('language_fk', 'stock_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE'); + $this->addForeignKey('language_fk', 'stock_lang', 'language_id', 'language', 'id', 'RESTRICT', 'CASCADE'); } /** diff --git a/standards b/standards new file mode 100644 index 0000000..5c5650a --- /dev/null +++ b/standards @@ -0,0 +1,68 @@ +SQL (https://launchbylunch.com/posts/2014/Feb/16/sql-naming-conventions/) +Основное: +1. Вместо пробела использовать нижний подчерк: first_name +2. Использовать только нижний регистр: word_count +3. Избегать зарезервированых слов: https://www.postgresql.org/docs/9.3/static/sql-keywords-appendix.html +4. Использовать только единичное число в названиях: team (NOT teams) +5. Название primary key только id. +6. Название foreign key должно быть table_id. +7. В названии индекса должны быть название таблицы и всех полей, который в нем участвуют: person_ix_first_name_last_name +8. Ограничения (Constraints) должны быть тоже информативными: team_member_pkey +9. Стандартные поля +Поля даты: +* created_at - дата создания +* updated_at - дата обновления +* deleted_at - дата удаления +Сео поля: +* meta_title +* meta_description +* meta_keywords +* meta_robots +* seo_text +* h1 +* alias - сео ссылка +Другие: +* id - primary key +* remote_id - внутренний id клиентов, либо сгенерированный нами поведением +* url - ссылка +* status - статус +* title - название +* image - название картинки, путь задается в модели для поведения +* alt - альт для изображения +* sort - порядок сортировки +10. Стараться избегать названия name и отдавать предпочтение title + +PHP (http://svyatoslav.biz/misc/psr_translation/). Использовать стили PHPStorm. +Основное: +1. Не использовать сокращенный тег в файлах, которые содержат только PHP-код. +10. В конце непустых строк не должно быть пробелов. +11. В одной строке не должно быть более одного выражения. +12. Не использовать в PHP слово var для обьявления переменных. Регулярка: var\s +13. Не использовать обьявления множества свойств в одном выражении: Регулярка: (?:public|protected|private)\s\$\w+, \$\w+ +14. Использовать elseif вместо else if. Регулярка: else\s+if +15. В конструкции switch всегда использовать break, если специально пропущено break, то использовать комментарий // no break. + Примерные регулярки: + \scase((?!break)[\s\S])*\s(?:case|default) + \s(?:case:|default:)((?!break)[\s\S])*} + +JS (https://learn.javascript.ru/coding-style). Использовать стили PHPStorm. +Основное: +1. Для события document ready в jQuery использовать ТОЛЬКО $(handler); синтаксис. Регулярка: \$\s*\(\s*['"]?document['"]?\s*\)\s*\.\s*\(\s*ready +2. Обработчики на динамические элементы (если есть хоть малейшая вероятность загрузки контента динамически через AJAX), ставим через $(document).on(event, selector, handler); +3. (https://learn.javascript.ru/coding-style#именование) Переменные называть существительными, функции - глаголы, или doSomething - верблюжья нотация, начиная с глагола. НЕ ИСПОЛЬЗОВАТЬ ТРАНСЛИТ, только английские слова. +4. (https://learn.javascript.ru/coding-style#функции-под-кодом) Зависимые функции располагать ниже по коду. +5. Просьба, по возможности начинать использовать JSDoc (http://usejsdoc.org/ раздел Block Tags). Зачем? Чтобы и разработчик, и IDE понимали что происходит, что передавать и что возвращать (https://learn.javascript.ru/coding-style#хорошие-комментарии). \ No newline at end of file diff --git a/todo b/todo index bd6a7d9..201f173 100755 --- a/todo +++ b/todo @@ -85,7 +85,8 @@ Fix по существующему: 9. Избавиться от Mailer widget 10. На статьях включить клиентскую валидацию 11. Спросить у Виталика или нужно вернуть модуль file (используется elfinder ?) - +12. Баг с опциями (если удалить все, то не удаляются), решение unlinkAll в контроллере +13. Баг с фильтром (если фильтруешь по productVariant, а опции Product пустые, то не находит ничего) Комментарии (создать поведение): 1. Добавить к Article с рейтингом \ No newline at end of file -- libgit2 0.21.4