예제 #1
0
 public function actionNotifications()
 {
     $myId = Yii::$app->getUser()->id;
     Notice::updateAll(['updated_at' => time(), 'status' => 1], ['status' => 0, 'target_id' => $myId]);
     $query = Notice::find()->where(['target_id' => $myId]);
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count('id')]);
     $notices = $query->orderBy(['id' => SORT_DESC])->offset($pages->offset)->with(['source', 'topic'])->limit($pages->limit)->asArray()->all();
     return $this->render('notifications', ['notices' => $notices, 'pages' => $pages]);
 }
예제 #2
0
 public function actionList()
 {
     $params = Yii::$app->request->queryParams;
     $limit = $params["iDisplayLength"];
     $offset = $params["iDisplayStart"];
     $sEcho = $params["sEcho"];
     $query = Notice::find();
     $count = $query->count();
     $aaData = $query->asArray()->orderBy(['notice_id' => SORT_DESC])->limit($limit)->offset($offset)->all();
     \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     return ['success' => true, 'aaData' => $aaData, "iTotalRecords" => $count, "iTotalDisplayRecords" => $count, "sEcho" => $sEcho];
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Notice::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'date' => $this->date]);
     $query->andFilterWhere(['like', 'content', $this->content]);
     return $dataProvider;
 }
예제 #4
0
 public function actionIndex()
 {
     $notice = null;
     $order_in = 0;
     $order_finish = 0;
     $order_pend = 0;
     if (!empty($this->user)) {
         $notice = Notice::find()->where('rids like :rids', [':rids' => '%,' . $this->user->rid . ',%'])->orderBy('create_time desc')->one();
         $order_in = CommodityOrder::find()->where('op_statu = :op_statu', [':op_statu' => CommodityOrder::$_OP_IN])->count();
         $order_finish = CommodityOrder::find()->where('op_statu = :op_statu', [':op_statu' => CommodityOrder::$_OP_FINISH])->count();
         $order_pend = CommodityOrder::find()->where('statu = :statu', [':statu' => CommodityOrder::$_AUDIT_PEND])->count();
     }
     return $this->render('index', ['notice' => $notice, 'order_in' => $order_in, 'order_finish' => $order_finish, 'order_pend' => $order_pend]);
 }
예제 #5
0
        <p class="lead">Sistem Informasi PT. Global Lestari Motorindo</p>

        <!--<p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>-->
    </div>

        <p><?php 
//echo __DIR__
?>
</p>

    <div class="body-content">
        <?php 
if (Yii::$app->user->isGuest) {
    echo '';
} else {
    $model = \app\models\Notice::find()->orderBy(['id' => SORT_DESC])->one();
    echo '<div class="alert alert-success alert-dismissible" role="alert">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>';
    echo '<strong>INFO : </strong>';
    echo nl2br($model->content);
    echo '<br/><br/><p style="font-size:12px;">Posted : ' . $model->date . '</p>';
    echo '</div>';
}
?>

       <!-- <div class="row">
            <div class="col-lg-4">
                <h2>Heading</h2>

                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
                    dolore magna liqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
예제 #6
0
파일: User.php 프로젝트: 0ps/simpleforum
 public function getNoticeCount()
 {
     return Notice::find()->where(['status' => 0, 'target_id' => $this->id])->count('id');
 }
예제 #7
0
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Notice::find()->orderBy('create_time desc')]);
     return $this->render('index', array('dataProvider' => $dataProvider));
 }