本文整理汇总了PHP中kartik\icons\Icon::show方法的典型用法代码示例。如果您正苦于以下问题:PHP Icon::show方法的具体用法?PHP Icon::show怎么用?PHP Icon::show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\icons\Icon
的用法示例。
在下文中一共展示了Icon::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveButtons
/**
* @param ActiveRecord $model Model instance
* @param string $indexAction Route path to index action
* @return string Rendered save buttons with redurectUrl!
*/
public static function saveButtons(ActiveRecord $model, $indexAction = 'index', $buttonClass = 'btn-sm', $onlySaveAndBack = false)
{
$result = '<div class="form-group no-margin btn-group">';
if ($onlySaveAndBack === false) {
$result .= Html::a(Icon::show('arrow-circle-left') . Yii::t('app', 'Back'), Yii::$app->request->get('returnUrl', [$indexAction, 'id' => $model->id]), ['class' => 'btn btn-default ' . $buttonClass]);
}
if ($model->isNewRecord && $onlySaveAndBack === false) {
$result .= Html::submitButton(Icon::show('save') . Yii::t('app', 'Save & Go next'), ['class' => 'btn btn-success ' . $buttonClass, 'name' => 'action', 'value' => 'next']);
}
$result .= Html::submitButton(Icon::show('save') . Yii::t('app', 'Save & Go back'), ['class' => 'btn btn-warning ' . $buttonClass, 'name' => 'action', 'value' => 'back']);
if ($onlySaveAndBack === false) {
$result .= Html::submitButton(Icon::show('save') . Yii::t('app', 'Save'), ['class' => 'btn btn-primary ' . $buttonClass, 'name' => 'action', 'value' => 'save']);
}
$result .= '</div>';
return $result;
}
示例2: run
public function run()
{
Icon::map($this->view, Icon::FA);
echo "<div id='cjModalContent'>" . Icon::show('refresh fa-spin', [], Icon::FA) . "</div>";
// echo "".Icon::show('refresh fa-spin', [], Icon::FA)."";
parent::run();
}
示例3: run
public function run()
{
echo Html::beginTag('div', ['class' => 'input-group']);
if (!isset($this->options['class'])) {
$this->options['class'] = 'form-control';
}
$iconId = 'icon-' . $this->options['id'];
if (!isset($this->options['aria-describedby'])) {
$this->options['aria-describedby'] = $iconId;
}
if ($this->hasModel()) {
$replace['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->options);
} else {
$replace['{input}'] = Html::textInput($this->name, $this->value, $this->options);
}
if ($this->icon != '') {
$replace['{icon}'] = Html::tag('span', Icon::show($this->icon, [], Icon::FA), ['class' => 'input-group-addon', 'id' => $iconId]);
}
echo strtr($this->template, $replace);
echo Html::endTag('div');
$view = $this->getView();
Assets::register($view);
$idMaster = $this->hasModel() ? Html::getInputId($this->model, $this->fromField) : $this->fromField;
$idSlave = $this->options['id'];
$view->registerJs("\n \$('#{$idMaster}').syncTranslit({\n destination: '{$idSlave}',\n type: 'url',\n caseStyle: 'lower',\n urlSeparator: '-'\n });");
}
示例4: init
public function init()
{
if (is_array($this->copyFrom)) {
$id = Html::getInputId($this->model, $this->attribute);
$buttonId = $id . '-copyButton';
$this->addon['append'] = ['content' => Html::button(Icon::show('code'), ['class' => 'btn btn-primary', 'id' => $buttonId]), 'asButton' => true];
$encodedFrom = Json::encode($this->copyFrom);
$encodedTo = Json::encode('#' . $id);
$js = <<<EOT
\$("#{$buttonId}").click(function(){
Admin.copyFrom(
{$encodedFrom},
{$encodedTo}
);
});
EOT;
$this->form->getView()->registerJs($js);
} elseif (is_array($this->makeSlug)) {
$id = Html::getInputId($this->model, $this->attribute);
$buttonId = $id . '-slugButton';
$this->addon['append'] = ['content' => Html::button(Icon::show('code'), ['class' => 'btn btn-primary', 'id' => $buttonId]), 'asButton' => true];
$encodedFrom = Json::encode($this->makeSlug);
$encodedTo = Json::encode('#' . $id);
$js = <<<EOT
\$("#{$buttonId}").click(function(){
Admin.makeSlug(
{$encodedFrom},
{$encodedTo}
);
});
EOT;
$this->form->getView()->registerJs($js);
}
parent::init();
}
示例5: initDefaultButtons
/**
* Initializes the default button rendering callbacks.
*/
protected function initDefaultButtons()
{
/* TODO: Add support!
if (!isset($this->buttons['view'])) {
$this->buttons['view'] = function ($url, $model, $key) {
$options = array_merge([
'title' => self::t('yii', 'View'),
'aria-label' => self::t('yii', 'View'),
'data-pjax' => '0',
], $this->buttonOptions);
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, $options);
};
}
*/
if (!isset($this->buttons['update'])) {
$this->buttons['update'] = function ($url, $model, $key) {
$options = array_merge(['title' => self::t('messages', 'Edit'), 'aria-label' => self::t('messages', 'Edit'), 'data-pjax' => '0'], $this->buttonOptions);
return Html::a(trim(Icon::show('pencil')), $url, $options);
};
}
if (!isset($this->buttons['copy'])) {
$this->buttons['copy'] = function ($url, $model, $key) {
$options = array_merge(['title' => self::t('messages', 'Copy'), 'aria-label' => self::t('messages', 'Copy')], $this->buttonOptions);
if ($model->hasMethod('duplicate') && ($model->hasAttribute('removed') && !$model->removed)) {
return Html::a(trim(Icon::show('copy')), $url, $options);
}
};
}
if (!isset($this->buttons['lock'])) {
$this->buttons['lock'] = function ($url, $model, $key) {
$options = array_merge(['title' => self::t('messages', 'Lock'), 'aria-label' => self::t('messages', 'Lock')], $this->buttonOptions);
if ($model->hasAttribute('locked') && !$model->locked && ($model->hasAttribute('removed') && !$model->removed)) {
return Html::a(trim(Icon::show('lock')), $url, $options);
}
};
}
if (!isset($this->buttons['unlock'])) {
$this->buttons['unlock'] = function ($url, $model, $key) {
$options = array_merge(['title' => self::t('messages', 'Unlock'), 'aria-label' => self::t('messages', 'Unlock')], $this->buttonOptions);
if ($model->hasAttribute('locked') && $model->locked && ($model->hasAttribute('removed') && !$model->removed)) {
return Html::a(trim(Icon::show('unlock')), $url, $options);
}
};
}
if (!isset($this->buttons['restore'])) {
$this->buttons['restore'] = function ($url, $model, $key) {
$options = array_merge(['title' => self::t('messages', 'Restore'), 'aria-label' => self::t('messages', 'Restore'), 'data-confirm' => self::t('messages', 'Are you sure you want to restore this item?'), 'data-method' => 'post', 'data-pjax' => '0'], $this->buttonOptions);
if ($model->hasAttribute('removed') && $model->removed) {
return Html::a(trim(Icon::show('share-square-o')), $url, $options);
}
};
}
if (!isset($this->buttons['delete'])) {
$this->buttons['delete'] = function ($url, $model, $key) {
$name = $model->hasAttribute('removed') && !$model->removed ? self::t('messages', 'To trash') : self::t('messages', 'Delete');
$options = array_merge(['title' => $name, 'aria-label' => $name, 'data-confirm' => self::t('messages', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0'], $this->buttonOptions);
return Html::a(trim(Icon::show('trash')), $url, $options);
};
}
}
示例6: run
public function run()
{
$this->genButton = Html::a(Icon::show('edit') . Yii::t('app', 'Generate'), '#', ['class' => 'btn btn-success', 'id' => 'btn-generate']);
$parent_id = $this->model->main_category_id;
$owner_id = $this->model->id;
$this->addButton = Html::a(Icon::show('plus') . Yii::t('app', 'Add'), Url::toRoute(['/shop/backend-product/edit', 'parent_id' => $parent_id, 'owner_id' => $owner_id, 'returnUrl' => \app\backend\components\Helper::getReturnUrl()]), ['class' => 'btn btn-success', 'id' => 'btn-add']);
if (!empty($this->footer)) {
$this->footer = Html::tag('div', $this->addButton . ' ' . $this->genButton, ['class' => 'widget-footer']);
}
$this->object = Object::getForClass(get_class($this->model));
$rest_pg = (new Query())->select('id, name')->from(PropertyGroup::tableName())->where(['object_id' => $this->object->id])->orderBy('sort_order')->all();
$this->property_groups_to_add = [];
foreach ($rest_pg as $row) {
$this->property_groups_to_add[$row['id']] = $row['name'];
}
$optionGenerate = Json::decode($this->model->option_generate);
if (null === PropertyGroup::findOne($optionGenerate['group'])) {
$this->model->option_generate = $optionGenerate = null;
}
$groupModel = null;
if (isset($optionGenerate['group'])) {
$groupModel = PropertyGroup::findOne($optionGenerate['group']);
$properties = Property::getForGroupId($optionGenerate['group']);
} else {
$group_ids = array_keys($this->property_groups_to_add);
$group_id = array_shift($group_ids);
$groupModel = PropertyGroup::findOne($group_id);
$properties = Property::getForGroupId($group_id);
}
if (is_null($groupModel)) {
$groupModel = new PropertyGroup();
}
return $this->render($this->viewFile, ['model' => $this->model, 'form' => $this->form, 'groups' => $this->property_groups_to_add, 'groupModel' => $groupModel, 'properties' => $properties, 'optionGenerate' => $optionGenerate, 'footer' => $this->footer]);
}
示例7: run
/**
* Renders the menu.
*/
public function run()
{
// Get Module list
$modules = array_keys(Yii::$app->modules);
// Get sub menu for each module
foreach ($modules as $moduleName) {
// Get module
$moduleObj = Yii::$app->getModule($moduleName);
$iconClass = isset($moduleObj->iconClass) ? $moduleObj->iconClass : 'fa-dashboard';
// Get menu
if (property_exists($moduleObj, 'backendMenu')) {
$getModule = Yii::$app->request->get('module');
$item = ['label' => Icon::show($iconClass) . '<span class="nav-label">' . Yii::t($moduleName, ucfirst($moduleName)) . '</span>', 'url' => ['/' . $moduleName . '/default']];
if (Yii::$app->controller->module->id == $moduleName and empty($getModule) or $getModule == $moduleName) {
$item['active'] = TRUE;
}
$backendMenu = $moduleObj->backendMenu;
if (is_array($backendMenu)) {
foreach ($backendMenu as $itemMenu) {
if (isset($itemMenu['access']) and $this->checkAccess($itemMenu['access'])) {
$item['items'][] = ['label' => $itemMenu['label'], 'url' => $itemMenu['url']];
}
}
if (isset($item['items']) and !empty($item['items'])) {
$item['label'] .= '<span class="fa arrow"></span>';
}
}
// assign to $this->items
$this->items[] = $item;
}
}
parent::run();
}
示例8: getActions
public function getActions()
{
$actions = is_null($this->actions) ? $this->_actions : array_intersect_key($this->_actions, $this->actions);
$ret_val = '';
foreach ($actions as $name => $action) {
switch (isset($action['adminOnly']) && $action['adminOnly'] == true) {
case true:
switch (\Yii::$app->userMeta->isAdmin()) {
case true:
$action['options']['id'] = $action['options']['id'] . $this->parentId;
$ret_val[$name] = function ($url, $model) use($action) {
return Html::a(Icon::show($action['text']), $action['action'] . '/' . $model->getId(), $action['options']);
};
break;
}
break;
default:
$action['options']['id'] = $action['options']['id'] . $this->parentId;
$ret_val[$name] = function ($url, $model) use($action) {
return Html::a(Icon::show($action['text']), $action['action'] . '/' . $model->getId(), $action['options']);
};
break;
}
}
return $ret_val;
}
示例9: renderButtons
/**
* @return string
*/
protected function renderButtons()
{
$buttons = [self::ADD_ACTION => Html::button(Icon::show('plus') . ' ' . Yii::t('app', 'Add selected to:'), ['class' => isset($this->htmlOptions['add-class']) ? $this->htmlOptions['add-class'] : 'btn btn-default', 'disabled' => 'disabled', 'data-mc-action' => self::ADD_ACTION]), self::MOVE_ACTION => Html::button(Icon::show('arrows') . ' ' . Yii::t('app', 'Move selected to:'), ['class' => isset($this->htmlOptions['move-class']) ? $this->htmlOptions['move-class'] : 'btn btn-default', 'disabled' => 'disabled', 'data-mc-action' => self::MOVE_ACTION])];
$group = '';
foreach ($buttons as $id => $button) {
$group .= Html::tag('div', Html::tag('div', $button . "\n\t" . Html::tag('div', Html::dropDownList(null, null, static::$categories, ['prompt' => Yii::t('app', 'Select category'), 'class' => 'form-control', 'id' => $id]), ['class' => 'input-group']), ['class' => 'btn-group']), ['class' => 'col-xs-12 col-sm-6']);
}
return Html::tag('div', $group, ['class' => 'row m-bottom-10']);
}
示例10: init
public function init()
{
$this->registerTranslations();
if (!is_null($this->autoQuery)) {
$auto = $this->autoQuery->roots();
if ($this->rootable) {
$this->query = $auto;
} else {
$this->query = $auto->one() ? $auto->one()->children(1) : null;
}
}
if (is_null($this->modelOptions)) {
$this->modelOptions = ['name' => function ($data) {
return $this->prepareRow($data);
}];
}
if (count($this->columns) == 1 && !$this->hideButtons) {
$this->columns['url'] = function ($data) {
return Url::toRoute([$this->driveController . 'update', 'id' => $data->primaryKey]);
};
}
if (is_null($this->buttons)) {
$model = new $this->query->modelClass();
$this->buttons = [['label' => Icon::show('pencil', [], Icon::FA), 'url' => function ($data) {
return Url::toRoute([$this->driveController . 'update', 'id' => $data->primaryKey]);
}, 'options' => ['title' => self::t('messages', 'Edit'), 'data-pjax' => 0]], ['label' => Icon::show('lock', [], Icon::FA), 'url' => function ($data) {
return Url::toRoute([$this->driveController . 'lock', 'id' => $data->primaryKey]);
}, 'options' => ['title' => self::t('messages', 'Lock'), 'data-method' => 'POST', 'data-pjax' => '0'], 'visible' => function ($data) {
return $data->hasAttribute('locked') && !$data->locked;
}], ['label' => Icon::show('unlock', [], Icon::FA), 'url' => function ($data) {
return Url::toRoute([$this->driveController . 'unlock', 'id' => $data->primaryKey]);
}, 'options' => ['title' => self::t('messages', 'Unlock'), 'data-method' => 'POST', 'data-pjax' => '0'], 'visible' => function ($data) {
return $data->hasAttribute('locked') && $data->locked;
}], ['label' => Icon::show('trash', [], Icon::FA), 'url' => function ($data) {
return Url::toRoute([$this->driveController . 'delete', 'id' => $data->primaryKey]);
}, 'options' => ['title' => self::t('messages', 'To trash'), 'data-method' => 'POST', 'data-pjax' => '0', 'data-confirm' => "Вы действительно хотите удалить этот элемент?"], 'visible' => function ($data) {
return $data->hasAttribute('removed') && !$data->removed;
}], ['label' => Icon::show('share-square-o', [], Icon::FA), 'url' => function ($data) {
return Url::toRoute([$this->driveController . 'restore', 'id' => $data->primaryKey]);
}, 'options' => ['title' => self::t('messages', 'Restore')], 'visible' => function ($data) {
return $data->hasAttribute('removed') && $data->removed;
}], ['label' => Icon::show('remove', [], Icon::FA), 'url' => function ($data) {
return Url::toRoute([$this->driveController . 'delete', 'id' => $data->primaryKey]);
}, 'options' => ['title' => self::t('messages', 'Delete'), 'data-method' => 'POST', 'data-pjax' => '0', 'data-confirm' => "Вы действительно хотите удалить этот элемент?"], 'visible' => function ($data) {
if ($data->hasAttribute('removed')) {
if (is_bool($data->removed)) {
return $data->removed;
}
return !is_null($data->removed);
}
return true;
}]];
}
$this->options['class'] = 'nestable' . (isset($this->options['class']) ? ' ' . $this->options['class'] : '');
parent::init();
}
示例11: run
public function run()
{
$this->options['id'] .= $this->parentId;
$this->options['class'] .= ' ' . ($this->model->count() >= 1 ? 'btn-primary' : 'btn-transparent');
$this->options['label'] = (int) $this->model->count() . ' Replies ' . Icon::show('eye');
$this->options['href'] = \Yii::$app->urlManager->createUrl(['/reply/index/' . $this->parentType . "/" . $this->parentId]);
$this->options['title'] = \Yii::t('yii', 'View Replies');
$info = $this->getInfoLink($this->model->isWhat());
return Html::tag('div', $info, $this->widgetOptions) . $this->getNewIndicator();
}
示例12: getUserMenu
public static function getUserMenu()
{
$userItems = [];
if (Yii::$app->user->isGuest) {
$userItems[] = ['label' => Icon::show('sign-in', ['class' => 'fa-fw']) . Yii::t('app', 'Login'), 'url' => ['/site/login']];
} else {
$userItems[] = ['label' => Icon::show('sign-out', ['class' => 'fa-fw']) . Yii::t('app', 'Logout'), 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']];
}
return $userItems;
}
示例13: run
public function run()
{
$this->options['id'] .= $this->parentId;
$this->options['class'] .= ' ' . ($this->model->count() >= 1 ? 'btn-primary' : 'btn-transparent');
$this->options['label'] = (int) $this->model->count() . ' Issues ' . Icon::show('eye');
$this->options['href'] = \Yii::$app->urlManager->createUrl(['/issue/index/' . $this->parentType . "/" . $this->parentId, '__format' => 'modal', IssuesModel::COMMENT_PARAM => $this->enableComments]);
$this->options['title'] = \Yii::t('yii', 'View Issues');
$info = $this->getInfoLink();
return Html::tag('div', $info, $this->widgetOptions) . $this->getNewIndicator();
}
示例14: accountMenu
public function accountMenu()
{
if (Yii::$app->user->isGuest) {
$items[] = ['label' => 'Войти', 'url' => ['/site/login']];
$items[] = ['label' => 'Зарегистрироваться', 'url' => ['/site/signup']];
} else {
$user = User::findOne(Yii::$app->user->id);
$items[] = ['label' => $user->username . ' ' . Html::tag('span', preg_replace('/\\,00/', '', number_format($user->money, 2, ',', ' ')) . ' ' . Icon::show('user', ['class' => 'fa-btc'], Icon::FA), ['style' => 'margin: 0 2px 0 6px;']), 'items' => [['label' => 'Добавить лот на продажу', 'url' => ['/tor/mng-ad']], '<li class="divider"></li>', ['label' => 'Сменить пароль', 'url' => ['#']], ['label' => 'Выход', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]]];
}
return $items;
}
示例15: show
public static function show($name, $options = [], $framework = null, $space = true, $tag = 'span')
{
$key = self::getFramework($framework);
if (in_array($key, array_keys(self::$_custom_frameworks))) {
$class = self::$_custom_frameworks[$key]['prefix'] . $name;
Html::addCssClass($options, $class);
return Html::tag($tag, '', $options) . ($space ? ' ' : '');
} else {
return parent::show($name, $options, $framework, $space, $tag);
}
}