Commit 088f364d0618c2868596454c68fb8393639090bd
1 parent
442daa2f
img from gallery in static page finish
Showing
6 changed files
with
218 additions
and
3 deletions
Show diff stats
common/config/main.php
| @@ -45,9 +45,9 @@ | @@ -45,9 +45,9 @@ | ||
| 45 | 'class' => SeoComponent::className(), | 45 | 'class' => SeoComponent::className(), |
| 46 | ], | 46 | ], |
| 47 | 'imagemanager' => [ | 47 | 'imagemanager' => [ |
| 48 | - 'class' => 'noam148\imagemanager\components\ImageManagerGetPath', | ||
| 49 | - 'mediaPath' => dirname(dirname(__DIR__)) . '/common/images', | ||
| 50 | - 'cachePath' => 'assets/images', | 48 | + 'class' => 'artbox\core\components\imagemanager\components\ImageManagerGetPath', |
| 49 | + 'mediaPath' => dirname(dirname(__DIR__)) . '/storage', | ||
| 50 | + 'cachePath' => '../../storage/cache', | ||
| 51 | 'useFilename' => true, | 51 | 'useFilename' => true, |
| 52 | 'absoluteUrl' => false, | 52 | 'absoluteUrl' => false, |
| 53 | ], | 53 | ], |
console/migrations/m171123_140641_create_page_category_table.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Handles the creation of table `page_category`. | ||
| 7 | + */ | ||
| 8 | +class m171123_140641_create_page_category_table extends Migration | ||
| 9 | +{ | ||
| 10 | + /** | ||
| 11 | + * @inheritdoc | ||
| 12 | + */ | ||
| 13 | + public function up() | ||
| 14 | + { | ||
| 15 | + $this->createTable('page_category', [ | ||
| 16 | + 'id' => $this->primaryKey(), | ||
| 17 | + 'sort' => $this->integer(), | ||
| 18 | + 'status' => $this->boolean(), | ||
| 19 | + ]); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * @inheritdoc | ||
| 24 | + */ | ||
| 25 | + public function down() | ||
| 26 | + { | ||
| 27 | + $this->dropTable('page_category'); | ||
| 28 | + } | ||
| 29 | +} |
console/migrations/m171123_140827_create_page_category_lang_table.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Handles the creation of table `page_category_lang`. | ||
| 7 | + */ | ||
| 8 | +class m171123_140827_create_page_category_lang_table extends Migration | ||
| 9 | +{ | ||
| 10 | + /** | ||
| 11 | + * @inheritdoc | ||
| 12 | + */ | ||
| 13 | + public function up() | ||
| 14 | + { | ||
| 15 | + $this->createTable('page_category_lang', [ | ||
| 16 | + 'id' => $this->primaryKey(), | ||
| 17 | + 'title' => $this->string(), | ||
| 18 | + 'language_id' => $this->integer(), | ||
| 19 | + 'page_category_id' => $this->integer(), | ||
| 20 | + ]); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * @inheritdoc | ||
| 25 | + */ | ||
| 26 | + public function down() | ||
| 27 | + { | ||
| 28 | + $this->dropTable('page_category_lang'); | ||
| 29 | + } | ||
| 30 | +} |
console/migrations/m171123_141322_create_junction_table_for_page_and_page_category_tables.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Handles the creation of table `page_page_category`. | ||
| 7 | + * Has foreign keys to the tables: | ||
| 8 | + * | ||
| 9 | + * - `page` | ||
| 10 | + * - `page_category` | ||
| 11 | + */ | ||
| 12 | +class m171123_141322_create_junction_table_for_page_and_page_category_tables extends Migration | ||
| 13 | +{ | ||
| 14 | + /** | ||
| 15 | + * @inheritdoc | ||
| 16 | + */ | ||
| 17 | + public function up() | ||
| 18 | + { | ||
| 19 | + $this->createTable('page_to_category', [ | ||
| 20 | + 'page_id' => $this->integer(), | ||
| 21 | + 'category_id' => $this->integer(), | ||
| 22 | + 'PRIMARY KEY(page_id, category_id)', | ||
| 23 | + ]); | ||
| 24 | + | ||
| 25 | + // creates index for column `page_id` | ||
| 26 | + $this->createIndex( | ||
| 27 | + 'idx-page_to_category-page_id', | ||
| 28 | + 'page_to_category', | ||
| 29 | + 'page_id' | ||
| 30 | + ); | ||
| 31 | + | ||
| 32 | + // add foreign key for table `page` | ||
| 33 | + $this->addForeignKey( | ||
| 34 | + 'fk-page_to_category-page_id', | ||
| 35 | + 'page_to_category', | ||
| 36 | + 'page_id', | ||
| 37 | + 'page', | ||
| 38 | + 'id', | ||
| 39 | + 'CASCADE' | ||
| 40 | + ); | ||
| 41 | + | ||
| 42 | + // creates index for column `category_id` | ||
| 43 | + $this->createIndex( | ||
| 44 | + 'idx-page_to_category-category_id', | ||
| 45 | + 'page_to_category', | ||
| 46 | + 'category_id' | ||
| 47 | + ); | ||
| 48 | + | ||
| 49 | + // add foreign key for table `page_category` | ||
| 50 | + $this->addForeignKey( | ||
| 51 | + 'fk-page_to_category-category_id', | ||
| 52 | + 'page_to_category', | ||
| 53 | + 'category_id', | ||
| 54 | + 'page_category', | ||
| 55 | + 'id', | ||
| 56 | + 'CASCADE' | ||
| 57 | + ); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * @inheritdoc | ||
| 62 | + */ | ||
| 63 | + public function down() | ||
| 64 | + { | ||
| 65 | + // drops foreign key for table `page` | ||
| 66 | + $this->dropForeignKey( | ||
| 67 | + 'fk-page_to_category-page_id', | ||
| 68 | + 'page_to_category' | ||
| 69 | + ); | ||
| 70 | + | ||
| 71 | + // drops index for column `page_id` | ||
| 72 | + $this->dropIndex( | ||
| 73 | + 'idx-page_to_category-page_id', | ||
| 74 | + 'page_to_category' | ||
| 75 | + ); | ||
| 76 | + | ||
| 77 | + // drops foreign key for table `page_category` | ||
| 78 | + $this->dropForeignKey( | ||
| 79 | + 'fk-page_to_category-category_id', | ||
| 80 | + 'page_to_category' | ||
| 81 | + ); | ||
| 82 | + | ||
| 83 | + // drops index for column `category_id` | ||
| 84 | + $this->dropIndex( | ||
| 85 | + 'idx-page_to_category-category_id', | ||
| 86 | + 'page_to_category' | ||
| 87 | + ); | ||
| 88 | + | ||
| 89 | + $this->dropTable('page_to_category'); | ||
| 90 | + } | ||
| 91 | +} |
console/migrations/m171123_142225_add_gallery_column_to_page_table.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Handles adding gallery to table `page`. | ||
| 7 | + */ | ||
| 8 | +class m171123_142225_add_gallery_column_to_page_table extends Migration | ||
| 9 | +{ | ||
| 10 | + /** | ||
| 11 | + * @inheritdoc | ||
| 12 | + */ | ||
| 13 | + public function up() | ||
| 14 | + { | ||
| 15 | + $this->addColumn('page', 'gallery', $this->string(255)); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * @inheritdoc | ||
| 20 | + */ | ||
| 21 | + public function down() | ||
| 22 | + { | ||
| 23 | + $this->dropColumn('page', 'gallery'); | ||
| 24 | + } | ||
| 25 | +} |
console/migrations/m171123_151350_create_ImageManager_table.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Handles the creation of table `ImageManager`. | ||
| 7 | + */ | ||
| 8 | +class m171123_151350_create_ImageManager_table extends Migration | ||
| 9 | +{ | ||
| 10 | + /** | ||
| 11 | + * @inheritdoc | ||
| 12 | + */ | ||
| 13 | + public function up() | ||
| 14 | + { | ||
| 15 | + $this->createTable('ImageManagerLang', [ | ||
| 16 | + 'image_id' => $this->integer(), | ||
| 17 | + 'language_id' => $this->integer(), | ||
| 18 | + 'title' => $this->string(), | ||
| 19 | + 'alt' => $this->string(), | ||
| 20 | + 'description' => $this->string(), | ||
| 21 | + ]); | ||
| 22 | + | ||
| 23 | + $this->createIndex( | ||
| 24 | + 'imageManagerIndexLang', | ||
| 25 | + 'ImageManagerLang', | ||
| 26 | + ['image_id', 'language_id'], | ||
| 27 | + true | ||
| 28 | + ); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * @inheritdoc | ||
| 33 | + */ | ||
| 34 | + public function down() | ||
| 35 | + { | ||
| 36 | + $this->dropIndex('imageManagerIndexLang', "ImageManagerLang"); | ||
| 37 | + | ||
| 38 | + $this->dropTable('ImageManagerLang'); | ||
| 39 | + } | ||
| 40 | +} |