Example #1
8
use yii\grid\DataColumn;
$speciesModel = new Species();
$searchModel = new SpeciesSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
?>

<h1><?php 
echo Yii::t('app', 'Alle soorten');
?>
</h1>
<?php 
echo Html::a(Yii::t('app', 'Toevoegen'), Url::toRoute('species/form'), ['class' => 'btn btn-successbtn btn-success']);
?>

<br><br>
<?php 
DataColumn::className();
?>

<?php 
echo DataTables::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'taxon', 'value' => function ($model, $key, $index, $column) {
    return $model->getTaxonomy($model->taxon);
}], ['attribute' => 'genus', 'format' => 'html', 'value' => function ($model, $key, $index, $column) {
    return Html::a($model->genus, Url::toRoute('species/detail/' . $model->id));
}], ['attribute' => 'speceus', 'format' => 'html', 'value' => function ($model, $key, $index, $column) {
    return Html::a($model->speceus, Url::toRoute('species/detail/' . $model->id));
}], ['attribute' => 'dutch', 'format' => 'html', 'value' => function ($model, $key, $index, $column) {
    return Html::a($model->dutch, Url::toRoute('species/detail/' . $model->id));
}], ['attribute' => 'url', 'format' => 'html', 'value' => function ($model, $key, $index, $column) {
    return Html::a($model->url, $model->url);
}]], 'clientOptions' => ['info' => false, 'responsive' => true, 'dom' => 'lfTrtip', 'tableTools' => ['aButtons' => [['sExtends' => 'copy', 'sButtonText' => Yii::t('app', 'Copy to clipboard')], ['sExtends' => 'csv', 'sButtonText' => Yii::t('app', 'Save to CSV')], ['sExtends' => 'xls', 'oSelectorOpts' => ['page' => 'current']], ['sExtends' => 'pdf', 'sButtonText' => Yii::t('app', 'Save to PDF')], ['sExtends' => 'print', 'sButtonText' => Yii::t('app', 'Print')]]]]]);
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ArrayHelper::merge(parent::actions(), ['index' => ['columns' => [['attribute' => 'status', 'class' => \yii\grid\DataColumn::className(), 'filter' => \skeeks\cms\comments2\models\Comments2Message::$statuses, 'format' => 'raw', 'value' => function (\skeeks\cms\comments2\models\Comments2Message $model) {
         if ($model->status == \skeeks\cms\comments2\models\Comments2Message::STATUS_NEW) {
             $class = "default";
         } else {
             if ($model->status == \skeeks\cms\comments2\models\Comments2Message::STATUS_PROCESSED) {
                 $class = "warning";
             } else {
                 if ($model->status == \skeeks\cms\comments2\models\Comments2Message::STATUS_CANCELED) {
                     $class = "danger";
                 } else {
                     if ($model->status == \skeeks\cms\comments2\models\Comments2Message::STATUS_ALLOWED) {
                         $class = "success";
                     }
                 }
             }
         }
         return '<span class="label label-' . $class . '">' . \yii\helpers\ArrayHelper::getValue(\skeeks\cms\comments2\models\Comments2Message::$statuses, $model->status) . '</span>';
     }], ['class' => \skeeks\cms\grid\CreatedAtColumn::className(), 'label' => 'Добавлен'], ['class' => \skeeks\cms\grid\CreatedByColumn::className()], ['attribute' => 'site_code', 'class' => \yii\grid\DataColumn::className(), 'filter' => \yii\helpers\ArrayHelper::map(\skeeks\cms\models\CmsSite::find()->all(), 'code', 'name'), 'value' => function (\skeeks\cms\comments2\models\Comments2Message $model) {
         return $model->site->name;
     }], ['attribute' => 'element_id', 'relation' => 'element', 'class' => \skeeks\cms\grid\CmsContentElementColumn::className()], ['filter' => \yii\helpers\ArrayHelper::map(\skeeks\cms\models\CmsContent::find()->all(), 'id', 'name'), 'attribute' => 'content_id', 'class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\comments2\models\Comments2Message $model) {
         return $model->element->cmsContent->name;
     }]]], "status-allowed-multi" => ['class' => AdminMultiModelEditAction::className(), "name" => \skeeks\cms\comments2\Module::t('app', 'Approve'), "eachCallback" => [$this, 'eachMultiStatusAllowed']], "status-canceled-multi" => ['class' => AdminMultiModelEditAction::className(), "name" => \skeeks\cms\comments2\Module::t('app', 'Reject'), "eachCallback" => [$this, 'eachMultiStatusCanceled']], "status-processed-multi" => ['class' => AdminMultiModelEditAction::className(), "name" => \skeeks\cms\comments2\Module::t('app', 'In progress'), "eachCallback" => [$this, 'eachMultiStatusProcessed']]]);
 }
