示例#1
0
 public static function baseQuery()
 {
     $query = BudgetItem::find();
     $query->andWhere(['user_id' => CurrentUser::getId()]);
     $query->andWhere(['active' => true]);
     return $query;
 }
示例#2
0
&nbsp;<?php 
echo HelpPopover::widget(['dataOptions' => ['content' => Yii::t('help', 'BudgetItemHelp')]]);
?>
</i>
            </h2>
        </div>

        <div class="panel-body">

            <div class="table-responsive">
                <?php 
echo GridView::widget(['layout' => '{summary}{pager}{items}{pager}', 'dataProvider' => $dataProvider, 'pager' => ['class' => yii\widgets\LinkPager::className(), 'firstPageLabel' => Yii::t('app', 'First'), 'lastPageLabel' => Yii::t('app', 'Last')], 'filterModel' => $searchModel, 'tableOptions' => ['class' => 'table table-striped table-bordered table-hover'], 'headerRowOptions' => ['class' => 'x'], 'columns' => [['class' => 'yii\\grid\\ActionColumn', 'urlCreator' => function ($action, $model, $key, $index) {
    // using the column name as key, not mapping to 'id' like the standard generator
    $params = is_array($key) ? $key : [$model->primaryKey()[0] => (string) $key];
    $params[0] = \Yii::$app->controller->id ? \Yii::$app->controller->id . '/' . $action : $action;
    return Url::toRoute($params);
}, 'contentOptions' => ['nowrap' => 'nowrap']], ['class' => \app\components\grid\EnumColumn::className(), 'attribute' => 'type_budget_item_id', 'name' => 'typeBudgetItemType', 'filter' => \app\models\BudgetItem::getTypes(), 'cssCLasses' => \app\models\BudgetItem::getTypesCssClass()], 'name', 'ammount', ['filter' => kartik\date\DatePicker::widget(['model' => $searchModel, 'attribute' => 'date', 'pluginOptions' => ['format' => 'dd.mm.yyyy']]), 'attribute' => 'date', 'format' => 'date']]]);
?>
            </div>

        </div>

    </div>

    <?php 
\yii\widgets\Pjax::end();
?>


</div>
示例#3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBudgetItems()
 {
     return $this->hasMany(\app\models\BudgetItem::className(), ['type_budget_item_id' => 'id']);
 }
示例#4
0
 public static function baseQuery()
 {
     $query = parent::baseQuery();
     return $query;
 }
示例#5
0
 /**
  * Finds the BudgetItem model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return BudgetItem the loaded model
  * @throws HttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = BudgetItem::findOne($id)) !== null) {
         return $model;
     } else {
         throw new HttpException(404, 'The requested page does not exist.');
     }
 }
示例#6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBudgetItems()
 {
     return $this->hasMany(\app\models\BudgetItem::className(), ['currency_id' => 'id']);
 }
示例#7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBudgetItem()
 {
     return $this->hasOne(\app\models\BudgetItem::className(), ['id' => 'budget_item_id']);
 }