/** * @param string|array $item the item to be normalized. * @return string|array normalized item. */ protected function normalizeItem($item) { if (is_array($item)) { if (isset($item['icon'])) { if (isset($item['label'])) { $label = $item['label']; $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels; if ($encodeLabel) { $label = Html::encode($label); } } else { $label = ''; } $item['encode'] = false; $label = Html::icon($item['icon']) . ' ' . $label; $item['label'] = $label; } if (isset($item['items'])) { foreach ($item['items'] as $key => $value) { $item['items'][$key] = $this->normalizeItem($value); } } } return $item; }
public function init() { $dir = Yii::getAlias('@vendor/dersonsena/yii2-common-classes/src'); $this->initI18N($dir, 'common'); $this->controllerDescription = Yii::t('common', 'NO CONTROLLER DESCRIPTION'); $this->actionDescription = Yii::t('common', 'NO ACTION DESCRIPTION'); parent::init(); Yii::setAlias('@common-classes', '@vendor/dersonsena/yii2-common-classes'); Yii::$app->params['pagination']['pageSize'] = 25; Yii::$app->params['maskMoneyOptions'] = ['prefix' => 'R$ ', 'suffix' => '', 'affixesStay' => true, 'thousands' => '.', 'decimal' => ',', 'precision' => 2, 'allowZero' => false, 'allowNegative' => false]; Yii::$app->params['defaultAddons'] = ['money' => ['prepend' => ['content' => '<i class="fa fa-money" aria-hidden="true"></i>']], 'url' => ['prepend' => ['content' => 'http://']], 'email' => ['prepend' => ['content' => Html::icon('envelope')]], 'phone' => ['prepend' => ['content' => Html::icon('phone-alt')]], 'date' => ['prepend' => ['content' => Html::icon('calendar')]], 'time' => ['prepend' => ['content' => Html::icon('time')]]]; }
<div class="row"> <div class="col-md-8" ng-app="user"> <div ng-controller="Feeds"> <div id="feedForm" class="mb10"> <form> <div class="feed-form"> <div class="feed-content"> <div class="form-group"> <textarea ng-model="feed.content" name="content" placeholder="发动态?有问题?什么可以发在这里" id="feedContent" rows="4"></textarea> </div> <div id="feed-images-preview" class="form-group"> <div class="image-box" ng-repeat="image in feed.args.imgs"> <img width="48" height="48" ng-src="{{image.src}}"> <?php echo Html::icon('remove', ['class' => 'remove', 'ng-click' => 'deleteImage($index)']); ?> </div> </div> </div> <div id="plus" class="form-group"> <span class="btns"> <span id="pic" ngf-pattern="'image/*'" ngf-accept="'image/*'" ngf-max-size="20MB" ngf-select="uploadFiles($files)" multiple="multiple">图片</span> <span ng-hide="form.contentLen <= 0">还可以输入<span ng-model="form.contentLen">{{(140-feed.content.length<=0)?0:(140-feed.content.length)}}个字符</span></span> <span ng-show="form.contentLenMore > 0">已经多出<span ng-model="form.contentLenMore">{{feed.contentLenMore}}个字符</span></span> </span> <button class="pull-right" id="feedSubmit" ng-click="postfeed()">发布</button> </div> <div id="info" ng-show="info.isShow">{{info.msg}}</div>
/** * Function gen template one image by path * @param $imgPath Path of image * @param $imgPathFull Path full of image * @return string */ private static function _generateGalleryTemplateByPath($imgPath, $imgPathFull) { $template = Html::beginTag('div', ['class' => 'col-md-3 col-lg-3 text-center']); $template .= Html::icon('ok', ['class' => 'icon-active sya_remove_img', 'onclick' => 'removeImageByGallery($(this).next());']); $infomation_images = Json::encode(['url' => $imgPath, 'title' => reset(explode('.', end(explode('/', $imgPath)))), 'caption' => '', 'alt_text' => '']); // View image $template .= Html::beginTag('div', ['class' => 'letImgPreview', 'id' => $imgPath, 'data-info' => $infomation_images, 'onclick' => 'syaPreviewImage(this);']); $template .= Html::img('@web/' . $imgPathFull, ['style' => 'max-width: 100%;']); $template .= Html::endTag('div'); $template .= Html::endTag('div'); return $template; }
<?php echo $form->field($model, 'rememberMe')->checkbox(); ?> </div> <div class="col-xs-4"> <?php echo Html::submitButton('Login ' . Html::icon('log-in'), ['class' => 'btn btn-primary btn-block btn-flat', 'name' => 'login-button']); ?> </div> </div> <?php ActiveForm::end(); ?> <div class="row"> <div class="col-xs-12 col-md-12"><hr/></div> </div> <?php echo Html::a(Html::icon('chevron-right') . ' Esqueceu sua senha? Clique aqui!', ['forgot']); ?> </div> <small class="text-center" style="margin-top: 20px; display: block;"> <?php echo $this->render('/partials/login-footer'); ?> </small> </div>
?> </p> <table class="table table-bordered table-striped"> <tbody> <?php foreach ($rows as $row) { ?> <tr> <td> <b><?php echo $row['title']; ?> </b><br> <?php echo $row['description']; ?> </td> <td style="text-align: center; vertical-align: middle;"> <?php echo Html::a(Html::icon($row['icon']) . ' ' . $row['title'], $row['url'], $row['options']); ?> </td> </tr> <?php } ?> </tbody> </table> </div> </div>
/** * @return array */ public function getDefaultButtonOptions() { return array_merge(parent::getDefaultButtonOptions(), ['icon' => Html::icon('glyphicon glyphicon-star'), 'label' => Yii::t('vote', 'Add to favorites'), 'labelAdd' => Yii::t('vote', 'Add to favorites'), 'labelRemove' => Yii::t('vote', 'Remove from favorites')]); }
</div> <div class="row"> <div class="col-xs-12 col-sm-6 col-md-5"> <?php echo $form->field($model, 'university_id')->dropDownList($universities, ['prompt' => Yii::t('lbl', 'University')])->label(false); ?> </div> <div class="col-xs-12 col-sm-6 col-md-5"> <?php echo $form->field($model, 'tag_id')->dropDownList($tags, ['prompt' => Yii::t('lbl', 'Interests')])->label(false); ?> </div> <div class="col-xs-12 col-sm-6 col-md-2"> <div class="form-group"> <?php echo Html::submitButton('Szukaj ' . Html::icon('search'), ['class' => 'btn btn-fullwidth btn-orange']); ?> </div> </div> </div> </article> <?php ActiveForm::end(); ?> <div class="search-results"> <?php if (is_array($results)) { if (empty($results)) { echo '<article>' . Yii::t('msg', 'No results') . '</article>'; } else {
* Time: 07:41 */ /** @var $this \yii\web\View */ use yii\bootstrap\Html; use d4rkstar\dbconfig\components\ConfigurationUtils; use yii\helpers\Inflector; use yii\bootstrap\Collapse; $params = Yii::$app->controller->module->config->params; print Html::beginForm('', 'post', ['class' => 'form-horizontal']); $this->title = Yii::t('app', 'Configuration'); $this->params['breadcrumbs'][] = $this->title; $items = []; $isFirst = true; print Html::tag('h1', Html::encode($this->title)); if (!Yii::$app->user->isGuest) { print ' ' . Html::tag('small', Html::icon('pencil', ['class' => 'xs']) . Html::a('Manage', \yii\helpers\Url::to('manage'))); } ?> <?php if (count($params) == 0) { print Html::tag('h2', Yii::t('app', 'No configuration items.')); } else { print Html::tag('p', Yii::t('app', 'Click on the titles to expand.')); foreach ($params as $group => $params) { $options = []; /*if ($isFirst) { $options['class'] = 'in'; $isFirst = false; }*/
?> <?php if ($number % 3 == 0) { ?> <?php if ($number != 0) { ?> </div> <?php } ?> <div class="row"> <?php } ?> <div class="col-lg-4"> <h3><?php echo $block['title']; ?> </h3> <p><?php echo $block['description']; ?> </p> <p><?php echo Html::a(Html::icon($block['icon']) . ' ' . $block['label'], $block['url'], ['class' => 'btn btn-default']); ?> </p> </div> <?php }
use choate\coderelease\components\LayerAsset; use yii\grid\ActionColumn; use yii\grid\GridView; use yii\helpers\Html; LayerAsset::register($this); echo Html::a('创建部署', ['deploy', 'id' => $id], ['class' => 'btn btn-primary', 'style' => 'margin-bottom:10px']); echo GridView::widget(['dataProvider' => $dataProvider, 'layout' => "{items}\n{pager}", 'afterRow' => function ($model, $key, $index, $grid) { $content = []; foreach ($model->taskItem as $task) { $content[] = Html::tag('div', $task->title, ['class' => 'task-title']); } return Html::tag('tr', Html::tag('td', implode("\n", $content), ['colspan' => 4])); }, 'columns' => ['deploy_version', 'statusName', 'deploy_time:datetime', ['header' => '操作', 'class' => ActionColumn::className(), 'template' => "{rollback}\n{redeploy}\n{test}", 'buttons' => ['rollback' => function ($url, $model) { return $model->getIsDeploy() ? Html::a(\yii\bootstrap\Html::icon('share-alt'), $url, ['title' => '回滚', 'class' => 'deploy-rollback']) : ''; }, 'redeploy' => function ($url, $model) { return $model->getIsRollback() ? Html::a(\yii\bootstrap\Html::icon('refresh'), $url, ['title' => '重新部署']) : ''; }]]]]); $this->registerJs(<<<EOF \$('.deploy-rollback').click(function(){ var url = \$(this).attr('href'); layer.confirm('回滚任务?', {icon: 3, title:'提示'}, function(index){ layer.close(index); var loadIndex = layer.load(1); \$.get(url, function() { layer.msg('回滚成功', {icon: 1, time:1000}, function() { location.reload(); }); }).fail(function() { layer.msg('回滚失败', {icon: 2, time:1000}); }).always(function() { layer.close(loadIndex);
public static function getMenuItems() { return [['encode' => false, 'label' => \yii\bootstrap\Html::icon('upload') . ' ' . Yii::t('app', 'Upload'), 'url' => ['/frontend/records/upload']], ['encode' => false, 'label' => \yii\bootstrap\Html::icon('search') . ' ' . Yii::t('app', 'Search'), 'url' => ['/frontend/records/search']], ['encode' => false, 'label' => \yii\bootstrap\Html::icon('eye-open') . ' ' . Yii::t('app', 'Review'), 'url' => ['/frontend/records/review']], ['encode' => false, 'label' => \yii\bootstrap\Html::icon('print') . ' ' . Yii::t('app', 'Print'), 'url' => false, 'options' => ['class' => 'disabled']], ['encode' => false, 'label' => \yii\bootstrap\Html::icon('pencil') . ' ' . Yii::t('app', 'Update'), 'url' => false, 'options' => ['class' => 'disabled']], ['encode' => false, 'label' => \yii\bootstrap\Html::icon('list-alt') . ' ' . Yii::t('app', 'Reports'), 'url' => false, 'options' => ['class' => 'disabled']], ['encode' => false, 'label' => \yii\bootstrap\Html::icon('asterisk') . ' ' . Yii::t('app', 'Settings'), 'url' => false, 'options' => ['class' => 'disabled']]]; }
/** * @return array */ public function getDefaultButtonOptions() { return array_merge(parent::getDefaultButtonOptions(), ['icon' => Html::icon('glyphicon glyphicon-heart'), 'label' => Yii::t('vote', 'Like')]); }
/** * @return array */ public function getDefaultButtonOptions() { return ['class' => 'vote-btn btn btn-default', 'icon' => Html::icon('glyphicon glyphicon-arrow-up'), 'label' => Yii::t('vote', 'Vote up')]; }
*/ use yii\helpers\Html; ?> <div class="favorite"> <h5><?php echo Html::a($model->title, $model->from_url, ['target' => '_blank']); ?> </h5> <div class="color-grey"> <?php echo $model->about; ?> </div> <div class="color-gey"> <span class="pull-right"> <?php echo $model->created_at; ?> </span> <span class="mr10 color-grey"> <?php echo \yii\bootstrap\Html::icon('remove'); ?> <?php echo Html::a("删除", ['/api/favorite/delete', 'id' => $model->id], ['data-method' => 'POST']); ?> </span> </div> </div>
?> <?php echo $form->field($model, 'name')->textInput(); ?> <?php echo $form->field($model, 'url')->widget(\sibds\widgets\translitInput::className(), ['fromField' => 'name']); ?> <?php echo $form->field($model, 'image')->widget(\sibds\widgets\InputFile::className()); ?> <?php echo $form->field($model, 'layout')->widget(\kartik\select2\Select2::className(), ['data' => Yii::$app->controller->getLayouts(), 'options' => ['placeholder' => 'Значение по умолчанию'], 'addon' => ['prepend' => ['content' => \yii\bootstrap\Html::icon('open-file')]]]); ?> <?php echo $form->field($model, 'description')->widget(\sibds\widgets\CKEditor::className(), ['options' => ['rows' => 6]]); ?> <?php echo \sibds\form\FormFooter::widget(['model' => $model]); ?> <?php ActiveForm::end(); ?> </div>
* Email:awebc@qq.com */ use yii\bootstrap\Html; use yii\helpers\Url; use xj\qrcode\QRcode; use xj\qrcode\widgets\Text; $shareBaseUrl = 'http://v.t.sina.com.cn/share/share.php'; $shareParams = ['appkey' => 'weibo', 'url' => $url, 'title' => 'tt', 'pic' => '/images/thumb.png']; $params = http_build_query($shareParams); $shareUrl = $shareBaseUrl . $params; ?> <ul> <li class="mb10"> <?php echo Text::widget(['outputDir' => '@webroot/uploads/qrcode', 'outputDirWeb' => '@web/uploads/qrcode', 'ecLevel' => QRcode::QR_ECLEVEL_L, 'text' => $shareUrl, 'size' => 3]); ?> </li> <li> <?php echo Html::icon('share'); ?> <a href='javascript:void((function(s,d){var f="<?php echo $shareUrl; ?> ";function a(){if(!window.open(f,"mb",["toolbar=0,status=0,resizable=1,width=440,height=430,left=",(s.width-440)/2,",top=",(s.height-430)/2].join("")))location.href=f};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a()})(screen, document))'>分享到微博</a> </li> </ul>
?> </p> </section> <?php } ?> <?php if ($model->email) { ?> <?php echo Html::a(Html::icon('envelope') . Yii::t('btn', 'Write to us'), ['group/mail', 'url' => $model->url], ['class' => 'button-blue']); ?> <?php } ?> <?php echo Html::a(Html::icon('plus') . Yii::t('btn', 'Join'), ['group/join', 'url' => $model->url], ['class' => 'button-blue']); ?> </div> </div> <div class="col-xs-12 col-sm-8 col-md-9"> <article> <?php echo $model->content ? \yii\helpers\HtmlPurifier::process($model->content) : 'Brak opisu organizacji'; ?> </article> </div> </div> </div>
$fieldTemplate = "{input}\n{hint}\n{error}\n<span class='glyphicon glyphicon-lock form-control-feedback'></span>"; ?> <div class="login-box"> <div class="login-logo"> <?php echo Html::img('@web/images/logo.png', ['width' => '350', 'alt' => Yii::$app->name]); ?> </div> <div class="login-box-body"> <h3 class="box-title no-margin text-center"> <?php echo Html::icon('lock'); ?> Alterar Senha de Acesso </h3> <hr /> <?php $form = ActiveForm::begin(['id' => 'login-form', 'validateOnBlur' => false]); ?> <?php echo $form->field($formModel, 'password', ['options' => ['class' => 'form-group has-feedback'], 'template' => $fieldTemplate])->passwordInput(['placeholder' => 'Digite aqui sua nova senha de acesso...']); ?> <?php
/** * Renders single item. * @param array $item item configuration. * @return string rendered HTML */ protected function renderItem($item) { if (isset($item[0])) { $url = $item; $options = []; } else { $url = $item['url']; $options = $item; unset($options['url']); } // label : if (isset($options['label'])) { $label = $options['label']; unset($options['label']); } else { $label = $this->detectLabel($url); } if (isset($options['encode'])) { $encodeLabel = $options['encode']; unset($options['encode']); } else { $encodeLabel = $this->encodeLabels; } if ($encodeLabel) { $label = Html::encode($label); } // icon : if (isset($options['icon'])) { $icon = $options['icon']; unset($options['icon']); } else { $icon = $this->detectIcon($url); } if ($icon) { $label = Html::icon($icon) . ' ' . $label; } // CSS class : if (isset($options['class'])) { Html::addCssClass($options, ['widget' => 'btn']); } else { $options['class'] = ['btn', $this->detectClass($url)]; } if (!isset($options['data'])) { $options['data'] = $this->detectData($url); } return Html::a($label, $url, $options); }
use yii\bootstrap\Html; ?> <div class="login-box"> <div class="login-logo"> <?php echo Html::img('@web/images/logo.png', ['width' => '350', 'alt' => Yii::$app->name]); ?> </div> <div class="login-box-body"> <h3 class="box-title no-margin text-center"> <?php echo Html::icon('question-sign'); ?> Esqueci minha senha </h3> <hr /> <?php $form = ActiveForm::begin(['id' => 'login-form', 'validateOnBlur' => false]); ?> <?php echo $form->field($formModel, 'email', ['options' => ['class' => 'form-group has-feedback'], 'template' => "{input}\n{hint}\n{error}\n<span class='glyphicon glyphicon-envelope form-control-feedback'></span>"])->textInput(['type' => 'email', 'placeholder' => 'Digite aqui o seu e-mail de cadastro...']); ?> <div class="row" style="margin-bottom: 10px">
/** * Renders button. * @param string $name button name. * @param mixed $model * @param string $key * @param integer $index * @return string rendered HTML * @throws InvalidConfigException on invalid button format. */ protected function renderButton($name, $model, $key, $index) { if (!isset($this->buttons[$name])) { return ''; } $button = $this->buttons[$name]; if ($button instanceof \Closure) { $url = $this->createUrl($name, $model, $key, $index); return call_user_func($button, $url, $model, $key); } if (!is_array($button)) { throw new InvalidConfigException("Button should be either a Closure or array configuration."); } // Visibility : if (isset($button['visible'])) { if ($button['visible'] instanceof \Closure) { if (!call_user_func($button['visible'], $model, $key, $index)) { return ''; } } elseif (!$button['visible']) { return ''; } } // URL : if (isset($button['url'])) { $url = call_user_func($button['url'], $name, $model, $key, $index); } else { $url = $this->createUrl($name, $model, $key, $index); } // label : if (isset($button['label'])) { $label = $button['label']; if (isset($button['encode'])) { $encodeLabel = $button['encode']; unset($button['encode']); } else { $encodeLabel = true; } if ($encodeLabel) { $label = Html::encode($label); } } else { $label = ''; } // icon : if (isset($button['icon'])) { $icon = $button['icon']; $label = Html::icon($icon) . (empty($label) ? '' : ' ' . $label); } $options = array_merge(ArrayHelper::getValue($button, 'options', []), $this->buttonOptions); return Html::a($label, $url, $options); }
<div class="mb10"> <?php echo $model->content; ?> <?php if ($model->parent_id) { ?> <blockquote> @ <?php echo $model->parent->author->a; ?> <?php echo $model->parent->content; ?> </blockquote> <?php } ?> </div> <div class="comment-action"> <?php echo Html::icon("comment"); ?> <a href="javascript:;" class="color-grey" onclick="replyComment(<?php echo $model->id; ?> );">回复</a> </div> </div>
<div class="col-sm-4"> <ul class="list-group"> <li class="list-group-item"> <?php echo Yii::t('setup', 'Choose language'); ?> <?php echo Html::icon('ok', ['class' => 'text-success']); ?> </li> <li class="list-group-item"> <?php echo Yii::t('setup', 'Verify requirements'); ?> <?php echo Html::icon('ok', ['class' => 'text-success']); ?> </li> <li class="list-group-item list-group-item-current"><?php echo Yii::t('setup', 'Set up database'); ?> </li> <li class="list-group-item"><?php echo Yii::t('setup', 'Install app'); ?> </li> <li class="list-group-item"><?php echo Yii::t('setup', 'Create admin account'); ?> </li> <li class="list-group-item"><?php
/** * Renders single item. * @param array $item item configuration. * @return string rendered HTML */ protected function prepareItems() { foreach ($this->items as &$item) { if (is_string($item)) { continue; } // url if (isset($item[0])) { $item['url'] = $item[0]; unset($item[0]); } // label if (!isset($item['label'])) { $item['label'] = $this->detectLabel($item['url']); } if (!isset($options['encode'])) { $item['encode'] = $this->encodeLabel; } if ($item['encode']) { $item['label'] = Html::encode($item['label']); } // icon if (!isset($item['icon'])) { $item['icon'] = $this->detectIcon($item['url']); } if ($item['icon']) { $item['label'] = Html::icon($item['icon']) . ' ' . $item['label']; } // class if (!isset($item['linkOptions'])) { $item['linkOptions'] = []; } if (!isset($item['linkOptions']['class'])) { $item['linkOptions']['class'] = [$this->detectClass($item['url'])]; } if (!isset($item['linkOptions']['data'])) { $item['linkOptions']['data'] = $this->detectData($item['url']); } } }