/** * @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; }
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(); }
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 });"); }
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(); }
/** * 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); }; } }
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]); }
/** * 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(); }
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; }
/** * @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']); }
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(); }
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(); }
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; }
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(); }
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; }
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); } }
public function run() { if (!empty($this->footer)) { $this->footer = Html::tag('div', $this->footer, ['class' => 'widget-footer']); } if (!empty($this->icon)) { $this->title = Icon::show($this->icon) . $this->title; } $this->params['title'] = $this->title; $this->params['header_append'] = $this->header_append; $this->params['footer'] = $this->footer; $this->params['_id'] = $this->getId(); return parent::run(); }
public function run() { app\backend\assets\FrontendEditingAsset::register($this->view); $items = [['label' => Icon::show('dashboard') . ' ' . Yii::t('app', 'Backend'), 'url' => ['/backend/']]]; switch (Yii::$app->requestedRoute) { case 'shop/product/list': if (isset($_GET['properties'])) { $apply_if_params = []; foreach ($_GET['properties'] as $property_id => $values) { if (isset($values[0])) { $apply_if_params[$property_id] = $values[0]; } } if (Yii::$app->response->dynamic_content_trait === true) { $items[] = ['label' => Icon::show('puzzle') . ' ' . Yii::t('app', 'Edit Dynamic Content'), 'url' => ['/backend/dynamic-content/edit', 'id' => Yii::$app->response->matched_dynamic_content_trait_model->id]]; } else { if (isset($_GET['properties'], $_GET['last_category_id'])) { $items[] = ['label' => Icon::show('puzzle') . ' ' . Yii::t('app', 'Add Dynamic Content'), 'url' => ['/backend/dynamic-content/edit', 'DynamicContent' => ['apply_if_params' => Json::encode($apply_if_params), 'apply_if_last_category_id' => $_GET['last_category_id'], 'object_id' => Object::getForClass(app\modules\shop\models\Product::className())->id, 'route' => 'shop/product/list']]]; } } } else { // no properties selected - go to category edit page if (isset($_GET['last_category_id'])) { $reviewsLink = $this->getReviewEditParams("Category", intval($_GET['last_category_id'])); $cat = app\modules\shop\models\Category::findById($_GET['last_category_id']); $items[] = ['label' => Icon::show('pencil') . ' ' . Yii::t('app', 'Edit category'), 'url' => ['/shop/backend-category/edit', 'id' => $cat->id, 'parent_id' => $cat->parent_id]]; } } break; case 'shop/product/show': if (isset($_GET['model_id'])) { $reviewsLink = $this->getReviewEditParams("Product", intval($_GET['model_id'])); $items[] = ['label' => Icon::show('pencil') . ' ' . Yii::t('app', 'Edit product'), 'url' => ['/shop/backend-product/edit', 'id' => intval($_GET['model_id'])]]; } break; case '/page/page/show': case '/page/page/list': if (isset($_GET['id'])) { $page = app\modules\page\models\Page::findById($_GET['id']); $reviewsLink = $this->getReviewEditParams("Page", $_GET['id']); $items[] = ['label' => Icon::show('pencil') . ' ' . Yii::t('app', 'Edit page'), 'url' => ['/page/backend/edit', 'id' => $page->id, 'parent_id' => $page->parent_id]]; } break; } if (!empty($reviewsLink)) { $items[] = $reviewsLink; } return $this->render('floating-panel', ['items' => $items, 'bottom' => $this->bottom]); }
public function init() { Icon::map($this->grid->getView()); $this->registerTranslations(); parent::init(); // TODO: Change the autogenerated stub $this->value = function ($model, $key, $index, $widget) { $lockIcon = ''; if ($this->showLock) { if ($model->hasAttribute('locked') && $model->{$model->lockedAttribute}) { $lockIcon = Icon::show('eye-slash'); } else { $lockIcon = Icon::show('eye'); } } return Html::a($lockIcon . $model->{$this->attribute}, ['update', 'id' => $model->id], ['title' => self::t('messages', 'Edit item')]); }; }
/** * Initializes the default button rendering callbacks */ protected function initDefaultButtons() { if (!isset($this->buttons['view'])) { $this->buttons['view'] = function ($url, $model) { return Html::a(Icon::show('eye', ['class' => 'fa-lg'], Icon::FA), $url, ['title' => \Yii::t('yii', 'View'), 'data-pjax' => '0']); }; } if (!isset($this->buttons['update'])) { $this->buttons['update'] = function ($url, $model) { return Html::a(Icon::show('edit', ['class' => 'fa-lg'], Icon::FA), $url, ['title' => \Yii::t('yii', 'Update'), 'data-pjax' => '0']); }; } if (!isset($this->buttons['delete'])) { $this->buttons['delete'] = function ($url, $model) { return Html::a(Icon::show('trash-o', ['class' => 'fa-lg'], Icon::FA), $url, ['title' => \Yii::t('yii', 'Delete'), 'data-confirm' => \Yii::t('yii', 'Are you sure to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0']); }; } }
protected function initDefaultButtons() { $this->template = '<div class="btn-group">' . $this->template . '</div>'; if (!isset($this->buttons['view'])) { $this->buttons['view'] = function ($url, $model, $key) { return Html::a(Icon::show('eye'), $url, array_merge(['title' => Yii::t('yii', 'View'), 'data-pjax' => '0', 'class' => 'btn btn-success btn-xs'], $this->buttonOptions)); }; } if (!isset($this->buttons['update'])) { $this->buttons['update'] = function ($url, $model, $key) { return Html::a(Icon::show('edit'), $url, array_merge(['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0', 'class' => 'btn btn-primary btn-xs'], $this->buttonOptions)); }; } if (!isset($this->buttons['delete'])) { $this->buttons['delete'] = function ($url, $model, $key) { return Html::a(Icon::show('trash'), $url, array_merge(['title' => Yii::t('yii', 'Delete'), 'class' => 'btn btn-danger btn-xs', 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0'], $this->buttonOptions)); }; } }
public function getdocfiles_iconshow() { $excel = '<span style="font-size: 19px; color: green;">' . Icon::show('file-excel-o') . '</span>'; $word = '<span style="font-size: 19px; color: blue;">' . Icon::show('file-word-o') . '</span>'; $pdf = '<span style="font-size: 19px; color: red;">' . Icon::show('file-pdf-o') . '</span>'; $image = '<span style="font-size: 19px; color: orange;">' . Icon::show('file-image-o') . '</span>'; $text = '<span style="font-size: 19px; color: black;">' . Icon::show('file-text-o') . '</span>'; if (in_array($this->docfiles_ext, ['XLS', 'XLSX'])) { return $excel; } elseif (in_array($this->docfiles_ext, ['DOC', 'DOCX'])) { return $word; } elseif (in_array($this->docfiles_ext, ['PDF'])) { return $pdf; } elseif (in_array($this->docfiles_ext, ['PNG', 'JPG', 'JPEG', 'TIFF'])) { return $image; } elseif (in_array($this->docfiles_ext, ['TXT'])) { return $text; } }
public function run() { $shortLinkLabel = $this->useLabel ? Html::tag('span', $this->label, ['class' => 'input-group-addon']) : ''; $shortLinkInput = Html::input('text', $this->label, empty($this->inputOptions['text']) ? $this->url : $this->inputOptions['text'], array_merge(['class' => 'form-control'], $this->inputOptions)); $shortLinkButton = Html::a("View " . Icon::show('eye'), $this->url, array_merge(['class' => 'input-group-addon'], $this->viewOptions)); switch ($this->type) { case 'modal': $this->modalOptions = array_merge(['size' => $this->size, 'header' => $this->header, 'toggleButton' => ['label' => Icon::show('eye') . " Modal", 'data-remote' => $this->getUrl('modal'), 'class' => 'btn btn-default', 'wrapper' => ['tag' => 'span', 'class' => 'input-group-btn']], 'options' => ['id' => 'short-link' . uniqid()]], $this->modalOptions); $shortLinkButton = \nitm\widgets\modal\Modal::widget($this->modalOptions); break; default: $shortLinkButton = Html::a(Icon::show('eye') . (!isset($this->viewOptions['label']) ? " In Page" : $this->viewOptions['label']), $this->getUrl('page'), array_merge(['class' => 'input-group-addon'], $this->viewOptions)); $this->viewOptions = []; break; } $newWindowLinkButton = Html::a(Icon::show('eye') . " Window", 'javascript:void(0)', array_merge(['class' => 'input-group-addon', 'onclick' => "javascript:window.open('" . $this->getUrl('popup') . "', '" . uniqid() . "', 'width=800, height=900, location=0, scrollbars=1')"], $this->viewOptions)); $shortLink = Html::tag('div', $shortLinkLabel . $shortLinkInput . $shortLinkButton . $newWindowLinkButton, ['class' => 'input-group', 'style' => 'width:100%']); echo $shortLink; }
private static function normalizeMenu($menus, $root = null) { $order = []; foreach ($menus[$root] as $id => $menu) { if (!empty($menu['ds_icon'])) { $StrMenu = Icon::show($menu['ds_icon']) . ' ' . $menu['ds_menu']; } else { $StrMenu = $menu['ds_menu']; } $items[$id] = ['label' => $StrMenu, 'url' => $menu['ds_rota']]; $order[] = $menu['nr_ordem']; if (isset($menus[$id])) { $items[$id]['items'] = static::normalizeMenu($menus, $menu['id']); } } if ($items != []) { array_multisort($order, $items); } return $items; }
protected function renderDataCellContent($model, $key, $index) { if ($this->callbackButtons instanceof Closure) { $btns = call_user_func($this->callbackButtons, $model, $key, $index, $this); if (null === $btns) { $this->buttons = $this->defaultButtons; } else { $this->buttons = $btns; } } $min_width = count($this->buttons) * 34; //34 is button-width $data = Html::beginTag('div', ['class' => 'btn-group', 'style' => 'min-width: ' . $min_width . 'px']); foreach ($this->buttons as $button) { Html::addCssClass($button, 'btn'); Html::addCssClass($button, 'btn-sm'); $buttonText = isset($button['text']) ? ' ' . $button['text'] : ''; $data .= Html::a(Icon::show($button['icon']) . $buttonText, $url = $this->createUrl($button['url'], $model, $key, $index), ArrayHelper::merge(isset($button['options']) ? $button['options'] : [], ['class' => $button['class'], 'title' => $button['label']])) . ' '; } $data .= '</div>'; return $data; }
public function getIcon($ext) { if ($ext == 'doc' || $ext == 'docx') { return Icon::show('file-word-o', ['class' => 'text-primary']); } else { if ($ext == 'xls' || $ext == 'xlsx') { return Icon::show('file-excel-o', ['class' => 'text-success']); } else { if ($ext == 'ppt' || $ext == 'pptx') { return Icon::show('file-powerpoint-o', ['class' => 'text-danger']); } else { if ($ext == 'pdf') { return Icon::show('file-pdf-o', ['class' => 'text-danger']); } else { if ($ext == 'txt') { return Icon::show('file-text'); } } } } } }
<div class="wrapper"> <header class="main-header"> <a class="logo bg-red"> <?php echo Html::img('http://lukisongroup.com/favicon.ico', ['width' => '20']); ?> <!-- LOGO --> LukisonGroup </a> <!-- <div class="navbar-custom-menu">!--> <?php // echo \yii\helpers\Json::encode($menuItems); if (!Yii::$app->user->isGuest) { //$menuItems = MenuHelper::getAssignedMenu(Yii::$app->user->id); $menuItems = MenuHelper::getAssignedMenu(Yii::$app->user->id, null, $callback); $menuItems[] = ['label' => Icon::show('power-off'), 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]; NavBar::begin(['brandLabel' => '<!-- Sidebar toggle button--> <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"> <span class="sr-only">Toggle Navigation</span> </a>', 'options' => ['class' => ['navbar navbar-inverse navbar-static-top', 'style' => 'background-color:#313131'], 'role' => 'button', 'style' => 'margin-bottom: 0']]); echo NavX::widget(['options' => ['class' => 'navbar-nav navbar-left'], 'items' => $menuItems, 'activateParents' => true, 'encodeLabels' => false]); NavBar::end(); } ?> <!-- </div>!--> </header> <aside class="main-sidebar"> <section class="sidebar"> <!-- User Login --> <div class="user-panel">
}, type:'POST' }).done(function(){container.slideUp()}); } return false; }); DEL; $this->registerJs($deleteJS); ?> <div class="panel-body"> <?php Pjax::begin(['id' => 'WidgetLocationPjax']); echo ListView::widget(array('id' => 'LocationsTable', 'dataProvider' => $dpLocations, 'itemView' => '@frenzelgmbh/cmaddress/widgets/views/iviews/_location_view', 'layout' => '{items}')); echo "<p> </p>"; ?> <div class="navbar navbar-default"> <?php echo Html::a('<span class="btn btn-success navbar-btn pull-right tipster" title="add location">' . Icon::show('plus', ['class' => 'fa'], Icon::FA) . ' add location</span>', array("/posts/widgetconfig/addlocation", 'id' => $id, 'module' => $module), array('class' => 'create')); ?> </div> <?php Pjax::end(); ?> </div>
</div> <div class="form-group resizeHeight"> <label for="<?php echo $idWidget; ?> _cbox_resize_height" class="col-md-3"><?php echo Cropbox::t('Height'); ?> </label> <div class="col-md-6"> <?php echo Slider::widget(['name' => $idWidget . '_cbox_resize_height', 'sliderColor' => Slider::TYPE_GREY, 'handleColor' => Slider::TYPE_PRIMARY, 'pluginOptions' => ['orientation' => 'horizontal', 'handle' => 'round', 'step' => 1, 'tooltip' => 'hide'], 'pluginEvents' => ['slide' => "function(e) {\n \$('#{$idWidget}').cropbox('resizeThumbBox', {height: e.value});\n }"]]); ?> </div> </div> </div> <div class="cropped"> <?php if (is_string($originalUrl) && !empty($originalUrl)) { echo Html::a(Icon::show('eye') . Cropbox::t('Show original'), $originalUrl, ['target' => '_blank', 'class' => 'btn btn-info']); } if (!empty($previewUrl)) { foreach ($previewUrl as $url) { echo Html::img($url, ['class' => 'img-thumbnail']); } } ?> </div> </div> <?php echo Html::activeHiddenInput($model, $attributeCropInfo);
use yii\helpers\Html; use yii\helpers\Url; use kartik\grid\GridView; use kartik\icons\Icon; use common\helpers\ThumbHelper; /* @var $this yii\web\View */ /* @var $searchModel backend\modules\Slides\models\search\SearchSlider */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('app', 'Slides'); $this->params['breadcrumbs'][] = $this->title; $this->registerCss("\n .slide-index img {\n width: 180px;\n height: 38px;\n }\n"); ?> <div class="slide-index"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'hover' => true, 'showPageSummary' => false, 'responsive' => true, 'showFooter' => false, 'export' => false, 'pjax' => true, 'bordered' => true, 'striped' => false, 'condensed' => false, 'panel' => ['heading' => Html::tag('h3', Icon::show('image') . Yii::t('app', 'Slides'), ['class' => 'panel-title']), 'type' => GridView::TYPE_DEFAULT], 'toolbar' => [['content' => Html::a(Icon::show('plus'), ['create'], ['title' => Yii::t('users', 'Add User'), 'class' => 'btn btn-success']) . ' ' . Html::a(Icon::show('repeat'), ['index'], ['class' => 'btn btn-default', 'title' => Yii::t('users', 'Reset Grid')])]], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['format' => 'raw', 'width' => '190px', 'attribute' => 'image', 'value' => function ($model) { return ThumbHelper::getImg($model->img, 180, 38); }], ['attribute' => 'title', 'width' => '60%'], ['format' => 'raw', 'attribute' => 'url', 'value' => function ($model) { return Html::a('link', $model->url, ['_target' => 'blank']); }], ['class' => 'kartik\\grid\\BooleanColumn', 'attribute' => 'status', 'vAlign' => 'middle'], 'created_at:datetime', ['header' => Yii::t('users', 'Actions'), 'class' => 'kartik\\grid\\ActionColumn', 'dropdown' => false, 'vAlign' => 'middle', 'urlCreator' => function ($action, $model, $key, $index) { $link = '#'; switch ($action) { case 'view': $link = Url::toRoute(['view', 'id' => $model->id]); break; case 'update': $link = Url::toRoute(['update', 'id' => $model->id]); break; case 'delete': $link = Url::toRoute(['delete', 'id' => $model->id]); break;
public function init() { $fields = ['copyFrom' => ['buttonIdSuffix' => '-copyButton', 'buttonIcon' => 'code', 'jsMethodName' => 'Admin.copyFrom'], 'makeSlug' => ['buttonIdSuffix' => '-slugButton', 'buttonIcon' => 'code', 'jsMethodName' => 'Admin.makeSlug'], 'makeKey' => ['buttonIdSuffix' => '-keyButton', 'buttonIcon' => 'code', 'jsMethodName' => 'Admin.makeKey']]; foreach ($fields as $fieldName => $params) { if (true === is_array($this->{$fieldName})) { $id = Html::getInputId($this->model, $this->attribute); $buttonId = $id . $params['buttonIdSuffix']; $this->addon['append'] = ['content' => Html::button(Icon::show($params['buttonIcon']), ['class' => 'btn btn-primary', 'id' => $buttonId]), 'asButton' => true]; $encodedFrom = Json::encode($this->{$fieldName}); $encodedTo = Json::encode('#' . $id); $js = <<<EOT \$("#{$buttonId}").click(function() { {$params['jsMethodName']}({$encodedFrom}, {$encodedTo}); }); EOT; $this->form->getView()->registerJs($js); } } parent::init(); }