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
*/
?>
-= $form->field($model_lang, '[' . $language->language_id . ']title')
+= $form->field($model_lang, '[' . $language->id . ']title')
->textInput([ 'maxlength' => true ]); ?>
-= $form->field($model_lang, '[' . $language->language_id . ']alt')
+= $form->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 @@
-
-
-
-
- ['index'],
- 'method' => 'get',
- ]); ?>
-
- = $form->field($model, 'slider_image_id') ?>
-
- = $form->field($model, 'slider_id') ?>
-
- = $form->field($model, 'image') ?>
-
- = $form->field($model, 'alt') ?>
-
- = $form->field($model, 'title') ?>
-
- field($model, 'url') ?>
-
- field($model, 'status') ?>
-
- field($model, 'sort') ?>
-
-
- = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
- = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
-
-
-
-
-
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 @@
= $this->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 @@
= $this->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 @@
-
-
-
-
- ['index'],
- 'method' => 'get',
- ]); ?>
-
- = $form->field($model, 'slider_id') ?>
-
-
- = $form->field($model, 'speed') ?>
-
- = $form->field($model, 'duration') ?>
-
- = $form->field($model, 'title') ?>
-
- field($model, 'status') ?>
-
-
- = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
- = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
-
-
-
-
-
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 @@
-
-
-
-
- ['index'],
- 'method' => 'get',
- ]); ?>
-
- = $form->field($model, 'id') ?>
-
- = $form->field($model, 'username') ?>
-
- = $form->field($model, 'email') ?>
-
- field($model, 'status') ?>
-
- field($model, 'created_at') ?>
-
- field($model, 'updated_at') ?>
-
-
- = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
- = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
-
-
-
-
-
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', $model->created_at);
?>
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 @@
+
+
+
+ = Html::img($item['image'])?>
+
+
\ 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 @@
+
+
+
+
+
+
+
+
+
+ = Html::a( Html::img($item['image']),'#',['class'=>'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];
+
+?>
+
+
+
+
+ = Html::activeHiddenInput( $model,$field,['id' => "{$field}_picture_link"]) ?>
+
+
+
+
+
+
+
+
+
+ $field): ?>
+
+
+
+ $field):?>
+ = Html::a(Html::img($model->$field),'#',['class'=>'thumbnail']) ?>
+
+
+
+
+
+
+
+
+ =$name?>
+
+ = Html::activeFileInput( new ImageSizerForm(),'file',['id'=>$field, 'data-url'=>Yii::$app->getUrlManager()->createUrl('file/uploader/download-photo')]);?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =$name?>
+
+ = Html::activeFileInput( new ImageSizerForm(),'file',['id'=>$field, 'data-url'=>Yii::$app->getUrlManager()->createUrl('file/uploader/download-photo'), 'multiple'=> 'multiple' ]);?>
+
+
+ = Html::activeHiddenInput( $model,$field,['id' => "{$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 @@
$model_lang) {
+ foreach($modelLangs as $lang => $model_lang) {
if(!array_key_exists($lang, $languages)) {
continue;
}
echo Html::tag('li', Html::a($languages[ $lang ]->url, [
'',
- '#' => $id_prefix . '_' . $lang,
+ '#' => $idPrefix . '_' . $lang,
], [ 'data-toggle' => 'tab' ]), [
'class' => $first ? 'active' : '',
]);
@@ -38,7 +38,7 @@
$model_lang) {
+ foreach($modelLangs as $lang => $model_lang) {
if(!array_key_exists($lang, $languages)) {
continue;
}
@@ -48,7 +48,7 @@
'form' => $form,
]), [
'class' => 'tab-pane' . ( $first ? ' active' : '' ),
- 'id' => $id_prefix . '_' . $lang,
+ 'id' => $idPrefix . '_' . $lang,
]);
$first = false;
}
@@ -57,9 +57,9 @@
language_id ] )) {
+ if(isset( $modelLangs[ $language->id ] )) {
echo $this->render($form_view, [
- 'model_lang' => $model_langs[ $language->language_id ],
+ 'model_lang' => $modelLangs[ $language->id ],
'language' => $language,
'form' => $form,
]);
diff --git a/common/modules/product/controllers/ManageController.php b/common/modules/product/controllers/ManageController.php
index a23e72c..3c5e55f 100755
--- a/common/modules/product/controllers/ManageController.php
+++ b/common/modules/product/controllers/ManageController.php
@@ -92,13 +92,13 @@
if($model->save() && $model->transactionStatus) {
return $this->redirect([
'view',
- 'id' => $model->product_id,
+ 'id' => $model->id,
]);
}
}
return $this->render('create', [
'model' => $model,
- 'model_langs' => $model->model_langs,
+ 'modelLangs' => $model->modelLangs,
]);
}
@@ -119,7 +119,7 @@
if($model->save() && $model->transactionStatus) {
return $this->redirect([
'view',
- 'id' => $model->product_id,
+ 'id' => $model->id,
]);
}
}
@@ -129,7 +129,7 @@
$groups = $model->getTaxGroupsByLevel(0);
return $this->render('update', [
'model' => $model,
- 'model_langs' => $model->model_langs,
+ 'modelLangs' => $model->modelLangs,
'groups' => $groups,
]);
}
@@ -161,7 +161,7 @@
exit;
}
- public function actionIs_top($id)
+ public function actionIsTop($id)
{
$model = $this->findModel($id);
@@ -172,7 +172,7 @@
return $this->redirect([ 'index' ]);
}
- public function actionIs_new($id)
+ public function actionIsNew($id)
{
$model = $this->findModel($id);
@@ -201,12 +201,12 @@
$languages = Language::find()
->select([
'name',
- 'language_id',
+ 'id',
])
->where([ 'status' => 1 ])
->orderBy([ 'default' => SORT_DESC ])
->asArray()
- ->indexBy('language_id')
+ ->indexBy('id')
->column();
if($model->load(Yii::$app->request->post())) {
@@ -307,7 +307,7 @@
protected function findModel($id)
{
if(( $model = Product::find()
- ->where([ 'product_id' => $id ])
+ ->where([ 'id' => $id ])
->with('lang')
->one() ) !== NULL
) {
diff --git a/common/modules/product/controllers/ProductUnitController.php b/common/modules/product/controllers/ProductUnitController.php
index 1977d40..13d6b77 100755
--- a/common/modules/product/controllers/ProductUnitController.php
+++ b/common/modules/product/controllers/ProductUnitController.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/common/modules/product/controllers/VariantController.php b/common/modules/product/controllers/VariantController.php
index eba5f65..02acb53 100755
--- a/common/modules/product/controllers/VariantController.php
+++ b/common/modules/product/controllers/VariantController.php
@@ -52,7 +52,7 @@
*/
$query = $dataProvider->query;
$query->with('image')
- ->andWhere([ 'product_id' => $product->product_id ]);
+ ->andWhere([ 'product_id' => $product->id ]);
return $this->render('index', [
'searchModel' => $searchModel,
@@ -90,7 +90,7 @@
{
$product = $this->findProduct($product_id);
$model = new ProductVariant();
- $model->product_id = $product->product_id;
+ $model->product_id = $product->id;
$model->generateLangs();
if($model->load(Yii::$app->request->post())) {
$model->loadLangs(\Yii::$app->request);
@@ -101,25 +101,25 @@
$model->unlinkAll('stocks', true);
$sorted_array = [];
foreach($ProductStocks as $subArray) {
- if(!empty( $subArray[ 'name' ] ) && !empty( $subArray[ 'quantity' ] )) {
- if(!empty( $sorted_array[ $subArray[ 'name' ] ] )) {
- $sorted_array[ $subArray[ 'name' ] ] += $subArray[ 'quantity' ];
+ if(!empty( $subArray[ 'title' ] ) && !empty( $subArray[ 'quantity' ] )) {
+ if(!empty( $sorted_array[ $subArray[ 'title' ] ] )) {
+ $sorted_array[ $subArray[ 'title' ] ] += $subArray[ 'quantity' ];
} else {
- $sorted_array[ $subArray[ 'name' ] ] = $subArray[ 'quantity' ];
+ $sorted_array[ $subArray[ 'title' ] ] = $subArray[ 'quantity' ];
}
}
}
$ProductStocks = $sorted_array;
$stock_names = array_keys($ProductStocks);
$stocks = Stock::find()
- ->where([ 'name' => $stock_names ])
- ->indexBy('name')
+ ->where([ 'title' => $stock_names ])
+ ->indexBy('title')
->all();
foreach($ProductStocks as $name => $quantity) {
$quantity = (int) $quantity;
if(!array_key_exists($name, $stocks)) {
$stock = new Stock([
- 'name' => $name,
+ 'title' => $name,
]);
if(!$stock->save()) {
continue;
@@ -145,7 +145,7 @@
if($model->save() && $model->transactionStatus) {
return $this->redirect([
'index',
- 'product_id' => $product->product_id,
+ 'product_id' => $product->id,
]);
}
}
@@ -153,7 +153,7 @@
$groups = $model->getTaxGroupsByLevel(1);
return $this->render('create', [
'model' => $model,
- 'model_langs' => $model->model_langs,
+ 'modelLangs' => $model->modelLangs,
'groups' => $groups,
'stocks' => [ new ProductStock() ],
'product' => $product,
@@ -183,25 +183,25 @@
$model->unlinkAll('stocks', true);
$sorted_array = [];
foreach($ProductStocks as $subArray) {
- if(!empty( $subArray[ 'name' ] ) && !empty( $subArray[ 'quantity' ] )) {
- if(!empty( $sorted_array[ $subArray[ 'name' ] ] )) {
- $sorted_array[ $subArray[ 'name' ] ] += $subArray[ 'quantity' ];
+ if(!empty( $subArray[ 'title' ] ) && !empty( $subArray[ 'quantity' ] )) {
+ if(!empty( $sorted_array[ $subArray[ 'title' ] ] )) {
+ $sorted_array[ $subArray[ 'title' ] ] += $subArray[ 'quantity' ];
} else {
- $sorted_array[ $subArray[ 'name' ] ] = $subArray[ 'quantity' ];
+ $sorted_array[ $subArray[ 'title' ] ] = $subArray[ 'quantity' ];
}
}
}
$ProductStocks = $sorted_array;
$stock_names = array_keys($ProductStocks);
$stocks = Stock::find()
- ->where([ 'name' => $stock_names ])
- ->indexBy('name')
+ ->where([ 'title' => $stock_names ])
+ ->indexBy('title')
->all();
foreach($ProductStocks as $name => $quantity) {
$quantity = (int) $quantity;
if(!array_key_exists($name, $stocks)) {
$stock = new Stock([
- 'name' => $name,
+ 'title' => $name,
]);
if(!$stock->save()) {
continue;
@@ -234,7 +234,7 @@
$groups = $model->getTaxGroupsByLevel(1);
return $this->render('update', [
'model' => $model,
- 'model_langs' => $model->model_langs,
+ 'modelLangs' => $model->modelLangs,
'groups' => $groups,
'stocks' => ( !empty( $model->variantStocks ) ) ? $model->variantStocks : [ new ProductStock ],
'product' => $product,
@@ -306,7 +306,7 @@
{
if(( $model = Product::find()
->with('lang')
- ->where([ 'product_id' => $product_id ])
+ ->where([ 'id' => $product_id ])
->one() ) !== NULL
) {
return $model;
diff --git a/common/modules/product/helpers/ProductHelper.php b/common/modules/product/helpers/ProductHelper.php
index 2e4deed..5d118b9 100755
--- a/common/modules/product/helpers/ProductHelper.php
+++ b/common/modules/product/helpers/ProductHelper.php
@@ -88,7 +88,7 @@
if($as_object) {
$last_products = Product::find()
->joinWith([ 'variant' ])
- ->where([ Product::tableName() . '.product_id' => $last_products ])
+ ->where([ Product::tableName() . '.id' => $last_products ])
->andWhere([
'!=',
ProductVariant::tableName() . '.stock',
@@ -126,11 +126,17 @@
->all();
}
+ /**
+ * @param Product $product
+ * @param int $count
+ *
+ * @return array|\yii\db\ActiveRecord[]
+ */
public static function getSimilarProducts($product, $count = 10)
{
if(!is_object($product)) {
$product = Product::find()
- ->where([ 'product_id' => $product ])
+ ->where([ 'id' => $product ])
->with('enabledVariants')
->one();
}
@@ -140,10 +146,10 @@
}
$product_categories = [];
foreach($product->categories as $category) {
- $product_categories[] = $category->category_id;
+ $product_categories[] = $category->id;
}
$query = Product::find()
- ->select('product.product_id')
+ ->select('product.id')
->innerJoinWith('variant')
->joinWith('category')
->where([
@@ -154,36 +160,38 @@
->andWhere([ 'product_category.category_id' => $product_categories ]);
foreach($product->properties as $group) {
$where = [];
- foreach($group->_options as $option) {
+ foreach($group->options as $option) {
$where[] = $option->tax_option_id;
}
if(!$where) {
continue;
}
- $query->innerJoin('product_option to' . $group->tax_group_id, 'to' . $group->tax_group_id . '.product_id = product.product_id');
+ $query->innerJoin('product_option to' . $group->tax_group_id, 'to' . $group->tax_group_id . '.product_id = product.id');
$query->andWhere([ 'to' . $group->tax_group_id . '.option_id' => $where ]);
}
$query->andWhere([
'!=',
- 'product.product_id',
- $product->product_id,
+ 'product.id',
+ $product->id,
]);
- $query->groupBy('product.product_id');
+ $query->groupBy('product.id');
$query->limit($count);
$products = $query->asArray()
->all();
foreach($products as &$_product) {
- $_product = Product::findOne($_product[ 'product_id' ]);
+ $_product = Product::findOne($_product[ 'id' ]);
}
return $products;
}
/**
+ * @todo Refactor
+ *
* @param ActiveQuery $query
* @param $params
* @param bool $setPriceLimits
*/
- public static function _setQueryParams(&$query, $params, $setPriceLimits = true)
+ public static function setQueryParams(&$query, $params, $setPriceLimits = true)
{
if(!empty( $params[ 'keywords' ] )) {
if(!is_array($params[ 'keywords' ])) {
@@ -246,10 +254,10 @@
/**
* @todo Refactor this
*/
- $query->andWhere(Product::tableName() . '.product_id IN (
+ $query->andWhere(Product::tableName() . '.id IN (
SELECT DISTINCT products
FROM (
- SELECT product_id AS products
+ SELECT id AS products
FROM product_option
INNER JOIN tax_option ON tax_option.tax_option_id = product_option.option_id
INNER JOIN tax_group ON tax_group.tax_group_id = tax_option.tax_group_id
@@ -263,6 +271,7 @@
)
) AS table_name
)');
+ break;
}
}
@@ -290,8 +299,8 @@
} else {
$query = Product::find();
}
- ProductHelper::_setQueryParams($query, $params);
- $query->select([ 'COUNT(product.product_id)' ]);
+ ProductHelper::setQueryParams($query, $params);
+ $query->select([ 'COUNT(product.id)' ]);
return $query;
}
diff --git a/common/modules/product/models/Brand.php b/common/modules/product/models/Brand.php
index db00ba1..f4ab946 100755
--- a/common/modules/product/models/Brand.php
+++ b/common/modules/product/models/Brand.php
@@ -11,7 +11,7 @@
/**
* This is the model class for table "brand".
- * @property integer $brand_id
+ * @property integer $id
* @property string $image
* @property bool $in_menu
* @property Product[] $products
@@ -19,10 +19,10 @@
* * From language behavior *
* @property BrandLang $lang
* @property BrandLang[] $langs
- * @property BrandLang $object_lang
+ * @property BrandLang $objectLang
* @property string $ownerKey
* @property string $langKey
- * @property BrandLang[] $model_langs
+ * @property BrandLang[] $modelLangs
* @property bool $transactionStatus
* @method string getOwnerKey()
* @method void setOwnerKey( string $value )
@@ -46,7 +46,7 @@
class Brand extends ActiveRecord
{
- public $_items_count = 0;
+ public $itemsCount = 0;
/**
* @inheritdoc
@@ -93,7 +93,7 @@
public function attributeLabels()
{
return [
- 'brand_id' => Yii::t('product', 'Brand ID'),
+ 'id' => Yii::t('product', 'Brand ID'),
'image' => Yii::t('product', 'Image'),
];
}
@@ -103,6 +103,6 @@
*/
public function getProducts()
{
- return $this->hasMany(Product::className(), [ 'brand_id' => 'brand_id' ]);
+ return $this->hasMany(Product::className(), [ 'brand_id' => 'id' ]);
}
}
diff --git a/common/modules/product/models/BrandLang.php b/common/modules/product/models/BrandLang.php
index 5a0d094..7ae906e 100755
--- a/common/modules/product/models/BrandLang.php
+++ b/common/modules/product/models/BrandLang.php
@@ -10,10 +10,10 @@
* This is the model class for table "brand_lang".
* @property integer $brand_id
* @property integer $language_id
- * @property string $name
+ * @property string $title
* @property string $meta_title
* @property string $meta_robots
- * @property string $meta_desc
+ * @property string $meta_description
* @property string $seo_text
* @property string $alias
* @property Brand $brand
@@ -43,9 +43,6 @@
return [
'slug' => [
'class' => 'common\behaviors\Slug',
- 'in_attribute' => 'name',
- 'out_attribute' => 'alias',
- 'translit' => true,
],
];
}
@@ -57,7 +54,7 @@
{
return [
[
- [ 'name' ],
+ [ 'title' ],
'required',
],
[
@@ -66,10 +63,10 @@
],
[
[
- 'name',
+ 'title',
'meta_title',
'meta_robots',
- 'meta_desc',
+ 'meta_description',
'alias',
],
'string',
@@ -92,14 +89,14 @@
'exist',
'skipOnError' => true,
'targetClass' => Brand::className(),
- 'targetAttribute' => [ 'brand_id' => 'brand_id' ],
+ 'targetAttribute' => [ 'id' => 'brand_id' ],
],
[
[ 'language_id' ],
'exist',
'skipOnError' => true,
'targetClass' => Language::className(),
- 'targetAttribute' => [ 'language_id' => 'language_id' ],
+ 'targetAttribute' => [ 'language_id' => 'id' ],
],
];
}
@@ -112,10 +109,10 @@
return [
'brand_id' => Yii::t('app', 'Brand ID'),
'language_id' => Yii::t('app', 'Language ID'),
- 'name' => Yii::t('app', 'Name'),
+ 'title' => Yii::t('app', 'Name'),
'meta_title' => Yii::t('app', 'Meta Title'),
'meta_robots' => Yii::t('app', 'Meta Robots'),
- 'meta_desc' => Yii::t('app', 'Meta Desc'),
+ 'meta_description' => Yii::t('app', 'Meta Desc'),
'seo_text' => Yii::t('app', 'Seo Text'),
'alias' => Yii::t('app', 'Alias'),
];
@@ -126,7 +123,7 @@
*/
public function getBrand()
{
- return $this->hasOne(Brand::className(), [ 'brand_id' => 'brand_id' ]);
+ return $this->hasOne(Brand::className(), [ 'id' => 'brand_id' ]);
}
/**
@@ -134,6 +131,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/modules/product/models/BrandSearch.php b/common/modules/product/models/BrandSearch.php
index c945a66..41221a5 100755
--- a/common/modules/product/models/BrandSearch.php
+++ b/common/modules/product/models/BrandSearch.php
@@ -13,7 +13,7 @@
class BrandSearch extends Brand
{
- public $brand_name;
+ public $brandName;
/**
* @inheritdoc
@@ -22,11 +22,11 @@
{
return [
[
- [ 'brand_name' ],
+ [ 'brandName' ],
'safe',
],
[
- [ 'brand_id' ],
+ [ 'id' ],
'integer',
],
];
@@ -74,28 +74,30 @@
$dataProvider->setSort([
'attributes' => [
- 'brand_id',
- 'brand_name' => [
- 'asc' => [ 'brand_lang.name' => SORT_ASC ],
- 'desc' => [ 'brand_lang.name' => SORT_DESC ],
+ 'id',
+ 'brandName' => [
+ 'asc' => [ 'brand_lang.title' => SORT_ASC ],
+ 'desc' => [ 'brand_lang.title' => SORT_DESC ],
],
],
]);
// grid filtering conditions
$query->andFilterWhere([
- 'brand.brand_id' => $this->brand_id,
+ 'brand.id' => $this->id,
])
->andFilterWhere([
'ilike',
- 'brand_lang.name',
- $this->brand_name,
+ 'brand_lang.title',
+ $this->brandName,
]);
return $dataProvider;
}
/**
+ *
+ * @todo Refactor this
* @param null|Category $category
* @param array $params
* @param null|ActiveQuery $productQuery
@@ -109,22 +111,22 @@
->select([
Brand::tableName() . '.*',
])
- ->innerJoin(Product::tableName(), Product::tableName() . '.brand_id=' . Brand::tableName() . '.brand_id')
- ->innerJoin(ProductCategory::tableName(), ProductCategory::tableName() . '.product_id=' . Product::tableName() . '.product_id');
+ ->innerJoin(Product::tableName(), Product::tableName() . '.brand_id=' . Brand::tableName() . '.id')
+ ->innerJoin(ProductCategory::tableName(), ProductCategory::tableName() . '.product_id=' . Product::tableName() . '.id');
- $query->innerJoin('product_variant', 'product_variant.product_id = ' . Product::tableName() . '.product_id');
+ $query->innerJoin('product_variant', 'product_variant.product_id = ' . Product::tableName() . '.id');
$query->where([
'!=',
'product_variant.stock',
0,
]);
- $query->groupBy(Product::tableName() . '.product_id');
+ $query->groupBy(Product::tableName() . '.id');
if(!empty( $category )) {
$query->andWhere([
- ProductCategory::tableName() . '.category_id' => $category->category_id,
+ ProductCategory::tableName() . '.category_id' => $category->id,
]);
}
- $query->groupBy(Brand::tableName() . '.brand_id');
+ $query->groupBy(Brand::tableName() . '.id');
return $query;
}
diff --git a/common/modules/product/models/Category.php b/common/modules/product/models/Category.php
index 15f12d1..1197860 100755
--- a/common/modules/product/models/Category.php
+++ b/common/modules/product/models/Category.php
@@ -28,10 +28,10 @@
* * From language behavior *
* @property CategoryLang $lang
* @property CategoryLang[] $langs
- * @property CategoryLang $object_lang
+ * @property CategoryLang $objectLang
* @property string $ownerKey
* @property string $langKey
- * @property CategoryLang[] $model_langs
+ * @property CategoryLang[] $modelLangs
* @property bool $transactionStatus
* @method string getOwnerKey()
* @method void setOwnerKey( string $value )
@@ -115,7 +115,7 @@
public function attributeLabels()
{
return [
- 'category_id' => Yii::t('product', 'Category ID'),
+ 'id' => Yii::t('product', 'Category ID'),
'parent_id' => Yii::t('product', 'Parent ID'),
'path' => Yii::t('product', 'Path'),
'depth' => Yii::t('product', 'Depth'),
@@ -141,8 +141,8 @@
public function getProducts()
{
- return $this->hasMany(Product::className(), [ 'product_id' => 'product_id' ])
- ->viaTable('product_category', [ 'category_id' => 'category_id' ]);
+ return $this->hasMany(Product::className(), [ 'id' => 'product_id' ])
+ ->viaTable('product_category', [ 'category_id' => 'id' ]);
}
/**
@@ -150,7 +150,7 @@
*/
public function getProductCategories()
{
- return $this->hasMany(ProductCategory::className(), [ 'category_id' => 'category_id' ]);
+ return $this->hasMany(ProductCategory::className(), [ 'category_id' => 'id' ]);
}
public function getBrands()
@@ -158,14 +158,14 @@
return $this->getProducts()
->select('brand.*')
->joinWith('brand')
- ->groupBy('brand.brand_id');
+ ->groupBy('brand.id');
}
public function getTaxGroupsByLevel($level)
{
return $this->hasMany(TaxGroup::className(), [ 'tax_group_id' => 'tax_group_id' ])
- ->viaTable('tax_group_to_category', [ 'category_id' => 'category_id' ])
+ ->viaTable('tax_group_to_category', [ 'category_id' => 'id' ])
->andWhere([ 'level' => $level ]);
}
@@ -192,10 +192,10 @@
->innerJoin('product_variant_option', 'tax_option.tax_option_id = product_variant_option.option_id')
->innerJoin('tax_group', 'tax_group.tax_group_id = tax_option.tax_group_id')
->innerJoin('product_variant', 'product_variant.product_variant_id = product_variant_option.product_variant_id')
- ->innerJoin('product', 'product.product_id = product_variant.product_id')
- ->innerJoin('product_category', 'product_category.product_id = product.product_id')
+ ->innerJoin('product', 'product.id = product_variant.product_id')
+ ->innerJoin('product_category', 'product_category.product_id = product.id')
->where([
- 'product_category.category_id' => $this->category_id,
+ 'product_category.category_id' => $this->id,
'tax_group.is_filter' => true,
])
->andWhere([
@@ -211,11 +211,11 @@
->from('tax_option')
->innerJoin('product_option', 'tax_option.tax_option_id = product_option.option_id')
->innerJoin('tax_group', 'tax_group.tax_group_id = tax_option.tax_group_id')
- ->innerJoin('product', 'product.product_id = product_option.product_id')
- ->innerJoin('product_category', 'product_category.product_id = product.product_id')
- ->innerJoin('product_variant', 'product_variant.product_id = product.product_id')
+ ->innerJoin('product', 'product.id = product_option.product_id')
+ ->innerJoin('product_category', 'product_category.product_id = product.id')
+ ->innerJoin('product_variant', 'product_variant.product_id = product.id')
->where([
- 'product_category.category_id' => $this->category_id,
+ 'product_category.category_id' => $this->id,
'tax_group.is_filter' => true,
])
->andWhere([
@@ -254,7 +254,7 @@
)
)
AND tax_group.is_menu = TRUE AND tax_group_to_category.category_id = :category_id', [
- ':category_id' => $this->category_id,
+ ':category_id' => $this->id,
]);
return $command->queryAll();
@@ -275,6 +275,6 @@
public function getTaxGroup()
{
return $this->hasMany(TaxGroup::className(), [ 'tax_group_id' => 'tax_group_id' ])
- ->viaTable('tax_group_to_category', [ 'category_id' => 'category_id' ]);
+ ->viaTable('tax_group_to_category', [ 'category_id' => 'id' ]);
}
}
diff --git a/common/modules/product/models/CategoryLang.php b/common/modules/product/models/CategoryLang.php
index f407569..84c8e4c 100755
--- a/common/modules/product/models/CategoryLang.php
+++ b/common/modules/product/models/CategoryLang.php
@@ -10,10 +10,10 @@
* This is the model class for table "category_lang".
* @property integer $category_id
* @property integer $language_id
- * @property string $name
+ * @property string $title
* @property string $meta_title
* @property string $meta_robots
- * @property string $meta_desc
+ * @property string $meta_description
* @property string $seo_text
* @property string $h1
* @property Category $category
@@ -43,9 +43,6 @@
return [
'slug' => [
'class' => 'common\behaviors\Slug',
- 'in_attribute' => 'name',
- 'out_attribute' => 'alias',
- 'translit' => true,
],
];
}
@@ -57,7 +54,7 @@
{
return [
[
- [ 'name' ],
+ [ 'title' ],
'required',
],
[
@@ -69,10 +66,10 @@
],
[
[
- 'name',
+ 'title',
'meta_title',
'meta_robots',
- 'meta_desc',
+ 'meta_description',
'h1',
],
'string',
@@ -95,14 +92,14 @@
'exist',
'skipOnError' => true,
'targetClass' => Category::className(),
- 'targetAttribute' => [ 'category_id' => 'category_id' ],
+ 'targetAttribute' => [ 'category_id' => 'id' ],
],
[
[ 'language_id' ],
'exist',
'skipOnError' => true,
'targetClass' => Language::className(),
- 'targetAttribute' => [ 'language_id' => 'language_id' ],
+ 'targetAttribute' => [ 'language_id' => 'id' ],
],
];
}
@@ -115,10 +112,10 @@
return [
'category_id' => Yii::t('app', 'Category ID'),
'language_id' => Yii::t('app', 'Language ID'),
- 'name' => Yii::t('app', 'Name'),
+ 'title' => Yii::t('app', 'Name'),
'meta_title' => Yii::t('app', 'Meta Title'),
'meta_robots' => Yii::t('app', 'Meta Robots'),
- 'meta_desc' => Yii::t('app', 'Meta Desc'),
+ 'meta_description' => Yii::t('app', 'Meta Desc'),
'seo_text' => Yii::t('app', 'Seo Text'),
'h1' => Yii::t('app', 'H1'),
];
@@ -129,7 +126,7 @@
*/
public function getCategory()
{
- return $this->hasOne(Category::className(), [ 'category_id' => 'category_id' ]);
+ return $this->hasOne(Category::className(), [ 'id' => 'category_id' ]);
}
/**
@@ -137,6 +134,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/modules/product/models/CategorySearch.php b/common/modules/product/models/CategorySearch.php
index fd72e5a..edb7261 100755
--- a/common/modules/product/models/CategorySearch.php
+++ b/common/modules/product/models/CategorySearch.php
@@ -12,7 +12,7 @@
class CategorySearch extends Category
{
- public $category_name;
+ public $brandName;
public function behaviors()
{
@@ -26,11 +26,11 @@
{
return [
[
- [ 'category_name' ],
+ [ 'brandName' ],
'safe',
],
[
- [ 'category_id' ],
+ [ 'id' ],
'integer',
],
];
@@ -72,18 +72,18 @@
// grid filtering conditions
$query->andFilterWhere([
- 'category.category_id' => $this->category_id,
+ 'category.id' => $this->id,
])
->andFilterWhere([
'ilike',
- 'category_lang.name',
- $this->category_name,
+ 'category_lang.title',
+ $this->brandName,
]);
$query->orderBy([
'category.path' => SORT_ASC,
'category.depth' => SORT_ASC,
- 'category.category_id' => SORT_ASC,
+ 'category.id' => SORT_ASC,
]);
return $dataProvider;
diff --git a/common/modules/product/models/Export.php b/common/modules/product/models/Export.php
index abfd872..72fc9e8 100755
--- a/common/modules/product/models/Export.php
+++ b/common/modules/product/models/Export.php
@@ -27,7 +27,7 @@
[
'lang',
'default',
- 'value' => Language::getCurrent()->language_id,
+ 'value' => Language::getCurrent()->id,
],
];
}
@@ -43,7 +43,7 @@
$handle = fopen(\Yii::getAlias('@storage/sync/') . $filename, "a");
}
- $language = Language::findOne(\Yii::$app->session->get('export_lang', Language::getDefaultLanguage()->language_id));
+ $language = Language::findOne(\Yii::$app->session->get('export_lang', Language::getDefaultLanguage()->id));
Language::setCurrent($language->url);
/**
@@ -66,7 +66,7 @@
/**
* @var ProductVariant $variant
*/
- $color = $variant->lang->name;
+ $color = $variant->lang->title;
$mods[] = $variant->sku . $this->generateID($variant->remote_id) . '=' . $this->convertFilterToString($variant->filters) . '=' . $color . '=' . ( ( !empty( $variant->image ) ) ? $variant->image->image : '' ) . '=' . $variant->stock;
}
@@ -77,7 +77,7 @@
$categories = [];
foreach($product->categories as $value) {
- $categories[] = $value->lang->name . $this->generateID($value->remote_id);
+ $categories[] = $value->lang->title . $this->generateID($value->remote_id);
}
$categories = implode(',', $categories);
@@ -85,9 +85,9 @@
$list = [
$categories,
//A - категории через запятую Название(remote_id)
- ( ( !empty( $product->brand ) ) ? $product->brand->lang->name . $this->generateID($product->brand->remote_id) : '' ),
+ ( ( !empty( $product->brand ) ) ? $product->brand->lang->title . $this->generateID($product->brand->remote_id) : '' ),
//B - бренд Название(remote_id)
- $product->lang->name . $this->generateID($product->remote_id),
+ $product->lang->title . $this->generateID($product->remote_id),
//C - название товара Название(remote_id)
( ( !empty( $product->lang->description ) ) ? $product->lang->description : '' ),
//D - описание товара Описание(remote_id)
@@ -148,7 +148,7 @@
* @var TaxOption[] $filters
*/
foreach($filters as $filter) {
- $fittersArray[ $filter->taxGroup->lang->name . $this->generateID($filter->taxGroup->remote_id) ][] = $filter->lang->value . $this->generateID($filter->remote_id);
+ $fittersArray[ $filter->taxGroup->lang->title . $this->generateID($filter->taxGroup->remote_id) ][] = $filter->lang->value . $this->generateID($filter->remote_id);
}
$filterString = [];
diff --git a/common/modules/product/models/Import.php b/common/modules/product/models/Import.php
index 714017e..d703f97 100755
--- a/common/modules/product/models/Import.php
+++ b/common/modules/product/models/Import.php
@@ -124,12 +124,12 @@
// ===== Set stock ====
if($city_name) {
if(( $stock = Stock::find()
- ->filterWhere([ 'name' => trim($city_name) ])
+ ->filterWhere([ 'title' => trim($city_name) ])
->one() ) === NULL
) {
// Create stock
$stock = new Stock();
- $stock->name = trim($city_name);
+ $stock->title = trim($city_name);
$stock->save(false);
}
@@ -245,24 +245,24 @@
->one() ) !== NULL
) {
if(!empty( $category->lang )) {
- $category->lang->name = $parsed_name[ 'name' ];
+ $category->lang->title = $parsed_name[ 'name' ];
$category->lang->save(false);
} else {
- throw new \Exception('Category with ID ' . $category->category_id . ' and lang ' . Language::getCurrent()->language_id . ' doesn\'t exist');
+ throw new \Exception('Category with ID ' . $category->id . ' and lang ' . Language::getCurrent()->id . ' doesn\'t exist');
}
} else {
// Create category
$category = new Category();
$category->generateLangs();
- $category_langs = $category->model_langs;
+ $category_langs = $category->modelLangs;
foreach($category_langs as $category_lang) {
- $category_lang->name = $parsed_name[ 'name' ];
+ $category_lang->title = $parsed_name[ 'name' ];
}
$category->remote_id = $parsed_name[ 'remote_id' ];
$category->save(false);
}
- $category_id[] = $category->category_id;
+ $category_id[] = $category->id;
}
return $category_id;
}
@@ -287,23 +287,23 @@
->one() ) !== NULL
) {
if(!empty( $brand->lang )) {
- $brand->lang->name = $parsed_name[ 'name' ];
+ $brand->lang->title = $parsed_name[ 'name' ];
$brand->lang->save(false);
} else {
- throw new \Exception('Brand with ID ' . $brand->brand_id . ' and lang ' . Language::getCurrent()->language_id . ' doesn\'t exist');
+ throw new \Exception('Brand with ID ' . $brand->id . ' and lang ' . Language::getCurrent()->id . ' doesn\'t exist');
}
- return $brand->brand_id;
+ return $brand->id;
} else {
// Create brand
$brand = new Brand();
$brand->generateLangs();
- $brand_langs = $brand->model_langs;
+ $brand_langs = $brand->modelLangs;
foreach($brand_langs as $brand_lang) {
- $brand_lang->name = $parsed_name[ 'name' ];
+ $brand_lang->title = $parsed_name[ 'name' ];
}
$brand->remote_id = $parsed_name[ 'remote_id' ];
$brand->save(false);
- return $brand->brand_id;
+ return $brand->id;
}
}
return NULL;
@@ -385,16 +385,16 @@
$_productVariant->remote_id = $mod_art_parsed[ 'remote_id' ];
}
$_productVariant->generateLangs();
- $product_variant_langs = $_productVariant->model_langs;
+ $product_variant_langs = $_productVariant->modelLangs;
foreach($product_variant_langs as $product_variant_lang) {
- $product_variant_lang->name = $mod_name;
+ $product_variant_lang->title = $mod_name;
}
} else {
if(!empty( $_productVariant->lang )) {
- $_productVariant->lang->name = $mod_name;
+ $_productVariant->lang->title = $mod_name;
$_productVariant->lang->save(false);
} else {
- throw new \Exception('Product variant with ID ' . $_productVariant->product_variant_id . ' and lang ' . Language::getCurrent()->language_id . ' doesn\'t exist');
+ throw new \Exception('Product variant with ID ' . $_productVariant->product_variant_id . ' and lang ' . Language::getCurrent()->id . ' doesn\'t exist');
}
}
$_productVariant->product_unit_id = 1;
@@ -521,12 +521,12 @@
$fotos = explode(',', trim($data[ 12 ]));
}
- // $lang = \Yii::$app->session->get('export_lang', Language::getDefaultLanguage()->language_id);
+ // $lang = \Yii::$app->session->get('export_lang', Language::getDefaultLanguage()->id);
// /**
// * @var Language $language
// */
// $language = Language::find()
- // ->where([ 'language_id' => $lang ])
+ // ->where([ 'id' => $lang ])
// ->one();
// Language::setCurrent($language->url);
$categories = $this->saveCatalog($catalog_names);
@@ -547,23 +547,23 @@
->one() ) !== NULL
) {
if(!empty( $_product->lang )) {
- $_product->lang->name = $parsed_name[ 'name' ];
+ $_product->lang->title = $parsed_name[ 'name' ];
$_product->lang->description = $product_body;
$_product->lang->save(false);
} else {
- throw new \Exception('Product with ID ' . $_product->product_id . ' and lang ' . Language::getCurrent()->language_id . ' doesn\'t exist');
+ throw new \Exception('Product with ID ' . $_product->id . ' and lang ' . Language::getCurrent()->id . ' doesn\'t exist');
}
} else {
$_product = new Product();
$_product->generateLangs();
- $product_langs = $_product->model_langs;
+ $product_langs = $_product->modelLangs;
foreach($product_langs as $product_lang) {
- $product_lang->name = $parsed_name[ 'name' ];
+ $product_lang->title = $parsed_name[ 'name' ];
$product_lang->description = $product_body;
}
}
- $is_new_product = empty( $_product->product_id );
+ $is_new_product = empty( $_product->id );
$_product->categories = $categories;
@@ -578,9 +578,9 @@
}
if(!empty( $_product->lang )) {
- $product_name_inserted = $_product->lang->name;
+ $product_name_inserted = $_product->lang->title;
} else {
- $product_name_inserted = $_product->model_langs[ Language::$current->language_id ]->name;
+ $product_name_inserted = $_product->modelLangs[ Language::$current->id ]->title;
}
if(( $_product->save(false) === false ) || !$_product->transactionStatus) {
@@ -588,14 +588,14 @@
continue;
}
- $this->saveFotos($fotos, $_product->product_id);
+ $this->saveFotos($fotos, $_product->id);
// нужно для проставления характеристик относящихся к модификациям
- $this->saveVariants($data, $product_cost_old, $_product->product_id, $_product->categories, $product_cost);
+ $this->saveVariants($data, $product_cost_old, $_product->id, $_product->categories, $product_cost);
// $_product->save(false);
- $result_items[] = "Product {$product_name_inserted} #{$_product->product_id} saved (" . ( $is_new_product ? 'new product' : 'exists product' ) . ")" . " (line $j)";
+ $result_items[] = "Product {$product_name_inserted} #{$_product->id} saved (" . ( $is_new_product ? 'new product' : 'exists product' ) . ")" . " (line $j)";
} catch(\Exception $e) {
$result_items[] = $e->getMessage() . '(line ' . $j . ')';
@@ -661,17 +661,17 @@
->one() ) !== NULL
) {
if(!empty( $taxGroup->lang )) {
- $taxGroup->lang->name = $parsed_group_name[ 'name' ];
+ $taxGroup->lang->title = $parsed_group_name[ 'name' ];
$taxGroup->lang->save(false);
} else {
- throw new \Exception('Tax group with ID ' . $taxGroup->tax_group_id . ' and lang ' . Language::getCurrent()->language_id . ' doesn\'t exist');
+ throw new \Exception('Tax group with ID ' . $taxGroup->tax_group_id . ' and lang ' . Language::getCurrent()->id . ' doesn\'t exist');
}
} else {
$taxGroup = new TaxGroup();
$taxGroup->generateLangs();
- $tax_group_langs = $taxGroup->model_langs;
+ $tax_group_langs = $taxGroup->modelLangs;
foreach($tax_group_langs as $tax_group_lang) {
- $tax_group_lang->name = $parsed_group_name[ 'name' ];
+ $tax_group_lang->title = $parsed_group_name[ 'name' ];
}
$taxGroup->level = $level;
$taxGroup->categories = $catalog_names;
@@ -695,13 +695,13 @@
$option->lang->value = $parsed_option_name[ 'name' ];
$option->lang->save(false);
} else {
- throw new \Exception('Tax option with ID ' . $option->tax_option_id . ' and lang ' . Language::getCurrent()->language_id . ' doesn\'t exist');
+ throw new \Exception('Tax option with ID ' . $option->tax_option_id . ' and lang ' . Language::getCurrent()->id . ' doesn\'t exist');
}
} else {
// Create option
$option = new TaxOption();
$option->generateLangs();
- $option_langs = $option->model_langs;
+ $option_langs = $option->modelLangs;
foreach($option_langs as $option_lang) {
$option_lang->value = $parsed_option_name[ 'name' ];
}
diff --git a/common/modules/product/models/Product.php b/common/modules/product/models/Product.php
index d36bb66..3a67a40 100755
--- a/common/modules/product/models/Product.php
+++ b/common/modules/product/models/Product.php
@@ -19,7 +19,7 @@
/**
* This is the model class for table "{{%product}}".
* @property integer $brand_id
- * @property integer $product_id
+ * @property integer $id
* @property Category $category
* @property Category[] $categories
* @property ProductVariant[] $variants
@@ -41,10 +41,10 @@
* * From language behavior *
* @property ProductLang $lang
* @property ProductLang[] $langs
- * @property ProductLang $object_lang
+ * @property ProductLang $objectLang
* @property string $ownerKey
* @property string $langKey
- * @property ProductLang[] $model_langs
+ * @property ProductLang[] $modelLangs
* @property bool $transactionStatus
* @method string getOwnerKey()
* @method void setOwnerKey( string $value )
@@ -71,8 +71,8 @@
class Product extends ActiveRecord
{
- /** @var array $_variants */
- public $_variants = [];
+ /** @var array $variants */
+ public $variants = [];
public $imagesUpload = [];
@@ -88,14 +88,14 @@
'directory' => 'products',
'column' => 'image',
'links' => [
- 'product_id' => 'product_id',
+ 'id' => 'product_id',
],
'model' => ProductImage::className(),
],
'multipleImage' => [
'class' => MultipleImgBehavior::className(),
'links' => [
- 'product_id' => 'product_id',
+ 'id' => 'product_id',
],
'conditions' => [
'product_variant_id' => NULL,
@@ -166,7 +166,7 @@
public function attributeLabels()
{
return [
- 'product_id' => Yii::t('product', 'ID'),
+ 'id' => Yii::t('product', 'ID'),
'brand_id' => Yii::t('product', 'Brand'),
'categories' => Yii::t('product', 'Categories'),
// relation behavior field
@@ -187,7 +187,7 @@
*/
public function getBrand()
{
- return $this->hasOne(Brand::className(), [ 'brand_id' => 'brand_id' ]);
+ return $this->hasOne(Brand::className(), [ 'id' => 'brand_id' ]);
}
/**
@@ -195,7 +195,7 @@
*/
public function getVariant()
{
- return $this->hasOne(ProductVariant::className(), [ 'product_id' => 'product_id' ]);
+ return $this->hasOne(ProductVariant::className(), [ 'product_id' => 'id' ]);
}
/**
@@ -203,7 +203,7 @@
*/
public function getEnabledVariant()
{
- return $this->hasOne(ProductVariant::className(), [ 'product_id' => 'product_id' ])
+ return $this->hasOne(ProductVariant::className(), [ 'product_id' => 'id' ])
->andOnCondition([
'!=',
ProductVariant::tableName() . '.stock',
@@ -226,12 +226,12 @@
*/
public function getVariants()
{
- return $this->hasMany(ProductVariant::className(), [ 'product_id' => 'product_id' ]);
+ return $this->hasMany(ProductVariant::className(), [ 'product_id' => 'id' ]);
}
public function getEnabledVariants()
{
- return $this->hasMany(ProductVariant::className(), [ 'product_id' => 'product_id' ])
+ return $this->hasMany(ProductVariant::className(), [ 'product_id' => 'id' ])
->andOnCondition([
'!=',
ProductVariant::tableName() . '.stock',
@@ -242,12 +242,12 @@
public function setVariants($variants)
{
- $this->_variants = $variants;
+ $this->variants = $variants;
}
public function getFullname()
{
- return empty( $this->brand ) ? $this->lang->name : $this->brand->lang->name . ' ' . $this->lang->name;
+ return empty( $this->brand ) ? $this->lang->title : $this->brand->lang->title . ' ' . $this->lang->title;
}
/**
@@ -255,22 +255,22 @@
*/
public function getCategories()
{
- return $this->hasMany(Category::className(), [ 'category_id' => 'category_id' ])
- ->viaTable('product_category', [ 'product_id' => 'product_id' ]);
+ return $this->hasMany(Category::className(), [ 'id' => 'category_id' ])
+ ->viaTable('product_category', [ 'product_id' => 'id' ]);
}
public function getCategoriesNames()
{
$result = [];
foreach($this->categories as $category) {
- $result[] = $category->lang->name;
+ $result[] = $category->lang->title;
}
return $result;
}
public function getVariantsWithFilters()
{
- return $this->hasMany(ProductVariant::className(), [ 'product_id' => 'product_id' ])
+ return $this->hasMany(ProductVariant::className(), [ 'product_id' => 'id' ])
->joinWith('lang', true, 'INNER JOIN')
->with([
'filters',
@@ -283,14 +283,14 @@
*/
public function getCategory()
{
- return $this->hasOne(Category::className(), [ 'category_id' => 'category_id' ])
- ->viaTable('product_category', [ 'product_id' => 'product_id' ]);
+ return $this->hasOne(Category::className(), [ 'id' => 'category_id' ])
+ ->viaTable('product_category', [ 'product_id' => 'id' ]);
}
public function getOptions()
{
return $this->hasMany(TaxOption::className(), [ 'tax_option_id' => 'option_id' ])
- ->viaTable('product_option', [ 'product_id' => 'product_id' ]);
+ ->viaTable('product_option', [ 'product_id' => 'id' ]);
}
/**
@@ -309,7 +309,7 @@
->with('lang')
->all() as $group) {
if(!empty( $options[ $group->tax_group_id ] )) {
- $group->_options = $options[ $group->tax_group_id ];
+ $group->options = $options[ $group->tax_group_id ];
$groups[] = $group;
}
}
@@ -328,13 +328,13 @@
->where([
'tax_group.tax_group_id' => array_keys($options),
'tax_group.display' => true,
- 'category.category_id' => $category_id,
+ 'category.id' => $category_id,
])
->all();
foreach($taxGroups as $group) {
if(!empty( $options[ $group->tax_group_id ] )) {
- $group->_options = $options[ $group->tax_group_id ];
+ $group->options = $options[ $group->tax_group_id ];
$groups[] = $group;
}
}
@@ -344,13 +344,13 @@
public function getStocks()
{
return $this->hasMany(Stock::className(), [ 'stock_id' => 'stock_id' ])
- ->viaTable(ProductStock::tableName(), [ 'product_id' => 'product_id' ]);
+ ->viaTable(ProductStock::tableName(), [ 'product_id' => 'id' ]);
}
public function getQuantity()
{
return ProductStock::find()
- ->where([ 'product_id' => $this->product_id ])
+ ->where([ 'product_id' => $this->id ])
->sum('quantity');
}
@@ -374,12 +374,12 @@
}
}
- if(!empty( $this->_variants )) {
+ if(!empty( $this->variants )) {
$todel = [];
foreach($this->variants ? : [] as $_variant) {
$todel[ $_variant->product_variant_id ] = $_variant->product_variant_id;
}
- foreach($this->_variants as $_variant) {
+ foreach($this->variants as $_variant) {
if(!is_array($_variant)) {
return;
}
@@ -389,9 +389,9 @@
} else {
$model = new ProductVariant();
}
- $_variant[ 'product_id' ] = $this->product_id;
+ $_variant[ 'product_id' ] = $this->id;
$model->load([ 'ProductVariant' => $_variant ]);
- $model->product_id = $this->product_id;
+ $model->product_id = $this->id;
$model->save();
}
if(!empty( $todel )) {
@@ -417,7 +417,7 @@
$averageRating->value = $average;
} else {
$averageRating = new ProductToRating([
- 'product_id' => $this->product_id,
+ 'product_id' => $this->id,
'value' => $average,
]);
}
@@ -430,7 +430,7 @@
public function getComments()
{
- return $this->hasMany(CommentModel::className(), [ 'entity_id' => 'product_id' ])
+ return $this->hasMany(CommentModel::className(), [ 'entity_id' => 'id' ])
->where([
'artbox_comment.entity' => self::className(),
'artbox_comment.status' => CommentModel::STATUS_ACTIVE,
@@ -440,12 +440,12 @@
public function getAverageRating()
{
- return $this->hasOne(ProductToRating::className(), [ 'product_id' => 'product_id' ]);
+ return $this->hasOne(ProductToRating::className(), [ 'product_id' => 'id' ]);
}
public function getTaxGroupsByLevel($level)
{
- $categories = ArrayHelper::getColumn($this->categories, 'category_id');
+ $categories = ArrayHelper::getColumn($this->categories, 'id');
return TaxGroup::find()
->distinct()
->innerJoin('tax_group_to_category', 'tax_group_to_category.tax_group_id = tax_group.tax_group_id')
@@ -466,7 +466,7 @@
public function getFilters()
{
return $this->hasMany(TaxOption::className(), [ 'tax_option_id' => 'option_id' ])
- ->viaTable('product_option', [ 'product_id' => 'product_id' ])
+ ->viaTable('product_option', [ 'product_id' => 'id' ])
->joinWith('taxGroup.lang', true, 'INNER JOIN')
->joinWith('lang', true, 'INNER JOIN');
}
diff --git a/common/modules/product/models/ProductCategory.php b/common/modules/product/models/ProductCategory.php
index b94806d..0c7aee9 100755
--- a/common/modules/product/models/ProductCategory.php
+++ b/common/modules/product/models/ProductCategory.php
@@ -43,14 +43,14 @@
'exist',
'skipOnError' => true,
'targetClass' => Category::className(),
- 'targetAttribute' => [ 'category_id' => 'category_id' ],
+ 'targetAttribute' => [ 'category_id' => 'id' ],
],
[
[ 'product_id' ],
'exist',
'skipOnError' => true,
'targetClass' => Product::className(),
- 'targetAttribute' => [ 'product_id' => 'product_id' ],
+ 'targetAttribute' => [ 'product_id' => 'id' ],
],
];
}
diff --git a/common/modules/product/models/ProductImage.php b/common/modules/product/models/ProductImage.php
index c79ebba..827a6cb 100755
--- a/common/modules/product/models/ProductImage.php
+++ b/common/modules/product/models/ProductImage.php
@@ -71,7 +71,7 @@
'exist',
'skipOnError' => true,
'targetClass' => Product::className(),
- 'targetAttribute' => [ 'product_id' => 'product_id' ],
+ 'targetAttribute' => [ 'product_id' => 'id' ],
],
[
[ 'product_variant_id' ],
@@ -105,7 +105,7 @@
*/
public function getProduct()
{
- $return = $this->hasOne(Product::className(), [ 'product_id' => 'product_id' ]);
+ $return = $this->hasOne(Product::className(), [ 'id' => 'product_id' ]);
if(empty( $return )) {
$return = $this->productVariant->product_id;
}
diff --git a/common/modules/product/models/ProductLang.php b/common/modules/product/models/ProductLang.php
index 88a1422..2eff2e7 100755
--- a/common/modules/product/models/ProductLang.php
+++ b/common/modules/product/models/ProductLang.php
@@ -10,7 +10,7 @@
* This is the model class for table "product_lang".
* @property integer $product_id
* @property integer $language_id
- * @property string $name
+ * @property string $title
* @property string $description
* @property string $alias
* @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,14 +83,14 @@
'exist',
'skipOnError' => true,
'targetClass' => Language::className(),
- 'targetAttribute' => [ 'language_id' => 'language_id' ],
+ 'targetAttribute' => [ 'language_id' => 'id' ],
],
[
[ 'product_id' ],
'exist',
'skipOnError' => true,
'targetClass' => Product::className(),
- 'targetAttribute' => [ 'product_id' => 'product_id' ],
+ 'targetAttribute' => [ 'product_id' => 'id' ],
],
];
}
@@ -106,7 +103,7 @@
return [
'product_id' => Yii::t('app', 'Product 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' ]);
}
/**
@@ -125,6 +122,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/modules/product/models/ProductOption.php b/common/modules/product/models/ProductOption.php
index 513753a..9c6989b 100755
--- a/common/modules/product/models/ProductOption.php
+++ b/common/modules/product/models/ProductOption.php
@@ -49,7 +49,7 @@
'exist',
'skipOnError' => true,
'targetClass' => Product::className(),
- 'targetAttribute' => [ 'product_id' => 'product_id' ],
+ 'targetAttribute' => [ 'product_id' => 'id' ],
],
[
[ 'option_id' ],
@@ -77,7 +77,7 @@
*/
public function getProduct()
{
- return $this->hasOne(Product::className(), [ 'product_id' => 'product_id' ]);
+ return $this->hasOne(Product::className(), [ 'id' => 'product_id' ]);
}
/**
diff --git a/common/modules/product/models/ProductSearch.php b/common/modules/product/models/ProductSearch.php
index e486460..cbf2e89 100755
--- a/common/modules/product/models/ProductSearch.php
+++ b/common/modules/product/models/ProductSearch.php
@@ -13,13 +13,11 @@
class ProductSearch extends Product
{
- public $brand_id;
+ public $categoryId;
- public $category_id;
+ public $productName;
- public $product_name;
-
- public $variant_count;
+ public $variantCount;
public function behaviors()
{
@@ -38,15 +36,15 @@
return [
[
[
- 'product_name',
+ 'productName',
],
'safe',
],
[
[
'brand_id',
- 'product_id',
- 'category_id',
+ 'id',
+ 'categoryId',
],
'integer',
],
@@ -65,10 +63,10 @@
{
$labels = parent::attributeLabels();
$new_labels = [
- 'category_id' => 'Category ID',
+ 'categoryId' => 'Category ID',
'brand_id' => 'Brand ID',
- 'product_name' => 'Product name',
- 'variant_count' => 'Variant count',
+ 'productName' => 'Product name',
+ 'variantCount' => 'Variant count',
];
return array_merge($labels, $new_labels);
}
@@ -113,9 +111,9 @@
->joinWith('variants');
$query->groupBy([
- 'product.product_id',
- 'brand_lang.name',
- 'product_lang.name',
+ 'product.id',
+ 'brand_lang.title',
+ 'product_lang.title',
]);
$dataProvider = new ActiveDataProvider([
@@ -124,17 +122,17 @@
$dataProvider->setSort([
'attributes' => [
- 'product_id',
- 'product_name' => [
- 'asc' => [ 'product_lang.name' => SORT_ASC ],
- 'desc' => [ 'product_lang.name' => SORT_DESC ],
+ 'id',
+ 'productName' => [
+ 'asc' => [ 'product_lang.title' => SORT_ASC ],
+ 'desc' => [ 'product_lang.title' => SORT_DESC ],
],
'brand_id' => [
- 'asc' => [ 'brand_lang.name' => SORT_ASC ],
- 'desc' => [ 'brand_lang.name' => SORT_DESC ],
+ 'asc' => [ 'brand_lang.title' => SORT_ASC ],
+ 'desc' => [ 'brand_lang.title' => SORT_DESC ],
'default' => SORT_DESC,
],
- 'variant_count' => [
+ 'variantCount' => [
'asc' => [ 'count' => SORT_ASC ],
'desc' => [ 'count' => SORT_DESC ],
],
@@ -158,13 +156,13 @@
}
$query->andFilterWhere([
'product.brand_id' => $this->brand_id,
- 'product.product_id' => $this->product_id,
- 'product_category.category_id' => $this->category_id,
+ 'product.id' => $this->id,
+ 'product_category.category_id' => $this->categoryId,
]);
$query->andFilterWhere([
'like',
- 'product_lang.name',
- $this->product_name,
+ 'product_lang.title',
+ $this->productName,
]);
return $dataProvider;
diff --git a/common/modules/product/models/ProductStock.php b/common/modules/product/models/ProductStock.php
index 625df7a..31bb09c 100755
--- a/common/modules/product/models/ProductStock.php
+++ b/common/modules/product/models/ProductStock.php
@@ -41,7 +41,7 @@
'integer',
],
[
- [ 'name' ],
+ [ 'title' ],
'required',
],
[
@@ -49,7 +49,7 @@
'exist',
'skipOnError' => true,
'targetClass' => Product::className(),
- 'targetAttribute' => [ 'product_id' => 'product_id' ],
+ 'targetAttribute' => [ 'product_id' => 'id' ],
],
[
[ 'product_variant_id' ],
@@ -78,7 +78,7 @@
'stock_id' => 'Stock ID',
'quantity' => 'Количество',
'product_variant_id' => 'Product Variant ID',
- 'name' => "Название",
+ 'title' => "Название",
];
}
@@ -87,7 +87,7 @@
*/
public function getProduct()
{
- return $this->hasOne(Product::className(), [ 'product_id' => 'product_id' ]);
+ return $this->hasOne(Product::className(), [ 'id' => 'product_id' ]);
}
/**
@@ -100,7 +100,7 @@
public function getName()
{
- return ( !empty( $this->stock ) ) ? $this->stock->name : '';
+ return ( !empty( $this->stock ) ) ? $this->stock->title : '';
}
/**
@@ -110,7 +110,7 @@
*/
public function setName($value)
{
- $this->name = $value;
+ $this->title = $value;
}
/**
diff --git a/common/modules/product/models/ProductUnit.php b/common/modules/product/models/ProductUnit.php
index 9c35960..3b24fb0 100755
--- a/common/modules/product/models/ProductUnit.php
+++ b/common/modules/product/models/ProductUnit.php
@@ -17,10 +17,10 @@
* * From language behavior *
* @property ProductUnitLang $lang
* @property ProductUnitLang[] $langs
- * @property ProductUnitLang $object_lang
+ * @property ProductUnitLang $objectLang
* @property string $ownerKey
* @property string $langKey
- * @property ProductUnitLang[] $model_langs
+ * @property ProductUnitLang[] $modelLangs
* @property bool $transactionStatus
* @method string getOwnerKey()
* @method void setOwnerKey( string $value )
diff --git a/common/modules/product/models/ProductUnitLang.php b/common/modules/product/models/ProductUnitLang.php
index 235ba35..c181348 100755
--- a/common/modules/product/models/ProductUnitLang.php
+++ b/common/modules/product/models/ProductUnitLang.php
@@ -10,7 +10,7 @@
* This is the model class for table "product_unit_lang".
* @property integer $product_unit_id
* @property integer $language_id
- * @property string $name
+ * @property string $title
* @property string $short
* @property Language $language
* @property ProductUnit $productUnit
@@ -41,12 +41,12 @@
{
return [
[
- [ 'name' ],
+ [ 'title' ],
'required',
],
[
[
- 'name',
+ 'title',
'short',
],
'string',
@@ -69,7 +69,7 @@
'exist',
'skipOnError' => true,
'targetClass' => Language::className(),
- 'targetAttribute' => [ 'language_id' => 'language_id' ],
+ 'targetAttribute' => [ 'language_id' => 'id' ],
],
[
[ 'product_unit_id' ],
@@ -89,7 +89,7 @@
return [
'product_unit_id' => Yii::t('app', 'Product Unit ID'),
'language_id' => Yii::t('app', 'Language ID'),
- 'name' => Yii::t('app', 'Name'),
+ 'title' => Yii::t('app', 'Name'),
'short' => Yii::t('app', 'Short'),
];
}
@@ -99,7 +99,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/product/models/ProductUnitSearch.php b/common/modules/product/models/ProductUnitSearch.php
index f563f1c..ffcdfb5 100755
--- a/common/modules/product/models/ProductUnitSearch.php
+++ b/common/modules/product/models/ProductUnitSearch.php
@@ -23,7 +23,7 @@
{
$labels = parent::attributeLabels();
$new_labels = [
- 'name' => \Yii::t('product', 'Product Unit Name'),
+ 'title' => \Yii::t('product', 'Product Unit Name'),
];
return array_merge($labels, $new_labels);
}
@@ -35,7 +35,7 @@
{
return [
[
- [ 'name' ],
+ [ 'title' ],
'safe',
],
[
@@ -78,9 +78,9 @@
'attributes' => [
'product_unit_id',
'is_defaut',
- 'name' => [
- 'asc' => [ 'product_unit_lang.name' => SORT_ASC ],
- 'desc' => [ 'product_unit_lang.name' => SORT_DESC ],
+ 'title' => [
+ 'asc' => [ 'product_unit_lang.title' => SORT_ASC ],
+ 'desc' => [ 'product_unit_lang.title' => SORT_DESC ],
],
],
],
@@ -101,8 +101,8 @@
])
->andFilterWhere([
'ilike',
- 'product_unit_lang.name',
- $this->name,
+ 'product_unit_lang.title',
+ $this->title,
]);
return $dataProvider;
diff --git a/common/modules/product/models/ProductVariant.php b/common/modules/product/models/ProductVariant.php
index 5fc3b3a..685dd67 100755
--- a/common/modules/product/models/ProductVariant.php
+++ b/common/modules/product/models/ProductVariant.php
@@ -1,351 +1,355 @@
- [
- 'class' => LanguageBehavior::className(),
- ],
- 'images' => [
- 'class' => SaveMultipleFileBehavior::className(),
- 'name' => 'imagesUpload',
- 'directory' => 'products',
- 'column' => 'image',
- 'links' => [
- 'product_id' => 'product_id',
- 'product_variant_id' => 'product_variant_id',
- ],
- 'model' => ProductImage::className(),
- ],
- 'multipleImage' => [
- 'class' => MultipleImgBehavior::className(),
- 'links' => [
- 'product_variant_id' => 'product_variant_id',
- ],
- 'model' => ProductImage::className(),
- 'config' => [
- 'caption' => 'image',
- 'delete_action' => '/product/variant/delimg',
- 'id' => 'product_image_id',
- ],
- ],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [
- [
- 'product_id',
- 'product_unit_id',
- ],
- 'required',
- ],
- [
- [
- 'product_id',
- 'product_unit_id',
- ],
- 'integer',
- ],
- [
- [
- 'price',
- 'price_old',
- 'stock',
- ],
- 'number',
- ],
- [
- [
- 'sku',
- ],
- 'string',
- 'max' => 255,
- ],
- [
- [
- 'options',
- ],
- 'safe',
- ],
- [
- [ 'product_unit_id' ],
- 'exist',
- 'skipOnError' => true,
- 'targetClass' => ProductUnit::className(),
- 'targetAttribute' => [ 'product_unit_id' => 'product_unit_id' ],
- ],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'product_variant_id' => Yii::t('product', 'Product Variant ID'),
- 'product_id' => Yii::t('product', 'Product ID'),
- 'sku' => Yii::t('product', 'Sku'),
- 'price' => Yii::t('product', 'Price'),
- 'price_old' => Yii::t('product', 'Price Old'),
- 'stock' => Yii::t('product', 'Stock'),
- 'product_unit_id' => Yii::t('product', 'Product Unit ID'),
- 'stock_caption' => Yii::t('product', 'Stock'),
- 'image' => Yii::t('product', 'Image'),
- 'images' => Yii::t('product', 'Images'),
- ];
- }
-
- /**
- * @return \yii\db\ActiveQuery
- */
- public function getProductUnit()
- {
- return $this->hasOne(ProductUnit::className(), [ 'product_unit_id' => 'product_unit_id' ]);
- }
-
- /**
- * @return \yii\db\ActiveQuery
- */
- public function getProduct()
- {
- return $this->hasOne(Product::className(), [ 'product_id' => 'product_id' ]);
- }
-
- public function getProductStock()
- {
- return $this->hasMany(ProductStock::className(), [ 'product_variant_id' => 'product_variant_id' ]);
- }
-
- public function getQuantity()
- {
- return ProductStock::find()
- ->where([ 'product_variant_id' => $this->product_variant_id ])
- ->sum('quantity');
- }
-
- public function getStock_caption()
- {
- return is_null($this->stock) ? '∞' : ( $this->stock > 0 ? Yii::t('product', 'Enable') : Yii::t('product', 'Disable') );
- }
-
- public function getVariantStocks()
- {
-
- return $this->hasMany(ProductStock::className(), [ 'product_variant_id' => 'product_variant_id' ])
- ->joinWith('stock');
- }
-
- public function getStocks()
- {
-
- return $this->hasMany(Stock::className(), [ 'stock_id' => 'stock_id' ])
- ->viaTable(ProductStock::tableName(), [ 'product_variant_id' => 'product_variant_id' ]);
- }
-
- public function getFilters()
- {
-
- return $this->hasMany(TaxOption::className(), [ 'tax_option_id' => 'option_id' ])
- ->viaTable('product_variant_option', [ 'product_variant_id' => 'product_variant_id' ])
- ->joinWith('taxGroup.lang', true, 'INNER JOIN')
- ->joinWith('lang', true, 'INNER JOIN');
- }
-
- public function getFullname()
- {
- return empty( $this->product ) ? NULL : ( $this->product->lang->name . ( empty( $this->lang->name ) ? '' : ' ' . $this->lang->name ) );
- }
-
- public function setOptions($values)
- {
- $this->_options = $values;
- }
-
- public function getOptions()
- {
- return $this->hasMany(TaxOption::className(), [ 'tax_option_id' => 'option_id' ])
- ->viaTable('product_variant_option', [ 'product_variant_id' => 'product_variant_id' ]);
- }
-
- /**
- * @return TaxGroup[]
- */
- public function getProperties()
- {
- $groups = $options = [];
- foreach($this->getOptions()
- ->with('lang')
- ->all() as $option) {
- $options[ $option->tax_group_id ][] = $option;
- }
- foreach(TaxGroup::find()
- ->where([ 'tax_group.tax_group_id' => array_keys($options) ])
- ->orderBy([ 'sort' => SORT_ASC ])
- ->with('lang')
- ->all() as $group) {
- if(!empty( $options[ $group->tax_group_id ] )) {
- $group->_options = $options[ $group->tax_group_id ];
- $groups[] = $group;
- }
- }
- return $groups;
- }
-
- public function getId()
- {
- return $this->product_variant_id;
- }
-
- /**
- * @todo Check if needed
- *
- * @param mixed $stocks
- */
- public function setStocks($stocks)
- {
- $this->stocks = (array) $stocks;
- }
-
- public function getCategory()
- {
- return $this->hasOne(Category::className(), [ 'category_id' => 'category_id' ])
- ->viaTable('product_category', [ 'product_id' => 'product_id' ]);
- }
-
- public function getCategories()
- {
- return $this->hasMany(Category::className(), [ 'category_id' => 'category_id' ])
- ->viaTable('product_category', [ 'product_id' => 'product_id' ]);
- }
-
- public function getTaxGroupsByLevel($level)
- {
- $categories = ArrayHelper::getColumn($this->categories, 'category_id');
- return TaxGroup::find()
- ->distinct()
- ->innerJoin('tax_group_to_category', 'tax_group_to_category.tax_group_id = tax_group.tax_group_id')
- ->where([ 'tax_group_to_category.category_id' => $categories ])
- ->where([ 'level' => $level ]);
- }
-
- public function afterSave($insert, $changedAttributes)
- {
- parent::afterSave($insert, $changedAttributes);
- if(!empty( $this->_options )) {
- $options = TaxOption::findAll($this->_options);
- $this->unlinkAll('options', true);
- foreach($options as $option) {
- $this->link('options', $option);
- }
- }
-
- if(!empty( $this->stocks )) {
- ProductStock::deleteAll([ 'product_variant_id' => $this->product_variant_id ]);
- foreach($this->stocks as $id => $quantity) {
- /**
- * @var ProductStock $productStock
- */
- $productStock = ProductStock::find()
- ->where([
- 'product_variant_id' => $this->product_variant_id,
- 'stock_id' => $id,
- ])
- ->one();
- $productStock->quantity = $quantity;
- $productStock->save();
- }
- }
- }
-
- }
+ [
+ 'class' => LanguageBehavior::className(),
+ ],
+ 'images' => [
+ 'class' => SaveMultipleFileBehavior::className(),
+ 'name' => 'imagesUpload',
+ 'directory' => 'products',
+ 'column' => 'image',
+ 'links' => [
+ 'product_id' => 'product_id',
+ 'product_variant_id' => 'product_variant_id',
+ ],
+ 'model' => ProductImage::className(),
+ ],
+ 'multipleImage' => [
+ 'class' => MultipleImgBehavior::className(),
+ 'links' => [
+ 'product_variant_id' => 'product_variant_id',
+ ],
+ 'model' => ProductImage::className(),
+ 'config' => [
+ 'caption' => 'image',
+ 'delete_action' => '/product/variant/delimg',
+ 'id' => 'product_image_id',
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ [
+ [
+ 'product_id',
+ 'product_unit_id',
+ ],
+ 'required',
+ ],
+ [
+ [
+ 'product_id',
+ 'product_unit_id',
+ ],
+ 'integer',
+ ],
+ [
+ [
+ 'price',
+ 'price_old',
+ 'stock',
+ ],
+ 'number',
+ ],
+ [
+ [
+ 'sku',
+ ],
+ 'string',
+ 'max' => 255,
+ ],
+ [
+ [
+ 'options',
+ ],
+ 'safe',
+ ],
+ [
+ [ 'product_unit_id' ],
+ 'exist',
+ 'skipOnError' => true,
+ 'targetClass' => ProductUnit::className(),
+ 'targetAttribute' => [ 'product_unit_id' => 'product_unit_id' ],
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'product_variant_id' => Yii::t('product', 'Product Variant ID'),
+ 'product_id' => Yii::t('product', 'Product ID'),
+ 'sku' => Yii::t('product', 'Sku'),
+ 'price' => Yii::t('product', 'Price'),
+ 'price_old' => Yii::t('product', 'Price Old'),
+ 'stock' => Yii::t('product', 'Stock'),
+ 'product_unit_id' => Yii::t('product', 'Product Unit ID'),
+ 'stock_caption' => Yii::t('product', 'Stock'),
+ 'image' => Yii::t('product', 'Image'),
+ 'images' => Yii::t('product', 'Images'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getProductUnit()
+ {
+ return $this->hasOne(ProductUnit::className(), [ 'product_unit_id' => 'product_unit_id' ]);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getProduct()
+ {
+ return $this->hasOne(Product::className(), [ 'id' => 'product_id' ]);
+ }
+
+ public function getProductStock()
+ {
+ return $this->hasMany(ProductStock::className(), [ 'product_variant_id' => 'product_variant_id' ]);
+ }
+
+ public function getQuantity()
+ {
+ return ProductStock::find()
+ ->where([ 'product_variant_id' => $this->product_variant_id ])
+ ->sum('quantity');
+ }
+
+ public function getStockCaption()
+ {
+ return is_null($this->stock) ? '∞' : ( $this->stock > 0 ? Yii::t('product', 'Enable') : Yii::t(
+ 'product',
+ 'Disable'
+ ) );
+ }
+
+ public function getVariantStocks()
+ {
+ return $this->hasMany(ProductStock::className(), [ 'product_variant_id' => 'product_variant_id' ])
+ ->joinWith('stock');
+ }
+
+ public function getStocks()
+ {
+ return $this->hasMany(Stock::className(), [ 'stock_id' => 'stock_id' ])
+ ->viaTable(ProductStock::tableName(), [ 'product_variant_id' => 'product_variant_id' ]);
+ }
+
+ public function getFilters()
+ {
+ return $this->hasMany(TaxOption::className(), [ 'tax_option_id' => 'option_id' ])
+ ->viaTable('product_variant_option', [ 'product_variant_id' => 'product_variant_id' ])
+ ->joinWith('taxGroup.lang', true, 'INNER JOIN')
+ ->joinWith('lang', true, 'INNER JOIN');
+ }
+
+ public function getFullname()
+ {
+ return empty( $this->product ) ? null : ( $this->product->lang->title . ( empty( $this->lang->title ) ? '' : ' ' . $this->lang->title ) );
+ }
+
+ public function setOptions($values)
+ {
+ $this->options = $values;
+ }
+
+ public function getOptions()
+ {
+ return $this->hasMany(TaxOption::className(), [ 'tax_option_id' => 'option_id' ])
+ ->viaTable('product_variant_option', [ 'product_variant_id' => 'product_variant_id' ]);
+ }
+
+ /**
+ * @return TaxGroup[]
+ */
+ public function getProperties()
+ {
+ $groups = $options = [];
+ foreach ($this->getOptions()
+ ->with('lang')
+ ->all() as $option) {
+ $options[ $option->tax_group_id ][] = $option;
+ }
+ foreach (TaxGroup::find()
+ ->where([ 'tax_group.tax_group_id' => array_keys($options) ])
+ ->orderBy([ 'sort' => SORT_ASC ])
+ ->with('lang')
+ ->all() as $group) {
+ if (!empty( $options[ $group->tax_group_id ] )) {
+ $group->options = $options[ $group->tax_group_id ];
+ $groups[] = $group;
+ }
+ }
+ return $groups;
+ }
+
+ public function getId()
+ {
+ return $this->product_variant_id;
+ }
+
+ /**
+ * @todo Check if needed
+ *
+ * @param mixed $stocks
+ */
+ public function setStocks($stocks)
+ {
+ $this->stocks = (array) $stocks;
+ }
+
+ public function getCategory()
+ {
+ return $this->hasOne(Category::className(), [ 'id' => 'category_id' ])
+ ->viaTable('product_category', [ 'product_id' => 'product_id' ]);
+ }
+
+ public function getCategories()
+ {
+ return $this->hasMany(Category::className(), [ 'id' => 'category_id' ])
+ ->viaTable('product_category', [ 'product_id' => 'product_id' ]);
+ }
+
+ public function getTaxGroupsByLevel($level)
+ {
+ $categories = ArrayHelper::getColumn($this->categories, 'id');
+ return TaxGroup::find()
+ ->distinct()
+ ->innerJoin(
+ 'tax_group_to_category',
+ 'tax_group_to_category.tax_group_id = tax_group.tax_group_id'
+ )
+ ->where([ 'tax_group_to_category.category_id' => $categories ])
+ ->where([ 'level' => $level ]);
+ }
+
+ public function afterSave($insert, $changedAttributes)
+ {
+ parent::afterSave($insert, $changedAttributes);
+ if (!empty( $this->options )) {
+ $options = TaxOption::findAll($this->options);
+ $this->unlinkAll('options', true);
+ foreach ($options as $option) {
+ $this->link('options', $option);
+ }
+ }
+
+ if (!empty( $this->stocks )) {
+ ProductStock::deleteAll([ 'product_variant_id' => $this->product_variant_id ]);
+ foreach ($this->stocks as $id => $quantity) {
+ /**
+ * @var ProductStock $productStock
+ */
+ $productStock = ProductStock::find()
+ ->where(
+ [
+ 'product_variant_id' => $this->product_variant_id,
+ 'stock_id' => $id,
+ ]
+ )
+ ->one();
+ $productStock->quantity = $quantity;
+ $productStock->save();
+ }
+ }
+ }
+ }
diff --git a/common/modules/product/models/ProductVariantLang.php b/common/modules/product/models/ProductVariantLang.php
index 54a0dc0..57368c2 100755
--- a/common/modules/product/models/ProductVariantLang.php
+++ b/common/modules/product/models/ProductVariantLang.php
@@ -10,7 +10,7 @@
* This is the model class for table "product_variant_lang".
* @property integer $product_variant_id
* @property integer $language_id
- * @property string $name
+ * @property string $title
* @property Language $language
* @property ProductVariant $productVariant
*/
@@ -40,11 +40,11 @@
{
return [
[
- [ 'name' ],
+ [ 'title' ],
'required',
],
[
- [ 'name' ],
+ [ 'title' ],
'string',
'max' => 255,
],
@@ -65,7 +65,7 @@
'exist',
'skipOnError' => true,
'targetClass' => Language::className(),
- 'targetAttribute' => [ 'language_id' => 'language_id' ],
+ 'targetAttribute' => [ 'language_id' => 'id' ],
],
[
[ 'product_variant_id' ],
@@ -85,7 +85,7 @@
return [
'product_variant_id' => Yii::t('app', 'Product Variant ID'),
'language_id' => Yii::t('app', 'Language ID'),
- 'name' => Yii::t('app', 'Name'),
+ 'title' => Yii::t('app', 'Name'),
];
}
@@ -94,7 +94,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/product/models/ProductVariantSearch.php b/common/modules/product/models/ProductVariantSearch.php
index 12be9bf..62beff8 100755
--- a/common/modules/product/models/ProductVariantSearch.php
+++ b/common/modules/product/models/ProductVariantSearch.php
@@ -12,7 +12,7 @@
class ProductVariantSearch extends ProductVariant
{
- public $variant_name;
+ public $variantName;
public function behaviors()
{
@@ -27,7 +27,7 @@
return [
[
[
- 'variant_name',
+ 'variantName',
'sku',
],
'safe',
@@ -88,9 +88,9 @@
'attributes' => [
'product_variant_id',
'sku',
- 'variant_name' => [
- 'asc' => [ 'product_variant_lang.name' => SORT_ASC ],
- 'desc' => [ 'product_variant_lang.name' => SORT_DESC ],
+ 'variantName' => [
+ 'asc' => [ 'product_variant_lang.title' => SORT_ASC ],
+ 'desc' => [ 'product_variant_lang.title' => SORT_DESC ],
],
'price',
'price_old',
@@ -106,8 +106,8 @@
$query->andFilterWhere([
'ilike',
- 'product_variant_lang.name',
- $this->variant_name,
+ 'product_variant_lang.title',
+ $this->variantName,
])
->andFilterWhere([
'ilike',
@@ -117,7 +117,7 @@
$query->groupBy([
'product_variant.product_variant_id',
- 'product_variant_lang.name',
+ 'product_variant_lang.title',
]);
return $dataProvider;
diff --git a/common/modules/product/models/Stock.php b/common/modules/product/models/Stock.php
index 01b30f1..66063a3 100755
--- a/common/modules/product/models/Stock.php
+++ b/common/modules/product/models/Stock.php
@@ -8,7 +8,7 @@
/**
* This is the model class for table "stock".
* @property integer $stock_id
- * @property string $name
+ * @property string $title
* @property ProductStock[] $productStocks
*/
class Stock extends ActiveRecord
@@ -29,12 +29,12 @@
{
return [
[
- [ 'name' ],
+ [ 'title' ],
'string',
'max' => 150,
],
[
- [ 'name' ],
+ [ 'title' ],
'required',
],
];
@@ -47,7 +47,7 @@
{
return [
'stock_id' => Yii::t('product', 'Stock ID'),
- 'name' => Yii::t('product', 'Name'),
+ 'title' => Yii::t('product', 'Name'),
];
}
}
diff --git a/common/modules/product/views/manage/_form.php b/common/modules/product/views/manage/_form.php
index e1b8b71..3642b85 100755
--- a/common/modules/product/views/manage/_form.php
+++ b/common/modules/product/views/manage/_form.php
@@ -14,7 +14,7 @@
/**
* @var yii\web\View $this
* @var common\modules\product\models\Product $model
- * @var ProductLang[] $model_langs
+ * @var ProductLang[] $modelLangs
* @var yii\widgets\ActiveForm $form
* @var ActiveQuery $groups
*/
@@ -39,13 +39,13 @@
= $form->field($model, 'brand_id')
->dropDownList(ArrayHelper::map(ProductHelper::getBrands()
->with('lang')
- ->all(), 'brand_id', 'lang.name'), [
+ ->all(), 'id', 'lang.title'), [
'prompt' => Yii::t('product', 'Select brand'),
]) ?>
= $form->field($model, 'categories')
->widget(Select2::className(), [
- 'data' => ArtboxTreeHelper::treeMap(ProductHelper::getCategories(), 'category_id', 'lang.name'),
+ 'data' => ArtboxTreeHelper::treeMap(ProductHelper::getCategories(), 'id', 'lang.title'),
'language' => 'ru',
'options' => [
'placeholder' => Yii::t('product', 'Select categories'),
@@ -74,7 +74,7 @@
'overwriteInitial' => false,
'showRemove' => false,
'showUpload' => false,
- 'uploadAsync' => !empty( $model->product_id ),
+ 'uploadAsync' => !empty( $model->id ),
'previewFileType' => 'image',
],
]); ?>
@@ -92,7 +92,7 @@
'multiple' => true,
'unselect' => NULL,
])
- ->label($group->lang->name);
+ ->label($group->lang->title);
}
}
?>
@@ -100,7 +100,7 @@
= LanguageForm::widget([
- 'model_langs' => $model_langs,
+ 'modelLangs' => $modelLangs,
'formView' => '@common/modules/product/views/manage/_form_language',
'form' => $form,
]) ?>
diff --git a/common/modules/product/views/manage/_form_language.php b/common/modules/product/views/manage/_form_language.php
index bc5e962..14a4c59 100755
--- a/common/modules/product/views/manage/_form_language.php
+++ b/common/modules/product/views/manage/_form_language.php
@@ -13,11 +13,11 @@
* @var View $this
*/
?>
-= $form->field($model_lang, '[' . $language->language_id . ']name')
+= $form->field($model_lang, '[' . $language->id . ']title')
->textInput([ 'maxlength' => true ]); ?>
-= $form->field($model_lang, '[' . $language->language_id . ']alias')
+= $form->field($model_lang, '[' . $language->id . ']alias')
->textInput([ 'maxlength' => true ]); ?>
-= $form->field($model_lang, '[' . $language->language_id . ']description')
+= $form->field($model_lang, '[' . $language->id . ']description')
->widget(CKEditor::className(), [
'editorOptions' => ElFinder::ckeditorOptions('elfinder', [
'preset' => 'full',
diff --git a/common/modules/product/views/manage/create.php b/common/modules/product/views/manage/create.php
index 808fede..28c8410 100755
--- a/common/modules/product/views/manage/create.php
+++ b/common/modules/product/views/manage/create.php
@@ -8,7 +8,7 @@
/**
* @var View $this
* @var Product $model
- * @var ProductLang[] $model_langs
+ * @var ProductLang[] $modelLangs
*/
$this->title = Yii::t('product', 'Create Product');
@@ -24,7 +24,7 @@
= $this->render('_form', [
'model' => $model,
- 'model_langs' => $model_langs,
+ 'modelLangs' => $modelLangs,
]) ?>
diff --git a/common/modules/product/views/manage/export.php b/common/modules/product/views/manage/export.php
index 2f50c6d..3731926 100755
--- a/common/modules/product/views/manage/export.php
+++ b/common/modules/product/views/manage/export.php
@@ -35,12 +35,12 @@
->dropDownList(Language::find()
->select([
'name',
- 'language_id',
+ 'id',
])
->where([ 'status' => 1 ])
->orderBy([ 'default' => SORT_DESC ])
->asArray()
- ->indexBy('language_id')
+ ->indexBy('id')
->column()) ?>
diff --git a/common/modules/product/views/manage/index.php b/common/modules/product/views/manage/index.php
index 938b841..a544045 100755
--- a/common/modules/product/views/manage/index.php
+++ b/common/modules/product/views/manage/index.php
@@ -27,157 +27,206 @@
= Html::a(Yii::t('product', 'Create Product'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
- = GridView::widget([
- 'dataProvider' => $dataProvider,
- 'filterModel' => $searchModel,
- 'columns' => [
- 'product_id',
- [
- 'attribute' => 'product_name',
- 'value' => 'lang.name',
- ],
- [
- 'label' => Yii::t('product', 'Brand'),
- 'attribute' => 'brand_id',
- 'value' => 'brand.lang.name',
- 'filter' => Select2::widget([
- 'model' => $searchModel,
- 'attribute' => 'brand_id',
- 'data' => Brand::find()
- ->joinWith('lang')
- ->select([
- 'brand_lang.name',
- 'brand.brand_id',
- ])
- ->asArray()
- ->indexBy('brand_id')
- ->column(),
- 'language' => 'ru',
- 'options' => [
- 'placeholder' => Yii::t('product', 'Select brand'),
- 'multiple' => false,
- ],
- 'pluginOptions' => [
- 'allowClear' => true,
- ],
- ]),
- ],
- [
- 'label' => Yii::t('product', 'Category'),
- 'attribute' => 'category_id',
- 'value' => function($model) {
- /**
- * @var Product $model
- */
- $categories = [];
- foreach($model->getCategories()
- ->with('lang')
- ->all() as $category) {
+ = GridView::widget(
+ [
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ 'id',
+ [
+ 'attribute' => 'productName',
+ 'value' => 'lang.title',
+ ],
+ [
+ 'label' => Yii::t('product', 'Brand'),
+ 'attribute' => 'brand_id',
+ 'value' => 'brand.lang.title',
+ 'filter' => Select2::widget(
+ [
+ 'model' => $searchModel,
+ 'attribute' => 'brand_id',
+ 'data' => Brand::find()
+ ->joinWith('lang')
+ ->select(
+ [
+ 'brand_lang.title',
+ 'brand.id',
+ ]
+ )
+ ->asArray()
+ ->indexBy('id')
+ ->column(),
+ 'language' => 'ru',
+ 'options' => [
+ 'placeholder' => Yii::t('product', 'Select brand'),
+ 'multiple' => false,
+ ],
+ 'pluginOptions' => [
+ 'allowClear' => true,
+ ],
+ ]
+ ),
+ ],
+ [
+ 'label' => Yii::t('product', 'Category'),
+ 'attribute' => 'categoryId',
+ 'value' => function ($model) {
/**
- * @var Category $category
+ * @var Product $model
*/
- $categories[] = $category->lang->name;
- }
- return implode(", ", $categories);
- },
- 'filter' => Select2::widget([
- 'model' => $searchModel,
- 'attribute' => 'category_id',
- 'data' => ArtboxTreeHelper::treeMap(ProductHelper::getCategories(), 'category_id', 'lang.name'),
- 'language' => 'ru',
- 'options' => [
- 'placeholder' => Yii::t('product', 'Select category'),
- 'multiple' => false,
- ],
- 'pluginOptions' => [
- 'allowClear' => true,
- ],
- ]),
- ],
- [
- 'attribute' => 'variant_count',
- 'value' => function($model) {
- /**
- * @var Product $model
- */
- return count($model->variants);
- },
- ],
- [
- 'class' => 'yii\grid\ActionColumn',
- 'template' => '{items} {view} |{is_top} {is_new} {akciya} | {update} {delete}',
- 'buttons' => [
- 'is_top' => function($url, $model) {
- return Html::a('
', $url, [
- 'title' => Yii::t('product', ( $model->is_top ? 'Set not is top' : 'Set is top' )),
- ]);
- },
- 'is_new' => function($url, $model) {
- return Html::a('
', $url, [
- 'title' => Yii::t('product', ( $model->is_new ? 'Set not is new' : 'Set is new' )),
- ]);
+ $categories = [];
+ foreach ($model->getCategories()
+ ->with('lang')
+ ->all() as $category) {
+ /**
+ * @var Category $category
+ */
+ $categories[] = $category->lang->title;
+ }
+ return implode(", ", $categories);
},
- 'akciya' => function($url, $model) {
- return Html::a('
', $url, [
- 'title' => Yii::t('product', ( $model->akciya ? 'Set not is promotion' : 'Set is promotion' )),
- ]);
+ 'filter' => Select2::widget(
+ [
+ 'model' => $searchModel,
+ 'attribute' => 'categoryId',
+ 'data' => ArtboxTreeHelper::treeMap(
+ ProductHelper::getCategories(),
+ 'id',
+ 'lang.title'
+ ),
+ 'language' => 'ru',
+ 'options' => [
+ 'placeholder' => Yii::t('product', 'Select category'),
+ 'multiple' => false,
+ ],
+ 'pluginOptions' => [
+ 'allowClear' => true,
+ ],
+ ]
+ ),
+ ],
+ [
+ 'attribute' => 'productName',
+ 'value' => function ($model) {
+ /**
+ * @var Product $model
+ */
+ return count($model->variants);
},
- 'items' => function($url, $model) {
- return Html::a('
', $url, [
- 'title' => Yii::t('product', 'Variants'),
- ]);
+ ],
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'template' => '{items} {view} |{is_top} {is_new} {akciya} | {update} {delete}',
+ 'buttons' => [
+ 'is_top' => function ($url, $model) {
+ return Html::a(
+ '
',
+ $url,
+ [
+ 'title' => Yii::t('product', ( $model->is_top ? 'Set not is top' : 'Set is top' )),
+ ]
+ );
+ },
+ 'is_new' => function ($url, $model) {
+ return Html::a(
+ '
',
+ $url,
+ [
+ 'title' => Yii::t('product', ( $model->is_new ? 'Set not is new' : 'Set is new' )),
+ ]
+ );
+ },
+ 'akciya' => function ($url, $model) {
+ return Html::a(
+ '
',
+ $url,
+ [
+ 'title' => Yii::t(
+ 'product',
+ ( $model->akciya ? 'Set not is promotion' : 'Set is promotion' )
+ ),
+ ]
+ );
+ },
+ 'items' => function ($url, $model) {
+ return Html::a(
+ '
',
+ $url,
+ [
+ 'title' => Yii::t('product', 'Variants'),
+ ]
+ );
+ },
+
+ ],
+ 'urlCreator' => function ($action, $model, $key, $index) {
+ /**
+ * @var Product $model
+ */
+ switch ($action) {
+ case 'items':
+ return \yii\helpers\Url::to(
+ [
+ '/product/variant',
+ 'product_id' => $model->id,
+ ]
+ );
+ break;
+ case 'is_top':
+ return \yii\helpers\Url::to(
+ [
+ 'manage/is_top',
+ 'id' => $model->id,
+ ]
+ );
+ break;
+ case 'is_new':
+ return \yii\helpers\Url::to(
+ [
+ 'manage/is_new',
+ 'id' => $model->id,
+ ]
+ );
+ break;
+ case 'akciya':
+ return \yii\helpers\Url::to(
+ [
+ 'manage/akciya',
+ 'id' => $model->id,
+ ]
+ );
+ break;
+ case 'view':
+ return \yii\helpers\Url::to(
+ [
+ 'manage/view',
+ 'id' => $model->id,
+ ]
+ );
+ break;
+ case 'update':
+ return \yii\helpers\Url::to(
+ [
+ 'manage/update',
+ 'id' => $model->id,
+ ]
+ );
+ break;
+ case 'delete':
+ return \yii\helpers\Url::to(
+ [
+ 'manage/delete',
+ 'id' => $model->id,
+ ]
+ );
+ break;
+ default:
+ return '';
+ break;
+ }
},
-
],
- 'urlCreator' => function($action, $model, $key, $index) {
- switch($action) {
- case 'items':
- return \yii\helpers\Url::to([
- '/product/variant',
- 'product_id' => $model->product_id,
- ]);
- break;
- case 'is_top':
- return \yii\helpers\Url::to([
- 'manage/is_top',
- 'id' => $model->product_id,
- ]);
- break;
- case 'is_new':
- return \yii\helpers\Url::to([
- 'manage/is_new',
- 'id' => $model->product_id,
- ]);
- break;
- case 'akciya':
- return \yii\helpers\Url::to([
- 'manage/akciya',
- 'id' => $model->product_id,
- ]);
- break;
- case 'view':
- return \yii\helpers\Url::to([
- 'manage/view',
- 'id' => $model->product_id,
- ]);
- break;
- case 'update':
- return \yii\helpers\Url::to([
- 'manage/update',
- 'id' => $model->product_id,
- ]);
- break;
- case 'delete':
- return \yii\helpers\Url::to([
- 'manage/delete',
- 'id' => $model->product_id,
- ]);
- break;
- default:
- return '';
- }
- },
],
- ],
- ]); ?>
+ ]
+ ); ?>
diff --git a/common/modules/product/views/manage/update.php b/common/modules/product/views/manage/update.php
index 9d85ab5..d7a202a 100755
--- a/common/modules/product/views/manage/update.php
+++ b/common/modules/product/views/manage/update.php
@@ -9,22 +9,22 @@
/**
* @var View $this
* @var Product $model
- * @var ProductLang[] $model_langs
+ * @var ProductLang[] $modelLangs
* @var ActiveQuery $groups
*/
$this->title = Yii::t('product', 'Update {modelClass}: ', [
'modelClass' => 'Product',
- ]) . ' ' . $model->lang->name;
+ ]) . ' ' . $model->lang->title;
$this->params[ 'breadcrumbs' ][] = [
'label' => Yii::t('product', 'Products'),
'url' => [ 'index' ],
];
$this->params[ 'breadcrumbs' ][] = [
- 'label' => $model->lang->name,
+ 'label' => $model->lang->title,
'url' => [
'view',
- 'id' => $model->product_id,
+ 'id' => $model->id,
],
];
$this->params[ 'breadcrumbs' ][] = Yii::t('product', 'Update');
@@ -35,7 +35,7 @@
= $this->render('_form', [
'model' => $model,
- 'model_langs' => $model_langs,
+ 'modelLangs' => $modelLangs,
'groups' => $groups,
]) ?>
diff --git a/common/modules/product/views/manage/view.php b/common/modules/product/views/manage/view.php
index 4e3c863..e99cfe6 100755
--- a/common/modules/product/views/manage/view.php
+++ b/common/modules/product/views/manage/view.php
@@ -17,26 +17,29 @@
* @var ProductVariant[] $variants
*/
- $this->title = $model->lang->name;
+ $this->title = $model->lang->title;
$this->params[ 'breadcrumbs' ][] = [
'label' => Yii::t('product', 'Products'),
'url' => [ 'index' ],
];
$this->params[ 'breadcrumbs' ][] = $this->title;
$properties_string = '';
- foreach($properties as $property) {
+ foreach ($properties as $property) {
$property_list = '';
- foreach($property->options as $option) {
+ foreach ($property->options as $option) {
$property_list .= Html::tag('li', $option->lang->value);
}
- $properties_string .= Html::tag('p', $property->lang->name) . Html::tag('ul', $property_list);
+ $properties_string .= Html::tag('p', $property->lang->title) . Html::tag('ul', $property_list);
}
$variants_string = '';
- foreach($variants as $variant) {
- $variants_string .= Html::a($variant->lang->name, [
- '/product/variant/view',
- 'id' => $variant->product_variant_id,
- ]) . ' ';
+ foreach ($variants as $variant) {
+ $variants_string .= Html::a(
+ $variant->lang->title,
+ [
+ '/product/variant/view',
+ 'id' => $variant->product_variant_id,
+ ]
+ ) . ' ';
}
?>
@@ -44,68 +47,94 @@
= Html::encode($this->title) ?>
- = Html::a(Yii::t('product', 'Update'), [
- 'update',
- 'id' => $model->product_id,
- ], [ 'class' => 'btn btn-primary' ]) ?>
- = Html::a(Yii::t('product', 'Delete'), [
- 'delete',
- 'id' => $model->product_id,
- ], [
- 'class' => 'btn btn-danger',
- 'data' => [
- 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'),
- 'method' => 'post',
- ],
- ]) ?>
- = Html::a(Yii::t('product', 'Variants'), [
- '/product/variant/index',
- 'product_id' => $model->product_id,
- ], [ 'class' => 'btn btn-info' ]) ?>
-
-
- = DetailView::widget([
- 'model' => $model,
- 'attributes' => [
- 'product_id',
- 'brand.lang.name',
+ = Html::a(
+ Yii::t('product', 'Update'),
[
- 'label' => \Yii::t('app', 'Categories'),
- 'value' => implode('
', ArrayHelper::getColumn($categories, 'lang.name')),
- 'format' => 'html',
+ 'update',
+ 'id' => $model->id,
],
+ [ 'class' => 'btn btn-primary' ]
+ ) ?>
+ = Html::a(
+ Yii::t('product', 'Delete'),
[
- 'attribute' => 'is_top',
- 'value' => $model->is_top ? Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-ok' ]) : Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-remove' ]),
- 'format' => 'html',
+ 'delete',
+ 'id' => $model->id,
],
[
- 'attribute' => 'is_new',
- 'value' => $model->is_new ? Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-ok' ]) : Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-remove' ]),
- 'format' => 'html',
- ],
- [
- 'attribute' => 'akciya',
- 'value' => $model->akciya ? Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-ok' ]) : Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-remove' ]),
- 'format' => 'html',
- ],
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]
+ ) ?>
+ = Html::a(
+ Yii::t('product', 'Variants'),
[
- 'attribute' => 'video',
- 'format' => 'html',
+ '/product/variant/index',
+ 'product_id' => $model->id,
],
- [
- 'label' => \Yii::t('app', 'Properties'),
- 'value' => $properties_string,
- 'format' => 'html',
- ],
- [
- 'label' => \Yii::t('app', 'Variants'),
- 'value' => $variants_string,
- 'format' => 'html',
+ [ 'class' => 'btn btn-info' ]
+ ) ?>
+
+
+ = DetailView::widget(
+ [
+ 'model' => $model,
+ 'attributes' => [
+ 'id',
+ 'brand.lang.title',
+ [
+ 'label' => \Yii::t('app', 'Categories'),
+ 'value' => implode('
', ArrayHelper::getColumn($categories, 'lang.title')),
+ 'format' => 'html',
+ ],
+ [
+ 'attribute' => 'is_top',
+ 'value' => $model->is_top ? Html::tag(
+ 'span',
+ '',
+ [ 'class' => 'glyphicon glyphicon-ok' ]
+ ) : Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-remove' ]),
+ 'format' => 'html',
+ ],
+ [
+ 'attribute' => 'is_new',
+ 'value' => $model->is_new ? Html::tag(
+ 'span',
+ '',
+ [ 'class' => 'glyphicon glyphicon-ok' ]
+ ) : Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-remove' ]),
+ 'format' => 'html',
+ ],
+ [
+ 'attribute' => 'akciya',
+ 'value' => $model->akciya ? Html::tag(
+ 'span',
+ '',
+ [ 'class' => 'glyphicon glyphicon-ok' ]
+ ) : Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-remove' ]),
+ 'format' => 'html',
+ ],
+ [
+ 'attribute' => 'video',
+ 'format' => 'html',
+ ],
+ [
+ 'label' => \Yii::t('app', 'Properties'),
+ 'value' => $properties_string,
+ 'format' => 'html',
+ ],
+ [
+ 'label' => \Yii::t('app', 'Variants'),
+ 'value' => $variants_string,
+ 'format' => 'html',
+ ],
+ 'lang.description:html',
+ 'image.imageUrl:image',
],
- 'lang.description:html',
- 'image.imageUrl:image',
- ],
- ]) ?>
+ ]
+ ) ?>
diff --git a/common/modules/product/views/product-unit/_form.php b/common/modules/product/views/product-unit/_form.php
index 32e6bc0..9deebf6 100755
--- a/common/modules/product/views/product-unit/_form.php
+++ b/common/modules/product/views/product-unit/_form.php
@@ -10,7 +10,7 @@
/**
* @var View $this
* @var ProductUnit $model
- * @var ProductUnitLang[] $model_langs
+ * @var ProductUnitLang[] $modelLangs
* @var ActiveForm $form
*/
?>
@@ -23,7 +23,7 @@
->checkbox() ?>
= LanguageForm::widget([
- 'model_langs' => $model_langs,
+ 'modelLangs' => $modelLangs,
'form' => $form,
'formView' => '@common/modules/product/views/product-unit/_form_language',
]) ?>
diff --git a/common/modules/product/views/product-unit/_form_language.php b/common/modules/product/views/product-unit/_form_language.php
index 868196a..de27f49 100755
--- a/common/modules/product/views/product-unit/_form_language.php
+++ b/common/modules/product/views/product-unit/_form_language.php
@@ -11,7 +11,7 @@
* @var View $this
*/
?>
-= $form->field($model_lang, '[' . $language->language_id . ']name')
+= $form->field($model_lang, '[' . $language->id . ']title')
->textInput([ 'maxlength' => true ]); ?>
-= $form->field($model_lang, '[' . $language->language_id . ']short')
+= $form->field($model_lang, '[' . $language->id . ']short')
->textInput([ 'maxlength' => true ]); ?>
\ No newline at end of file
diff --git a/common/modules/product/views/product-unit/create.php b/common/modules/product/views/product-unit/create.php
index dc908f5..788602e 100755
--- a/common/modules/product/views/product-unit/create.php
+++ b/common/modules/product/views/product-unit/create.php
@@ -8,7 +8,7 @@
/**
* @var View $this
* @var ProductUnit $model
- * @var ProductUnitLang[] $model_langs
+ * @var ProductUnitLang[] $modelLangs
*/
$this->title = Yii::t('product', 'Create Product Unit');
@@ -24,7 +24,7 @@
= $this->render('_form', [
'model' => $model,
- 'model_langs' => $model_langs,
+ 'modelLangs' => $modelLangs,
]) ?>
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 @@
= $this->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' ],
+ ]
+ ); ?>
= $form->field($model, 'product_id')
->hiddenInput()
@@ -57,56 +59,63 @@ $(".dynamicform_wrapper").on("limitReached", function(e, item) {
= $form->field($model, 'price_old')
->textarea(); ?>
= $form->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',
+ ],
+ ]
+ ); ?>
- = LanguageForm::widget([
- 'model_langs' => $model_langs,
- 'formView' => '@common/modules/product/views/variant/_form_language',
- 'form' => $form,
- ]) ?>
+ = LanguageForm::widget(
+ [
+ 'modelLangs' => $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 ]) ?>
- = $form->field($stock, "[{$i}]name")
+ = $form->field($stock, "[{$i}]title")
->textInput([ 'maxlength' => true ]) ?>
@@ -151,32 +160,49 @@ $(".dynamicform_wrapper").on("limitReached", function(e, item) {
= $form->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);
}
} ?>
- = Html::submitButton($model->isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?>
+ = Html::submitButton(
+ $model->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
*/
?>
-= $form->field($model_lang, '[' . $language->language_id . ']name')
+= $form->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 @@
= Html::encode($this->title) ?>
- = $this->render('_form', [
- 'model' => $model,
- 'model_langs' => $model_langs,
- 'groups' => $groups,
- 'stocks' => $stocks,
- 'product' => $product,
- ]) ?>
+ = $this->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 @@
= Html::encode($this->title) ?>
- = Html::a(Yii::t('product', 'Create Variant'), Url::toRoute([
- 'create',
- 'product_id' => $product->product_id,
- ]), [ 'class' => 'btn btn-success' ]) ?>
+ = Html::a(
+ Yii::t('product', 'Create Variant'),
+ Url::toRoute(
+ [
+ 'create',
+ 'product_id' => $product->id,
+ ]
+ ),
+ [ 'class' => 'btn btn-success' ]
+ ) ?>
- = GridView::widget([
- 'dataProvider' => $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',
- ]);
-
- },
+ = GridView::widget(
+ [
+ 'dataProvider' => $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 @@
= Html::encode($this->title) ?>
- = $this->render('_form', [
- 'model' => $model,
- 'model_langs' => $model_langs,
- 'groups' => $groups,
- 'stocks' => $stocks,
- 'product' => $product,
- ]) ?>
+ = $this->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 @@
= Html::encode($this->title) ?>
- = Html::a(Yii::t('product', 'Update'), [
- 'update',
- 'id' => $model->product_variant_id,
- ], [ 'class' => 'btn btn-primary' ]) ?>
- = Html::a(Yii::t('product', 'Delete'), [
- 'delete',
- 'id' => $model->product_variant_id,
- ], [
- 'class' => 'btn btn-danger',
- 'data' => [
- 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'),
- 'method' => 'post',
+ = Html::a(
+ Yii::t('product', 'Update'),
+ [
+ 'update',
+ 'id' => $model->product_variant_id,
],
- ]) ?>
-
-
- = DetailView::widget([
- 'model' => $model,
- 'attributes' => [
- 'product_variant_id',
- 'lang.name',
- 'sku',
- 'price',
- 'price_old',
- 'stock',
- 'productUnit.lang.name',
+ [ 'class' => 'btn btn-primary' ]
+ ) ?>
+ = Html::a(
+ Yii::t('product', 'Delete'),
[
- 'attribute' => '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',
+ ],
+ ]
+ ) ?>
+
+
+ = DetailView::widget(
+ [
+ 'model' => $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 @@
- = Html::a($product->lang->name, Url::to([
+ = Html::a($product->lang->title, Url::to([
'catalog/product',
'product' => $product->lang->alias,
]), [ 'class' => 'btn-product-details' ]) ?>
@@ -22,8 +22,8 @@
'product' => $product->lang->alias,
]) ?>">
= \common\components\artboximage\ArtboxImageHelper::getImage($product->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 @@
- Бренд: = $product->brand->lang->name ?>
+ Бренд: = $product->brand->lang->title ?>
- getActiveProperties($product->category->category_id) as $group): ?>
+ getActiveProperties($product->category->id) as $group): ?>
- = $group->name ?> _options as $option ) : ?> = $option->value ?>
+ = $group->title ?> options as $option ) : ?> = $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' ] ]); ?>
= $form->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
*/
?>
-= $form->field($model_lang, '[' . $language->language_id . ']name')
+= $form->field($model_lang, '[' . $language->id . ']title')
->textInput([ 'maxlength' => true ]); ?>
-= $form->field($model_lang, '[' . $language->language_id . ']alias')
+= $form->field($model_lang, '[' . $language->id . ']alias')
->textInput([ 'maxlength' => true ]); ?>
-= $form->field($model_lang, '[' . $language->language_id . ']description')
+= $form->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 @@
= $this->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 @@
= $this->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
*/
?>
-= $form->field($model_lang, '[' . $language->language_id . ']value')
+= $form->field($model_lang, '[' . $language->id . ']value')
->textInput([ 'maxlength' => true ]); ?>
-= $form->field($model_lang, '[' . $language->language_id . ']alias')
+= $form->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 @@
= $this->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 @@
= $this->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 @@
]) ?>
= Html::a(Yii::t('rubrication', 'Create Option'), [ 'tax-option/create?group=' . $model->tax_group_id ], [ 'class' => 'btn btn-success' ]) ?>
parent_id )) : ?>
- = Html::a(Yii::t('rubrication', 'Create Option By {name}', [ 'name' => $model->parent->tax_option_id ]), [ 'tax-option/create?group=' . $model->tax_group_id . '&parent=' . $model->parent->tax_option_id ], [ 'class' => 'btn btn-success' ]) ?>
+ = Html::a(Yii::t('rubrication', 'Create Option By {title}', [ 'title' => $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->name . ' ' . $item[ 'item' ]->name ?>
+ = $item[ 'item' ]->product->title . ' ' . $item[ 'item' ]->title ?>
= Yii::t('app', 'code', '45885-01016049') ?>
@@ -50,6 +50,6 @@
= Html::a(Yii::t('app', 'continue_shopping'), '#', [ 'class' => 'close' ]) ?>
- = Html::a(Yii::t('app', 'checkout'), [ 'orders/first' ], [ 'class' => 'button' ]); ?>
+ = Html::a(Yii::t('app', 'checkout'), [ 'order/first' ], [ 'class' => '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|=).*
+2. Использовать только UTF-8 без BOM-байта. В PHPStorm в меню File есть пункт Remove BOM.
+3. Не использовать в классах никакие символы кроме букв и цыфр, резделение должно быть CamelCase. Регулярка для поиска: \sclass\s[a-z\d]+[^a-z\s\d]+[a-z\d]+\s
+4. Константы должны быть в вернем регистре с подчеркиванием для разделения слов. Регулярка для поиска: \sconst\s(?=\w*[a-z])(?=\w*[A-Z]?)\w*\s
+5. Методы должны быть camelCase, без разделителей. Не использовать _ для обозначения private и protected. Регулярка для поиска (примерная, находит родные функции php): function\s(?=\w*[_])\w*\(
+6. Свойства с базы данных table_column через нижний подчерк, все остальные camelCase. Не использовать _ для обозначения private и protected. Регулярка для поиска: (?:public|private|protected) \$(?=\w*[_])\w*
+7. Последовательность модификаторов долна быть такой, нельзя пропускать модификатор области видимости:
+ abstract/final public/protected/private static
+ Регулярки:
+ static\s(?:abstract\s|final\s)?(?:public\s|private\s|protected\s)
+ (?:abstract\s|final\s)?static(?:public\s|private\s|protected\s)
+ (?:abstract\s|final\s)static(?:public\s|private\s|protected\s)?
+ (?:public\s|private\s|protected\s)(?:abstract\s|final\s)
+8. Каждый файл с PHP-кодом должен иметь в конце пустую строку.
+9. Не использовать ?> в файлах, которые содержат только 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