Example #3
0
 /**
  * @see \yii\grid\GridView::createDataColumn()
  * @inheritdoc
  */
 protected function createDataColumn($text)
 {
     if (!preg_match('/^([^:]+)(:(\\w*))?(:(.*))?$/', $text, $matches)) {
         throw new InvalidConfigException('The column must be specified in the format of "attribute", "attribute:format" or "attribute:format:label"');
     }
     return Yii::createObject(['class' => $this->dataColumnClass ?: DataColumn::className(), 'grid' => $this, 'attribute' => $matches[1], 'format' => isset($matches[3]) ? $matches[3] : 'text', 'label' => isset($matches[5]) ? $matches[5] : null]);
 }
    /**
     * @inheritdoc
     */
    public function actions()
    {
        return ArrayHelper::merge(parent::actions(), ['index' => ["columns" => [['class' => CreatedAtColumn::className()], 'id', ['class' => DataColumn::className(), 'attribute' => 'status_code', 'format' => 'raw', 'filter' => ArrayHelper::map(ShopOrderStatus::find()->all(), 'code', 'name'), 'value' => function (ShopOrder $order) {
            return Html::label($order->status->name, null, ['style' => "background: {$order->status->color}", 'class' => "label"]) . "<br />" . Html::tag("small", \Yii::$app->formatter->asDatetime($order->status_at) . " (" . \Yii::$app->formatter->asRelativeTime($order->status_at) . ")");
        }], ['class' => BooleanColumn::className(), 'attribute' => 'payed', 'format' => 'raw'], ['class' => DataColumn::className(), 'attribute' => "canceled", 'format' => "raw", 'filter' => ['Y' => \Yii::t('app', 'Yes'), 'N' => \Yii::t('app', 'No')], 'value' => function (ShopOrder $shopOrder) {
            return $shopOrder->canceled == "Y" ? \Yii::t('app', 'Yes') : \Yii::t('app', 'No');
        }], ['class' => DataColumn::className(), 'attribute' => "user_id", 'label' => \skeeks\cms\shop\Module::t('app', 'Buyer'), 'format' => "raw", 'value' => function (ShopOrder $shopOrder) {
            return (new \skeeks\cms\shop\widgets\AdminBuyerUserWidget(['user' => $shopOrder->user]))->run();
        }], ['class' => DataColumn::className(), 'filter' => false, 'format' => 'raw', 'label' => \skeeks\cms\shop\Module::t('app', 'Good'), 'value' => function (ShopOrder $model) {
            if ($model->shopBaskets) {
                $result = [];
                foreach ($model->shopBaskets as $shopBasket) {
                    $money = \Yii::$app->money->intlFormatter()->format($shopBasket->money);
                    $result[] = Html::a($shopBasket->name, $shopBasket->product->cmsContentElement->url, ['target' => '_blank']) . <<<HTML
  — {$shopBasket->quantity} {$shopBasket->measure_name}
HTML;
                }
                return implode('<hr style="margin: 0px;"/>', $result);
            }
        }], ['class' => DataColumn::className(), 'format' => 'raw', 'attribute' => 'price', 'label' => \skeeks\cms\shop\Module::t('app', 'Sum'), 'value' => function (ShopOrder $model) {
            return \Yii::$app->money->intlFormatter()->format($model->money);
        }], ['class' => DataColumn::className(), 'filter' => ArrayHelper::map(CmsSite::find()->active()->all(), 'id', 'name'), 'attribute' => 'site_id', 'format' => 'raw', 'visible' => false, 'label' => \skeeks\cms\shop\Module::t('app', 'Site'), 'value' => function (ShopOrder $model) {
            return $model->site->name . " [{$model->site->code}]";
        }]]], "view" => ['class' => AdminOneModelEditAction::className(), "name" => \Yii::t('app', "Информация"), "icon" => "glyphicon glyphicon-eye-open", "priority" => 5, "callback" => [$this, 'view']]]);
    }
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ArrayHelper::merge(parent::actions(), ['index' => ["columns" => ['value', ['class' => DataColumn::className(), 'value' => function (ShopTaxRate $model) {
         return $model->tax->name . " (" . $model->tax->site->name . ")";
     }, 'attribute' => "tax_id"], ['class' => DataColumn::className(), 'value' => function (ShopTaxRate $model) {
         return $model->personType->name;
     }, 'attribute' => "person_type_id"], ['class' => BooleanColumn::className(), 'attribute' => "is_in_price"], ['class' => BooleanColumn::className(), 'attribute' => "active"], ['attribute' => "priority"]]]]);
 }
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ArrayHelper::merge(parent::actions(), ['index' => ["gridConfig" => ['settingsData' => ['order' => SORT_ASC, 'orderBy' => "priority"]], "columns" => ['name', 'priority', ['class' => DataColumn::className(), 'attribute' => "shopPaySystems", 'filter' => false, 'value' => function (ShopDelivery $model) {
         return implode(", ", ArrayHelper::map($model->shopPaySystems, 'id', 'name'));
     }], ['class' => DataColumn::className(), 'attribute' => "price", 'format' => 'raw', 'filter' => false, 'value' => function (ShopDelivery $model) {
         return \Yii::$app->money->intlFormatter()->format($model->money);
     }], ['class' => BooleanColumn::className(), 'attribute' => "active"]]]]);
 }
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ArrayHelper::merge(parent::actions(), ['index' => ["columns" => [['class' => DataColumn::className(), 'attribute' => 'name', 'format' => 'raw', 'value' => function (KladrLocation $model) {
         if ($model->parent_id) {
             return $model->fullName . " <small>(" . implode(", ", ArrayHelper::map($model->parents, 'id', 'fullName')) . ") </small>";
         } else {
             return $model->fullName;
         }
     }], ['class' => DataColumn::className(), 'attribute' => 'type', 'filter' => KladrLocation::possibleTypes(), 'value' => function (KladrLocation $model) {
         return $model->typeName;
     }]]], 'update-database' => ["class" => AdminAction::className(), "name" => "Импорт местоположений", "icon" => "glyphicon glyphicon-paperclip", "callback" => [$this, 'actionUpdateDatabase']]]);
 }
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ArrayHelper::merge(parent::actions(), ['index' => ["dataProviderCallback" => function (ActiveDataProvider $activeDataProvider) {
         $activeDataProvider->query->andWhere(['type' => ShopDiscount::TYPE_DEFAULT]);
     }, "gridConfig" => ['settingsData' => ['order' => SORT_ASC, 'orderBy' => "priority"]], "columns" => ['id', ['attribute' => 'name'], ['attribute' => 'value', 'class' => DataColumn::className(), 'value' => function (ShopDiscount $shopDiscount) {
         if ($shopDiscount->value_type == ShopDiscount::VALUE_TYPE_P) {
             return \Yii::$app->formatter->asPercent($shopDiscount->value / 100);
         } else {
             $money = Money::fromString((string) $shopDiscount->value, $shopDiscount->currency_code);
             return \Yii::$app->money->intlFormatter()->format($money);
         }
     }], ['attribute' => 'active', 'class' => BooleanColumn::className()], ['attribute' => 'active_from', 'class' => DateTimeColumnData::className()], ['attribute' => 'active_to', 'class' => DateTimeColumnData::className()], ['class' => UpdatedByColumn::className()], ['class' => UpdatedAtColumn::className()], 'priority']]]);
 }
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ArrayHelper::merge(parent::actions(), ['create' => ['visible' => false], 'update' => ['visible' => false], 'system' => ['visible' => false], 'index' => ["columns" => [['class' => CreatedAtColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'Date views')], ['class' => DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'User'), 'value' => function (ShopViewedProduct $shopViewedProduct) {
         if ($shopViewedProduct->shopFuser->user) {
             return $shopViewedProduct->shopFuser->user->displayName;
         }
         return \skeeks\cms\shop\Module::t('app', 'Not authorized') . " [{$shopViewedProduct->shopFuser->id}]";
     }], ['class' => DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'Good'), 'value' => function (ShopViewedProduct $shopViewedProduct) {
         if ($shopViewedProduct->shopProduct) {
             return $shopViewedProduct->shopProduct->cmsContentElement->name;
         }
         return null;
     }]]]]);
 }
 public function actionIndex()
 {
     $meta['title'] = $this->pageTitle;
     $meta['description'] = 'List all media';
     $meta['pageIcon'] = $this->pageIcon;
     $module = MediaModule::getInstance();
     if (!is_null($module->adminLayout)) {
         $this->layout = $module->adminLayout;
     }
     $searchModel = new MediaSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());
     $getColumns = [['class' => 'yii\\grid\\SerialColumn'], ['class' => DataColumn::className(), 'attribute' => 'title', 'format' => 'text', 'label' => 'Title'], 'create_time', ['class' => DataColumn::className(), 'attribute' => 'statusLabel', 'format' => 'text', 'label' => 'Status'], ['class' => DataColumn::className(), 'attribute' => 'uploadedTo', 'format' => 'html', 'label' => 'Uploaded to'], ['class' => 'backend\\components\\ActionColumn']];
     return $this->render($module->adminView, ['meta' => $meta, 'dataProvider' => $dataProvider, 'getColumns' => $getColumns]);
 }
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ArrayHelper::merge(parent::actions(), ['index' => ["dataProviderCallback" => function (ActiveDataProvider $dataProvider) {
         $query = $dataProvider->query;
         /**
          * @var \yii\db\ActiveQuery $query
          */
         //$query->select(['app_company.*', 'count(`app_company_officer_user`.`id`) as countOfficer']);
         $query->groupBy([CmsUser::tableName() . '.id']);
         $query->innerJoin(ShopBuyer::tableName(), '`shop_buyer`.`cms_user_id` = `cms_user`.`id`');
     }, "columns" => [['class' => UserColumnData::className(), 'attribute' => 'id', 'label' => \skeeks\cms\shop\Module::t('app', 'Buyer')], 'email', 'phone', ['class' => DateTimeColumnData::className(), 'attribute' => 'created_at', 'label' => \skeeks\cms\shop\Module::t('app', 'Date of registration')], ['class' => DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'Date of last order'), 'value' => function (CmsUser $model) {
         if ($order = ShopOrder::find()->where(['user_id' => $model->id])->orderBy(['created_at' => SORT_DESC])->one()) {
             return \Yii::$app->formatter->asDatetime($order->created_at);
         }
         return null;
     }], ['class' => DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'The amount paid orders'), 'value' => function (CmsUser $model) {
         return ShopOrder::find()->where(['user_id' => $model->id, 'payed' => Cms::BOOL_Y])->count();
     }]]]]);
 }
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ArrayHelper::merge(parent::actions(), ['index' => ["gridConfig" => [], "columns" => [['class' => \yii\grid\SerialColumn::className()], ['class' => \yii\grid\DataColumn::className(), 'attribute' => 'name', 'format' => 'raw', 'value' => function (\skeeks\cms\shop\models\ShopBasket $shopBasket) {
         $widget = new \skeeks\cms\modules\admin\widgets\AdminImagePreviewWidget(['image' => $shopBasket->product->cmsContentElement->image]);
         return $widget->run();
     }], ['class' => \yii\grid\DataColumn::className(), 'attribute' => 'name', 'format' => 'raw', 'value' => function (\skeeks\cms\shop\models\ShopBasket $shopBasket) {
         if ($shopBasket->product) {
             return Html::a($shopBasket->name, $shopBasket->product->cmsContentElement->url, ['target' => '_blank', 'titla' => \Yii::t('skeeks/shop/app', 'Watch Online'), 'data-pjax' => 0]);
         } else {
             return $shopBasket->name;
         }
     }], ['class' => \yii\grid\DataColumn::className(), 'attribute' => 'quantity', 'value' => function (\skeeks\cms\shop\models\ShopBasket $shopBasket) {
         return $shopBasket->quantity . " " . $shopBasket->measure_name;
     }], ['class' => \yii\grid\DataColumn::className(), 'label' => \Yii::t('skeeks/shop/app', 'Price'), 'attribute' => 'price', 'format' => 'raw', 'value' => function (\skeeks\cms\shop\models\ShopBasket $shopBasket) {
         if ($shopBasket->discount_value) {
             return "<span style='text-decoration: line-through;'>" . \Yii::$app->money->intlFormatter()->format($shopBasket->moneyOriginal) . "</span><br />" . Html::tag('small', $shopBasket->notes) . "<br />" . \Yii::$app->money->intlFormatter()->format($shopBasket->money) . "<br />" . Html::tag('small', \Yii::t('skeeks/shop/app', 'Discount') . ": " . $shopBasket->discount_value);
         } else {
             return \Yii::$app->money->intlFormatter()->format($shopBasket->money) . "<br />" . Html::tag('small', $shopBasket->notes);
         }
     }], ['class' => \yii\grid\DataColumn::className(), 'label' => \Yii::t('skeeks/shop/app', 'Sum'), 'attribute' => 'price', 'format' => 'raw', 'value' => function (\skeeks\cms\shop\models\ShopBasket $shopBasket) {
         return \Yii::$app->money->intlFormatter()->format($shopBasket->money->multiply($shopBasket->quantity));
     }]]]]);
 }
