/** * Finds the Bids model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Bids the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Bids::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Bids::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, 'activity_id' => $this->activity_id, 'offer_id' => $this->offer_id, 'order_id' => $this->order_id, 'loc_id' => $this->loc_id, 'period' => $this->period, 'period_unit' => $this->period_unit, 'delivery_starts' => $this->delivery_starts, 'price' => $this->price, 'currency_id' => $this->currency_id, 'price_per_unit' => $this->price_per_unit, 'fixed_price' => $this->fixed_price, 'warranty' => $this->warranty, 'time' => $this->time, 'hit_counter' => $this->hit_counter]); $query->andFilterWhere(['like', 'price_per', $this->price_per])->andFilterWhere(['like', 'note', $this->note])->andFilterWhere(['like', 'spec', $this->spec])->andFilterWhere(['like', 'reject_reason', $this->reject_reason])->andFilterWhere(['like', 'report_reason', $this->report_reason]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getBids() { return $this->hasMany(Bids::className(), ['loc_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getBids() { return $this->hasMany(Bids::className(), ['period_unit' => 'id']); }
public function findBid($id) { if ($activity = \common\models\Activities::find()->where(['activity' => 'bid', 'user_id' => $id])->one()) { if ($bid = \common\models\Bids::find()->where(['activity_id' => $activity->id])->one()) { return $bid; } } return null; }
/** * @return \yii\db\ActiveQuery */ public function getBid() { return $this->hasOne(Bids::className(), ['activity_id' => 'id']); }
$icon = '<i class="fa fa-trophy fa-lg"></i>'; $color = '#00aff0;'; $pre = ''; $log_text = Yii::t('app', 'successfully closed') . $suff . ' <a href="' . Url::to('order/' . $log->alias . '') . '">' . Yii::t('app', 'the request') . ' <i class="fa fa-file"></i> #' . $log->alias . '</a>'; } // if ($log->action=='order_successful') // provider_selected if ($log->action == 'provider_selected') { $icon = '<i class="fa fa-trophy fa-lg"></i>'; $color = 'purple'; $pre = ''; $log_text = Yii::t('app', 'selected') . $suff . ' <a href="' . Url::to('provider/' . $user1->username . '/i') . '"><i class="fa fa-user"></i> ' . Yii::t('app', 'a service provider') . '</a> ' . Yii::t('app', 'for the request') . ' #<a href="' . Url::to('order/' . $log->alias2 . '') . '">' . $log->alias2 . '</a>'; } // if ($log->action=='provider_selected') if ($log->alias != null) { $bid = \common\models\Bids::findOne($log->alias); // bid_sent if ($log->action == 'bid_sent') { $icon = '<i class="fa fa-check-square fa-lg"></i>'; $color = '#00cc00;'; $pre = ''; $log_text = Yii::t('app', 'sent') . $suff . ' <a href="' . Url::to('order/' . $bid->order_id . '') . '">' . Yii::t('app', 'a bid') . ' <i class="fa fa-share-square-o"></i> #' . $log->alias . '</a>'; } // if ($log->action=='bid_sent') // bid_updated if ($log->action == 'bid_updated') { $icon = '<i class="fa fa-edit fa-lg"></i>'; $color = '#00cc00;'; $pre = ''; $log_text = Yii::t('app', 'updated') . $suff . ' <a href="' . Url::to('order/' . $bid->order_id . '') . '">' . Yii::t('app', 'the bid') . ' <i class="fa fa-share-square-o"></i> #' . $log->alias . '</a>'; }