From a82865e34cf4a4381da498ec1f110d3c0562441d Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 8 Feb 2016 14:31:03 +0200 Subject: [PATCH] add Vitaliy's widgets --- common/widgets/views/image_sizer.php | 8 ++++---- console/migrations/m160204_103008_add_payment_connections.php | 3 ++- console/migrations/m160208_091942_vacancies.php | 30 ++++++++++++++++++++++++++++++ console/migrations/m160208_093153_project.php | 36 ++++++++++++++++++++++++++++++++++++ console/migrations/m160208_094102_add_project_specialization.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ console/migrations/m160208_095412_portfolio.php | 41 +++++++++++++++++++++++++++++++++++++++++ console/migrations/m160208_101449_team.php | 32 ++++++++++++++++++++++++++++++++ console/migrations/m160208_111900_blog.php | 30 ++++++++++++++++++++++++++++++ console/migrations/m160208_112838_gallery.php | 28 ++++++++++++++++++++++++++++ 9 files changed, 252 insertions(+), 5 deletions(-) create mode 100644 console/migrations/m160208_091942_vacancies.php create mode 100644 console/migrations/m160208_093153_project.php create mode 100644 console/migrations/m160208_094102_add_project_specialization.php create mode 100644 console/migrations/m160208_095412_portfolio.php create mode 100644 console/migrations/m160208_101449_team.php create mode 100644 console/migrations/m160208_111900_blog.php create mode 100644 console/migrations/m160208_112838_gallery.php diff --git a/common/widgets/views/image_sizer.php b/common/widgets/views/image_sizer.php index 3579881..09307ff 100755 --- a/common/widgets/views/image_sizer.php +++ b/common/widgets/views/image_sizer.php @@ -57,17 +57,17 @@ $id = $model::tableName().'_id'; var old_url = $('#_old_img').val(); var new_url = $('#_new_img').val(); var model = ''; - $.post( "/admin/site/delete-image",{new_url:new_url,old_img: old_url,model:model,field:"", id:"$id?>",action:'save'}, function() { + $.post( "/file/delete-image",{new_url:new_url,old_img: old_url,model:model,field:"", id:"$id?>",action:'save'}, function() { }); $("#_picture_link").val(new_url); }); $('body').on('click', '#_remove_img',function(){ $("#_buttons_block").remove(); - $("#_buttons_block").remove(); + var old_url = $('#_old_img').val(); var new_url = $('#_new_img').val(); - $.post( "/admin/site/delete-image",{old_img: new_url}, function() { + $.post( "/file/delete-image",{old_img: new_url}, function() { }); $("#_picture_link").val(old_url); $('#_img_block').find('img').attr('src',old_url); @@ -120,7 +120,7 @@ $id = $model::tableName().'_id'; var gallery = $("#_picture_link"); var urls = gallery.val(); gallery.val(urls.replace(url+',', "")); - $.post( "/admin/site/delete-image",{old_img: url}, function( data ) { + $.post( "/file/delete-image",{old_img: url}, function( data ) { $( ".result" ).html( data ); }); }) diff --git a/console/migrations/m160204_103008_add_payment_connections.php b/console/migrations/m160204_103008_add_payment_connections.php index b3df37d..45f33ab 100644 --- a/console/migrations/m160204_103008_add_payment_connections.php +++ b/console/migrations/m160204_103008_add_payment_connections.php @@ -29,9 +29,10 @@ public function down () { - $this->dropTable ('{{%payment}}'); $this->dropTable('{{%user_specialization}}'); $this->dropTable('{{%user_payment}}'); + $this->dropTable ('{{%payment}}'); + } /* // Use safeUp/safeDown to run migration code within a transaction diff --git a/console/migrations/m160208_091942_vacancies.php b/console/migrations/m160208_091942_vacancies.php new file mode 100644 index 0000000..6027efe --- /dev/null +++ b/console/migrations/m160208_091942_vacancies.php @@ -0,0 +1,30 @@ +createTable('{{%vacancy}}', [ + 'vacancy_id' => $this->primaryKey(), + 'user_id' => $this->integer()->notNull(), + 'name' => $this->string(255)->notNull(), + 'link' => $this->string(255), + 'date_add' => $this->timestamp(), + 'user_add_id' => $this->integer(), + 'view_count' => $this->integer(), + 'user_name' => $this->string(255), + 'city' => $this->string(255), + 'description' => $this->text(), + ], $tableOptions); + + } + + public function down() + { + $this->dropTable('{{%vacancy}}'); + } +} diff --git a/console/migrations/m160208_093153_project.php b/console/migrations/m160208_093153_project.php new file mode 100644 index 0000000..ca5f952 --- /dev/null +++ b/console/migrations/m160208_093153_project.php @@ -0,0 +1,36 @@ +createTable('{{%project}}', [ + 'project_id' => $this->primaryKey(), + 'user_id' => $this->integer()->notNull(), + 'name' => $this->string(255)->notNull(), + 'link' => $this->string(255), + 'project_pid' => $this->integer(), + 'date_add' => $this->timestamp()->notNull(), + 'date_end' => $this->timestamp(), + 'user_add_id' => $this->integer(), + 'view_count' => $this->float(), + 'budget' => $this->string(255), + 'city' => $this->string(255), + 'street' => $this->string(255), + 'house' => $this->string(255), + 'payment_variant' => $this->smallInteger()->defaultValue(1), + 'deadline' => $this->integer(), + 'description' => $this->text(), + ], $tableOptions); + + } + + public function down() + { + $this->dropTable('{{%project}}'); + } +} diff --git a/console/migrations/m160208_094102_add_project_specialization.php b/console/migrations/m160208_094102_add_project_specialization.php new file mode 100644 index 0000000..464fc5a --- /dev/null +++ b/console/migrations/m160208_094102_add_project_specialization.php @@ -0,0 +1,49 @@ +createTable ( + '{{%project_specialization}}', [ + 'project_specialization_id' => $this->primaryKey (), 'project_id' => $this->integer (), 'specialization_id' => $this->integer (), + ] + ); + $this->addForeignKey ('project_specialization_index', '{{%project_specialization}}', 'specialization_id', '{{%specialization}}', 'specialization_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey ('specialization_project_index', '{{%project_specialization}}', 'project_id', '{{%project}}', 'project_id', 'CASCADE', 'CASCADE'); + + $this->createTable ( + '{{%project_payment}}', [ + 'project_payment_id' => $this->primaryKey (), 'project_id' => $this->integer (), 'payment_id' => $this->integer (), + ] + ); + $this->addForeignKey ('project_payment_index', '{{%project_payment}}', 'payment_id', '{{%payment}}', 'payment_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey ('payment_project_index', '{{%project_payment}}', 'project_id', '{{%project}}', 'project_id', 'CASCADE', 'CASCADE'); + + $this->createTable ( + '{{%employment}}', [ + 'employment_id' => $this->primaryKey (), 'name' => $this->integer (), + ] + ); + $this->createTable ( + '{{%vacancy_employment}}', [ + 'vacancy_employment' => $this->primaryKey (), 'vacancy_id' => $this->integer (), 'employment_id' => $this->integer (), + ] + ); + $this->addForeignKey ('vacancy_employment_index', '{{%vacancy_employment}}', 'employment_id', '{{%employment}}', 'employment_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey ('employment_vacancy_index', '{{%vacancy_employment}}', 'vacancy_id', '{{%vacancy}}', 'vacancy_id', 'CASCADE', 'CASCADE'); + + } + + public function down () + { + $this->dropTable('{{%project_specialization}}'); + $this->dropTable('{{%project_payment}}'); + $this->dropTable('{{%vacancy_employment}}'); + $this->dropTable('{{%employment}}'); + + } + +} diff --git a/console/migrations/m160208_095412_portfolio.php b/console/migrations/m160208_095412_portfolio.php new file mode 100644 index 0000000..bf4a492 --- /dev/null +++ b/console/migrations/m160208_095412_portfolio.php @@ -0,0 +1,41 @@ +createTable('{{%portfolio}}', [ + 'portfolio_id' => $this->primaryKey(), + 'user_id' => $this->integer()->notNull(), + 'name' => $this->string(255)->notNull(), + 'link' => $this->string(255), + 'date_add' => $this->timestamp()->notNull(), + 'user_add_id' => $this->integer(), + 'view_count' => $this->integer()->defaultValue(0), + 'city' => $this->string(255), + 'street' => $this->string(255), + 'house' => $this->string(255), + 'description' => $this->text(), + 'cover' => $this->text(), + 'gallery_id' => $this->integer(), + ], $tableOptions); + $this->createTable ( + '{{%portfolio_specialization}}', [ + 'portfolio_specialization_id' => $this->primaryKey (), 'portfolio_id' => $this->integer (), 'specialization_id' => $this->integer (), + ] + ); + $this->addForeignKey ('portfolio_specialization_index', '{{%portfolio_specialization}}', 'specialization_id', '{{%specialization}}', 'specialization_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey ('specialization_portfolio_index', '{{%portfolio_specialization}}', 'portfolio_id', '{{%portfolio}}', 'portfolio_id', 'CASCADE', 'CASCADE'); + } + + public function down() + { + + $this->dropTable('{{%portfolio_specialization}}'); + $this->dropTable('{{%portfolio}}'); + } +} diff --git a/console/migrations/m160208_101449_team.php b/console/migrations/m160208_101449_team.php new file mode 100644 index 0000000..5bb93ec --- /dev/null +++ b/console/migrations/m160208_101449_team.php @@ -0,0 +1,32 @@ +createTable('{{%team}}', [ + 'team_id' => $this->primaryKey(), + 'user_id' => $this->integer()->notNull(), + 'firstname' => $this->string(255)->notNull(), + 'lastname' => $this->string(255)->notNull(), + 'midlename' => $this->string(255), + 'link' => $this->string(255), + 'position' => $this->string(255)->notNull(), + 'department_id' => $this->integer()->notNull(), + 'experience_from' => $this->timestamp(), + 'date_add' => $this->timestamp()->notNull(), + 'user_add_id' => $this->integer(), + 'photo' => $this->string(255), + 'country_id' => $this->string(255)->notNull(), + ], $tableOptions); + } + + public function down() + { + $this->dropTable('{{%team}}'); + } +} diff --git a/console/migrations/m160208_111900_blog.php b/console/migrations/m160208_111900_blog.php new file mode 100644 index 0000000..ca88b1c --- /dev/null +++ b/console/migrations/m160208_111900_blog.php @@ -0,0 +1,30 @@ +createTable('{{%blog}}', [ + 'blog_id' => $this->primaryKey(), + 'user_id' => $this->integer()->notNull(), + 'name' => $this->string(255)->notNull(), + 'link' => $this->string(255), + 'date_add' => $this->timestamp()->notNull(), + 'user_add_id' => $this->integer(), + 'view_count' => $this->integer()->defaultValue(0), + 'description' => $this->text(), + 'cover' => $this->string(255), + ], $tableOptions); + + } + + public function down() + { + $this->dropTable('{{%blog}}'); + } + +} diff --git a/console/migrations/m160208_112838_gallery.php b/console/migrations/m160208_112838_gallery.php new file mode 100644 index 0000000..8f8cddf --- /dev/null +++ b/console/migrations/m160208_112838_gallery.php @@ -0,0 +1,28 @@ +createTable('{{%gallery}}', [ + 'gallery_id' => $this->primaryKey(), + 'user_id' => $this->integer()->notNull(), + 'name' => $this->string(255)->notNull(), + 'date_add' => $this->timestamp()->notNull(), + 'user_add_id' => $this->integer(), + 'cover' => $this->string(255), + 'type' => $this->smallInteger(), + 'photo' => $this->text(), + ], $tableOptions); + + } + + public function down() + { + $this->dropTable('{{%gallery}}'); + } +} -- libgit2 0.21.4