Example #13
0
 * @date 02.06.2015
 */
/* @var $this yii\web\View */
/* @var $searchModel \skeeks\cms\models\Search */
/* @var $dataProvider yii\data\ActiveDataProvider */
$query = $dataProvider->query;
$query->groupBy([\skeeks\cms\models\CmsUser::tableName() . '.id']);
$query->leftJoin(\skeeks\cms\shop\models\ShopOrder::tableName(), '`shop_order`.`user_id` = `cms_user`.`id`');
?>

<? $pjax = \skeeks\cms\modules\admin\widgets\Pjax::begin(); ?>

    <?php 
echo $this->render('_search', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
?>

    <?php 
echo \skeeks\cms\modules\admin\widgets\GridViewStandart::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => $pjax, 'adminController' => \Yii::$app->controller, 'columns' => [['class' => \skeeks\cms\grid\UserColumnData::className(), 'attribute' => 'id', 'label' => \Yii::t('skeeks/shop/app', 'Buyer')], 'email', 'phone', ['class' => \skeeks\cms\grid\DateTimeColumnData::className(), 'attribute' => 'created_at', 'label' => \Yii::t('skeeks/shop/app', 'Date of registration')], ['class' => \yii\grid\DataColumn::className(), 'label' => \Yii::t('skeeks/shop/app', 'Date of last order'), 'value' => function (\skeeks\cms\models\CmsUser $model) {
    if ($order = \skeeks\cms\shop\models\ShopOrder::find()->where(['user_id' => $model->id])->orderBy(['created_at' => SORT_DESC])->one()) {
        return \Yii::$app->formatter->asDatetime($order->created_at);
    }
    return null;
}], ['class' => \yii\grid\DataColumn::className(), 'label' => \Yii::t('skeeks/shop/app', 'The amount paid orders'), 'value' => function (\skeeks\cms\models\CmsUser $model) {
    return \skeeks\cms\shop\models\ShopOrder::find()->where(['user_id' => $model->id, 'payed' => \skeeks\cms\components\Cms::BOOL_Y])->count();
}], ['class' => \yii\grid\DataColumn::className(), 'label' => \Yii::t('skeeks/shop/app', 'The amount paid orders'), 'value' => function (\skeeks\cms\models\CmsUser $model) {
    return \skeeks\cms\shop\models\ShopOrder::find()->where(['user_id' => $model->id, 'payed' => \skeeks\cms\components\Cms::BOOL_Y])->count();
}]]]);
?>

