Commit 21b35928 authored by waltermazza's avatar waltermazza
Browse files

Arter namespace

parent b2cac3f9
......@@ -11,13 +11,13 @@ Installation
Either run
```bash
composer require elitedivision/amos-comments
composer require arter/amos-comments
```
or add this row
```
"elitedivision/amos-comments": "dev-master"
"arter/amos-comments": "dev-master"
```
to the require section of your `composer.json` file.
......@@ -28,11 +28,11 @@ to the require section of your `composer.json` file.
<?php
'modules' => [
'comments' => [
'class' => 'elitedivision\amos\comments\AmosComments',
'class' => 'arter\amos\comments\AmosComments',
'modelsEnabled' => [
/**
* Add here the classnames of the models where you want the comments
* (i.e. 'elitedivision\amos\events\models\Event')
* (i.e. 'arter\amos\events\models\Event')
*/
],
// the following are mandatory fields
......@@ -57,7 +57,7 @@ Also, add these lines to your bootstrap:
<?php
'components' => [
'view' => [
'class' => 'elitedivision\amos\core\components\AmosView',
'class' => 'arter\amos\core\components\AmosView',
],
],
```
......@@ -65,7 +65,7 @@ Also, add these lines to your bootstrap:
4 Apply migrations
```bash
php yii migrate/up --migrationPath=@vendor/elitedivision/amos-comments/src/migrations
php yii migrate/up --migrationPath=@vendor/arter/amos-comments/src/migrations
```
or add this row to your migrations config in console:
......@@ -73,7 +73,7 @@ or add this row to your migrations config in console:
```php
<?php
return [
'@vendor/elitedivision/amos-comments/src/migrations',
'@vendor/arter/amos-comments/src/migrations',
];
```
......@@ -81,7 +81,7 @@ return [
```php
<?php
use elitedivision\amos\comments\models\CommentInterface;
use arter\amos\comments\models\CommentInterface;
/**
* Implement the CommentInterface
......@@ -103,7 +103,7 @@ public function isCommentable()
<?php
'modules' => [
'comments' => [
'class' => 'elitedivision\amos\comments\AmosComments',
'class' => 'arter\amos\comments\AmosComments',
'modelsEnabled' => [
'class_namespace\MyClass'
]
......@@ -118,7 +118,7 @@ public function isCommentable()
<?php
'modules' => [
'comments' => [
'class' => 'elitedivision\amos\comments\AmosComments',
'class' => 'arter\amos\comments\AmosComments',
'enableMailsNotification' => false,
'modelsEnabled' => [
'class_namespace\MyClass'
......@@ -133,9 +133,9 @@ you can insert an array
```php
'comments' => [
'htmlMailContent' => [
'elitedivision\amos\news\models\News' => '@backend/mail/comment/content_news',
'elitedivision\amos\discussioni\models\DiscussioniTopic' => '@backend/mail/comment/content_discussioni',
'elitedivision\amos\documenti\models\Documenti' => '@backend/mail/comment/content_documenti'
'arter\amos\news\models\News' => '@backend/mail/comment/content_news',
'arter\amos\discussioni\models\DiscussioniTopic' => '@backend/mail/comment/content_discussioni',
'arter\amos\documenti\models\Documenti' => '@backend/mail/comment/content_documenti'
],
```
or a string if the conente is valid for all contents(news/discussioni/docuemnts/ecc..)
......
......@@ -22,7 +22,7 @@
},
"autoload": {
"psr-4": {
"elitedivision\\amos\\comments\\": "src"
"arter\\amos\\comments\\": "src"
}
}
}
\ No newline at end of file
......@@ -5,25 +5,25 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments
* @package arter\amos\comments
* @category CategoryName
* @author Elite Division S.r.l.
*/
namespace elitedivision\amos\comments;
namespace arter\amos\comments;
use elitedivision\amos\comments\components\CommentComponent;
use elitedivision\amos\comments\models\Comment;
use elitedivision\amos\comments\models\CommentReply;
use elitedivision\amos\core\components\AmosView;
use elitedivision\amos\core\module\AmosModule;
use elitedivision\amos\core\module\ModuleInterface;
use arter\amos\comments\components\CommentComponent;
use arter\amos\comments\models\Comment;
use arter\amos\comments\models\CommentReply;
use arter\amos\core\components\AmosView;
use arter\amos\core\module\AmosModule;
use arter\amos\core\module\ModuleInterface;
use yii\base\BootstrapInterface;
use yii\base\Event;
/**
* Class AmosComments
* @package elitedivision\amos\comments
* @package arter\amos\comments
*/
class AmosComments extends AmosModule implements ModuleInterface, BootstrapInterface
{
......@@ -39,7 +39,7 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter
/**
* @inheritdoc
*/
public $controllerNamespace = 'elitedivision\amos\comments\controllers';
public $controllerNamespace = 'arter\amos\comments\controllers';
public $newFileMode = 0666;
......@@ -64,21 +64,21 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter
/**
* This is the html used to render the subject of the e-mail. In the view is available the variable $profile
* that is an instance of 'elitedivision\amos\admin\models\UserProfile'
* that is an instance of 'arter\amos\admin\models\UserProfile'
* @var string
*/
public $htmlMailContentTitle = '@vendor/elitedivision/amos-comments/src/views/comment/email/content_title';
public $htmlMailContentTitle = '@vendor/arter/amos-comments/src/views/comment/email/content_title';
/**
* This is the html used to render the message of the e-mail. In the view is available the variable $profile
* that is an instance of 'elitedivision\amos\admin\models\UserProfile'
* that is an instance of 'arter\amos\admin\models\UserProfile'
* @var string|array
*/
public $htmlMailContent = '@vendor/elitedivision/amos-comments/src/views/comment/email/content';
public $htmlMailContent = '@vendor/arter/amos-comments/src/views/comment/email/content';
// public $htmlMailContent = [
// 'elitedivision\amos\news\models\News' => '@vendor/elitedivision/amos-comments/src/views/comment/email/content_news',
// 'elitedivision\amos\discussioni\models\DiscussioniTopic' => '@vendor/elitedivision/amos-comments/src/views/comment/email/content_discussioni',
// 'elitedivision\amos\documenti\models\Documenti' => '@vendor/elitedivision/amos-comments/src/views/comment/email/content_documenti'
// 'arter\amos\news\models\News' => '@vendor/arter/amos-comments/src/views/comment/email/content_news',
// 'arter\amos\discussioni\models\DiscussioniTopic' => '@vendor/arter/amos-comments/src/views/comment/email/content_discussioni',
// 'arter\amos\documenti\models\Documenti' => '@vendor/arter/amos-comments/src/views/comment/email/content_documenti'
// ];
/**
......@@ -119,7 +119,7 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter
public function init()
{
parent::init();
\Yii::setAlias('@elitedivision/amos/' . static::getModuleName() . '/controllers', __DIR__ . '/controllers/');
\Yii::setAlias('@arter/amos/' . static::getModuleName() . '/controllers', __DIR__ . '/controllers/');
// custom initialization code goes here
\Yii::configure($this, require(__DIR__ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'));
}
......@@ -167,7 +167,7 @@ class AmosComments extends AmosModule implements ModuleInterface, BootstrapInter
->andWhere(['context' => $model->className(), 'context_id' => $model->id])
->groupBy('comment.id');
/** @var \elitedivision\amos\comments\models\Comment $lastComment */
/** @var \arter\amos\comments\models\Comment $lastComment */
$countComment = $query->count();
$query = Comment::find()
->joinWith('commentReplies', true, 'LEFT JOIN')
......
......@@ -5,25 +5,25 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\assets
* @package arter\amos\comments\assets
* @category CategoryName
* @author Elite Division S.r.l.
*/
namespace elitedivision\amos\comments\assets;
namespace arter\amos\comments\assets;
use yii\web\AssetBundle;
/**
* Class CommentsAsset
* @package elitedivision\amos\comments\assets
* @package arter\amos\comments\assets
*/
class CommentsAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public $sourcePath = '@vendor/elitedivision/amos-comments/src/assets/web';
public $sourcePath = '@vendor/arter/amos-comments/src/assets/web';
/**
* @inheritdoc
......@@ -50,9 +50,9 @@ class CommentsAsset extends AssetBundle
{
$moduleL = \Yii::$app->getModule('layout');
if (!empty($moduleL)) {
$this->depends [] = 'elitedivision\amos\layout\assets\BaseAsset';
$this->depends [] = 'arter\amos\layout\assets\BaseAsset';
} else {
$this->depends [] = 'elitedivision\amos\core\views\assets\AmosCoreAsset';
$this->depends [] = 'arter\amos\core\views\assets\AmosCoreAsset';
}
parent::init(); // TODO: Change the autogenerated stub
}
......
/**
IMPORT AMOS-LAYOUT VARIABLES
*/
@import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/variables.less";
@import (optional) "../../vendor/elitedivision/amos-layout/src/assets/resources/base/less/utility.less";
@import (optional) "../../vendor/arter/amos-layout/src/assets/resources/base/less/variables.less";
@import (optional) "../../vendor/arter/amos-layout/src/assets/resources/base/less/utility.less";
/**
IMPORT STYLE-CUSTOM
*/
......
......@@ -4,28 +4,28 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\base
* @package arter\amos\comments\base
* @category CategoryName
* @author Elite Division S.r.l.
*/
namespace elitedivision\amos\comments\base;
namespace arter\amos\comments\base;
use elitedivision\amos\comments\AmosComments;
use elitedivision\amos\comments\models\Comment;
use elitedivision\amos\comments\models\CommentReply;
use elitedivision\amos\core\controllers\CrudController;
use elitedivision\amos\core\interfaces\ModelLabelsInterface;
use elitedivision\amos\core\record\Record;
use elitedivision\amos\core\user\User;
use elitedivision\amos\core\utilities\Email;
use arter\amos\comments\AmosComments;
use arter\amos\comments\models\Comment;
use arter\amos\comments\models\CommentReply;
use arter\amos\core\controllers\CrudController;
use arter\amos\core\interfaces\ModelLabelsInterface;
use arter\amos\core\record\Record;
use arter\amos\core\user\User;
use arter\amos\core\utilities\Email;
use Yii;
use yii\base\BaseObject;
use yii\helpers\ArrayHelper;
/**
* Class PartecipantsNotification
* @package elitedivision\amos\comments\base
* @package arter\amos\comments\base
*/
class PartecipantsNotification extends BaseObject
{
......@@ -70,9 +70,9 @@ class PartecipantsNotification extends BaseObject
$model_reply = $comment;
}
/** @var \elitedivision\amos\core\record\Record $contextModelClassName */
/** @var \arter\amos\core\record\Record $contextModelClassName */
$contextModelClassName = $model->context;
/** @var \elitedivision\amos\core\record\Record $contextModel */
/** @var \arter\amos\core\record\Record $contextModel */
$contextModel = $contextModelClassName::findOne($model->context_id);
$users = $this->getRecipients($contextModel, $contextModelClassName);
......@@ -107,8 +107,8 @@ class PartecipantsNotification extends BaseObject
$users = [];
// If the context is discussion, the emails must be sent to the participants in the scope.
if (Yii::$app->hasModule('discussioni') && ($contextModel instanceof \elitedivision\amos\discussioni\models\DiscussioniTopic)) {
/** @var \elitedivision\amos\discussioni\AmosDiscussioni $moduleDiscussioni */
if (Yii::$app->hasModule('discussioni') && ($contextModel instanceof \arter\amos\discussioni\models\DiscussioniTopic)) {
/** @var \arter\amos\discussioni\AmosDiscussioni $moduleDiscussioni */
$moduleDiscussioni = Yii::$app->getModule('discussioni');
$session = \Yii::$app->session;
$moduleCwh = \Yii::$app->getModule('cwh');
......@@ -116,8 +116,8 @@ class PartecipantsNotification extends BaseObject
if (!empty(\Yii::$app->params['isPoi']) && \Yii::$app->params['isPoi'] == true && !empty($scope) && !empty($scope['community'])
&& $scope['community'] == 2750) {
$communityManager = \elitedivision\amos\community\models\CommunityUserMm::find()->andWhere(['community_id' => 2750])->andWhere([
'role' => \elitedivision\amos\community\models\Community::ROLE_COMMUNITY_MANAGER]);
$communityManager = \arter\amos\community\models\CommunityUserMm::find()->andWhere(['community_id' => 2750])->andWhere([
'role' => \arter\amos\community\models\Community::ROLE_COMMUNITY_MANAGER]);
foreach ($communityManager->all() as $idComm) {
$user = User::findOne($idComm->user_id);
if (!is_null($user)) {
......@@ -128,15 +128,15 @@ class PartecipantsNotification extends BaseObject
if ($moduleDiscussioni->hasProperty('notifyOnlyContributors') && !$moduleDiscussioni->notifyOnlyContributors) {
$moduleCwh = Yii::$app->getModule('cwh');
if (!is_null($moduleCwh)) {
/** @var \elitedivision\amos\cwh\AmosCwh $moduleCwh */
if (in_array(\elitedivision\amos\discussioni\models\DiscussioniTopic::className(),
/** @var \arter\amos\cwh\AmosCwh $moduleCwh */
if (in_array(\arter\amos\discussioni\models\DiscussioniTopic::className(),
$moduleCwh->modelsEnabled)) {
$cwhActiveQuery = new \elitedivision\amos\cwh\query\CwhActiveQuery(\elitedivision\amos\discussioni\models\DiscussioniTopic::className());
$cwhActiveQuery = new \arter\amos\cwh\query\CwhActiveQuery(\arter\amos\discussioni\models\DiscussioniTopic::className());
if (in_array($contextModel->regola_pubblicazione,
\elitedivision\amos\cwh\utility\CwhUtil::getNetworkCwhRuleIds())) {
\arter\amos\cwh\utility\CwhUtil::getNetworkCwhRuleIds())) {
$queryUsers = $cwhActiveQuery->getRecipients($contextModel->regola_pubblicazione,
$contextModel->tagValues, $contextModel->destinatari);
$queryUsers->andWhere(['<>', \elitedivision\amos\core\user\User::tableName().'.id', Yii::$app->user->id]); // Exclude logged user id
$queryUsers->andWhere(['<>', \arter\amos\core\user\User::tableName().'.id', Yii::$app->user->id]); // Exclude logged user id
$users = ArrayHelper::map($queryUsers->all(), 'id', 'id');
}
}
......@@ -195,8 +195,8 @@ class PartecipantsNotification extends BaseObject
$user = User::findOne($id);
if(!empty($moduleNotify)) {
/** @var $notificationConf \elitedivision\amos\notificationmanager\models\NotificationConf */
$notificationConf = \elitedivision\amos\notificationmanager\models\NotificationConf::find()
/** @var $notificationConf \arter\amos\notificationmanager\models\NotificationConf */
$notificationConf = \arter\amos\notificationmanager\models\NotificationConf::find()
->andWhere(['user_id' => $id])
->one();
if($notificationConf->hasProperty('notifications_enabled') && ($notificationConf->notify_comments == 0 || $notificationConf->notifications_enabled == 0)){
......
......@@ -5,23 +5,23 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\components
* @package arter\amos\comments\components
* @category CategoryName
* @author Elite Division S.r.l.
*/
namespace elitedivision\amos\comments\components;
namespace arter\amos\comments\components;
use elitedivision\amos\comments\AmosComments;
use elitedivision\amos\comments\models\CommentInterface;
use elitedivision\amos\comments\widgets\CommentsWidget;
use arter\amos\comments\AmosComments;
use arter\amos\comments\models\CommentInterface;
use arter\amos\comments\widgets\CommentsWidget;
use Yii;
use yii\base\Component;
use yii\base\Event;
/**
* Class CommentComponent
* @package elitedivision\amos\events\components
* @package arter\amos\events\components
*/
class CommentComponent extends Component implements CommentComponentInterface
{
......@@ -32,7 +32,7 @@ class CommentComponent extends Component implements CommentComponentInterface
public function showComments(Event $event)
{
if (isset(Yii::$app->controller->model)) {
/** @var \elitedivision\amos\core\record\Record $controllerModel */
/** @var \arter\amos\core\record\Record $controllerModel */
$controllerModel = Yii::$app->controller->model;
if ($this->checkCommentsModuleEnabled($controllerModel) && $this->checkCommentsEnabledOnModel($controllerModel)) {
echo CommentsWidget::widget([
......@@ -45,7 +45,7 @@ class CommentComponent extends Component implements CommentComponentInterface
/**
* The method checks if the comment module is present and the actual controller
* model class name is present in the comments module configurations.
* @param \elitedivision\amos\core\record\Record $controllerModel
* @param \arter\amos\core\record\Record $controllerModel
* @return bool
*/
protected function checkCommentsModuleEnabled($controllerModel)
......@@ -62,7 +62,7 @@ class CommentComponent extends Component implements CommentComponentInterface
/**
* Method that checks if the controller model is an instance of CommentInterface
* and then if the model is commentable.
* @param \elitedivision\amos\core\record\Record $controllerModel
* @param \arter\amos\core\record\Record $controllerModel
* @return bool
*/
protected function checkCommentsEnabledOnModel($controllerModel)
......
......@@ -5,18 +5,18 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\components
* @package arter\amos\comments\components
* @category CategoryName
* @author Elite Division S.r.l.
*/
namespace elitedivision\amos\comments\components;
namespace arter\amos\comments\components;
use yii\base\Event;
/**
* Interface CommentComponentInterface
* @package elitedivision\amos\comments\components
* @package arter\amos\comments\components
*/
interface CommentComponentInterface
{
......
......@@ -5,7 +5,7 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\config
* @package arter\amos\comments\config
* @category CategoryName
* @author Elite Division S.r.l.
*/
......
......@@ -5,23 +5,23 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\controllers
* @package arter\amos\comments\controllers
* @category CategoryName
* @author Elite Division S.r.l.
*/
namespace elitedivision\amos\comments\controllers;
namespace arter\amos\comments\controllers;
use elitedivision\amos\comments\AmosComments;
use elitedivision\amos\comments\base\PartecipantsNotification;
use elitedivision\amos\comments\exceptions\CommentsException;
use elitedivision\amos\comments\models\Comment;
use elitedivision\amos\comments\models\search\CommentSearch;
use elitedivision\amos\core\controllers\CrudController;
use elitedivision\amos\core\helpers\BreadcrumbHelper;
use elitedivision\amos\core\helpers\Html;
use elitedivision\amos\core\icons\AmosIcons;
use elitedivision\amos\notificationmanager\utility\NotifyUtility;
use arter\amos\comments\AmosComments;
use arter\amos\comments\base\PartecipantsNotification;
use arter\amos\comments\exceptions\CommentsException;
use arter\amos\comments\models\Comment;
use arter\amos\comments\models\search\CommentSearch;
use arter\amos\core\controllers\CrudController;
use arter\amos\core\helpers\BreadcrumbHelper;
use arter\amos\core\helpers\Html;
use arter\amos\core\icons\AmosIcons;
use arter\amos\notificationmanager\utility\NotifyUtility;
use Yii;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
......@@ -31,9 +31,9 @@ use yii\helpers\Url;
/**
* Class CommentController
*
* @property \elitedivision\amos\comments\models\Comment $model
* @property \arter\amos\comments\models\Comment $model
*
* @package elitedivision\amos\comments\controllers
* @package arter\amos\comments\controllers
*/
class CommentController extends CrudController
{
......
......@@ -5,21 +5,21 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\controllers
* @package arter\amos\comments\controllers
* @category CategoryName
* @author Elite Division S.r.l.
*/
namespace elitedivision\amos\comments\controllers;
namespace arter\amos\comments\controllers;
use elitedivision\amos\comments\AmosComments;
use elitedivision\amos\comments\base\PartecipantsNotification;
use elitedivision\amos\comments\exceptions\CommentsException;
use elitedivision\amos\comments\models\CommentReply;
use elitedivision\amos\comments\models\search\CommentReplySearch;
use elitedivision\amos\core\controllers\CrudController;
use elitedivision\amos\core\helpers\Html;
use elitedivision\amos\core\icons\AmosIcons;
use arter\amos\comments\AmosComments;
use arter\amos\comments\base\PartecipantsNotification;
use arter\amos\comments\exceptions\CommentsException;
use arter\amos\comments\models\CommentReply;
use arter\amos\comments\models\search\CommentReplySearch;
use arter\amos\core\controllers\CrudController;
use arter\amos\core\helpers\Html;
use arter\amos\core\icons\AmosIcons;
use Yii;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
......@@ -29,9 +29,9 @@ use yii\helpers\Url;
/**
* Class CommentReplyController
*
* @property \elitedivision\amos\comments\models\CommentReply $model
* @property \arter\amos\comments\models\CommentReply $model
*
* @package elitedivision\amos\comments\controllers
* @package arter\amos\comments\controllers
*/
class CommentReplyController extends CrudController
{
......@@ -123,7 +123,7 @@ class CommentReplyController extends CrudController
}
/**
* @return CommentReply|\elitedivision\amos\core\record\Record|string|\yii\web\Response
* @return CommentReply|\arter\amos\core\record\Record|string|\yii\web\Response
*/
public function actionCreate()
{
......@@ -152,7 +152,7 @@ class CommentReplyController extends CrudController
}
/**
* @return array|CommentReply|\elitedivision\amos\core\record\Record
* @return array|CommentReply|\arter\amos\core\record\Record
* @throws CommentsException
*/
public function actionCreateAjax()
......
......@@ -5,16 +5,16 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\exceptions
* @package arter\amos\comments\exceptions
* @category CategoryName
* @author Elite Division S.r.l.
*/
namespace elitedivision\amos\comments\exceptions;
namespace arter\amos\comments\exceptions;
/**
* Class CommentsException
* @package elitedivision\amos\comments\exceptions
* @package arter\amos\comments\exceptions
*/
class CommentsException extends \Exception
{
......
......@@ -5,7 +5,7 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\i18n\en-GB
* @package arter\amos\comments\i18n\en-GB
* @category CategoryName
* @author Elite Division S.r.l.
*/
......
......@@ -5,7 +5,7 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\i18n\en-US
* @package arter\amos\comments\i18n\en-US
* @category CategoryName
* @author Elite Division S.r.l.
*/
......
......@@ -5,7 +5,7 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\i18n\it-IT
* @package arter\amos\comments\i18n\it-IT
* @category CategoryName
* @author Elite Division S.r.l.
*/
......
......@@ -5,12 +5,12 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\migrations
* @package arter\amos\comments\migrations
* @category CategoryName
* @author Elite Division S.r.l.
*/
use elitedivision\amos\core\migration\AmosMigrationTableCreation;
use arter\amos\core\migration\AmosMigrationTableCreation;
/**
* Class m170523_084441_create_comment_table
......
......@@ -5,12 +5,12 @@
* OPEN 2.0
*
*
* @package elitedivision\amos\comments\migrations
* @package arter\amos\comments\migrations
* @category CategoryName
* @author Elite Division S.r.l.
*/
use elitedivision\amos\core\migration\AmosMigrationTableCreation;
use arter\amos\core\migration\AmosMigrationTableCreation;
/**