echo Url::to(['/job/seeker/information']); ?> "><?php echo Yii::t('account', 'Basic Information'); ?> </a></li> <li><a href="#">Free Format Resume</a></li> <!--<li><a href="#">Job Prefrence</a></li>--> </ul> </li> <li class="menu-item-has-children"> <a href="<?php echo Url::to(['/message/frontend/default/index']); ?> ">My messages <span class="label label-danger"><?php echo \app\modules\message\models\Message::countMessageUnread(); ?> </span></a> <ul class="sub-menu"> <li><a href="<?php echo Url::to(['/message/default', 'type' => 1]); ?> ">Inbox</a></li> <li><a href="<?php echo Url::to(['/message/default', 'type' => 2]); ?> ">Outbox</a></li> </ul> </li> <li> <a href="<?php
<div class="row"> <div class="col-xs-12 col-sm-9 col-sm-push-3 col-main section-gap"> <div class="reg-area"> <h1 class="text-center h2">Create New Message</h1> <?php $form = ActiveForm::begin(['id' => 'formDefault', 'layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data'], 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'wrapper' => 'col-sm-10', 'error' => 'help-block m-b-none', 'hint' => '']]]); ?> <?php echo $form->field($model, 'subject'); ?> <?php echo $form->field($model, 'users')->widget(\kartik\select2\Select2::classname(), ['data' => $model->getUserOptions(), 'options' => ['placeholder' => Yii::t('message', 'Select Users'), 'multiple' => 'multiple'], 'pluginOptions' => ['allowClear' => true, 'minimumInputLength' => 2, 'ajax' => ['url' => Url::to(['user-list']), 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term}; }')], 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), 'templateResult' => new JsExpression('function(users) { return users.text; }'), 'templateSelection' => new JsExpression('function (users) { return users.text; }')]]); ?> <?php echo $form->field($model, 'category_id')->dropDownList(\app\modules\message\models\Message::getCategoryOptions()); ?> <?php echo $form->field($model, 'content')->widget(letyii\tinymce\Tinymce::className(), ['options' => ['style' => 'height: 400px;'], 'configs' => ['setup' => new \yii\web\JsExpression('function(editor) { editor.on("change", function() { tinymce.triggerSave(); }); }'), 'plugins' => 'moxiemanager advlist autolink lists link image charmap print preview hr anchor pagebreak ' . 'searchreplace wordcount visualblocks visualchars code fullscreen ' . 'insertdatetime media nonbreaking save table contextmenu directionality ' . 'emoticons template paste textcolor colorpicker textpattern', 'toolbar1' => 'insertfile undo redo | styleselect | fontselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', 'toolbar2' => 'print preview media | forecolor backcolor emoticons', 'moxiemanager_image_settings' => ['moxiemanager_title' => 'Images', 'moxiemanager_extensions' => 'jpg,png,gif', 'moxiemanager_rootpath' => '/uploads/files', 'moxiemanager_view' => 'thumbs'], 'external_plugins' => ['moxiemanager' => Url::base() . '/plugins/moxiemanager/plugin.min.js']]]); ?> <div class="text-center"> <button type="submit" class="button button-primary button-lg">Send</button> </div> <?php ActiveForm::end(); ?> </div> </div>
/** * Finds the Message model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $_id * @return Message the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Message::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getMessage() { return $this->hasOne(Message::className(), ['_id' => 'message_id']); }
/* @var $dataProvider yii\data\ActiveDataProvider */ ?> <!-- MAIN --> <main id="main" class="main-container"> <!-- SECTION 1 --> <div class="section section-1"> <div class="container"> <div class="section-inner"> <div class="section-content layout-2cols-left"> <div class="row"> <div class="col-xs-12 col-sm-9 col-sm-push-3 col-main section-gap"> <div class="tab-content"> <div role="tabpanel"> <h3>Message list filtering by: <?php echo $paramCategory != 0 ? Message::getCategoryText($paramCategory) : Message::getTypeText($paramType); ?> </h3> <form method="GET"> <div class="table-responsive"> <table class="table table-bordered table-striped table-hover"> <tbody> <tr> <td> <input type="text" name="keyword" class="form-control full-width" placeholder="Enter message subject, email, name etc." value="<?php echo Yii::$app->request->get('keyword'); ?> "> </td> <td class="text-center" style="width:200px">
</li> <li role="presentation" class="<?php if ($action == 'index' && $paramCategory == Message::CATEGORY_SCOUTS) { echo 'active'; } ?> "> <a href="<?php echo Url::to(['/message/frontend/default/index', 'category' => Message::CATEGORY_SCOUTS]); ?> ">Scouts ( <?php echo Message::countMessageByCategory(Message::CATEGORY_SCOUTS); ?> )</a> </li> <li role="presentation" class="<?php if ($action == 'index' && $paramCategory == Message::CATEGORY_APPLICATIONS) { echo 'active'; } ?> "> <a href="<?php echo Url::to(['/message/frontend/default/index', 'category' => Message::CATEGORY_APPLICATIONS]); ?> ">Applications ( <?php echo Message::countMessageByCategory(Message::CATEGORY_APPLICATIONS); ?> )</a> </li> </ul>
public function actionBulkDelete() { /** @var $model \app\modules\message\models\Message */ Yii::$app->response->format = Response::FORMAT_JSON; if (!isset($_POST['keys'])) { return ['status' => 0]; } $keys = Yii::$app->request->getBodyParam('keys'); if (!is_array($keys) || empty($keys)) { return ['status' => 0]; } $messageIds = []; if (($modelMessageUser = MessageUser::find()->where(['_id' => $keys])->all()) != null) { foreach ($modelMessageUser as $dataMessageUser) { $messageIds[] = $dataMessageUser->message_id; } } if (empty($messageIds)) { return ['status' => 0]; } $userId = Yii::$app->user->id; if (($modelMessage = Message::find()->where(['_id' => $messageIds])->all()) == null) { return ['status' => 0]; } foreach ($modelMessage as $model) { // Neu day chi la nguoi nhan if ($model->created_by != $userId) { MessageUser::updateAll(['is_delete' => 1], ['message_id' => $model->primaryKey, 'user_id' => $userId]); continue; } // Neu day la nguoi tao message // Xoa du lieu lien quan Message::deleteAll(['message_id' => $model->primaryKey]); MessageUser::deleteAll(['message_id' => $model->primaryKey]); // Xoa message chinh $model->delete(); } return ['status' => 1]; }