<? $pjax::end(); ?>
Example #14
0
use yii\helpers\Url;
use yii\grid\DataColumn;
use app\models\Kek;
/* @var $this yii\web\View */
/* @var $searchModel app\models\KekSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Kierunkowe efekty kształcenia';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="kek-index">
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal">
  		Dodaj kierunkowy efekt kształcenia
	</button>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'symbol', 'opis:ntext', ['class' => DataColumn::className(), 'attribute' => 'kategoria', 'value' => function ($model) {
    return Kek::categoryName[$model->kategoria];
}], ['class' => 'yii\\grid\\ActionColumn', 'controller' => 'kek', 'template' => '{del}', 'buttons' => ['del' => function ($url, $model, $key) {
    $icon = '<span class="glyphicon glyphicon-trash"></span>';
    $label = 'Usun';
    $url = Url::to(["/kek/delete", 'id' => $model->id, 'kid' => $model->kierunekStudiow_id]);
    return Yii::$app->user->identity->groupId == 'admin' ? Html::a($icon, $url, ['title' => $label]) : '';
}]]]]);
?>
</div>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
    if (!$model->cmsTree) {
        return null;
    }
    $path = [];
    if ($model->cmsTree->parents) {
        foreach ($model->cmsTree->parents as $parent) {
            if ($parent->isRoot()) {
                $path[] = "[" . $parent->site->name . "] " . $parent->name;
            } else {
                $path[] = $parent->name;
            }
        }
    }
    $path = implode(" / ", $path);
    return "<small><a href='{$model->cmsTree->url}' target='_blank' data-pjax='0'>{$path} / {$model->cmsTree->name}</a></small>";
}, 'format' => 'raw', 'filter' => \skeeks\cms\helpers\TreeOptions::getAllMultiOptions(), 'attribute' => 'tree_id'], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) {
    $result = [];
    if ($model->cmsContentElementTrees) {
        foreach ($model->cmsContentElementTrees as $contentElementTree) {
            $site = $contentElementTree->tree->root->site;
            $result[] = "<small><a href='{$contentElementTree->tree->url}' target='_blank' data-pjax='0'>[{$site->name}]/.../{$contentElementTree->tree->name}</a></small>";
        }
    }
    return implode('<br />', $result);
}, 'format' => 'raw', 'label' => \Yii::t('app', 'Additional sections')], ['attribute' => 'active', 'class' => \skeeks\cms\grid\BooleanColumn::className()], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) {
    return \yii\helpers\Html::a('<i class="glyphicon glyphicon-arrow-right"></i>', $model->absoluteUrl, ['target' => '_blank', 'title' => \Yii::t('app', 'Watch to site (opens new window)'), 'data-pjax' => '0', 'class' => 'btn btn-default btn-sm']);
}, 'format' => 'raw']];
?>


Example #16
0
<?php

use yii\grid\DataColumn;
use yii\grid\GridView;
/* @var $this yii\web\View */
$this->title = "Latest Torrents";
$this->params['isRecent'] = true;
$tmpPage = \Yii::$app->request->get('page');
$page = intval($tmpPage) > 0 ? intval($tmpPage) : 1;
$pageSize = $torrents->pagination->pageSize;
$from = $page == 1 ? 1 : ($page - 1) * $pageSize + 1;
$to = $page * $pageSize > 10000 ? 10000 : $page * $pageSize;
?>

