コード例 #1
0
ファイル: SiteController.php プロジェクト: phaniapsr/yiicomm
 public function actionIndex()
 {
     /**
      * fetch a count of customers
      */
     $custCount = Customers::find()->count();
     /**
      * fetch the orders for today
      */
     $orders = Orderstatuses::find()->where('StatusOrder = 1')->count();
     /**
      * fetch the visitor count from the ebsite
      */
     $vistors = 0;
     /**
      * fetch the profit year to date
      */
     $profitytd = Orderdetails::find()->all();
     /**
      * fetch todays profit
      */
     $todayprofit = Orders::find()->with(['orderdetails', 'orderStatus'])->where('OrderStatusId = 1')->all();
     /**
      * fetch the count of active campaigns
      */
     $campaigncount = Campaigns::find()->where('EndedOn = NULL')->count();
     /**
      * count of queued emails
      */
     $countQueued = Queuedemails::find()->where('SentOn <> NULL')->count();
     return $this->render('index', ['custCount' => $custCount, 'orders' => $orders, 'profitytd' => $profitytd, 'todayprofit' => $todayprofit, 'campaigncount' => $campaigncount, 'countQueued' => $countQueued]);
 }
コード例 #2
0
ファイル: SearchCampaigns.php プロジェクト: phaniapsr/yiicomm
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Campaigns::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['CampaignId' => $this->CampaignId, 'CampaignTypeId' => $this->CampaignTypeId, 'DiscountPercent' => $this->DiscountPercent, 'OrderLimit' => $this->OrderLimit, 'MaximumProductPurchaceLimit' => $this->MaximumProductPurchaceLimit, 'MinimumProductPurchaceLimit' => $this->MinimumProductPurchaceLimit, 'StartedOn' => $this->StartedOn, 'EndedOn' => $this->EndedOn, 'ShippingStartsOn' => $this->ShippingStartsOn, 'ShippingEndsOn' => $this->ShippingEndsOn, 'created_by' => $this->created_by, 'LastUpdatedBy' => $this->LastUpdatedBy, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'deleted_at' => $this->deleted_at]);
     $query->andFilterWhere(['like', 'Name', $this->Name])->andFilterWhere(['like', 'ShortDescription', $this->ShortDescription])->andFilterWhere(['like', 'Description', $this->Description])->andFilterWhere(['like', 'HtmlDescription', $this->HtmlDescription])->andFilterWhere(['like', 'ImageUrl', $this->ImageUrl])->andFilterWhere(['like', 'Comment', $this->Comment]);
     return $dataProvider;
 }
コード例 #3
0
ファイル: _form.php プロジェクト: phaniapsr/yiicomm
<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\bootstrap\ActiveForm;
use common\models\Products;
use common\models\Stockunits;
use common\models\Campaigns;
/* @var $this yii\web\View */
/* @var $model common\models\Campaignproducts */
/* @var $form yii\widgets\ActiveForm */
$dataCampaigns = ArrayHelper::map(Campaigns::find()->asArray()->all(), 'CampaignId', 'Name');
$dataProducts = ArrayHelper::map(Products::find()->asArray()->all(), 'ProductId', 'Name');
$dataStockUnits = ArrayHelper::map(Stockunits::find()->asArray()->all(), 'StockUnitId', 'Name');
?>

<div class="campaignproducts-form">

    <?php 
$form = ActiveForm::begin(['layout' => 'horizontal']);
?>

    <?php 
echo $form->field($model, 'CampaignId', ['horizontalCssClasses' => ['wrapper' => 'col-sm-3']])->dropDownList($dataCampaigns, ['prompt' => 'Choose a Campaign']);
?>

    <?php 
echo $form->field($model, 'ProductId', ['horizontalCssClasses' => ['wrapper' => 'col-sm-4']])->dropDownList($dataProducts, ['prompt' => 'Choose a Product']);
?>

    <?php 
コード例 #4
0
 /**
  * Finds the Campaigns model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Campaigns the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Campaigns::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #5
0
ファイル: Campaigntypes.php プロジェクト: phaniapsr/yiicomm
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCampaigns()
 {
     return $this->hasMany(Campaigns::className(), ['CampaignTypeId' => 'CampaignTypeId']);
 }
コード例 #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCampaign()
 {
     return $this->hasOne(Campaigns::className(), ['CampaignId' => 'CampaignId']);
 }