protected function renderDataCellContent($model, $key, $index)
 {
     $detailsLinkOptions = $this->grid->prepareDetailsLink($model->id);
     $removeLinkOptions = $this->grid->prepareRemoveLink($model->id);
     $items = [['label' => __('Edit'), 'url' => $detailsLinkOptions['href'], 'linkOptions' => $detailsLinkOptions]];
     foreach ($this->extraItems as $item) {
         $idField = !empty($item['idField']) ? $item['idField'] : 'id';
         $items[] = ['label' => $item['label'], 'url' => $this->grid->prepareCustomLink($item['action'], [$idField => $model->id]), 'linkOptions' => !empty($item['linkOptions']) ? $item['linkOptions'] : []];
     }
     $items[] = ['label' => __('Delete'), 'url' => $removeLinkOptions['href'], 'linkOptions' => $removeLinkOptions];
     return ActionsDropdown::widget(['size' => $this->size, 'items' => $items]);
 }
Example #2
0
 protected function renderDataCellContent($model, $key, $index)
 {
     $action_items = [];
     foreach ($this->items as $item) {
         if ($options = $item($model)) {
             $label = $options['label'];
             unset($options['label']);
             $url = $options['href'];
             unset($options['href']);
             $action_items[] = ['label' => $label, 'url' => $url, 'linkOptions' => $options];
         }
     }
     if ($action_items) {
         return ActionsDropdown::widget(['size' => $this->size, 'items' => $action_items]);
     }
 }
Example #3
0
File: index.php Project: vsguts/crm
$this->title = __('States');
$this->params['breadcrumbs'][] = $this->title;
$detailsLink = function ($model) {
    return ['label' => __('Edit'), 'class' => 'app-modal', 'href' => Url::to(['/state/update', 'id' => $model->id, '_return_url' => Url::to()]), 'data-target-id' => 'state_' . $model->id];
};
?>
<div class="state-index">

    <div class="pull-right buttons-container">
        <div class="btn-group">
            <?php 
echo Html::a(__('Create state'), ['update', '_return_url' => Url::to()], ['class' => 'btn btn-success app-modal', 'data-target-id' => 'state_create']);
?>
        </div>
        <?php 
echo ActionsDropdown::widget(['layout' => 'info', 'items' => [['label' => __('Delete'), 'url' => Url::to(['delete']), 'linkOptions' => ['data-app-process-items' => 'ids', 'data-confirm' => __('Are you sure you want to delete this item?'), 'data-method' => 'post']]]]);
?>
    </div>

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

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

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], ['attribute' => 'name', 'link' => $detailsLink], ['attribute' => 'country.name', 'label' => __('Country'), 'link' => function ($model) {
    return ['class' => 'app-modal', 'href' => Url::to(['/country/update', 'id' => $model->country_id, '_return_url' => Url::to()]), 'data-target-id' => 'country_' . $model->country_id];
Example #4
0
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use app\widgets\grid\GridView;
use app\widgets\ActionsDropdown;
$this->title = Yii::t('app', 'Stores');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="store-index">

    <div class="pull-right">
        <?php 
echo ActionsDropdown::widget(['layout' => 'info', 'items' => [['label' => __('Send admin notification'), 'url' => Url::to(['admin-notification']), 'linkOptions' => ['data-c-process-items' => 'ids']], ['label' => __('Delete selected'), 'url' => Url::to(['delete']), 'linkOptions' => ['data-c-process-items' => 'ids', 'data-confirm' => __('Are you sure you want to delete selected items?'), 'data-method' => 'post']]]]);
?>
    </div>

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

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

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], 'id', 'domain', 'created_at:datetime', 'updated_at:datetime', ['class' => 'app\\widgets\\grid\\ActionColumn', 'size' => 'xs', 'extraItems' => [['action' => 'admin-notification', 'idField' => 'ids', 'label' => __('Send admin notification')]]]]]);
?>

</div>
Example #5
0
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use app\widgets\ActionsDropdown;
$this->title = __('Newsletter: {newsletter}', ['newsletter' => $model->subject]);
$this->params['breadcrumbs'][] = ['label' => __('Newsletters'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $model->subject;
?>
<div class="newsletter-update">

    <div class="pull-right buttons-container">
    <?php 
if (Yii::$app->user->can('newsletter_manage')) {
    $items = [['label' => __('Send'), 'url' => Url::to(['send', 'id' => $model->id]), 'linkOptions' => ['data-confirm' => __('Are you sure you want to proceed?'), 'data-method' => 'post']], ['label' => __('Delete'), 'url' => Url::to(['delete', 'id' => $model->id]), 'linkOptions' => ['data-confirm' => __('Are you sure you want to delete this item?'), 'data-method' => 'post']]];
    echo ActionsDropdown::widget(['items' => $items]);
    echo '&nbsp;';
    echo Html::submitButton(__('Update'), ['form' => 'newsletter_form', 'class' => 'btn btn-primary']);
}
?>
    </div>
    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo $this->render('components/form', ['model' => $model, 'logSearch' => $logSearch]);
?>

</div>
Example #6
0
File: index.php Project: vsguts/crm
            <div class="btn-group">
                <?php 
    echo Html::a(__('Create donate'), ['update', '_return_url' => Url::to()], ['class' => 'btn btn-success app-modal', 'data-target-id' => 'donate_create']);
    ?>
            </div>
        <?php 
}
?>
        
        <?php 
$items = [['label' => __('Export selected'), 'url' => Url::to(['/export/export/', 'object' => 'donate']), 'linkOptions' => ['class' => 'app-modal app-modal-force', 'data-target-id' => 'export', 'data-app-process-items' => 'ids']], ['label' => __('Export all'), 'url' => Url::to(['/export/export/', 'object' => 'donate', 'attributes' => ['queryParams' => Yii::$app->request->queryParams]]), 'linkOptions' => ['class' => 'app-modal app-modal-force', 'data-target-id' => 'export']]];
if (Yii::$app->user->can('donate_manage')) {
    $items[] = '<li role="presentation" class="divider"></li>';
    $items[] = ['label' => __('Delete selected'), 'url' => Url::to(['delete']), 'linkOptions' => ['data-app-process-items' => 'ids', 'data-confirm' => __('Are you sure you want to delete this item?'), 'data-method' => 'post']];
}
echo ActionsDropdown::widget(['layout' => 'info', 'items' => $items]);
?>
    </div>

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    
    <?php 
echo $this->render('components/search', ['model' => $searchModel]);
?>

    <?php 
echo $this->render('components/grid', ['dataProvider' => $dataProvider]);
?>
Example #7
0
File: logs.php Project: vsguts/crm
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use app\widgets\ActionsDropdown;
use app\widgets\grid\GridExtraRowView;
$dropdown = ActionsDropdown::widget(['items' => [['label' => __('Delete selected'), 'url' => Url::to(['log-delete', 'newsletter_id' => $model->id]), 'linkOptions' => ['data-app-process-items' => 'ids', 'data-confirm' => __('Are you sure you want to delete this item?'), 'data-method' => 'post']]]]);
echo Html::tag('div', $dropdown, ['class' => 'pull-right buttons-container']);
echo GridExtraRowView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], 'timestamp:datetime', ['attribute' => 'user.name', 'label' => __('User')], ['class' => 'app\\widgets\\grid\\ToggleColumn']], 'extraRow' => ['format' => 'raw', 'value' => function ($model, $key, $index, $column) {
    return Html::tag('div', nl2br($model->content), ['class' => 'well']);
}], 'extraRowColspan' => '4']);