<?php 
echo GridView::widget(['dataProvider' => $torrents, 'tableOptions' => ['class' => 'result'], 'layout' => '<div class="title">
                <h2 class="left"><span class="bold">Latest Torrents</span></h2>
                <span class="right font-12">Displaying hits from ' . $from . ' to ' . $to . '</span>
                <div class="clear"></div>
            </div>{summary}<div class="panel panel-default"><div class="table-responsive">{items}</div><div class="table-footer"><div class="navigation">{pager}</div></div></div>', 'summary' => false, 'emptyText' => "Blimey! Nothing was found. Try to search again with a different query.", 'columns' => [['class' => frontend\widgets\grid\TorrentTitleColumn::className(), 'options' => ['style' => 'width:64%'], 'label' => 'Name'], ['class' => frontend\widgets\grid\TorrentAgeColumn::className(), 'options' => ['style' => 'width:8%'], 'contentOptions' => ['class' => 'v-middle font-12'], 'label' => 'Age'], ['class' => frontend\widgets\grid\TorrentSizeColumn::className(), 'options' => ['style' => 'width:8%'], 'contentOptions' => ['class' => 'v-middle font-12'], 'label' => 'Size'], ['class' => \yii\grid\DataColumn::className(), 'options' => ['style' => 'width:5%'], 'contentOptions' => ['class' => 'v-middle font-12'], 'attribute' => 'seeders', 'label' => 'SE'], ['class' => DataColumn::className(), 'options' => ['style' => 'width:5%'], 'contentOptions' => ['class' => 'v-middle font-12'], 'attribute' => 'leechers', 'label' => 'LE']], 'pager' => ['options' => ['class' => 'center'], 'activePageCssClass' => 'disabled', 'firstPageCssClass' => 'border-none', 'lastPageCssClass' => 'border-none', 'nextPageCssClass' => 'border-none', 'prevPageCssClass' => 'border-none', 'firstPageLabel' => '<i class="icon-12 two-left-arrow v-sub"></i>', 'lastPageLabel' => '<i class="icon-12 two-right-arrow v-sub"></i>', 'nextPageLabel' => '<i class="icon-12 one-right-arrow v-sub"></i>', 'prevPageLabel' => '<i class="icon-12 one-left-arrow v-sub"></i>']]);
Example #17
0
    return $widget->run();
}], ['class' => \yii\grid\DataColumn::className(), 'attribute' => 'name', 'format' => 'raw', 'value' => function (\skeeks\cms\shop\models\ShopBasket $shopBasket) {
    if ($shopBasket->product) {
        return Html::a($shopBasket->name, $shopBasket->product->cmsContentElement->url, ['target' => '_blank', 'titla' => "Смотреть на сайте", 'data-pjax' => 0]);
    } else {
        return $shopBasket->name;
    }
}], ['class' => \yii\grid\DataColumn::className(), 'attribute' => 'quantity', 'value' => function (\skeeks\cms\shop\models\ShopBasket $shopBasket) {
    return $shopBasket->quantity . " " . $shopBasket->measure_name;
}], ['class' => \yii\grid\DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'Price'), 'attribute' => 'price', 'format' => 'raw', 'value' => function (\skeeks\cms\shop\models\ShopBasket $shopBasket) {
    if ($shopBasket->discount_value) {
        return "<span style='text-decoration: line-through;'>" . \Yii::$app->money->intlFormatter()->format($shopBasket->moneyOriginal) . "</span><br />" . Html::tag('small', $shopBasket->notes) . "<br />" . \Yii::$app->money->intlFormatter()->format($shopBasket->money) . "<br />" . Html::tag('small', \skeeks\cms\shop\Module::t('app', 'Discount') . ": " . $shopBasket->discount_value);
    } else {
        return \Yii::$app->money->intlFormatter()->format($shopBasket->money) . "<br />" . Html::tag('small', $shopBasket->notes);
    }
}], ['class' => \yii\grid\DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'Sum'), 'attribute' => 'price', 'format' => 'raw', 'value' => function (\skeeks\cms\shop\models\ShopBasket $shopBasket) {
    return \Yii::$app->money->intlFormatter()->format($shopBasket->money->multiply($shopBasket->quantity));
}]]]);
?>

        <div class="row">
            <div class="col-md-8"></div>
            <div class="col-md-4">
                    <div class="sx-result">
                <?php 
$this->registerCss(<<<CSS
.sx-result
{
    background-color: #ecf2d3;
}
CSS
Example #18
0
use yii\grid\GridView;
use yii\grid\DataColumn;
use yii\helpers\Url;
use yii\helpers\Html;
$this->title = Yii::t('user', 'Правила доступа');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="news-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Yii::t('user', 'Добавить новое правило'), ['add-permission'], ['class' => 'btn btn-success']);
?>
    </p>
<?php 
$dataProvider = new ArrayDataProvider(['allModels' => Yii::$app->authManager->getPermissions(), 'sort' => ['attributes' => ['name', 'description']], 'pagination' => ['pageSize' => 10]]);
?>

<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'uk-table uk-table-condensed uk-table-striped uk-table-hover'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => DataColumn::className(), 'attribute' => 'name', 'label' => Yii::t('user', 'Правило')], ['class' => DataColumn::className(), 'attribute' => 'description', 'label' => Yii::t('user', 'Описание')], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', Url::toRoute(['update-permission', 'name' => $model->name]), ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0']);
}, 'delete' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', Url::toRoute(['delete-permission', 'name' => $model->name]), ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0']);
}]]]]);
?>
</div>
Example #19
0
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
$this->title = Yii::t('user', 'Управление ролями');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="news-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Yii::t('user', 'Добавить роль'), ['add-role'], ['class' => 'btn btn-success']);
?>
    </p>
<?php 
$dataProvider = new ArrayDataProvider(['allModels' => Yii::$app->authManager->getRoles(), 'sort' => ['attributes' => ['name', 'description']], 'pagination' => ['pageSize' => 10]]);
?>

<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'uk-table uk-table-condensed uk-table-striped uk-table-hover'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => DataColumn::className(), 'attribute' => 'name', 'label' => Yii::t('user', 'Роль')], ['class' => DataColumn::className(), 'attribute' => 'description', 'label' => Yii::t('user', 'Описание')], ['class' => DataColumn::className(), 'label' => Yii::t('user', 'Разрешенные доступы'), 'format' => ['html'], 'value' => function ($data) {
    return implode('<br>', array_keys(ArrayHelper::map(Yii::$app->authManager->getPermissionsByRole($data->name), 'description', 'description')));
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<i class="uk-icon-pencil"></i>', Url::toRoute(['update-role', 'name' => $model->name]), ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0', 'class' => 'uk-button uk-button-success uk-button-mini']);
}, 'delete' => function ($url, $model) {
    return Html::a('<i class="uk-icon-trash"></i>', Url::toRoute(['delete-role', 'name' => $model->name]), ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0', 'class' => 'uk-button uk-button-danger uk-button-mini']);
}]]]]);
?>
</div>
Example #20
0
 * @var yii\web\View $this
 * @var yii\data\ActiveDataProvider $dataProvider
 * @var biz\inventory\models\searchs\TransferNotice $searchModel
 */
$this->title = 'Transfer Notices';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="transfer-notice-index col-lg-12">

    <?php 
Pjax::begin(['formSelector' => 'form', 'enablePushState' => false]);
?>
    <div class="box box-info">
        <div class="box-body no-padding">
            <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table table-striped'], 'layout' => '{items}{pager}', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'idTransfer.transfer_num', 'idTransfer.idWarehouseSource.nm_whse', 'idTransfer.idWarehouseDest.nm_whse', 'noticeDate', ['class' => DataColumn::className(), 'label' => 'Status', 'value' => function ($model) {
    $warnaStatus = 'label-warning';
    switch ($model->status) {
        case TransferNotice::STATUS_CREATE:
            $warnaStatus = 'label-danger';
            break;
        case TransferNotice::STATUS_UPDATE:
            $warnaStatus = 'label-success';
            break;
        case TransferNotice::STATUS_APPROVE:
            $warnaStatus = 'label-primary';
            break;
    }
    return "<span class='label {$warnaStatus}'>{$model->nmStatus}</span>";
}, 'format' => 'raw'], ['class' => 'biz\\app\\components\\ActionColumn', 'template' => '{view} {update}']]]);
?>
Example #21
0
File: index.php Project: apuc/api
</h3>
    </div>
    <div class="box-body no-padding">
        <div class="row">
            <div class="col-md-12">
                <form role="form">
                    <div class="box-body">
                        <div class="table-responsive">
                            <?php 
