Exemplo n.º 1
0
 /**
  * 发布
  * @param integer $id
  * @return  {[type]}                          [description]
  * @version 1.0      2016-03-09T15:42:23+0800     * @author cnzhangxl@foxmail.com
  */
 public function actionPush($id)
 {
     $model = $this->findModel($id);
     if ($model) {
         $model->scenario = 'push';
         $yesterday_content = $model->content;
         $model->content = $model->pre_content;
         if ($model->save()) {
             Yii::$app->cache->delete('piece_' . $id);
             $PieceOperateLog = new PieceOperateLog(['scenario' => 'create']);
             $PieceOperateLog->piece_id = $id;
             $PieceOperateLog->yesterday_content = $yesterday_content;
             $PieceOperateLog->mg_id = Yii::$app->user->id;
             $PieceOperateLog->save();
             return json_encode(['status' => 1]);
         }
     }
     return json_encode(['status' => 0]);
 }
Exemplo n.º 2
0
echo $model->getAttributeLabel("pre_content");
?>
</h2>
                <p><?php 
echo Html::textarea('', $model->pre_content, ['style' => 'width:100%', 'rows' => '20', 'readonly' => true]);
?>
</p>
                <p style="text-align: center;"> <?php 
echo Html::a('预览', Yii::$app->params['www_domain'] . $model->pre_url, ['class' => 'btn btn-success', 'target' => '_blank']);
?>
</p>
            </div>
        </div>
      </div><!-- /.tab-pane -->
      <div id="activity2" class="tab-pane">
        <?php 
Pjax::begin(['id' => 'countries']);
echo GridView::widget(['dataProvider' => new ActiveDataProvider(['query' => PieceOperateLog::find()->where(['piece_id' => $model->id]), 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]), 'columns' => [['attribute' => 'created_at', 'value' => function ($data) {
    return date('Y-m-d H:i:s', $data->created_at) . '(' . $data->mgId->username . ')';
}], ['attribute' => 'yesterday_content', 'contentOptions' => ['style' => "width:80%"], 'format' => 'raw', 'value' => function ($data) {
    return Html::textarea('', $data->yesterday_content, ['style' => 'width:100%', 'rows' => '5', 'readonly' => true]);
}]]]);
Pjax::end();
?>
        <table class="table table-condensed">
        <tr></tr>
        </table>
      </div><!-- /.tab-pane -->
    </div><!-- /.tab-content -->
  </div><!-- /.nav-tabs-custom -->
</div>