/** * Renders the header cell content. * The default implementation simply renders [[header]]. * This method may be overridden to customize the rendering of the header cell. * @return string the rendering result */ protected function renderHeaderCellContent() { $name = rtrim($this->name, '[]') . '_all'; $id = $this->grid->options['id']; $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name]); $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});"); if ($this->header !== null || !$this->multiple) { return parent::renderHeaderCellContent(); } else { return Html::checkBox($name, false, ['class' => 'select-on-check-all']); } }
<?php echo app\widgets\GridView::widget(array('id' => 'depsoit-grid', 'dataProvider' => $model->dp(), 'columns' => array(array('format' => 'raw', 'value' => function ($data) { return \yii\helpers\Html::checkBox("FormDeposit[Deposit][{$data->doc_id},{$data->line}]", null, array("onchange" => "CalcSum()")); }), array('format' => 'raw', 'value' => function ($data) { return \yii\helpers\Html::hiddenInput("FormDeposit[Total][{$data->doc_id},{$data->line}]", "{$data->sum}") . \yii\helpers\Html::hiddenInput("FormDeposit[Type][{$data->doc_id},{$data->line}]", "{$data->type}"); }), 'bank', 'branch', 'cheque_acct', 'cheque_num', 'cheque_date', 'dep_date', 'currency_id', 'refnum', 'sum', array('class' => 'yii\\grid\\ActionColumn'))));
/** * @inheritdoc */ protected function renderDataCellContent($model, $key, $index) { if ($this->gridType == 'datatable-select') { if (!$this->multiple) { return Html::radio(rtrim($this->name, '[]'), false, ['value' => $key]); } else { return Html::checkBox($this->name, false, ['value' => $key]); } } else { return parent::renderDataCellContent($model, $key, $index); } }
private function genField($name, $setting, $options) { if (preg_match("/number|string/i", $setting->type)) { return Html::textInput($name, $setting->value, $options); } elseif (preg_match("/text/i", $setting->type)) { return Html::textArea($name, $setting->value, $options); } elseif (preg_match("/bool/i", $setting->type)) { return Html::checkBox($name, $setting->value, array_merge($options, $this->checkboxOptions, ['template' => ''])); } elseif (preg_match("/dropdown/i", $setting->type)) { $data = @unserialize($setting->options); $data = is_array($data) ? $data : []; return Html::dropDownList($name, $setting->value, $data, $options); } elseif (preg_match("/radiolist/i", $setting->type)) { $data = @unserialize($setting->options); $data = is_array($data) ? $data : []; $template = $this->radioTemplate; $this->radioOptions['item'] = !$this->radioCallback ? function ($index, $label, $name, $checked, $value) use($template) { return strtr($template, ['{input}' => Html::radio($name, $checked, ['value' => $value]), '{labelText}' => $label]); } : $this->radioCallback; return Html::radioList($name, $setting->value, $data, array_merge($options, $this->radioOptions)); } elseif (preg_match("/{dateradiolist}/i", $setting->type)) { $data = @unserialize($setting->options); $data = is_array($data) ? $data : []; $template = $this->radioTemplate; $this->radioOptions['item'] = function ($index, $label, $name, $checked, $value) use($template) { return strtr($template, ['{input}' => Html::radio($name, $checked, ['value' => $value]), '{labelText}' => date($value, time())]); }; return Html::radioList($name, $setting->value, array_combine($data, $data), array_merge($options, $this->radioOptions)); } elseif (preg_match("/timezone/i", $setting->type)) { return Html::dropDownList($name, $setting->value, $this->getTimezones(), $options); } elseif (preg_match("/date/i", $setting->type)) { return DatePicker::widget(['name' => $name, 'type' => DatePicker::TYPE_INPUT, 'value' => date('d-m-Y', strtotime($setting->value)), 'pluginOptions' => ['autoclose' => true, 'format' => 'dd-M-yyyy']]); } else { return Html::textArea($name, $setting->value, $options); } }
echo Html::checkBox($task->name . '[]', in_array($task->name, $selectItems), array('id' => $task->name, 'class' => 'task_on', 'value' => $task->name, 'data-type' => 'task')); ?> <span><?php echo Yii::t('common', $task->description); ?> </span> <?php //echo Html::label(Yii::t('common', $task->description), $task->name); ?> </label> </td> <td class="tr_body"> <?php foreach ($permissions as $operation) { echo '<label for="' . $operation->name . '">'; echo Html::checkBox($task->name . '[]', in_array($task->name, $selectItems) || in_array($operation->name, $selectItems), array('id' => $operation->name, 'class' => 'operation_on', 'value' => $operation->name, 'data-type' => 'operation')); echo '<span>' . Yii::t('common', $operation->description) . '</span>'; // echo Html::label(Yii::t('common', $operation->description), $operation->name); echo '</label>'; } ?> </td> </tr> <?php } } ?> </tbody> </table> </div>
/** * Renders the header cell content. * The default implementation simply renders [[header]]. * This method may be overridden to customize the rendering of the header cell. * @return string the rendering result */ protected function renderHeaderCellContent() { $name = $this->name; if (substr_compare($name, '[]', -2, 2) === 0) { $name = substr($name, 0, -2); } if (substr_compare($name, ']', -1, 1) === 0) { $name = substr($name, 0, -1) . '_all]'; } else { $name .= '_all'; } $id = $this->grid->options['id']; $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});"); if ($this->header !== null || !$this->multiple) { return parent::renderHeaderCellContent(); } else { return Html::checkBox($name, false, ['class' => 'select-on-check-all']); } }
<div class="activity-users-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_search', ['model' => $searchModel]); ?> <?php $form = ActiveForm::begin(['action' => \yii\helpers\Url::to('/Admin/activity-users/update-status')]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'header' => Html::checkBox('selection_all', false, ['class' => 'select-on-check-all'])], ['attribute' => 'activity_id', 'value' => function ($searchModel) { return app\models\Activity::getOneActivityNameById($searchModel->activity_id); }], ['attribute' => 'user_id', 'format' => 'html', 'value' => function ($searchModel) { return '<a href="/Admin/users/index?UsersSearch[id]=' . $searchModel->user_id . '">' . app\models\Users::getOneUserNameById($searchModel->user_id) . '</a>'; }], ['attribute' => 'status', 'value' => function ($searchModel) { return app\models\ActivityUsers::$statusList[$searchModel->status]; }], 'practice_score', 'theory_score', 'rule_score', 'score_appraise', ['attribute' => 'attendance_appraise', 'format' => 'html', 'value' => function ($searchModel) { return '<a href="/Admin/attendance/index?AttendanceSearch[user_id]=' . $searchModel->user_id . '&AttendanceSearch[activity_id]=' . $searchModel->activity_id . '" target="_blank" style="width:300px">' . $searchModel->attendance_appraise . '</a>'; }], ['class' => 'yii\\grid\\ActionColumn']]]); ?> <select name="status"> <?php foreach ($statusList as $key => $val) { ?> <option value="<?php echo $key;
<?php echo $form->field($model, 'description')->textarea(); ?> </div> <div class="col col-md-8"> <?php if (!empty($possibleChildren)) { ?> <h2><?php echo Yii::t('accounts', 'Permissions'); ?> </h2> <?php echo GridView::widget(['dataProvider' => $possibleChildren, 'id' => 'role-permissions-grid', 'layout' => "{items}\n{pager}\n{summary}", 'tableOptions' => ['class' => 'table table-striped table-hover table-condensed table-bordered'], 'rowOptions' => function ($row, $key, $index, $grid) { return ['class' => $row['isChild'] ? 'success' : null]; }, 'columns' => [['header' => Html::checkBox('permissions_all', false, ['class' => 'select-all-on-check']), 'format' => 'raw', 'value' => function ($row, $key, $index, $column) { return Html::checkbox('assignedChildren[' . $row['name'] . ']', $row['isChild'], ['class' => 'select-on-check', 'id' => $row['name']]); }], ['attribute' => 'name', 'format' => 'raw', 'value' => function ($row) { return Html::label($row['name'], $row['name']); }], 'ruleName', 'createdAt:RelativeTime', ['class' => 'yii\\grid\\ActionColumn', 'buttons' => ['delete' => function ($url, $model, $key) { return null; }]]]]); ?> <?php //js for own header "select all checkbox" column $this->registerJs("\n jQuery('.select-all-on-check').click(function(){\n \$('.select-on-check').prop('checked', \$(this).prop('checked'));\n });\n "); ?> <?php } ?> </div>
<div class="row"> <div class="col-md-6"> <?php echo app\widgets\GridView::widget(array('id' => 'bankbook-grid', 'dataProvider' => $model->search([]), 'panel' => false, 'columns' => array(array('format' => 'raw', 'value' => function ($data) { return \yii\helpers\Html::checkBox("FormExtmatch[Bankbooks][match][{$data->id}]", null, array("class" => "ext_match", "onchange" => "CalcMatchSum()")) . \yii\helpers\Html::hiddenInput("FormExtmatch[Bankbooks][total][{$data->id}]", "{$data->sum}", array("class" => "ext_total")); }), 'details', 'date', 'refnum', 'currency_id', 'sum'))); ?> </div> <div class="col-md-6"> <?php echo app\widgets\GridView::widget(array('id' => 'transaction-grid', 'dataProvider' => $trans->search([]), 'panel' => false, 'columns' => array(array('format' => 'raw', 'value' => function ($data) { return \yii\helpers\Html::checkBox("FormExtmatch[Transactions][match][{$data->id}]", null, array("class" => "trans_match", "onchange" => "CalcMatchSum()")) . \yii\helpers\Html::hiddenInput("FormExtmatch[Transactions][total][{$data->id}]", $data->sum * -1, array("class" => "trans_total")); }), 'details', 'valuedate', 'currency_id', array('format' => 'raw', 'value' => function ($data) { return $data->sum * -1; })))); ?> </div> </div>
<div class="col-xs-6"> <?php echo $form->field($model, 'NRIC')->label("FIN / NRIC"); ?> <?php echo $form->field($model, 'email'); ?> </div> <?php $assigned_check = isset($_GET['EmployeeSearch']['is_assigned']) ? true : false; ?> <?php echo ' ' . Html::checkBox('EmployeeSearch[is_assigned]', $assigned_check, ['label' => ' Added Employee Only']); ?> <div class="form-group float-right"> <?php echo Html::submitButton('Search', ['class' => 'btn btn-primary']); ?> <?php echo Html::a('Reset', ['update', 'id' => $group_id], ['class' => 'btn btn-default']); ?> </div> <?php ActiveForm::end(); ?>
/** * _getTree * * @param string $statusField * @param string $parentIdField * @param int $pid * * @return array tree */ private function _getTree($statusField, $parentIdField, $pid = 0) { $op = array(); foreach ($this->models as $model) { if ($model->{$parentIdField} == $pid) { $children = $this->_getTree($statusField, $parentIdField, $model->id); if ($statusField) { $status = $model->{$statusField} == 1 ? '' : 'jqtree-inactive'; } else { $status = ''; } $leafLink = "<label class='checkbox " . $status . "'>"; $leafLink .= Html::checkBox('leaf[]', false, array('value' => $model->id)) . ' '; $leafLink .= call_user_func($this->leafName, $model); $leafLink .= "</label>"; if ($children) { $op[] = array('id' => $model->id, 'name' => $leafLink, 'parent_id' => $model->{$parentIdField}, 'children' => $children); } else { $op[] = array('id' => $model->id, 'name' => $leafLink, 'parent_id' => $model->{$parentIdField}); } } } return $op; }
<div class="col-xs-6"> <?php echo $form->field($model, 'company_email')->label("Email"); ?> <?php echo $form->field($model, 'person_in_charge'); ?> </div> <?php $assigned_check = isset($_GET['CompanySearch']['is_assigned']) ? true : false; ?> <?php echo ' ' . Html::checkBox('CompanySearch[is_assigned]', $assigned_check, ['label' => ' Added Company Only']); ?> <div class="form-group float-right"> <?php echo Html::submitButton('Search', ['class' => 'btn btn-primary']); ?> <?php echo Html::a('Reset', ['update', 'id' => $group_id], ['class' => 'btn btn-default']); ?> </div> <?php ActiveForm::end(); ?>
/** * Renders the header cell content. * The default implementation simply renders [[header]]. * This method may be overridden to customize the rendering of the header cell. * @return string the rendering result */ protected function renderHeaderCellContent() { $name = rtrim($this->name, '[]') . '_all'; $id = $this->grid->options['id']; $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name]); $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});"); if ($this->header !== null || !$this->multiple) { return parent::renderHeaderCellContent(); } else { $content = Html::tag('button', Html::checkBox($name, false, ['class' => 'select-on-check-all', 'data-target' => $this->name, 'data-checkall' => 1, 'data-parent-id' => $id]) . ' <span class="caret"></span>', ['type' => 'button', 'class' => 'btn btn-default dropdown-toggle', 'data-toggle' => 'dropdown']); $buttons = preg_replace_callback('/\\{([\\w\\-\\/]+)\\}/', function ($matches) use($model, $key, $index) { $name = $matches[1]; $module = \Yii::$app->user->can(\Yii::$app->controller->module->id . '/' . \Yii::$app->controller->id . '/' . $name); if ($module) { if (isset($this->buttons[$name])) { $url = $this->createUrl($name, $model, $key, $index); if (call_user_func($this->checkaccess, $url)) { return call_user_func($this->buttons[$name], $url, $model); } else { return ''; } } else { return ''; } } }, $this->template); if ($buttons == '') { return $buttons; } $content .= Html::tag('ul', $buttons, ['class' => 'dropdown-menu pull-right', 'role' => 'menu']); return Html::tag('div', $content, ['class' => 'dropdown']); } }
<?php /* @var $this ForumController */ /* @var $model YBoardChoice */ use yii\helpers\Html; ?> <div class="row"> <div class="poll col-md-12"> <?php if ($this->context->poll->allow_multiple) { ?> <?php echo Html::checkBox('choice[' . $model->id . ']', false, array('value' => $model->id)); ?> <?php } else { ?> <?php echo Html::radio('choice[]', false, array('value' => $model->id)); ?> <?php } ?> <?php echo $model->choice; ?> </div> </div>
<div style=" width: 35%; display: inline-block; margin-right: 150px; "> <?php echo app\widgets\GridView::widget(array('id' => 'in-grid', 'dataProvider' => $in->searchIn(), 'panel' => false, 'columns' => array(array('format' => 'raw', 'value' => function ($data) { return \yii\helpers\Html::checkBox("FormIntmatch[In][match][{$data->id}]", null, array("class" => "In_match", "onchange" => "CalcMatchSum()")) . \yii\helpers\Html::hiddenInput("FormIntmatch[In][total][{$data->id}]", "{$data->sum}", array("class" => "In_total")); }), array('attribute' => 'type', 'value' => function ($data) { return Yii::t("app", $data->ttype->name); }), 'details', 'currency_id', 'sum'))); ?> </div> <div style=" width: 35%; display: inline-block;"> <?php echo app\widgets\GridView::widget(array('id' => 'out-grid', 'dataProvider' => $out->searchOut(), 'panel' => false, 'columns' => array(array('format' => 'raw', 'value' => function ($data) { return \yii\helpers\Html::checkBox("FormIntmatch[Out][match][{$data->id}]", null, array("class" => "Out_match", "onchange" => "CalcMatchSum()")) . \yii\helpers\Html::hiddenInput("FormIntmatch[Out][total][{$data->id}]", "{$data->sum}", array("class" => "Out_total")); }), array('attribute' => 'type', 'value' => function ($data) { return Yii::t("app", $data->ttype->name); }), 'details', 'currency_id', 'sum'))); ?> </div>
}], ['label' => 'Название детали', 'value' => function ($model) { return $model['part_name'] ? $model['part_name'] : $model['tovar']['name']; }], ['attribute' => '', 'label' => 'Цена', 'value' => function ($model) { return number_format($model['tovar_price'], 2, '.', ''); }, 'contentOptions' => ['class' => 'itemPrice']], ['label' => 'Кол-во ед.', 'format' => 'raw', 'value' => function ($model) { return '<input type="number" class="form-control" onChange="countBasketSum(); detailCounter(this, ' . $model['id'] . ')" value="' . $model['tovar_count'] . '" min="' . $model['tovar_min'] . '">'; }, 'contentOptions' => ['class' => 'itemCount']], ['attribute' => 'allsum', 'label' => 'Сумма', 'value' => function ($model) { return number_format($model['tovar_price'], 2, '.', ''); }, 'contentOptions' => ['class' => 'itemFullPrice']], ['attribute' => 'period', 'label' => 'Срок'], ['label' => 'Описание', 'format' => 'raw', 'value' => function ($model) { $description = $model['description'] ? $model['description'] : 'Ввести описание'; $data = Html::a('<i class="icon-edit icon-white"></i>', '#', ['class' => 'grid-right-up-corner', 'onClick' => 'editText(this)', 'title' => 'Редактировать описание']); $data .= Html::a('<i class="icon-cross icon-white"></i>', '#', ['class' => 'grid-left-up-corner', 'onClick' => 'cancelEdit(this)', 'title' => 'Отменить редактирование']); $data .= '<span id="oldText" style="display: none"></span>'; $data .= Html::textarea('itemDescription', $description, ['readonly' => true]); return $data; }, 'contentOptions' => ['class' => 'itemDescription']], ['class' => 'yii\\grid\\CheckboxColumn', 'checkboxOptions' => ['onChange' => 'countBasketMarkedItemsSum()'], 'header' => yii\helpers\Html::checkBox('selection_all', false, ['class' => 'select-on-check-all', 'onChange' => 'countBasketMarkedItemsSum()', 'value' => '0'])]]]); ?> </div> <div class="col-xs-12 col-lg-12 col-md-12 col-sm-12"> <div class="basket-grid-footer"> <div class="basked-all-items">В корзине товаров на сумму: <strong><?php echo Yii::$app->formatter->asCurrency($itogo['tovar_summa']); ?> </strong></div> <div class="basket-marked-items">Выбрано позиций <strong>0</strong>, на сумму <strong>0,00</strong> руб.</div> </div> </div> <div class="form-group"> <div class="col-xs-offset-9 col-xs-12"> <?php
<?php foreach ($poll->answers as $answer) { ?> <div class="row"> <?php if (!$poll->hasUserVoted()) { ?> <div class="col-md-1" style="padding-right: 0;"> <?php if ($poll->allow_multiple) { ?> <div class="checkbox"> <label> <?php echo Html::checkBox('answers[' . $answer->id . ']'); ?> </label> </div> <?php } else { ?> <div class="radio"> <label> <?php echo Html::radio('answers', false, array('value' => $answer->id, 'id' => 'answer_' . $answer->id)); ?> </label> </div> <?php
</div> </div> <div class="form-actions"> <?php echo \yii\helpers\Html::submitButton(Yii::t('app', 'Deposit'), ['class' => 'btn btn-success']); ?> <div id ="result"> <?php //echo app\widgets\GridView::widget( array( echo yii\grid\GridView::widget(array('id' => 'depsoit-grid', 'dataProvider' => $cheques->depositSearch(), 'columns' => array(array('value' => function ($data) { return \yii\helpers\Html::checkBox("FormDeposit[Deposit][{$data->doc_id},{$data->line}]", false, ['id' => 'FormDeposit_Deposit-' . $data->doc_id . "_" . $data->line]) . \yii\helpers\Html::hiddenInput("FormDeposit[Total][{$data->doc_id},{$data->line}]", "{$data->sum}", ['id' => 'FormDeposit_Total-' . $data->doc_id . "_" . $data->line]) . \yii\helpers\Html::hiddenInput("FormDeposit[Type][{$data->doc_id},{$data->line}]", "{$data->type}", ['id' => 'FormDeposit_Type-' . $data->doc_id . "_" . $data->line]); }, 'filter' => '', 'format' => 'raw'), array('attribute' => 'type', 'value' => function ($data) { return Yii::t("app", $data->typeo->name); }), array('value' => function ($data) { return $data->printDetails(); }), 'currency_id', 'sum', array('class' => 'yii\\grid\\ActionColumn')))); ?> </div> <div id="sum"> </div> </div> <?php kartik\form\ActiveForm::end(); ?>
if ($file->operation === CodeFile::OP_SKIP) { echo 'unchanged'; } else { echo $file->operation; } ?> </td> <?php if ($fileChangeExists) { ?> <td class="check"> <?php if ($file->operation === CodeFile::OP_SKIP) { echo ' '; } else { echo Html::checkBox("answers[{$file->id}]", isset($answers) ? isset($answers[$file->id]) : $file->operation === CodeFile::OP_CREATE); } ?> </td> <?php } ?> </tr> <?php } ?> </tbody> </table> <div class="modal fade" id="preview-modal" tabindex="-1" role="dialog"> <div class="modal-dialog">
protected function renderHeaderCellContent() { $name = rtrim($this->name, '[]') . '_all'; $id = $this->grid->options['id']; $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});"); if ($this->header !== null || !$this->multiple) { return parent::renderHeaderCellContent(); } else { return '<div class="input-control checkbox"><label>' . Html::checkBox($name, false, ['class' => 'select-on-check-all']) . '<span class="check"></span></label></div>'; } }