echo \yii\grid\GridView::widget(['dataProvider' => $provider, 'tableOptions' => ['class' => 'table table-striped table-bordered'], 'columns' => [['attribute' => 'service_id', 'value' => function ($model) {
    return $model->service->name;
}], ['attribute' => 'status', 'value' => function ($model) {
    return $model::getStatuses()[$model->status];
}], ['attribute' => 'title', 'format' => 'raw', 'value' => function ($model) {
    return '<a href="' . $model->url . '" target=_blank>' . $model->title . '</a>';
}], 'sum', ['class' => DataColumn::className(), 'header' => 'Действия', 'format' => 'html', 'value' => function ($model, $index, $widget) {
    $repeat = Html::a("<span class='glyphicon glyphicon-repeat'></span>", Yii::$app->urlManager->createUrl(['task/order/repeat', 'id' => $model->id]), ['class' => 'btn btn-default repeat', 'title' => 'Перезапустить задачу']);
    $edit = Html::a("<span class='glyphicon glyphicon-edit'></span>", Yii::$app->urlManager->createUrl(['task/order/update', 'type' => $model->service->model_name, 'id' => $model->id]), ['class' => 'btn btn-default', 'title' => 'Редактировать']);
    $buttons = "<div class='row text-center'>" . $repeat . "</div>";
    if ($model->status == \frontend\modules\task\models\db\Order::DONE || $model->status == \frontend\modules\task\models\db\Order::DONE_AND_HIDE) {
        return "<div class='row text-center'>" . $repeat . "</div>";
    }
    if ($model->status == \frontend\modules\task\models\db\Order::REJECTED) {
        return "<div class='row text-center'>" . $edit . "</div>";
    }
    return false;
}]]]);
?>
                        </div>
                    </div>
                </form>
Example #22
0
		<div class="panel-heading">
			<h2>
				<i><?php 
echo $this->title;
?>
</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' => 'First', 'lastPageLabel' => 'Last'], 'filterModel' => $searchModel, 'tableOptions' => ['class' => 'table table-striped table-bordered table-hover'], 'headerRowOptions' => ['class' => 'x'], 'columns' => [['class' => 'yii\\grid\\SerialColumn', "options" => ["width" => "50px"]], ["attribute" => "name", "format" => "raw", "options" => [], "value" => function ($model) {
    return $model->linkTo;
}], 'abbreviation', ["label" => 'Action', "class" => \yii\grid\DataColumn::className(), "options" => ["width" => "120px"], "format" => "raw", "value" => function (Country $model) {
    return $model->operation->widgetDropdown();
}]]]);
?>
			</div>

		</div>

	</div>

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


</div>
Example #23
0
<?php

use common\widgets\admin\Grid;
/**
 * @var yii\web\View $this
 * @var yii\data\ActiveDataProvider $dataProvider
 * @var app\modules\news\models\News $searchModel
 */
echo Grid::widget(['dataProvider' => $dataProvider, 'model' => $searchModel, 'userColumns' => [['class' => \yii\grid\DataColumn::className(), 'header' => Yii::t('news/app', 'Link'), 'value' => function ($model, $index, $widget) {
    return Yii::$app->urlManager->createUrl(['/news/news/detail', 'section' => $model->sections[0]->code, 'code' => $model->code]);
}]]]);
use yii\data\ActiveDataProvider;
use yii\db\Query;
use app\models\Bookings;
use app\models\CustomFields;
?>
<div class="col-sm-12">
	<div class="panel panel-default">
		<div class="panel-heading">
			<?php 
echo Html::tag('h4', $model->date);
?>
		</div>
		<div class="panel-body">
			<h5 >Booked places</h5>
			<?php 
echo GridView::widget(['dataProvider' => new ActiveDataProvider(['query' => Bookings::find()->where([Bookings::FIELD_TOUR_DATE_ID => $model->tour_date_id])]), 'columns' => [Bookings::FIELD_NAME, Bookings::FIELD_ADULTS, Bookings::FIELD_CHILDREN, Bookings::FIELD_BABIES, ['class' => DataColumn::className(), 'format' => 'html', 'attribute' => Bookings::FIELD_CUSTOM_FIELDS, 'value' => function ($model) {
    /* @var $model Bookings */
    $result = 'Not set';
    if (isset($model->custom_fields)) {
        $result = null;
        $custom_fields = unserialize($model->custom_fields);
        foreach ($custom_fields as $key => $value) {
            $custom_field = CustomFields::findOne($key);
            $result .= '<b>' . $custom_field->label . ': </b>' . $value . '<br>';
        }
    }
    return $result;
}]]]);
?>
		</div>
	</div>
