mirror of
https://github.com/janickiy/yii2-nomer
synced 2025-03-09 15:39:59 +00:00
add files to project
This commit is contained in:
commit
5cac498444
3729 changed files with 836998 additions and 0 deletions
42
modules/admin/controllers/AppleController.php
Normal file
42
modules/admin/controllers/AppleController.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
namespace app\modules\admin\controllers;
|
||||
|
||||
use app\models\AppleSubscribeEvent;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
class AppleController extends AdminController {
|
||||
|
||||
public function actionIndex() {
|
||||
$query = AppleSubscribeEvent::find();
|
||||
$subId = \Yii::$app->request->get("sub_id");
|
||||
if($subId) {
|
||||
$query->andWhere(["subscription_id" => $subId]);
|
||||
}
|
||||
$tm_start = \Yii::$app->request->get("tm_start");
|
||||
if($tm_start) {
|
||||
$query->andWhere([">=", "original_start_date", $tm_start]);
|
||||
}
|
||||
|
||||
$tm_end = \Yii::$app->request->get("tm_end");
|
||||
if($tm_end) {
|
||||
$query->andWhere(["<=", "original_start_date", $tm_end]);
|
||||
}
|
||||
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
"query" => $query
|
||||
]);
|
||||
|
||||
$sData = AppleSubscribeEvent::find()->select(["subscription_id", "subscription_name"])->groupBy(["subscription_id", "subscription_name"])->all();
|
||||
$subs = ArrayHelper::map($sData, "subscription_id", "subscription_name");
|
||||
|
||||
return $this->render("index", [
|
||||
"dataProvider" => $dataProvider,
|
||||
"subs" => $subs,
|
||||
"subId" => $subId,
|
||||
"tm_start" => $tm_start,
|
||||
"tm_end" => $tm_end
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue