From d71705b985ec89533d1ee9810bfd7e5c39fd97c9 Mon Sep 17 00:00:00 2001 From: "quot;brussens" Date: Fri, 6 Feb 2015 20:49:58 +0300 Subject: [PATCH] =?UTF-8?q?Issue#7,=20=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5?= =?UTF-8?q?=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Создана админ панель, внесены небольшие правки. --- assets/less/message.less | 24 ++++ assets/web/css/message.css | 2 +- controllers/MessageBackendController.php | 169 +++++++++++++++++++++++ messages/ru/message.php | 38 +++++ models/Message.php | 55 ++++++++ views/message/inbox.php | 7 + views/message/index.php | 58 -------- views/messageBackend/_form.php | 119 ++++++++++++++++ views/messageBackend/_search.php | 70 ++++++++++ views/messageBackend/create.php | 27 ++++ views/messageBackend/index.php | 102 ++++++++++++++ views/messageBackend/update.php | 42 ++++++ views/messageBackend/view.php | 73 ++++++++++ 13 files changed, 727 insertions(+), 59 deletions(-) create mode 100644 controllers/MessageBackendController.php delete mode 100644 views/message/index.php create mode 100644 views/messageBackend/_form.php create mode 100644 views/messageBackend/_search.php create mode 100644 views/messageBackend/create.php create mode 100644 views/messageBackend/index.php create mode 100644 views/messageBackend/update.php create mode 100644 views/messageBackend/view.php diff --git a/assets/less/message.less b/assets/less/message.less index 9e2b75e..5679350 100644 --- a/assets/less/message.less +++ b/assets/less/message.less @@ -34,6 +34,12 @@ font-size:12px; position:relative; + table { + td { + height:50px; + } + } + &:hover, &:focus, &:active { border:1px solid #efefef; cursor:pointer; @@ -74,6 +80,24 @@ .message-preview-body { padding:5px 15px; border-radius:7px; + overflow:hidden; + max-height:100%; + &:before, + &:after { + content: " "; /* 1 */ + display: table; /* 2 */ + } + + &:after { + clear: both; + } + .hide-image { + color: #ffffff; + background:#67809f; + font-size:12px; + padding:3px 6px; + border-radius:3px; + } } &.hot { diff --git a/assets/web/css/message.css b/assets/web/css/message.css index 53c6693..2df2700 100644 --- a/assets/web/css/message.css +++ b/assets/web/css/message.css @@ -1 +1 @@ -#message-nav>li>a{padding:6px 12px}#message-nav>li>a>.label{background:#d9534f;display:block}#message-nav>li.active>a>.label{background:#fff;color:#428bca}.message-wrapper .list-view{padding-top:0}.message-wrapper .message-preview-item{border:1px solid #efefef;font-size:12px;position:relative}.message-wrapper .message-preview-item:hover,.message-wrapper .message-preview-item:focus,.message-wrapper .message-preview-item:active{border:1px solid #efefef;cursor:pointer;background:#f5f5f5}.message-wrapper .message-preview-item:hover>.message-preview-remove,.message-wrapper .message-preview-item:focus>.message-preview-remove,.message-wrapper .message-preview-item:active>.message-preview-remove{display:block}.message-wrapper .message-preview-item .message-preview-remove{display:none;background:0 0;border:0;position:absolute;top:5px;right:10px;font-size:18px;color:#aaa}.message-wrapper .message-preview-item .message-preview-remove:hover,.message-wrapper .message-preview-item .message-preview-remove:focus,.message-wrapper .message-preview-item .message-preview-remove:active{color:#d9534f}.message-wrapper .message-preview-item+.message-preview-item{border-top:0}.message-wrapper .message-preview-item .message-preview-info{padding-left:0}.message-wrapper .message-preview-item .message-preview-info .message-preview-info-time{font-size:10px;color:#666}.message-wrapper .message-preview-item .message-preview-body{padding:5px 15px;border-radius:7px}.message-wrapper .message-preview-item.hot .message-preview-body{background:#c5d9e7;color:#2b5b83}.message-view-wrapper{margin-bottom:15px}.message-view-wrapper .message-view-date{color:#d9534f;font-size:12px;padding:5px 0}.message-view-wrapper .message-view-body{font-size:16px;color:#2b5b83}.compose{padding:10px}.compose .compose-thumb{float:left;width:12%;padding-right:15px}.compose .compose-textarea{float:left;width:88%} \ No newline at end of file +#message-nav>li>a{padding:6px 12px}#message-nav>li>a>.label{background:#d9534f;display:block}#message-nav>li.active>a>.label{background:#fff;color:#428bca}.message-wrapper .list-view{padding-top:0}.message-wrapper .message-preview-item{border:1px solid #efefef;font-size:12px;position:relative}.message-wrapper .message-preview-item table td{height:50px}.message-wrapper .message-preview-item:hover,.message-wrapper .message-preview-item:focus,.message-wrapper .message-preview-item:active{border:1px solid #efefef;cursor:pointer;background:#f5f5f5}.message-wrapper .message-preview-item:hover>.message-preview-remove,.message-wrapper .message-preview-item:focus>.message-preview-remove,.message-wrapper .message-preview-item:active>.message-preview-remove{display:block}.message-wrapper .message-preview-item .message-preview-remove{display:none;background:0 0;border:0;position:absolute;top:5px;right:10px;font-size:18px;color:#aaa}.message-wrapper .message-preview-item .message-preview-remove:hover,.message-wrapper .message-preview-item .message-preview-remove:focus,.message-wrapper .message-preview-item .message-preview-remove:active{color:#d9534f}.message-wrapper .message-preview-item+.message-preview-item{border-top:0}.message-wrapper .message-preview-item .message-preview-info{padding-left:0}.message-wrapper .message-preview-item .message-preview-info .message-preview-info-time{font-size:10px;color:#666}.message-wrapper .message-preview-item .message-preview-body{padding:5px 15px;border-radius:7px;overflow:hidden;max-height:100%}.message-wrapper .message-preview-item .message-preview-body:before,.message-wrapper .message-preview-item .message-preview-body:after{content:" ";display:table}.message-wrapper .message-preview-item .message-preview-body:after{clear:both}.message-wrapper .message-preview-item .message-preview-body .hide-image{color:#fff;background:#67809f;font-size:12px;padding:3px 6px;border-radius:3px}.message-wrapper .message-preview-item.hot .message-preview-body{background:#c5d9e7;color:#2b5b83}.message-view-wrapper{margin-bottom:15px}.message-view-wrapper .message-view-date{color:#d9534f;font-size:12px;padding:5px 0}.message-view-wrapper .message-view-body{font-size:16px;color:#2b5b83}.compose{padding:10px}.compose .compose-thumb{float:left;width:12%;padding-right:15px}.compose .compose-textarea{float:left;width:88%} \ No newline at end of file diff --git a/controllers/MessageBackendController.php b/controllers/MessageBackendController.php new file mode 100644 index 0000000..41ad71f --- /dev/null +++ b/controllers/MessageBackendController.php @@ -0,0 +1,169 @@ + + * @link http://hoswac.ru + * @copyright 2014 Hoswac ltd. + * @package yupe.modules.message.controllers + * @since 0.2-α + * + */ + +class MessageBackendController extends \yupe\components\controllers\BackController +{ + public function accessRules() + { + return [ + ['allow', 'roles' => ['admin']], + ['allow', 'actions' => ['create'], 'roles' => ['Message.MessageBackend.Create']], + ['allow', 'actions' => ['delete'], 'roles' => ['Message.MessageBackend.Delete']], + ['allow', 'actions' => ['index'], 'roles' => ['Message.MessageBackend.Index']], + ['allow', 'actions' => ['inlineEdit'], 'roles' => ['Message.MessageBackend.Update']], + ['allow', 'actions' => ['update'], 'roles' => ['Message.MessageBackend.Update']], + ['allow', 'actions' => ['view'], 'roles' => ['Message.MessageBackend.View']], + ['deny'] + ]; + } + + public function actions() + { + return [ + 'inline' => [ + 'class' => 'yupe\components\actions\YInLineEditAction', + 'model' => 'Message', + 'validAttributes' => ['is_read'] + ] + ]; + } + + public function actionIndex() + { + $model = new Message('search'); + $model->unsetAttributes(); // clear any default values + + $model->setAttributes( + Yii::app()->getRequest()->getParam( + 'Message', + [] + ) + ); + + $this->render('index', [ + 'model' => $model + ]); + } + + public function actionView($id) + { + $model = Message::model()->findByPk($id)->with(['sender', 'recipient']); + $this->render('view', ['model' => $model]); + } + + public function actionCreate() + { + $model = new Message; + + if (($data = Yii::app()->getRequest()->getPost('Message')) !== null) { + + $model->setAttributes($data); + + $model->setAttributes( + [ + 'is_read' => Message::STATUS_NEW, + 'sender_del' => 1, + 'recipient_del' => 1 + ] + ); + + if ($model->save()) { + + Yii::app()->user->setFlash( + yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, + Yii::t('MessageModule.message', 'Message has been sent') + ); + + $this->redirect( + (array)Yii::app()->getRequest()->getPost( + 'submit-type', + ['create'] + ) + ); + } + } + + $this->render('create',[ + 'model' => $model + ]); + } + + public function actionUpdate($id) + { + $model = Message::model()->findByPk($id); + + if(!$model) { + throw new CHttpException(404, Yii::t('MessageModule.message', 'Such a message does not exist')); + } + + if (($data = Yii::app()->getRequest()->getPost('Message')) !== null) { + + $model->setAttributes($data); + + $model->setAttributes( + [ + 'is_read' => Message::STATUS_NEW, + 'sender_del' => 1, + 'recipient_del' => 1 + ] + ); + + if ($model->save()) { + + Yii::app()->user->setFlash( + yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, + Yii::t('MessageModule.message', 'Message has been changed') + ); + + $this->redirect( + (array)Yii::app()->getRequest()->getPost( + 'submit-type', + ['update'] + ) + ); + } + } + + $this->render('update',[ + 'model' => $model + ]); + } + + public function actionDelete($id) + { + if (Yii::app()->getRequest()->getIsPostRequest()) { + + // we only allow deletion via POST request + if (Message::model()->findByPk($id)->delete()) { + Yii::app()->user->setFlash( + yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, + Yii::t('MessageModule.message', 'Message has been removed') + ); + } else { + Yii::app()->user->setFlash( + yupe\widgets\YFlashMessages::ERROR_MESSAGE, + Yii::t('MessageModule.message', 'You can\'t make this changes') + ); + } + + // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser + Yii::app()->getRequest()->getParam('ajax') !== null || $this->redirect( + (array)Yii::app()->getRequest()->getPost('returnUrl', 'index') + ); + } else { + throw new CHttpException( + 400, + Yii::t('MessageModule.message', 'Bad request. Please don\'t use similar requests anymore') + ); + } + } +} \ No newline at end of file diff --git a/messages/ru/message.php b/messages/ru/message.php index 5bf9886..a5e6603 100644 --- a/messages/ru/message.php +++ b/messages/ru/message.php @@ -19,6 +19,7 @@ 'Message can not be empty' => 'Сообщение не должно быть пустым', 'Recipient can not be empty' => 'Получатель не должен быть пустым', 'Check a recipient' => 'Выберите получателя', + 'Check a sender' => 'Выберите отправителя', 'Enter your message text' => 'Введите текст вашего сообщения', 'Send' => 'Отправить', 'Your message has been sent successfully' => 'Ваше сообщение успешно отправлено', @@ -28,4 +29,41 @@ 'Services' => 'Сервисы', 'Messages list' => 'Список сообщений', 'Create message' => 'Создать сообщение', + 'management' => 'управление', + 'Management' => 'Управление', + 'Find messages' => 'Поиск сообщений', + 'Sent date' => 'Дата отправки', + 'Recipient' => 'Получатель', + 'Sender' => 'Отправитель', + 'Body' => 'Содержание', + 'ID' => '№', + 'Private messages - management' => 'Приватные сообщения - управление', + 'Private messages - show' => 'Приватные сообщения - просмотр', + 'Read' => 'Прочитано', + 'Not read' => 'Не прочитано', + 'Yes' => 'Да', + 'No' => 'Нет', + 'Show message' => 'Просмотр сообщения', + 'Manage messages' => 'Управление сообщениями', + 'Message' => 'Сообщение', + 'Edit message' => 'Редактировать сообщение', + 'Remove message' => 'Удалить сообщение', + 'Do you really want to remove this message?' => 'Вы действительно хотите удалить это сообщение?', + 'Create message and continue' => 'Создать сообщение и продолжить', + 'Save message and continue' => 'Сохранить сообщение и продолжить', + 'Create message and close' => 'Создать сообщение и закрыть', + 'Save message and close' => 'Сохранить сообщение и закрыть', + 'Fields with' => 'Поля, отмеченные', + 'are required' => 'обязательны', + 'Create' => 'Создать', + 'Edit' => 'Редактирование', + 'Private messages - edit message' => 'Приватные сообщения - редактирование сообщения', + 'Private messages - create message' => 'Приватные сообщения - создание сообщения', + 'Find message' => 'Искать сообщение', + 'Reset' => 'Очистить форму', + 'Message has been sent' => 'Сообщение отправлено', + 'Message has been changed' => 'Сообщение сохранено', + 'Message has been removed' => 'Сообщение удалено', + 'You can\'t make this changes' => 'Невозможно применить изменения', + 'Bad request. Please don\'t use similar requests anymore' => 'Неверный запрос. Пожалуйста, не используйте подобные запросы' ]; \ No newline at end of file diff --git a/models/Message.php b/models/Message.php index 5d4ef4b..33b80ca 100644 --- a/models/Message.php +++ b/models/Message.php @@ -39,6 +39,27 @@ public function tableName() return '{{message_message}}'; } + public function attributeLabels() + { + return[ + 'id' => Yii::t('MessageModule.message', 'ID'), + 'sent_at' => Yii::t('MessageModule.message', 'Sent date'), + 'recipient_id' => Yii::t('MessageModule.message', 'Recipient'), + 'sender_id' => Yii::t('MessageModule.message', 'Sender'), + 'body' => Yii::t('MessageModule.message', 'Body'), + 'is_read' => Yii::t('MessageModule.message', 'Read'), + ]; + } + + public function rules() + { + return [ + ['sender_id, recipient_id, body', 'required'], + ['sent_at, is_read', 'safe'], + ['sender_id, recipient_id', 'safe', 'on' => 'search'], + ]; + } + /** * @return array */ @@ -67,4 +88,38 @@ public function getHasAccess() } return false; } + + public function getStatusList() + { + return [ + self::STATUS_NEW => Yii::t('MessageModule.message', 'No'), + self::STATUS_READ => Yii::t('MessageModule.message', 'Yes'), + ]; + } + + public function getStatus() + { + return $this->getStatusList()[$this->is_read]; + } + + public function search($pageSize = 10) + { + $criteria = new CDbCriteria(); + + $criteria->compare('t.id', $this->id); + $criteria->compare('t.sent_at', $this->sent_at, true); + $criteria->compare('t.sender_id', $this->sender_id, true); + $criteria->compare('t.recipient_id', $this->recipient_id, true); + $criteria->with = ['sender', 'recipient']; + + return new CActiveDataProvider(get_class($this), array( + 'criteria' => $criteria, + 'pagination' => array( + 'pageSize' => $pageSize, + ), + 'sort' => array( + 'defaultOrder' => 'sent_at DESC', + ) + )); + } } \ No newline at end of file diff --git a/views/message/inbox.php b/views/message/inbox.php index 600631c..0df92eb 100644 --- a/views/message/inbox.php +++ b/views/message/inbox.php @@ -10,6 +10,13 @@ * */ ?> +
widget('zii.widgets.CListView', [ diff --git a/views/message/index.php b/views/message/index.php deleted file mode 100644 index b907057..0000000 --- a/views/message/index.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @link http://hoswac.ru - * @copyright 2014 Hoswac ltd. - * @package yupe.modules.message.views.message - * @since 0.2-RC - * - */?> - -
-widget('zii.widgets.CListView', array( - 'dataProvider'=>$dataProvider, - 'itemView'=>'_dialogue', - //'template'=>$this->renderPartial('_dialogue_template',array(),true), - )); -?> -
\ No newline at end of file diff --git a/views/messageBackend/_form.php b/views/messageBackend/_form.php new file mode 100644 index 0000000..7729e8f --- /dev/null +++ b/views/messageBackend/_form.php @@ -0,0 +1,119 @@ +findAll(), 'id', 'nick_name'); +$form = $this->beginWidget( + 'bootstrap.widgets.TbActiveForm', + [ + 'id' => 'message-form', + 'enableAjaxValidation' => false, + 'enableClientValidation' => true, + 'type' => 'vertical', + 'htmlOptions' => ['class' => 'well'], + ] +); ?> + +
+ + * + +
+ +errorSummary($model); ?> + +
+
+
+ labelEx($model, 'recipient_id'); ?> + widget( + 'booster.widgets.TbSelect2', + [ + 'model' => $model, + 'attribute' => 'recipient_id', + 'data' => $users, + 'options' => [ + 'placeholder' => Yii::t('MessageModule.message', 'Check a recipient'), + 'width' => '100%', + ], + ] + ); ?> +
+
+
+
+ labelEx($model, 'sender_id'); ?> + widget( + 'booster.widgets.TbSelect2', + [ + 'model' => $model, + 'attribute' => 'sender_id', + 'data' => $users, + 'options' => [ + 'placeholder' => Yii::t('MessageModule.message', 'Check a sender'), + 'width' => '100%', + ], + ] + ); ?> +
+
+
+ +
+
+ dateTimePickerGroup( + $model, + 'sent_at', + array( + 'widgetOptions' => array( + 'options' => array( + 'format' => 'yy-mm-dd hh:ii:ss', + 'todayBtn' => true, + 'weekStart' => 1, + 'autoclose' => true, + 'orientation' => 'auto right', + 'startView' => 2, + ), + ), + 'prepend' => '', + ) + ); + ?> +
+
+
+
+ labelEx($model, 'body'); ?> + widget( + $this->module->getVisualEditor(), + [ + 'model' => $model, + 'attribute' => 'body', + ] + ); ?> +
+
+ +widget( + 'bootstrap.widgets.TbButton', + [ + 'buttonType' => 'submit', + 'context' => 'primary', + 'label' => $model->isNewRecord ? Yii::t('MessageModule.message', 'Create message and continue') : Yii::t( + 'MessageModule.message', + 'Save message and continue' + ), + ] +); ?> + +widget( + 'bootstrap.widgets.TbButton', + [ + 'buttonType' => 'submit', + 'htmlOptions' => ['name' => 'submit-type', 'value' => 'index'], + 'label' => $model->isNewRecord ? Yii::t('MessageModule.message', 'Create message and close') : Yii::t( + 'MessageModule.message', + 'Save message and close' + ), + ] +); ?> + +endWidget(); ?> \ No newline at end of file diff --git a/views/messageBackend/_search.php b/views/messageBackend/_search.php new file mode 100644 index 0000000..2f9c661 --- /dev/null +++ b/views/messageBackend/_search.php @@ -0,0 +1,70 @@ +beginWidget( + 'bootstrap.widgets.TbActiveForm', + array( + 'action' => Yii::app()->createUrl($this->route), + 'method' => 'get', + 'type' => 'vertical', + 'htmlOptions' => array('class' => 'well'), + ) +); ?> +
+
+
+ labelEx($model, 'sender_id'); ?> + widget( + 'booster.widgets.TbSelect2', + [ + 'model' => $model, + 'attribute' => 'sender_id', + 'data' => $users, + 'options' => [ + 'placeholder' => Yii::t('MessageModule.message', 'Check a sender'), + 'width' => '100%', + ], + ] + ); ?> +
+
+ labelEx($model, 'recipient_id'); ?> + widget( + 'booster.widgets.TbSelect2', + [ + 'model' => $model, + 'attribute' => 'recipient_id', + 'data' => $users, + 'options' => [ + 'placeholder' => Yii::t('MessageModule.message', 'Check a recipient'), + 'width' => '100%', + ], + ] + ); ?> +
+
+
+ + + +
+ widget( + 'bootstrap.widgets.TbButton', + array( + 'buttonType' => 'submit', + 'context' => 'primary', + 'icon' => 'fa fa-search', + 'label' => Yii::t('MessageModule.message', 'Find message'), + ) + ); ?> + + widget( + 'bootstrap.widgets.TbButton', + array( + 'buttonType' => 'reset', + 'context' => 'danger', + 'icon' => 'fa fa-times', + 'label' => Yii::t('MessageModule.message', 'Reset'), + ) + ); ?> +
+ +endWidget(); ?> diff --git a/views/messageBackend/create.php b/views/messageBackend/create.php new file mode 100644 index 0000000..d90ea96 --- /dev/null +++ b/views/messageBackend/create.php @@ -0,0 +1,27 @@ +pageTitle = Yii::t('MessageModule.message', 'Private messages - create message'); + +$this->breadcrumbs = array( + Yii::t('MessageModule.message', 'Private messages') => array('/message/messageBackend/index'), + Yii::t('MessageModule.message', 'Create'), +); +$this->menu = array( + array( + 'label' => Yii::t('MessageModule.message', 'Private messages'), + 'items' => array( + array( + 'icon' => 'fa fa-fw fa-list-alt', + 'label' => Yii::t('MessageModule.message', 'Manage messages'), + 'url' => array('/message/messageBackend/index') + ) + ) + ) +); +?> + +renderPartial('_form', ['model' => $model]); ?> \ No newline at end of file diff --git a/views/messageBackend/index.php b/views/messageBackend/index.php new file mode 100644 index 0000000..545a1d0 --- /dev/null +++ b/views/messageBackend/index.php @@ -0,0 +1,102 @@ +breadcrumbs = array( + Yii::t('MessageModule.message', 'Private messages') => array('/message/messageBackend/index'), + Yii::t('MessageModule.message', 'Management'), +); + +$this->pageTitle = Yii::t('MessageModule.message', 'Private messages - management'); + +$this->menu = array( + array( + 'label' => Yii::t('MessageModule.message', 'Private messages'), + 'items' => array( + array( + 'icon' => 'fa fa-fw fa-list-alt', + 'label' => Yii::t('MessageModule.message', 'Manage messages'), + 'url' => array('/message/messageBackend/index') + ), + array( + 'icon' => 'fa fa-fw fa-plus-square', + 'label' => Yii::t('MessageModule.message', 'Create message'), + 'url' => array('/message/messageBackend/create') + ), + ) + ) +); + +$users = CHtml::listData(User::model()->findAll(), 'id', 'nick_name'); +?> + + + +

+ +   + +   + +

+ +
+ clientScript->registerScript( + 'search', + " + $('.search-form form').submit(function () { + event.preventDefault(); + + $.fn.yiiGridView.update('message-grid', { + data: $(this).serialize() + }); + }); +" + ); + $this->renderPartial('_search', array('model' => $model, 'users' => $users)); + ?> +
+ +widget( + 'yupe\widgets\CustomGridView', + array( + 'id' => 'message-grid', + 'dataProvider' => $model->search(), + 'filter' => $model, + 'columns' => array( + 'id', + array( + 'name' => 'sender_id', + 'type' => 'raw', + 'value' => 'CHtml::link($data->sender->nick_name, array("/user/userBackend/view", "id" => $data->sender_id))', + ), + array( + 'name' => 'recipient_id', + 'type' => 'raw', + 'value' => 'CHtml::link($data->recipient->nick_name, array("/user/userBackend/view", "id" => $data->recipient_id))', + ), + array( + 'name' => 'body', + 'type' => 'raw', + 'value' => 'StringHelper::truncate($data->body, 150);', + ), + array( + 'name' => 'is_read', + 'type' => 'raw', + 'value' => '$data->getStatus();', + ), + array( + 'name' => 'sent_at', + ), + + array( + 'header' => Yii::t('UserModule.user', 'Management'), + 'class' => 'yupe\widgets\CustomButtonColumn', + 'template' => '{view}{update}{delete}', + ), + ), + ) +); ?> \ No newline at end of file diff --git a/views/messageBackend/update.php b/views/messageBackend/update.php new file mode 100644 index 0000000..037c47e --- /dev/null +++ b/views/messageBackend/update.php @@ -0,0 +1,42 @@ +pageTitle = Yii::t('MessageModule.message', 'Private messages - edit message').' #'.$model->id; +$this->breadcrumbs = array( + Yii::t('MessageModule.message', 'Private messages') => array('/message/messageBackend/index'), + Yii::t('MessageModule.message', 'Edit').' #'.$model->id, +); +$this->menu = array( + array( + 'label' => Yii::t('MessageModule.message', 'Private messages'), + 'items' => array( + array( + 'icon' => 'fa fa-fw fa-list-alt', + 'label' => Yii::t('MessageModule.message', 'Manage messages'), + 'url' => array('/message/messageBackend/index') + ), + array( + 'icon' => 'fa fa-fw fa-plus-square', + 'label' => Yii::t('MessageModule.message', 'Create message'), + 'url' => array('/message/messageBackend/create') + ), + array('label' => Yii::t('MessageModule.message', 'Message') . ' «' . $model->id . '»'), + array( + 'icon' => 'fa fa-fw fa-trash-o', + 'label' => Yii::t('MessageModule.message', 'Remove message'), + 'url' => '#', + 'linkOptions' => array( + 'submit' => array('/message/messageBackend/delete', 'id' => $model->id), + 'params' => array(Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken), + 'confirm' => Yii::t('MessageModule.message', 'Do you really want to remove this message?') + ), + ), + ) + ) +); +?> + +renderPartial('_form', ['model' => $model]); ?> \ No newline at end of file diff --git a/views/messageBackend/view.php b/views/messageBackend/view.php new file mode 100644 index 0000000..10f8221 --- /dev/null +++ b/views/messageBackend/view.php @@ -0,0 +1,73 @@ +breadcrumbs = array( + Yii::t('MessageModule.message', 'Private messages') => array('/message/messageBackend/index'), + $model->id, +); + +$this->pageTitle = Yii::t('MessageModule.message', 'Private messages - show'); + +$this->menu = array( + array( + 'label' => Yii::t('MessageModule.message', 'Private messages'), + 'items' => array( + array( + 'icon' => 'fa fa-fw fa-list-alt', + 'label' => Yii::t('MessageModule.message', 'Manage messages'), + 'url' => array('/message/messageBackend/index') + ), + array( + 'icon' => 'fa fa-fw fa-plus-square', + 'label' => Yii::t('MessageModule.message', 'Create message'), + 'url' => array('/message/messageBackend/create') + ), + array('label' => Yii::t('MessageModule.message', 'Message') . ' «' . $model->id . '»'), + array( + 'icon' => 'fa fa-fw fa-pencil', + 'label' => Yii::t('MessageModule.message', 'Edit message'), + 'url' => array( + '/message/messageBackend/update', + 'id' => $model->id + ) + ), + array( + 'icon' => 'fa fa-fw fa-trash-o', + 'label' => Yii::t('MessageModule.message', 'Remove message'), + 'url' => '#', + 'linkOptions' => array( + 'submit' => array('/message/messageBackend/delete', 'id' => $model->id), + 'params' => array(Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken), + 'confirm' => Yii::t('MessageModule.message', 'Do you really want to remove this message?') + ), + ), + ) + ) +); +?> + + +widget( + 'bootstrap.widgets.TbDetailView', + array( + 'data' => $model, + 'attributes' => array( + 'id', + array( + 'name' => 'is_read', + 'value' => $model->getStatus(), + ), + array( + 'name' => 'sender_id', + 'value' => $model->sender->nick_name, + ), + array( + 'name' => 'recipient_id', + 'value' => $model->recipient->nick_name, + ), + 'body', + ), + ) +); ?> \ No newline at end of file