Example #25
0
    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Yii::t('user', 'Create {modelClass}', ['modelClass' => Yii::t('user', 'User')]), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'username:ntext', 'email:ntext', 'phone:ntext', ['class' => DataColumn::className(), 'attribute' => 'status', 'value' => function ($model, $key, $index) {
    switch ($model->status) {
        case $model::ST_ACTIVE:
            $_ = Yii::t('user', 'Active');
            break;
        case $model::ST_UNCONFIRMED_EMAIL:
            $_ = Yii::t('user', 'Unconfirmed email');
            break;
        case $model::ST_UNCONFIRMED_PHONE:
            $_ = Yii::t('user', 'Unconfirmed phone');
            break;
        default:
            $_ = Yii::t('user', 'Inactive');
            break;
    }
    return $_;
Example #26
0
?>

<div class="sx-box sx-p-10 sx-bg-primary">
    <?php 
echo \yii\helpers\Html::a(\Yii::t('app', 'Delete temporary files'), $url, ['class' => 'btn btn-primary', 'onclick' => 'new sx.classes.Clear(' . $data . '); return false;']);
?>
    <hr />

    <?php 
echo \skeeks\cms\modules\admin\widgets\GridView::widget(['dataProvider' => new \yii\data\ArrayDataProvider(['allModels' => $clearDirs]), 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'label', ['class' => \yii\grid\DataColumn::className(), 'value' => function ($data) {
    /**
     * @var $dir \skeeks\sx\Dir
     */
    $dir = $data['dir'];
    return $dir->getPath();
}], ['class' => \yii\grid\DataColumn::className(), 'value' => function ($data) {
    /**
     * @var $dir \skeeks\sx\Dir
     */
    $dir = $data['dir'];
    return $dir->getSize()->formatedShortSize();
}]]]);
?>
</div>
<?php 
$this->registerJs(<<<JS
    (function(sx, \$, _)
    {
        sx.classes.Clear = sx.classes.Component.extend({

            _init: function()
Example #27
0
echo Html::encode($this->title);
?>
</h1>

    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('创建', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'username', 'email:email', ['class' => DataColumn::className(), 'attribute' => 'role', 'format' => 'text', 'value' => function ($data) {
    if ($data->role == '1') {
        return "管理员";
    } else {
        return "会员";
    }
}], ['attribute' => 'status', 'format' => 'text', 'value' => function ($data) {
    if ($data->status == '0') {
        return "删除";
    } else {
        return "活跃";
    }
}], ['attribute' => 'created_at', 'format' => 'text', 'value' => function ($data) {
    return date("Y-m-d H:i:s", $data->created_at);
}], ['attribute' => 'updated_at', 'format' => 'text', 'value' => function ($data) {
    return date("Y-m-d H:i:s", $data->updated_at);
Example #28
0
        return '<span class="label label-danger">сведения не найдены</span>';
    }
}, 'format' => 'html'], ['attribute' => 'otd', 'value' => function ($model, $key, $index, $column) {
    return Html::a($model->otd, ['#'], ['class' => 'desc-link']);
}, 'format' => 'html'], ['label' => 'Ставка НДС', 'value' => function ($model, $key, $index, $column) {
    $product = app\modules\main\models\Products::findOne(['kodpart' => $model->kodpart]);
    if (isset($product)) {
        return $product->nds;
    } else {
        return 0;
    }
}, 'format' => 'text'], ['label' => 'Сумма с НДС', 'value' => function ($model, $key, $index, $column) {
    return number_format($model->wholesaleTotalPrice, 2, ' руб ', ' ') . 'коп';
}, 'format' => 'text'], ['class' => ActionProductsColumn::className(), 'buttonClass' => 'add-the-product'], ['attribute' => 'dsv', 'value' => function ($model, $key, $index, $column) {
    return Html::a($model->dsv, ['#'], ['class' => 'desc-link']);
}, 'format' => 'html'], ['class' => DataColumn::className(), 'label' => 'На складе', 'value' => function ($model, $key, $index, $column) {
    if ($model->isProduct) {
        return '<span class="label label-success"">В наличии</span>';
    } else {
        return '<span class="label label-danger">Нет</span>';
    }
}, 'format' => 'html'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{delete}']]]);
?>
    <?php 
if (isset($order)) {
    ?>
    <p>
        <?php 
    $form = ActiveForm::begin();
    ?>
            <?php 
Example #29
0
                </div>
            </div>

        </div>
        <?php 
$form->end();
?>

<?php 
?>

        <?php 
echo \kartik\grid\GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $model, 'columns' => [['class' => SerialColumn::className()], ['class' => \kartik\grid\CheckboxColumn::className()], 'user_id', 'user_name', 'email', ['class' => CheckboxColumn::className(), 'class' => DataColumn::className(), 'attribute' => 'is_validated', 'format' => 'html', 'value' => function ($model) {
    return $this->render('list_item.php', ['model' => $model, 'action' => 'is_validated']);
}], 'user_money', 'frozen_money', 'rank_points', 'pay_points', 'reg_time', ['class' => DataColumn::className(), 'format' => 'html', 'attribute' => Yii::$app->params['lang']['handler'], 'value' => function ($model) {
    return $this->render('list_item.php', ['model' => $model, 'action' => 'handler']);
}]]]);
?>




    </div>



</div>


Example #30
0
            <button type="submit" class="btn btn-danger btn-xs" onclick="sx.ComponentSettings.Remove.removeUsers(); return false;">
                <i class="glyphicon glyphicon-remove"></i> <?php 
    echo \Yii::t('app', 'Reset settings for all users');
    ?>
            </button>
        <?php 
} else {
    ?>
            <small><?php 
    echo \Yii::t('app', 'Neither user does not have personal settings for this component');
    ?>
</small>
        <?php 
}
?>
    </div>

    <?php 
$search = new \skeeks\cms\models\Search(\skeeks\cms\models\User::className());
$search->search(\Yii::$app->request->get());
$search->getDataProvider()->query->andWhere(['active' => \skeeks\cms\components\Cms::BOOL_Y]);
?>
    <?php 
echo \skeeks\cms\modules\admin\widgets\GridViewHasSettings::widget(['dataProvider' => $search->getDataProvider(), 'filterModel' => $search->getLoadedModel(), 'columns' => [['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\User $model, $key, $index, $this) {
    return \yii\helpers\Html::a('<i class="glyphicon glyphicon-cog"></i>', \skeeks\cms\helpers\UrlHelper::constructCurrent()->setRoute('cms/admin-component-settings/user')->set('user_id', $model->id)->toString(), ['class' => 'btn btn-default btn-xs', 'title' => \Yii::t('app', 'Customize')]);
}, 'format' => 'raw'], 'username', 'name', ['class' => \skeeks\cms\grid\ComponentSettingsColumn::className(), 'component' => $component]]]);
?>


<?php 
echo $this->render('_footer');