Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
maks757 committed Mar 12, 2018
2 parents 36503b9 + 78ec425 commit 79e9805
Show file tree
Hide file tree
Showing 22 changed files with 305 additions and 492 deletions.
12 changes: 0 additions & 12 deletions ArticleModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,5 @@

class ArticleModule extends Module
{
public $languageModel = Language::class;
public $defaultRoute = 'post/index';

public function init()
{
\Yii::$container->set(LanguageInterface::class, $this->languageModel);
\Yii::$container->set('language', $this->languageModel);
if(!(\Yii::$container->get('language') instanceof LanguageInterface)) {
throw new NotInstantiableException($this->languageModel);
}
parent::init();
}

}
56 changes: 56 additions & 0 deletions components/ArticleHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Created by PhpStorm.
* User: max
* Name: Cherednyk Maxim
* Phone: +380639960375
* Email: maks757q@gmail.com
* Date: 16.02.2018
* Time: 15:26
*/

namespace maks757\articlesdata\components;


use maks757\articlesdata\components\src\ArticleObject;
use maks757\articlesdata\entities\Yii2DataArticleGallery;
use maks757\articlesdata\entities\Yii2DataArticleImage;
use maks757\articlesdata\entities\Yii2DataArticleText;
use PHPUnit\Framework\MockObject\BadMethodCallException;
use yii\base\InvalidParamException;
use yii\helpers\ArrayHelper;

class ArticleHelper extends ArticleObject
{
const POSITION_UP = 0x0001;
const POSITION_DOWN = 0x0002;

/**
* @param $field_id
* @param $field_class Yii2DataArticleText|Yii2DataArticleGallery|Yii2DataArticleImage
* @param int $type
* @internal param $type :: POSITION_UP
* @internal param $type :: POSITION_DOWN
*/
public static function changeFieldPosition($field_id, $field_class, $type = ArticleHelper::POSITION_UP)
{
$class = $field_class::findOne($field_id);
switch ($type){
case ArticleHelper::POSITION_UP:{
$class->position = (integer)$class->position + 1;
break;
}
case ArticleHelper::POSITION_DOWN:{
$class->position = (integer)$class->position > 1 ? (integer)$class->position - 1 : 1;
break;
}
default:{
throw new InvalidParamException();
}
}

if(!$class->save()) {
throw new BadMethodCallException();
}
}
}
58 changes: 0 additions & 58 deletions components/image/CreateImageMetaMulti.php

This file was deleted.

19 changes: 0 additions & 19 deletions components/image/GenerateName.php

This file was deleted.

37 changes: 0 additions & 37 deletions components/interfaces/LanguageInterface.php

This file was deleted.

20 changes: 20 additions & 0 deletions components/src/ArticleObject.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Created by PhpStorm.
* User: max
* Name: Cherednyk Maxim
* Phone: +380639960375
* Email: maks757q@gmail.com
* Date: 16.02.2018
* Time: 15:27
*/

namespace maks757\articlesdata\components\src;


use yii\base\BaseObject;

abstract class ArticleObject extends BaseObject
{

}
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
],
"require": {
"yiisoft/yii2": ">=2.0.4",
"maks757/languages": "*",
"maks757/yii2-imagable": "*",
"yii2tech/ar-position": "*",
"yiisoft/yii2-jui": "*",
"2amigos/yii2-tinymce-widget": "*",
"maks757/embeddable-gallery": "*",
"kartik-v/yii2-widget-fileinput": "*",
"2amigos/yii2-ckeditor-widget": "*",
"yiisoft/yii2-jui": "*"
"kartik-v/yii2-widget-fileinput": "*",
"maks757/embeddable-gallery": "*",
"maks757/yii2-friendly-url": "*",
"maks757/yii2-seo": "*",
"2amigos/yii2-transliterator-helper": "*"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 79e9805

Please sign in to comment.