/** * @return array the list of attributes for this record */ public static function getApiLangs($select = null) { if ($select !== null) { return Ref::find()->where(['gtype' => 'type,lang', 'select' => $select])->getList(); } else { return Ref::find()->where(['gtype' => 'type,lang'])->getList(); } }
public function getData() { $refs = Ref::getList($this->gtype, $this->i18nDictionary, $this->findOptions); $res = []; foreach ($refs as $key => $value) { $res[] = ['id' => $key, 'text' => $value]; } return $res; }
<?php /* * Client module for HiPanel * * @link https://github.com/hiqdev/hipanel-module-client * @package hipanel-module-client * @license BSD-3-Clause * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/) */ use hipanel\grid\GridView; use yii\helpers\Html; use yii\widgets\Pjax; $this->title = 'Set language'; $this->params['breadcrumbs'][] = $this->title; echo Html::beginForm(['set-credit'], 'POST'); if (!Yii::$app->request->isAjax) { echo Html::submitButton(Yii::t('hipanel', 'Submit'), ['class' => 'btn btn-primary']); } if (!Yii::$app->request->isAjax) { echo Html::submitButton(Yii::t('hipanel', 'Cancel'), ['type' => 'cancel', 'class' => 'btn btn-success', 'onClick' => 'history.back()']); } Pjax::begin(); $widgetIndexConfig = ['dataProvider' => $dataProvider, 'columns' => [['label' => Yii::t('hipanel', 'Client'), 'format' => 'raw', 'value' => function ($data) { return HTML::input('hidden', "ids[{$data->id}][Client][id]", $data->id, ['readonly' => 'readonly']) . HTML::tag('span', $data->login); }], ['label' => Yii::t('hipanel', 'Language'), 'format' => 'raw', 'value' => function ($data) { return Html::dropDownList("ids[{$data->id}}][Client][language]", $data->language, \hipanel\models\Ref::getList('type,lang', 'hipanel')); }]]]; echo GridView::widget($widgetIndexConfig); Pjax::end(); echo Html::endForm();
/** * @return null|integer */ public function getTrashId() { $resultId = null; $ids = Ref::find(['gtype' => 'destination,trash', 'select' => 'full'])->all(); foreach ($ids as $model) { if ($model->name === 'main') { $resultId = $model->id; } } return $resultId; }
/** * @return array */ public static function getPanels() { return Ref::getList('type,panel', 'hipanel:server:panel', []); }
<?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'is_published')->widget(SwitchInput::class); ?> <?php echo $form->field($model, 'name'); ?> <?php echo $form->field($model, 'post_date')->widget(DatePicker::class, ['value' => date('d-M-Y', strtotime('+2 days'))]); ?> <?php echo $form->field($model, 'type')->dropDownList(ArrayHelper::map(Ref::find()->where(['gtype' => 'type,article'])->getList(false), 'gl_key', function ($l) { return ucfirst($l->gl_value); })); ?> <div role="tabpanel" style="margin-bottom: 25px;"> <!-- Nav tabs --> <ul id="lang_tab" class="nav nav-tabs" role="tablist"> <?php foreach ($langs as $code => $label) { ?> <?php echo Html::beginTag('li', ['role' => 'presentation']); ?> <?php
* @link https://github.com/hiqdev/hipanel-module-client * @package hipanel-module-client * @license BSD-3-Clause * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/) */ use hipanel\grid\GridView; use hipanel\models\Ref; use yii\helpers\Html; use yii\widgets\Pjax; $this->title = Yii::t('hipanel', ucfirst($action)) . ' ' . Yii::t('hipanel', 'block'); $this->params['breadcrumbs'][] = ['label' => 'Client', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; echo Html::beginForm([$action . '-block'], 'POST'); if (!Yii::$app->request->isAjax) { echo Html::submitButton(Yii::t('hipanel', 'Submit'), ['class' => 'btn btn-primary']); } if (!Yii::$app->request->isAjax) { echo Html::submitButton(Yii::t('hipanel', 'Cancel'), ['type' => 'cancel', 'class' => 'btn btn-success', 'onClick' => 'history.back()']); } Pjax::begin(); $blockReason = Ref::getList('type,block', 'hipanel'); $widgetIndexConfig = ['dataProvider' => $dataProvider, 'columns' => [['label' => Yii::t('hipanel', 'Client'), 'format' => 'raw', 'value' => function ($data) { return HTML::input('hidden', "ids[{$data->id}][Client][id]", $data->id, ['readonly' => 'readonly', 'disabled' => $data->id === \Yii::$app->user->identity->id || \Yii::$app->user->identity->type === 'client']) . HTML::tag('span', $data->login); }], ['label' => Yii::t('hipanel', 'Block reason'), 'format' => 'raw', 'value' => function ($data) { return Html::dropDownList("ids[{$data->id}][Client][type]", '', Ref::getList('type,block', 'hipanel'), ['promt' => Yii::t('hipanel', 'Select block reason')]); }], ['label' => Yii::t('hipanel', 'Comment'), 'format' => 'raw', 'value' => function ($data) { return Html::input('text', "ids[{$data->id}][Client][comment]", '', ['toggle-title' => Yii::t('hipanel', 'Write comment')]); }]]]; echo GridView::widget($widgetIndexConfig); Pjax::end(); echo Html::endForm();
public function getRefs($name, $translate = null, $options = []) { return Ref::getList($name, $translate, $options); }
protected function getRefs() { $elements = Ref::getList($this->gtype, $this->i18nDictionary, $this->findOptions); return ArrayHelper::merge($elements, $this->elementOverrides); }