Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Messagebox::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['msg_id' => $this->msg_id, 'receiver_type' => $this->receiver_type, 'receiver' => $this->receiver]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'author', $this->author]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * Finds the Messagebox model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Messagebox the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Messagebox::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 3
0
 public function actionMessageboxdetail()
 {
     $this->layout = false;
     $gh_id = U::getSessionParam('gh_id');
     $openid = U::getSessionParam('openid');
     Yii::$app->wx->setGhId($gh_id);
     $gh = Yii::$app->wx->getGh();
     $msg_id = $_GET['msg_id'];
     $messagebox = Messagebox::findOne(['msg_id' => $msg_id]);
     return $this->render('messageboxdetail', ['gh_id' => $gh_id, 'openid' => $openid, 'messagebox' => $messagebox]);
 }
Esempio n. 4
0
    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('新增消息', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['msg_id', 'title', 'digest', 'author', ['attribute' => 'receiver_type', 'value' => function ($model, $key, $index, $column) {
    return Messagebox::getReceiverTypeOptionName($model->receiver_type);
}, 'filter' => Messagebox::getReceiverTypeOptionName()], ['attribute' => 'receiver', 'value' => function ($model, $key, $index, $column) {
    $office = MOffice::findOne(['office_id' => $model->receiver]);
    if ($model->receiver_type == 0) {
        /*经销商*/
        return '--';
    } else {
        return $office->title;
    }
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Esempio n. 5
0
use app\models\Messagebox;
/* @var $this yii\web\View */
/* @var $model app\models\Messagebox */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => '消息中心', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="messagebox-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('修改', ['update', 'id' => $model->msg_id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('删除', ['delete', 'id' => $model->msg_id], ['class' => 'btn btn-danger', 'data' => ['confirm' => '删除本条消息,确定?', 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['msg_id', 'title', 'digest', 'content:ntext', 'author', ['attribute' => 'receiver_type', 'value' => function ($model, $key, $index, $column) {
    return Messagebox::getReceiverTypeOptionName($model->receiver_type);
}, 'filter' => Messagebox::getReceiverTypeOptionName(), 'visible' => false], 'receiver']]);
?>

</div>
Esempio n. 6
0
    <!--
    <//?= $form->field($model, 'receiver_type')->textInput() ?>
    -->

    <?php 
echo $form->field($model, 'receiver_type')->dropDownList(Messagebox::getReceiverTypeOptionName());
?>


    <!--
    <//?= $form->field($model, 'receiver')->textInput() ?>
    -->

    <span id="receiver-block">
	<?php 
echo $form->field($model, 'receiver')->dropDownList(Messagebox::getOfficeNameOptionAll('gh_03a74ac96138', false, true));
?>
	</span>
    
    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? '创建' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>