コード例 #1
0
 /**
  * Finds the Promotions model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Promotions the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Promotions::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Promotions::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, 'presentation_id' => $this->presentation_id, 'old_price' => $this->old_price, 'new_price' => $this->new_price, 'currency_id' => $this->currency_id, 'discount' => $this->discount, 'voucher' => $this->voucher, 'max_subscribers' => $this->max_subscribers, 'scheduling' => $this->scheduling, 'active_from' => $this->active_from, 'validity' => $this->validity, 'time' => $this->time]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'subtitle', $this->subtitle])->andFilterWhere(['like', 'promo_text', $this->promo_text])->andFilterWhere(['like', 'not_valid_for', $this->not_valid_for]);
     return $dataProvider;
 }
コード例 #3
0
ファイル: Activities.php プロジェクト: bokko79/servicemapp
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPromotion()
 {
     return $this->hasOne(Promotions::className(), ['id' => 'activity_id']);
 }
コード例 #4
0
ファイル: _card.php プロジェクト: bokko79/servicemapp
use yii\helpers\HtmlPurifier;
use yii\helpers\Url;
?>
          
<div class="card_container record-xl grid-item fadeInUp animated" id="card_container<?php 
echo $model->id;
?>
" style="float:none;">

<?php 
switch ($model->activity) {
    case 'order':
        echo $this->render('/orders/_card_compact.php', ['model' => \common\models\Orders::find('activity=' . $model->id)->one()]);
        break;
    case 'promotion':
        echo $this->render('/promotions/_card_compact.php', ['model' => \common\models\Promotions::find('activity=' . $model->id)->one()]);
        break;
    case 'presentation':
        echo $this->render('/presentations/_card_compact.php', ['model' => \common\models\Presentations::find('activity=' . $model->id)->one()]);
        break;
    default:
        //echo $this->render('/orders/_card_compact.php', ['model'=>\common\models\Orders::findOne('activity='.$model->id)]);
        break;
}
if ($model->activity == 'order' && $model->bid) {
    ?>
    <div class="action-area normal-case">
        <?php 
    echo Html::a(Yii::t('app', 'Bids') . '&nbsp;<i class="fa fa-caret-down"></i>', null, ['class' => 'btn btn-link bid-link']);
    ?>
    </div>
コード例 #5
0
ファイル: Presentations.php プロジェクト: bokko79/servicemapp
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPromotions()
 {
     return $this->hasMany(Promotions::className(), ['presentation_id' => 'id']);
 }
コード例 #6
0
ファイル: CsCurrencies.php プロジェクト: bokko79/servicemapp
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPromotions()
 {
     return $this->hasMany(Promotions::className(), ['currency_id' => 'id']);
 }