public static function defaultColumns() { return ['bill' => ['class' => MainColumn::class, 'attribute' => 'bill', 'filterAttribute' => 'bill_like'], 'time' => ['format' => 'html', 'filter' => false, 'contentOptions' => ['class' => 'text-nowrap'], 'value' => function ($model) { list($date, $time) = explode(' ', $model->time, 2); return $time === '00:00:00' ? Yii::$app->formatter->asDate($date) : Yii::$app->formatter->asDateTime($model->time); }], 'sum' => ['class' => CurrencyColumn::class, 'attribute' => 'sum', 'colors' => ['danger' => 'warning'], 'headerOptions' => ['class' => 'text-right'], 'contentOptions' => function ($model) { return ['class' => 'text-right' . ($model->sum > 0 ? ' text-bold' : '')]; }], 'sum_editable' => ['class' => CurrencyColumn::class, 'attribute' => 'sum', 'colors' => ['danger' => 'warning'], 'headerOptions' => ['class' => 'text-right'], 'urlCallback' => function ($model, $key) { return Url::to(['bill/update', 'id' => $model->id]); }, 'contentOptions' => function ($model) { return ['class' => 'text-right' . ($model->sum > 0 ? ' text-bold' : '')]; }], 'balance' => ['class' => CurrencyColumn::class, 'headerOptions' => ['class' => 'text-right'], 'contentOptions' => function ($model, $key, $index) { return ['class' => 'text-right' . ($index ? '' : ' text-bold')]; }], 'gtype' => ['attribute' => 'gtype'], 'type_label' => ['class' => RefColumn::class, 'i18nDictionary' => 'hipanel:finance', 'format' => 'raw', 'gtype' => Yii::$app->user->can('support') ? 'type,bill' : 'type,bill,deposit', 'filterAttribute' => 'gtype', 'headerOptions' => ['class' => 'text-right'], 'filterOptions' => ['class' => 'text-right'], 'contentOptions' => function ($model) { return ['class' => 'text-right']; }, 'value' => function ($model) { static $colors = ['correction' => 'normal', 'exchange' => 'warning', 'deposit' => 'success']; $color = $colors[$model->gtype] ?: 'muted'; return Html::tag('b', Yii::t('hipanel:finance', $model->type_label), ['class' => "text-{$color}"]); }], 'description' => ['attribute' => 'descr', 'format' => 'raw', 'value' => function ($model) { $descr = $model->descr ?: $model->label; $text = mb_strlen($descr) > 70 ? ArraySpoiler::widget(['data' => $descr]) : $descr; $tariff = $model->tariff ? Html::tag('span', Yii::t('hipanel', 'Tariff') . ': ' . Html::a($model->tariff, ['@tariff/view', 'id' => $model->tariff_id]), ['class' => 'pull-right']) : ''; $amount = static::billQuantity($model); $object = $model->object ? implode(': ', [$model->class_label, static::objectLink($model)]) : ''; return $tariff . $amount . ' ' . implode('<br>', array_filter([$object, $text])); }], 'tariff' => ['attribute' => 'tariff']]; }
public static function defaultColumns() { return ['ip' => ['class' => MainColumn::class, 'filterAttribute' => 'ip_like'], 'tags' => ['format' => 'raw', 'attribute' => 'tag', 'header' => Yii::t('hipanel:hosting', 'Tags'), 'visible' => Yii::$app->user->can('admin'), 'filter' => function ($column, $model) { return Html::activeDropDownList($model, 'tag_in', array_merge(['' => Yii::t('hipanel', '---')], static::$ipTags), ['class' => 'form-control']); }, 'value' => function ($model) { $labels = []; foreach ($model->tags as $tag) { $labels[] = IpTag::widget(['tag' => $tag]); } return implode(' ', $labels); }], 'counters' => ['format' => 'html', 'header' => Yii::t('hipanel:hosting', 'Counters'), 'value' => function ($model) { $html = ''; foreach ($model->objects_count as $count) { if ($count['type'] === 'hdomain') { $url['ok'] = ['@hdomain', (new HdomainSearch())->formName() => ['ip_like' => $model->ip]]; $url['deleted'] = ['@hdomain', (new HdomainSearch())->formName() => ['ip_like' => $model->ip, 'state' => 'deleted']]; $type = function ($count) { return Yii::t('hipanel:hosting', '{0, plural, one{domain} other{domains}}', (int) $count); }; } else { throw new InvalidParamException('The object type is not supported', $model); } if ($count['ok']) { $html .= Html::a((int) $count['ok'] . ' ' . FontIcon::i('fa-check') . ' ' . $type($count['ok']), $url['ok'], ['class' => 'btn btn-success btn-xs']); } $html .= ' '; if ($count['deleted'] > 0) { $html .= Html::a((int) $count['deleted'] . ' ' . FontIcon::i('fa-trash') . ' ' . $type($count['deleted']), $url['deleted'], ['class' => 'btn btn-xs btn-warning']); } } return $html; }], 'links' => ['format' => 'html', 'value' => function ($model) { $items = []; foreach ($model->links as $link) { $item = Html::a($link->device, ['@server/view', 'id' => $link->device_id]); if ($link->service_id) { $item .= ' ' . FontIcon::i('fa-long-arrow-right'); $item .= ' ' . Html::a($link->service ?: $link->soft, ['@service/view', 'id' => $link->service_id]); } $items[] = $item; } return ArraySpoiler::widget(['data' => $items, 'visibleCount' => 3]); }], 'services' => ['attribute' => 'links', 'format' => 'html', 'label' => Yii::t('hipanel:server', 'Services'), 'value' => function ($model) { return ArraySpoiler::widget(['data' => $model->links, 'formatter' => function ($link) { if (Yii::$app->user->can('support') && Yii::getAlias('@service', false)) { return Html::a($link->service, ['@service/view', 'id' => $link->service_id]); } return $link->service; }]); }], 'actions' => ['class' => MenuColumn::class, 'menuClass' => IpActionsMenu::class], 'ptr' => ['options' => ['style' => 'width: 40%'], 'format' => 'raw', 'value' => function ($model) { if ($model->canSetPtr()) { return XEditable::widget(['model' => $model, 'attribute' => 'ptr', 'pluginOptions' => ['url' => Url::to('@ip/set-ptr')]]); } return null; }]]; }
public static function defaultColumns() { return ['account' => ['class' => MainColumn::class, 'label' => Yii::t('hipanel', 'Account'), 'attribute' => 'login', 'filterAttribute' => 'login_like'], 'state' => ['class' => RefColumn::class, 'format' => 'raw', 'i18nDictionary' => 'hipanel:hosting', 'value' => function ($model) { return State::widget(compact('model')); }, 'gtype' => 'state,account'], 'server' => ['class' => ServerColumn::class], 'sshftp_ips' => ['attribute' => 'sshftp_ips', 'format' => 'raw', 'value' => function ($model) { return ArraySpoiler::widget(['data' => $model->sshftp_ips, 'visibleCount' => 3]); }], 'actions' => ['class' => ActionColumn::class, 'template' => '{view} {delete}'], 'type' => ['class' => RefColumn::class, 'i18nDictionary' => 'hipanel:hosting', 'format' => 'raw', 'value' => function ($model) { return Type::widget(compact('model')); }, 'gtype' => 'type,account']]; }
public static function defaultColumns() { return ['balance' => ['class' => 'hipanel\\modules\\finance\\grid\\BalanceColumn'], 'credit' => CreditColumn::resolveConfig(), 'invoices' => ['label' => Yii::t('hipanel:finance', 'Invoices'), 'format' => 'raw', 'value' => function ($model) { return ArraySpoiler::widget(['mode' => ArraySpoiler::MODE_SPOILER, 'data' => $model->files, 'delimiter' => ' ', 'formatter' => function ($file) { return self::pdfLink($file, $file->month); }, 'template' => '{button}{visible}{hidden}', 'visibleCount' => 2, 'button' => ['label' => FontIcon::i('fa-history fa-2x') . ' ' . Yii::t('hipanel', 'History'), 'class' => 'pull-right text-nowrap']]); }], 'taxes' => [], 'contact' => ['format' => 'raw', 'value' => function ($model) { $org = $model->contact->organization; return $org . ($org ? ' / ' : '') . $model->contact->name; }], 'requisite' => ['format' => 'raw', 'value' => function ($model) { $org = $model->requisite->organization; return $org . ($org ? ' / ' : '') . $model->requisite->name; }]]; }
public static function defaultColumns() { return ['hdomain' => ['class' => MainColumn::class, 'filterAttribute' => 'domain_like', 'attribute' => 'domain'], 'hdomain_with_aliases' => ['format' => 'raw', 'attribute' => 'domain', 'filterAttribute' => 'domain_like', 'value' => function ($model) { $aliases = (array) $model->getAttribute('aliases'); $html = Html::a($model->domain, ['view', 'id' => $model->id], ['class' => 'bold']) . ' '; $html .= ArraySpoiler::widget(['data' => $aliases, 'visibleCount' => 0, 'delimiter' => '<br />', 'button' => ['label' => Yii::t('hipanel', '+{0, plural, one{# alias} other{# aliases}}', count($aliases)), 'class' => 'badge progress-bar-info', 'popoverOptions' => ['html' => true]], 'formatter' => function ($value, $key) { return Html::a($value, ['view', 'id' => $key]); }]); return $html; }], 'account' => ['class' => AccountColumn::class], 'server' => ['class' => ServerColumn::class], 'ip' => ['enableSorting' => false, 'filter' => false, 'format' => 'raw', 'value' => function ($model) { $vhost = $model->getAttribute('vhost'); $html = $vhost['ip']; if (isset($vhost['port']) && $vhost['port'] !== 80) { $html .= ':' . $vhost['port']; } if ($model->isProxied) { $backend = $vhost['backend']; $html .= ' ' . Html::tag('i', '', ['class' => 'fa fa-long-arrow-right']) . ' ' . $backend['ip']; if ($backend['port'] !== 80) { $html .= ':' . $backend['port']; } } return $html; }], 'service' => ['label' => Yii::t('hipanel', 'Service'), 'value' => function ($model) { return $model->getAttribute('vhost')['service']; }], 'state' => ['class' => RefColumn::class, 'i18nDictionary' => 'hipanel:hosting', 'format' => 'raw', 'value' => function ($model) { $html = ''; if ($model->dns_on && empty($model->dns_hdomain_id)) { $html .= Label::widget(['color' => 'success', 'label' => Yii::t('hipanel', 'DNS'), 'tag' => 'span', 'labelOptions' => ['title' => Yii::t('hipanel:hosting', 'DNS is enabled')]]); } $html .= ' ' . State::widget(compact('model')); return $html; }, 'gtype' => 'state,hdomain'], 'dns_on' => ['format' => 'raw', 'value' => function ($model) { return $model->dns_on ? Yii::t('hipanel', 'Enabled') : Yii::t('hipanel', 'Disabled'); }], 'dns_switch' => ['attribute' => 'dns_on', 'label' => Yii::t('hipanel:hosting', 'DNS'), 'format' => 'raw', 'value' => function ($model) { if (empty($model->dns_hdomain_id)) { return XEditable::widget(['model' => $model, 'attribute' => 'dns_on', 'pluginOptions' => ['type' => 'select', 'title' => Yii::t('hipanel:hosting', 'Toggles DNS records upload on NS server'), 'source' => ['' => Yii::t('hipanel', 'Disabled'), '1' => Yii::t('hipanel', 'Enabled')], 'url' => Url::to('set-dns-on'), 'placement' => 'bottom'], 'linkOptions' => ['style' => ['word-break' => 'break-all']]]); } else { return Yii::t('hipanel:hosting', 'Belongs to {link}', ['link' => Html::a($model->dns_hdomain_domain, Url::to(['@hdomain/view', 'id' => $model->dns_hdomain_id]))]); } }], 'aliases' => ['label' => Yii::t('hipanel', 'Aliases'), 'format' => 'raw', 'value' => function ($model) { return ArraySpoiler::widget(['data' => (array) $model->getAttribute('aliases'), 'delimiter' => '<br />', 'button' => ['popoverOptions' => ['html' => true]]]); }], 'backups_widget' => ['label' => Yii::t('hipanel:hosting', 'Backups'), 'format' => 'raw', 'value' => function ($model) { return BackupGridRow::widget(['model' => $model]); }], 'actions' => ['class' => ActionColumn::class, 'template' => '{view} {delete}']]; }
public static function defaultColumns() { return ['zone' => ['class' => MainColumn::className(), 'label' => Yii::t('hipanel:dns', 'Zone'), 'attribute' => 'name'], 'domain' => ['class' => MainColumn::className(), 'filterAttribute' => 'domain_like'], 'idn' => ['class' => MainColumn::className(), 'filterAttribute' => 'idn_like'], 'actions' => ['class' => MenuColumn::class, 'menuClass' => DnsActionsMenu::class], 'nss' => ['format' => 'raw', 'attribute' => 'nss_like', 'label' => Yii::t('hipanel:dns', 'NS servers'), 'value' => function ($model) { return ArraySpoiler::widget(['data' => $model->nss]); }], 'dns_on' => ['format' => 'raw', 'filter' => function ($column, $model, $attribute) { return Html::activeDropDownList($model, $attribute, ['' => Yii::t('hipanel:dns', '---'), '1' => Yii::t('hipanel:dns', 'Enabled'), '0' => Yii::t('hipanel:dns', 'Disabled')], ['class' => 'form-control']); }, 'value' => function ($model) { return Label::widget(['color' => $model->dns_on ? 'success' : '', 'label' => $model->dns_on ? Yii::t('hipanel:dns', 'Enabled') : Yii::t('hipanel:dns', 'Disabled'), 'labelOptions' => ['title' => Yii::t('hipanel:dns', 'Means that the panel will publish DNS records on the NS servers')]]); }], 'bound_to' => ['format' => 'raw', 'label' => Yii::t('hipanel:dns', 'Bound to'), 'value' => function ($model) { if (Yii::getAlias('@domain') !== null && $model->is_reg_domain) { return Html::a(Yii::t('hipanel:dns', 'Registered domain'), ['@domain/view', 'id' => $model->id]); } elseif ($model->server_id) { return Html::a($model->account . '@' . $model->server, ['@hdomain/view', 'id' => $model->id]); } else { return Yii::$app->formatter->nullDisplay; } }]]; }
public static function defaultColumns() { return ['date' => ['attribute' => 'time', 'filter' => false, 'format' => 'date', 'contentOptions' => ['style' => 'white-space:nowrap']], 'time' => ['filter' => false, 'format' => 'datetime', 'contentOptions' => ['style' => 'white-space:nowrap']], 'move' => ['label' => Yii::t('hipanel:stock', 'Move'), 'format' => 'html', 'enableSorting' => false, 'filter' => false, 'value' => function ($model) { return sprintf('<b>%s</b> ← %s', $model->dst_name, $model->src_name); }], 'descr' => ['format' => 'html', 'enableSorting' => false, 'filter' => false, 'value' => function ($model) { return sprintf('<b>%s</b><br>%s', $model->type_label, $model->getDescription()); }], 'data' => ['enableSorting' => false, 'filter' => false], 'parts' => ['value' => function ($model) { $out = ''; if (is_array($model->parts)) { foreach ($model->parts as $part) { } } return $out; }], 'parts' => ['format' => 'raw', 'filter' => false, 'enableSorting' => false, 'value' => function ($model) { /** @var Part $model */ return ArraySpoiler::widget(['data' => $model->parts, 'visibleCount' => 2, 'button' => ['label' => '+' . (count($model->parts) - 2), 'popoverOptions' => ['html' => true, 'placement' => 'bottom']], 'formatter' => function ($item) { return Html::a($item['partno'] . ':' . $item['serial'], ['@part/view', 'id' => $item['part_id']], ['class' => 'text-nowrap']); }]); }]]; }
public static function defaultColumns() { return ['service' => ['class' => MainColumn::class, 'attribute' => 'name', 'filterAttribute' => 'service_like'], 'server' => ['class' => ServerColumn::class], 'object' => ['format' => 'raw', 'header' => Yii::t('hipanel:hosting', 'Object'), 'value' => function ($model) { $html = $model->name . ' '; if ($model->soft_type === Soft::TYPE_WEB) { $url['ok'] = ['@hdomain', (new HdomainSearch())->formName() => ['server' => $model->server, 'service' => $model->name]]; $url['deleted'] = ['@hdomain', (new HdomainSearch())->formName() => ['server' => $model->server, 'service' => $model->name, 'state' => 'deleted']]; $type = function ($count) { return Yii::t('hipanel:hosting', '{0, plural, one{domain} other{domains}}', (int) $count); }; } elseif ($model->soft_type === Soft::TYPE_DB) { $url['ok'] = ['@db', (new DbSearch())->formName() => ['server' => $model->server, 'service' => $model->name]]; $url['deleted'] = ['@db', (new DbSearch())->formName() => ['server' => $model->server, 'service' => $model->name, 'state' => 'deleted']]; $type = function ($count) { return Yii::t('hipanel:hosting', '{0, plural, one{# DB} other{# DBs}}', (int) $count); }; } else { return $html; } if ($count = $model->objects_count['ok']) { $html .= Html::a((int) $count . ' ' . FontIcon::i('fa-check') . ' ' . $type($count), $url['ok'], ['class' => 'btn btn-success btn-xs']); } $html .= ' '; if (($count = $model->objects_count['deleted']) > 0) { $html .= Html::a((int) $count . ' ' . FontIcon::i('fa-trash') . ' ' . $type($count), $url['deleted'], ['class' => 'btn btn-xs btn-warning']); } return $html; }], 'ip' => ['format' => 'raw', 'label' => Yii::t('hipanel:hosting', 'IP'), 'value' => function ($model) { return ArraySpoiler::widget(['data' => array_unique(array_merge((array) $model->ip, (array) $model->ips))]); }], 'bin' => ['format' => 'html', 'value' => function ($model) { return $model->bin ? Html::tag('code', $model->bin) : ''; }], 'etc' => ['format' => 'html', 'value' => function ($model) { return $model->etc ? Html::tag('code', $model->etc) : ''; }], 'soft' => ['value' => function ($model) { return $model->soft; }], 'state' => ['class' => RefColumn::class, 'i18nDictionary' => 'hipanel:hosting', 'format' => 'raw', 'value' => function ($model) { return State::widget(compact('model')); }, 'gtype' => 'state,service'], 'actions' => ['class' => MenuColumn::class, 'menuClass' => ServiceActionsMenu::class]]; }
public static function defaultColumns() { return ['mail' => ['class' => MainColumn::class, 'filterAttribute' => 'mail_like'], 'state' => ['class' => RefColumn::class, 'i18nDictionary' => 'hipanel:hosting', 'format' => 'raw', 'value' => function ($model) { return State::widget(compact('model')); }, 'gtype' => 'state,mail'], 'server' => ['class' => ServerColumn::class], 'domain' => ['attribute' => 'hdomain_id', 'format' => 'raw', 'value' => function ($model) { return Html::a($model->domain, ['@hdomain/view', 'id' => $model->hdomain_id]); }], 'type' => ['format' => 'raw', 'filter' => function ($column, $model, $attribute) { return Html::activeDropDownList($model, $attribute, ['' => '----------'] + Mail::getTypes(), ['class' => 'form-control']); }, 'value' => function ($model) { return Type::widget(compact('model')); }], 'forwards' => ['format' => 'raw', 'value' => function ($model) { return ArraySpoiler::widget(['delimiter' => '<br>', 'visibleCount' => 2, 'data' => $model->forwards, 'button' => ['label' => '+{count}', 'popoverOptions' => ['html' => true]]]); }], 'spam_action' => ['format' => 'raw', 'value' => function ($model) { /** @var $model Mail */ if ($model->spam_action === $model::SPAM_ACTION_DELETE) { return Label::widget(['color' => 'danger', 'label' => Yii::t('hipanel', 'Delete')]); } elseif ($model->spam_action === '') { return Label::widget(['color' => 'info', 'label' => Yii::t('hipanel:hosting', 'Do nothing')]); } else { return Label::widget(['color' => 'primary', 'label' => Yii::t('hipanel:hosting', 'Forward to')]) . ' ' . ArraySpoiler::widget(['data' => $model->spam_action, 'visibleCount' => 2]); } }], 'actions' => ['class' => ActionColumn::class, 'template' => '{view} {delete}']]; }
public static function defaultColumns() { return ['domain' => ['class' => MainColumn::class, 'attribute' => 'domain', 'note' => true, 'filterAttribute' => 'domain_like'], 'state' => ['format' => 'raw', 'filter' => function ($grid, $model, $attribute) { return Html::activeDropDownList($model, $attribute, Domain::stateOptions(), ['prompt' => '--', 'class' => 'form-control']); }, 'filterInputOptions' => ['style' => 'width:120px'], 'value' => function ($model) { $out = State::widget(compact('model')); if ($model->is_freezed || $model->is_holded) { $out .= '<br>'; $out .= $model->is_freezed ? Html::tag('span', Html::tag('span', '', ['class' => Menu::iconClass('fa-snowflake-o')]) . ' ' . Yii::t('hipanel:domain', 'Froze'), ['class' => 'label label-info']) : ''; $out .= $model->is_holded ? ' ' . Html::tag('span', Html::tag('span', '', ['class' => Menu::iconClass('fa-ban')]) . ' ' . Yii::t('hipanel:domain', 'Held'), ['class' => 'label label-warning']) : ''; } return $out; }], 'whois_protected' => ['class' => BootstrapSwitchColumn::class, 'attribute' => 'whois_protected', 'filter' => false, 'url' => Url::toRoute('set-whois-protect'), 'popover' => 'WHOIS protection', 'pluginOptions' => ['offColor' => 'warning']], 'is_secured' => ['class' => BootstrapSwitchColumn::class, 'filter' => false, 'url' => Url::toRoute('set-lock'), 'attribute' => 'is_secured', 'popover' => Yii::t('hipanel:domain', 'Protection from transfer')], 'note' => ['class' => XEditableColumn::class, 'attribute' => 'note', 'filter' => true, 'popover' => Yii::t('hipanel:domain', 'Make any notes for your convenience'), 'pluginOptions' => ['url' => 'set-note']], 'created_date' => ['attribute' => 'created_date', 'format' => 'date', 'filter' => false, 'contentOptions' => ['class' => 'text-nowrap']], 'expires' => ['format' => 'raw', 'filter' => false, 'headerOptions' => ['style' => 'width:1em'], 'value' => function ($model) { return Expires::widget(compact('model')); }], 'autorenewal' => ['class' => BootstrapSwitchColumn::class, 'label' => Yii::t('hipanel', 'Autorenew'), 'filter' => false, 'url' => Url::toRoute('set-autorenewal'), 'popover' => Yii::t('hipanel:domain', 'The domain will be autorenewed for one year in a week before it expires if you have enough credit on your account')], 'nameservers' => ['format' => 'raw', 'value' => function ($model) { return ArraySpoiler::widget(['data' => $model->nameservers]); }], 'actions' => ['class' => MenuColumn::class, 'menuClass' => DomainActionsMenu::class], 'old_actions' => ['class' => ActionColumn::class, 'template' => '{view} {manage-dns} {notify-transfer-in} {approve-preincoming} {reject-preincoming} {approve-transfer} {reject-transfer} {cancel-transfer} {sync} {enable-hold} {disable-hold} {enable-freeze} {disable-freeze} {delete-agp} {delete}', 'header' => Yii::t('hipanel', 'Actions'), 'buttons' => ['notify-transfer-in' => function ($url, $model, $key) { return $model->state === 'preincoming' ? Html::a('<i class="fa fa-envelope-o"></i>' . Yii::t('hipanel:domain', 'Send FOA again'), $url, ['data' => ['method' => 'post', 'data-pjax' => '0']]) : ''; }, 'approve-preincoming' => function ($url, $model, $key) { }, 'reject-preincoming' => function ($url, $model, $key) { }, 'approve-transfer' => function ($url, $model, $key) { return $model->state === 'outgoing' && Yii::$app->user->can('support') && Domain::notDomainOwner($model) ? Html::a('<i class="fa fa-exclamation-circle"></i>' . Yii::t('hipanel:domain', 'Approve transfer'), $url, ['data' => ['confirm' => Yii::t('hipanel:domain', 'Are you sure you want to approve outgoing transfer of domain {domain}?', ['domain' => $model->domain]), 'method' => 'post', 'data-pjax' => '0']]) : ''; }, 'reject-transfer' => function ($url, $model, $key) { return $model->state === 'outgoing' ? Html::a('<i class="fa fa-anchor"></i>' . Yii::t('hipanel:domain', 'Reject transfer'), $url, ['data' => ['confirm' => Yii::t('hipanel:domain', 'Are you sure you want to reject outgoing transfer of domain {domain}?', ['domain' => $model->domain]), 'method' => 'post', 'data-pjax' => '0']]) : ''; }, 'cancel-transfer' => function ($url, $model, $key) { return $model->state === 'incoming' ? Html::a('<i class="fa fa-exclamation-triangle"></i>' . Yii::t('hipanel:domain', 'Cancel transfer'), $url, ['data' => ['confirm' => Yii::t('hipanel:domain', 'Are you sure you want to cancel incoming transfer of domain {domain}?', ['domain' => $model->domain]), 'method' => 'post', 'data-pjax' => '0']]) : ''; }, 'sync' => function ($url, $model, $key) { return in_array($model->state, ['ok', 'expired'], true) && Yii::$app->user->can('support') && Domain::notDomainOwner($model) ? Html::a('<i class="fa ion-ios-loop-strong"></i>' . Yii::t('hipanel:domain', 'Synchronize contacts'), $url, ['data' => ['method' => 'post', 'data-pjax' => '0']]) : ''; }, 'delete' => function ($url, $model, $key) { return in_array($model->state, ['ok', 'expired', 'outgoing'], true) && Yii::$app->user->can('support') ? Html::a('<i class="fa fa-trash-o"></i>' . Yii::t('hipanel', 'Delete'), $url, ['title' => Yii::t('hipanel', 'Delete'), 'aria-label' => Yii::t('hipanel', 'Delete'), 'data' => ['confirm' => Yii::t('hipanel:domain', 'Are you sure you want to delete domain {domain}?', ['domain' => $model->domain]), 'method' => 'post', 'data-pjax' => '0']]) : ''; }, 'delete-agp' => function ($url, $model, $key) { if (!in_array($model->state, ['ok'], true)) { return ''; } if (time() >= strtotime('+5 days', strtotime($model->created_date))) { return ''; } if (strtotime('+1 year', time()) < strtotime($model->expires)) { return ''; } return in_array(Domain::getZone($model->domain), ['com', 'net'], true) ? Html::a('<i class="fa fa-trash-o"></i>' . Yii::t('hipanel:domain', 'Delete by AGP'), $url, ['title' => Yii::t('hipanel:domain', 'Delete by AGP'), 'aria-label' => Yii::t('hipanel:domain', 'Delete by AGP'), 'data' => ['confirm' => Yii::t('hipanel:domain', 'Are you sure you want to delete domain {domain}?', ['domain' => $model->domain]), 'method' => 'post', 'data-pjax' => '0']]) : ''; }, 'enable-freeze' => function ($url, $model, $key) { return !$model->is_freezed && Yii::$app->user->can('support') && Domain::notDomainOwner($model) ? Html::a('<i class="fa fa-lock"></i>' . Yii::t('hipanel:domain', 'Freeze domain'), $url, ['data' => ['method' => 'post', 'data-pjax' => '0']]) : ''; }, 'disable-freeze' => function ($url, $model, $key) { return $model->is_freezed && Yii::$app->user->can('support') && Domain::notDomainOwner($model) ? Html::a('<i class="fa fa-unlock"></i>' . Yii::t('hipanel:domain', 'Unfreeze domain'), $url, ['data' => ['method' => 'post', 'data-pjax' => '0']]) : ''; }, 'enable-hold' => function ($url, $model, $key) { if ($model->is_holded) { return ''; } if (Yii::$app->user->can('support') && Yii::$app->user->not($model->client_id) && Yii::$app->user->not($model->seller_id)) { return Html::a('<i class="fa fa-bomb"></i>' . Yii::t('hipanel:domain', 'Enable Hold'), $url); } return ''; }, 'disable-hold' => function ($url, $model, $key) { return $model->is_holded && in_array($model->state, ['ok', 'expired'], true) && Yii::$app->user->can('support') && Domain::notDomainOwner($model) ? Html::a('<i class="fa fa-link"></i>' . Yii::t('hipanel:domain', 'Disable Hold'), $url, ['data' => ['method' => 'post', 'data-pjax' => '0']]) : ''; }, 'manage-dns' => function ($url, $model, $key) { if (Yii::getAlias('@dns', false)) { return Html::a('<i class="fa fa-globe"></i>' . Yii::t('hipanel:domain', 'Manage DNS'), ['@dns/zone/view', 'id' => $model->id]); } return ''; }]]]; }
echo $form->field($model, 'domain')->textInput(['placeholder' => Yii::t('hipanel:domain', 'Domain name'), 'class' => 'form-control', 'name' => 'domain', 'value' => $model->getDomainAsUtf8()]); ?> <?php echo Html::submitButton('<i class="fa fa-search"></i> ' . Yii::t('hipanel:domain', 'Search'), ['class' => 'btn btn-info btn-flat btn-block xs-mb-10']); ?> <?php ActiveForm::end(); ?> <div class="bg-warning md-mt-10 xs-mb-10" style="padding: 5px 7px"> <span class="text-bold"><?php echo Yii::t('hipanel:domain', 'Available zones'); ?> :</span><br> <?php echo ArraySpoiler::widget(['data' => $availableZones, 'visibleCount' => count($availableZones)]); ?> </div> <p class="md-mt-20 text-justify"> <?php echo Yii::t('hipanel:domain', 'WHOIS isn’t an acronym, though it may look like one. In fact, it is the system that provides information, who is responsible for a domain name.'); ?> </p> </div> </div> </div> <div class="col-md-9 col-sm-12"> <div class="box box-primary"> <div class="box-header with-border"> <h3 class="box-title">
?> <div class="row"> <div class="col-md-4"> <div class="md-mb-10 text-center"> <?php echo LazyLoad::widget(['src' => $model->screenshot, 'options' => ['class' => 'img-thumbnail shot-img', 'alt' => $model->domain]]); ?> </div> </div> <div class="col-md-8"> <?php echo DetailView::widget(['model' => $model, 'attributes' => [['attribute' => 'domain', 'value' => $model->getDomainAsUtf8()], ['attribute' => 'created', 'format' => 'date', 'visible' => !empty($model->created)], ['attribute' => 'updated', 'format' => 'date', 'visible' => !empty($model->updated)], ['attribute' => 'expires', 'format' => 'date', 'visible' => !empty($model->expires)], ['attribute' => 'registrar', 'value' => is_array($model->registrar) ? rtrim(implode(', ', $model->registrar), ', ') : $model->registrar, 'visible' => !empty($model->expires)], ['attribute' => 'nss', 'value' => ArraySpoiler::widget(['data' => $model->nss, 'visibleCount' => count($model->nss), 'formatter' => function ($ip, $ns) { return $ns . ' - ' . $ip; }, 'delimiter' => '<br>']), 'format' => 'html'], ['attribute' => 'seo', 'label' => Yii::t('hipanel:domain', 'SEO'), 'value' => ArraySpoiler::widget(['data' => ['google', 'alexa', 'yandex'], 'visibleCount' => 3, 'delimiter' => '<br>', 'formatter' => function ($attribute) use($model) { if ($model->{$attribute}) { return $model->getAttributeLabel($attribute) . ': ' . $model->{$attribute}; } }]), 'format' => 'html'], ['attribute' => 'ip'], ['attribute' => 'country_name'], ['attribute' => 'city', 'visible' => !empty($model->city)]]]); ?> </div> </div> <div class="row"> <div class="col-md-12" style="font-family: monospace"> <div class="well well-sm"><?php echo WhoisData::widget(['data' => $model->rawdata]); ?> </div> </div> </div> <?php }
public static function defaultColumns() { $osImages = self::$osImages; return ['server' => ['class' => MainColumn::class, 'attribute' => 'name', 'filterAttribute' => 'name_like', 'note' => Yii::$app->user->can('support') ? 'label' : 'note', 'noteOptions' => ['url' => Yii::$app->user->can('support') ? Url::to('set-label') : Url::to('set-note')], 'badges' => function ($model) { $badges = ''; if (Yii::$app->user->can('support')) { if ($model->wizzarded) { $badges .= Label::widget(['label' => 'W', 'tag' => 'sup', 'color' => 'success']); } /*if ($model->state === 'disabled') { $badges .= ' ' . Label::widget(['label' => 'Panel OFF', 'tag' => 'sup', 'color' => 'danger', 'type' => 'text']); }*/ } return $badges; }], 'dc' => ['attribute' => 'dc', 'filter' => false], 'state' => ['class' => RefColumn::class, 'i18nDictionary' => 'hipanel:server', 'format' => 'raw', 'gtype' => 'state,device', 'value' => function ($model) { $html = State::widget(compact('model')); if ($model->status_time) { $html .= ' ' . Html::tag('nobr', Yii::t('hipanel:server', 'since {date}', ['date' => Yii::$app->formatter->asDate($model->status_time)])); } return $html; }], 'panel' => ['attribute' => 'panel', 'format' => 'text', 'contentOptions' => ['class' => 'text-uppercase'], 'value' => function ($model) { return $model->panel ? Yii::t('hipanel:server:panel', $model->panel) : Yii::t('hipanel:server:panel', 'No control panel'); }], 'os' => ['attribute' => 'os', 'format' => 'raw', 'value' => function ($model) use($osImages) { return OSFormatter::widget(['osimages' => $osImages, 'imageName' => $model->osimage]); }], 'os_and_panel' => ['attribute' => 'os', 'format' => 'raw', 'value' => function ($model) use($osImages) { $html = OSFormatter::widget(['osimages' => $osImages, 'imageName' => $model->osimage]); $html .= ' ' . $model->panel ?: ''; return $html; }], 'discount' => ['attribute' => 'discount', 'label' => Yii::t('hipanel:server', 'Discount'), 'format' => 'raw', 'headerOptions' => ['style' => 'width: 1em'], 'value' => function ($model) { return DiscountFormatter::widget(['current' => $model->discounts['fee']['current'], 'next' => $model->discounts['fee']['next']]); }], 'expires' => ['filter' => false, 'format' => 'raw', 'headerOptions' => ['style' => 'width: 1em'], 'value' => function ($model) { return Expires::widget(compact('model')); }], 'tariff' => ['format' => 'raw', 'filterAttribute' => 'tariff_like', 'value' => function ($model) { return self::formatTariff($model); }], 'tariff_and_discount' => ['attribute' => 'tariff', 'filterAttribute' => 'tariff_like', 'format' => 'raw', 'value' => function ($model) { return self::formatTariff($model) . ' ' . DiscountFormatter::widget(['current' => $model->discounts['fee']['current'], 'next' => $model->discounts['fee']['next']]); }], 'ip' => ['filter' => false], 'mac' => ['filter' => false], 'ips' => ['format' => 'raw', 'attribute' => 'ips', 'filter' => false, 'value' => function ($model) { return ArraySpoiler::widget(['data' => ArrayHelper::getColumn($model->ips, 'ip'), 'delimiter' => '<br />', 'visibleCount' => 3, 'button' => ['popoverOptions' => ['html' => true]]]); }], 'sale_time' => ['attribute' => 'sale_time', 'format' => 'datetime'], 'note' => ['class' => XEditableColumn::class, 'pluginOptions' => ['url' => Url::to('set-note')], 'widgetOptions' => ['linkOptions' => ['data-type' => 'textarea']]], 'label' => ['class' => XEditableColumn::class, 'visible' => Yii::$app->user->can('support'), 'pluginOptions' => ['url' => Url::to('set-label')], 'widgetOptions' => ['linkOptions' => ['data-type' => 'textarea']]], 'type' => ['format' => 'html', 'filter' => false, 'value' => function ($model) { return $model->type_label; }], 'rack' => ['format' => 'html', 'filter' => false, 'value' => function ($model) { return $model->switches['rack']['switch']; }], 'net' => ['format' => 'html', 'filter' => false, 'value' => function ($model) { return static::renderSwitchPort($model->switches['net']); }], 'kvm' => ['format' => 'html', 'filter' => false, 'value' => function ($model) { return static::renderSwitchPort($model->switches['kvm']); }], 'pdu' => ['format' => 'html', 'filter' => false, 'value' => function ($model) { return static::renderSwitchPort($model->switches['pdu']); }], 'ipmi' => ['format' => 'raw', 'filter' => false, 'value' => function ($model) { $ipmi = $model->switches['ipmi']['device_ip']; $link = $ipmi ? Html::a($ipmi, "http://{$ipmi}/", ['target' => '_blank']) . ' ' : ''; return $link . static::renderSwitchPort($model->switches['ipmi']); }], 'nums' => ['label' => '', 'format' => 'raw', 'value' => function ($model) { $ips_num = $model->ips_num; $ips = $ips_num ? Html::a("{$ips_num} ips", IpController::getSearchUrl(['server' => $model->name])) : 'no ips'; $act_acs_num = $model->acs_num - $model->del_acs_num; $del_acs_num = $model->del_acs_num; $acs_num = $act_acs_num . ($del_acs_num ? "+{$del_acs_num}" : ''); $acs = $acs_num ? Html::a("{$acs_num} acc", AccountController::getSearchUrl(['server' => $model->name])) : 'no acc'; return Html::tag('nobr', $ips) . ' ' . Html::tag('nobr', $acs); }], 'actions' => ['class' => ActionColumn::class, 'template' => '{view} {rrd} {switch-graph}', 'buttons' => ['switch-graph' => function ($url, $model) { return Html::a('<i class="fa fa-fw fa-area-chart"></i>' . Yii::t('hipanel:server', 'Switch graphs'), ['@switch-graph/view', 'id' => $model->id]); }, 'rrd' => function ($url, $model) { return Html::a('<i class="fa fa-fw fa-signal"></i>' . Yii::t('hipanel:server', 'Resources usage graphs'), ['@rrd/view', 'id' => $model->id]); }]]]; }
<div role="tabpanel" class="tab-pane active" id="bulk"> <div class="row" style="margin-top: 15pt;"> <div class="col-md-12"> <?php echo Html::textInput('bulk_ips', null, ['class' => 'form-control', 'placeholder' => Yii::t('hipanel', 'Type here...')]); ?> <br> <div class="panel panel-default"> <div class="panel-heading"><?php echo Yii::t('hipanel:domain', 'Affected name servers'); ?> </div> <div class="panel-body"> <?php echo ArraySpoiler::widget(['data' => $models, 'visibleCount' => count($models), 'formatter' => function ($model) { return $model->host; }, 'delimiter' => ', ']); ?> </div> </div> </div> </div> </div> <div role="tabpanel" class="tab-pane" id="by-one"> <div class="row" style="margin-top: 15pt;"> <?php foreach ($models as $model) { ?> <div class="col-md-4 text-right" style="line-height: 34px;"> <?php echo Html::activeHiddenInput($model, "[{$model->id}]id");
<?php } ?> </p> </div> <div class="panel panel-info"> <div class="panel-heading"><?php echo Yii::t('hipanel:domain', 'Affected domains'); ?> </div> <div class="panel-body"> <?php echo ArraySpoiler::widget(['data' => $models, 'visibleCount' => count($models), 'formatter' => function ($model) use(&$unPushable) { if (!$model->isPushable()) { $unPushable[] = $model->domain; } return $model->domain; }, 'delimiter' => ', ']); ?> </div> </div> <?php if (!empty($unPushable)) { ?> <div class="panel panel-warning"> <div class="panel-heading"> <?php echo Yii::t('hipanel:domain', 'Selected domains contain items which can not be Push:'); ?> </div> <div class="panel-body">
use yii\helpers\Html; use yii\widgets\DetailView; if ($model) { ?> <div class="row"> <div class="col-md-4"> <div class="md-mb-10 text-center"> <?php echo Html::img($model->screenshot, ['alt' => $model->domain, 'class' => 'img-thumbnail']); ?> </div> </div> <div class="col-md-8"$whoisData> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['domain', ['attribute' => 'created', 'format' => 'date', 'visible' => !empty($model->created)], ['attribute' => 'updated', 'format' => 'date', 'visible' => !empty($model->updated)], ['attribute' => 'expires', 'format' => 'date', 'visible' => !empty($model->expires)], ['attribute' => 'registrar', 'visible' => !empty($model->expires)], ['attribute' => 'nss', 'value' => ArraySpoiler::widget(['data' => $model->nss, 'visibleCount' => count($model->nss), 'formatter' => function ($ip, $ns) { return $ns . ' - ' . $ip; }, 'delimiter' => '<br>']), 'format' => 'html'], ['attribute' => 'ip'], ['attribute' => 'country_name'], ['attribute' => 'city', 'visible' => !empty($model->city)]]]); ?> </div> </div> <div class="row"> <div class="col-md-12" style="font-family: monospace"> <div class="well well-sm"><?php echo \hipanel\modules\domainchecker\widgets\WhoisData::widget(['data' => $model->rawdata]); ?> </div> </div> </div> <?php } else { ?>
<div role="tabpanel" class="tab-pane active" id="bulk"> <div class="row" style="margin-top: 15pt;"> <div class="col-md-12"> <?php echo NsWidget::widget(['model' => $models, 'attribute' => 'nsips', 'actionUrl' => 'bulk-set-nss']); ?> <br> <div class="panel panel-default"> <div class="panel-heading"><?php echo Yii::t('hipanel:domain', 'Affected domains'); ?> </div> <div class="panel-body"> <?php echo \hipanel\widgets\ArraySpoiler::widget(['data' => $models, 'visibleCount' => count($models), 'formatter' => function ($model) { return $model->domain; }, 'delimiter' => ', ']); ?> </div> </div> </div> </div> </div> <div role="tabpanel" class="tab-pane" id="by-one"> <?php $form = ActiveForm::begin(['id' => 'bulk-set-nss', 'action' => Url::toRoute('set-nss'), 'enableAjaxValidation' => true, 'validateOnBlur' => true, 'validationUrl' => Url::toRoute(['validate-form', 'scenario' => 'OLD-set-ns'])]); ?> <div class="row" style="margin-top: 15pt;"> <?php foreach ($models as $model) {
public static function defaultColumns() { return ['id' => ['class' => ClientColumn::class, 'attribute' => 'id', 'nameAttribute' => 'login', 'label' => Yii::t('hipanel', 'Client')], 'login' => ['class' => MainColumn::class, 'attribute' => 'login', 'filterAttribute' => 'login_like', 'format' => 'raw', 'note' => Yii::$app->user->can('manage') ? 'note' : null, 'noteOptions' => ['url' => Url::to('set-note')]], 'note' => ['class' => XEditableColumn::class, 'pluginOptions' => ['url' => Url::to('set-note')], 'widgetOptions' => ['linkOptions' => ['data-type' => 'textarea']], 'visible' => Yii::$app->user->can('manage')], 'name' => ['filterAttribute' => 'name_like'], 'state' => ['class' => RefColumn::class, 'filterAttribute' => 'states', 'format' => 'raw', 'gtype' => 'state,client', 'i18nDictionary' => 'hipanel:client', 'value' => function ($model) { return ClientState::widget(compact('model')); }], 'type' => ['class' => RefColumn::class, 'filterAttribute' => 'types', 'format' => 'raw', 'gtype' => 'type,client', 'i18nDictionary' => 'hipanel:client', 'value' => function ($model) { return ClientType::widget(compact('model')); }], 'balance' => ['class' => BalanceColumn::class], 'credit' => CreditColumn::resolveConfig(), 'country' => ['attribute' => 'contact', 'label' => Yii::t('hipanel:client', 'Country'), 'format' => 'html', 'value' => function ($model) { return Html::tag('span', '', ['class' => 'flag-icon flag-icon-' . $model->contact['country']]) . ' ' . $model->contact['country_name']; }], 'create_date' => ['attribute' => 'create_time', 'format' => 'date', 'filter' => false, 'contentOptions' => ['class' => 'text-nowrap']], 'create_time' => ['attribute' => 'create_time', 'format' => 'datetime', 'filter' => false], 'update_date' => ['attribute' => 'update_time', 'format' => 'date', 'filter' => false, 'contentOptions' => ['class' => 'text-nowrap']], 'update_time' => ['attribute' => 'update_time', 'format' => 'datetime', 'filter' => false], 'last_seen' => ['attribute' => 'last_seen', 'format' => 'date', 'filter' => false, 'contentOptions' => ['class' => 'text-nowrap'], 'value' => ''], 'tickets' => ['format' => 'html', 'label' => Yii::t('hipanel', 'Tickets'), 'value' => function ($model) { $num = $model->count['tickets']; $url = Url::toSearch('ticket', ['client_id' => $model->id]); return $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# ticket} other{# tickets}}', $num), $url) : ''; }], 'servers' => ['format' => 'raw', 'visible' => Yii::getAlias('@server', false) !== false, 'label' => Yii::t('hipanel', 'Servers'), 'value' => function ($model) { /** @var Client $model */ $num = $model->count['servers']; $url = Url::toSearch('server', ['client_id' => $model->id]); return $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# server} other{# servers}}', $num), $url) : ''; }], 'domains' => ['format' => 'html', 'visible' => Yii::getAlias('@domain', false) !== false, 'label' => Yii::t('hipanel', 'Domains'), 'value' => function ($model) { /** @var Client $model */ $num = $model->count['domains']; $url = Url::toSearch('domain', ['client_id' => $model->id]); return $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# domain} other{# domains}}', $num), $url) : ''; }], 'domains_spoiler' => ['format' => 'raw', 'visible' => Yii::getAlias('@domain', false) !== false, 'label' => Yii::t('hipanel', 'Domains'), 'value' => function ($model) { /** @var Client $model */ return ArraySpoiler::widget(['data' => $model->domains, 'visibleCount' => 1, 'button' => ['label' => '+' . ($model->count['domains'] - 1), 'popoverOptions' => ['html' => true]], 'formatter' => function ($item, $key) use($model) { static $index = 0; ++$index; $value = Html::a($item->domain, ['@domain/view', 'id' => $item->id]); if ($model->count['domains'] > count($model->domains) && $index === count($model->domains)) { $text = Yii::t('hipanel:client', 'and {n} more', ['n' => $model->count['domains'] - count($model->domains)]); $value .= ' ' . Html::a($text, Url::toSearch('domain', ['client_id' => $model->id]), ['class' => 'border-bottom-dashed']); } return $value; }]); }], 'servers_spoiler' => ['format' => 'raw', 'label' => Yii::t('hipanel', 'Servers'), 'value' => function ($model) { return ArraySpoiler::widget(['data' => $model->servers, 'visibleCount' => 1, 'button' => ['label' => '+' . ($model->count['servers'] - 1), 'popoverOptions' => ['html' => true]], 'formatter' => function ($item, $key) use($model) { static $index; ++$index; $value = Html::a($item->name, ['@server/view', 'id' => $item->id]); if ($model->count['servers'] > count($model->servers) && $index === count($model->servers)) { $text = Yii::t('hipanel:client', 'and {n} more', ['n' => $model->count['servers'] - count($model->servers)]); $value .= ' ' . Html::a($text, Url::toSearch('server', ['client_id' => $model->id]), ['class' => 'border-bottom-dashed']); } return $value; }]); }], 'contacts' => ['format' => 'html', 'label' => Yii::t('hipanel', 'Contacts'), 'value' => function ($model) { $num = $model->count['contacts']; $url = Url::toSearch('contact', ['client_id' => $model->id]); return $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# contact} other{# contacts}}', $num), $url) : ''; }], 'hosting' => ['format' => 'html', 'label' => Yii::t('hipanel', 'Hosting'), 'value' => function ($model) { $res = ''; $num = $model->count['accounts']; $url = Url::toSearch('account', ['client_id' => $model->id]); $res .= $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# account} other{# accounts}}', $num), $url) : ''; $num = $model->count['hdomains']; $url = Url::toSearch('hdomain', ['client_id' => $model->id]); $res .= $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# domain} other{# domains}}', $num), $url) : ''; $num = $model->count['dbs']; $url = Url::toSearch('db', ['client_id' => $model->id]); $res .= $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# database} other{# databases}}', $num), $url) : ''; return $res; }], 'actions' => ['class' => MenuColumn::class, 'menuClass' => ClientActionsMenu::class]]; }
use yii\helpers\Html; ?> <?php $form = ActiveForm::begin(['id' => 'set-price-form', 'action' => Url::toRoute('set-price'), 'validateOnBlur' => true, 'enableAjaxValidation' => true, 'validationUrl' => Url::toRoute(['validate-form', 'scenario' => 'set-price'])]); ?> <div class="panel panel-default"> <div class="panel-heading"><?php echo Yii::t('hipanel:stock', 'Set price'); ?> </div> <div class="panel-body"> <?php echo ArraySpoiler::widget(['data' => $models, 'visibleCount' => count($models), 'formatter' => function ($model) { return $model->partno . sprintf(' (%s)', $model->serial); }, 'delimiter' => ', ']); ?> </div> </div> <?php foreach ($models as $model) { ?> <?php echo Html::activeHiddenInput($model, "[{$model->id}]id"); } ?> <div class="<?php echo AmountWithCurrency::$widgetClass; ?>
use yii\helpers\Html; $unchangeableZones = []; $form = ActiveForm::begin(['id' => 'bulk-set-contact-form', 'action' => Url::toRoute('bulk-set-contacts'), 'enableAjaxValidation' => true, 'validationUrl' => Url::toRoute(['validate-set-contacts-form', 'scenario' => 'bulk-set-contacts'])]); ?> <div class="panel panel-default"> <div class="panel-heading"><?php echo Yii::t('hipanel:domain', 'Affected domains'); ?> </div> <div class="panel-body"> <?php echo ArraySpoiler::widget(['data' => $models, 'visibleCount' => count($models), 'formatter' => function ($model) use(&$unchangeableZones) { if (!$model->isContactChangeable()) { $unchangeableZones[] = $model->domain; } return $model->domain; }, 'delimiter' => ', ']); ?> </div> </div> <?php if (!empty($unchangeableZones)) { ?> <div class="panel panel-warning"> <div class="panel-heading"> <?php echo Yii::t('hipanel:domain', 'Selected domains contain zones which can not be changed contact details:'); ?> </div>