当前位置: 首页>>代码示例>>PHP>>正文


PHP Icon::make方法代码示例

本文整理汇总了PHP中Icon::make方法的典型用法代码示例。如果您正苦于以下问题:PHP Icon::make方法的具体用法?PHP Icon::make怎么用?PHP Icon::make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Icon的用法示例。


在下文中一共展示了Icon::make方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInput

 /**
  * Get the input corresponding to the field
  *
  * @return FormInput the input instance
  */
 public function getInput()
 {
     if (!is_array($this->search)) {
         $this->search = array('type' => 'text');
     }
     switch ($this->search['type']) {
         case 'select':
             $input = new SelectInput(array('options' => $this->search['options'], 'invitation' => isset($this->search['invitation']) ? $this->search['invitation'] : null, 'emptyValue' => isset($this->search['emptyValue']) ? $this->search['emptyValue'] : null, 'attributes' => array('e-value' => 'search', 'e-class' => "search ? 'alert-info not-empty' : 'empty'")));
             break;
         case 'checkbox':
             $input = new CheckboxInput(array('attributes' => array('e-value' => 'search')));
             break;
         case 'date':
             $input = new DatetimeInput(array('id' => uniqid(), 'after' => Icon::make(array('icon' => 'times-circle', 'class' => 'clean-search', 'e-click' => 'function(){ search = null; }', 'e-show' => 'search')), 'attributes' => array('e-value' => 'search', 'e-class' => "search ? 'alert-info not-empty' : 'empty'")));
             break;
         case 'text':
         default:
             $input = new TextInput(array('after' => Icon::make(array('icon' => 'times-circle', 'class' => 'clean-search', 'e-click' => 'function(){ search = null; }', 'e-show' => 'search')), 'attributes' => array('e-input' => 'search', 'e-class' => "search ? 'alert-info not-empty' : 'empty'")));
             break;
     }
     $input->attributes['data-field'] = $this->name;
     $input->class = ' list-search-input';
     $input->value = $this->searchValue;
     return $input;
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:30,代码来源:ItemListField.php

示例2: __construct

 /**
  * Constructor
  *
  * @param array $filters The filters
  */
 public function __construct($filters)
 {
     $options = array();
     // active languages
     $languages = array();
     $allLanguages = Language::getAll('tag');
     foreach ($allLanguages as $tag => $language) {
         $options[$tag] = $language->label;
         if ($language->active) {
             $languages[$tag] = $language;
         }
     }
     if (!in_array($filters['tag'], array_keys($allLanguages))) {
         $filters['tag'] = Lang::DEFAULT_LANGUAGE;
     }
     $param = array('id' => 'language-filter-form', 'method' => 'get', 'action' => App::router()->getUri('language-keys-list'), 'fieldsets' => array('filters' => array('nofieldset' => true, new SelectInput(array('name' => 'tag', 'options' => $options, 'default' => $filters['tag'], 'style' => 'width: 80%; margin-right: 5px;', 'label' => Lang::get('language.filter-language-label'), 'after' => Icon::make(array('icon' => 'pencil', 'class' => 'text-primary edit-lang', 'title' => Lang::get('language.filter-language-edit'))) . (count($allLanguages) > 1 && Option::get('main.language') != $filters['tag'] && $filters['tag'] != Lang::DEFAULT_LANGUAGE ? Icon::make(array('icon' => 'close', 'class' => 'text-danger delete-lang', 'title' => Lang::get('language.filter-language-delete'))) : ''))), new RadioInput(array('name' => 'keys', 'options' => array('missing' => Lang::get('language.filter-keys-missing'), 'all' => Lang::get('language.filter-keys-all')), 'default' => isset($filters['keys']) ? $filters['keys'] : 'all', 'label' => Lang::get('language.filter-keys-label'), 'labelWidth' => '100%', 'layout' => 'vertical')))));
     $this->form = new Form($param);
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:23,代码来源:LanguageFilterWidget.php

示例3: listRoles

 /**
  *  List all the roles
  */
 public function listRoles()
 {
     if (App::request()->getParams('setdefault')) {
         Option::set('roles.default-role', App::request()->getParams('setdefault'));
         $defaultRole = App::request()->getParams('setdefault');
     } else {
         $defaultRole = Option::get('roles.default-role');
     }
     $param = array('id' => 'roles-list', 'action' => App::router()->getUri('list-roles'), 'model' => 'Role', 'navigation' => false, 'controls' => array(array('icon' => 'plus', 'label' => Lang::get('roles.add-role-btn'), 'href' => App::router()->getUri('edit-role', array('roleId' => -1)), 'target' => 'dialog', 'class' => 'btn-success'), array('icon' => 'unlock-alt', 'label' => Lang::get('roles.edit-permissions-btn'), 'href' => App::router()->getUri('permissions'), 'target' => 'newtab')), 'fields' => array('removable' => array('field' => 'removable', 'hidden' => true), 'color' => array('field' => 'color', 'hidden' => true), 'actions' => array('independant' => true, 'display' => function ($value, $field, $line) {
         return Icon::make(array('icon' => 'pencil', 'class' => 'text-info', 'href' => App::router()->getUri('edit-role', array('roleId' => $line->id)), 'target' => 'dialog')) . Icon::make(array('icon' => 'unlock-alt', 'class' => 'text-success', 'href' => App::router()->getUri('role-permissions', array('roleId' => $line->id)), 'target' => 'newtab')) . ($line->isRemovable() ? Icon::make(array('icon' => 'close', 'class' => 'text-danger delete-role', 'data-role' => $line->id)) : '');
     }, 'search' => false, 'sort' => false), 'name' => array('independant' => true, 'label' => Lang::get('roles.list-name-label'), 'display' => function ($value, $field, $line) {
         return "<span style='color:{$line->color}'>" . Lang::get("roles.role-{$line->id}-label") . "</span>";
     }), 'default' => array('independant' => true, 'label' => Lang::get('roles.list-default-label'), 'display' => function ($value, $field, $line) use($defaultRole) {
         if ($line->id != 0) {
             $checkbox = new CheckboxInput(array('class' => 'set-default-role', 'value' => $defaultRole == $line->id, 'disabled' => $defaultRole == $line->id, 'attributes' => array('value' => $line->id)));
             return $checkbox->display();
         }
     }, 'search' => false, 'sort' => false)));
     $this->addKeysToJavaScript("roles.delete-role-confirmation");
     return View::make(Plugin::current()->getView("roles-list.tpl"), array('list' => new ItemList($param)));
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:24,代码来源:RoleController.php

示例4: medias

 /**
  * Media gallery
  */
 public function medias()
 {
     $theme = Theme::getSelected();
     $rootDir = $theme->getMediasDir();
     $files = glob($rootDir . '*');
     $medias = array('image' => array('icon' => 'picture-o', 'files' => array()), 'audio' => array('icon' => 'music', 'files' => array()), 'other' => array('icon' => 'file', 'files' => array()));
     $finfo = finfo_open(FILEINFO_MIME_TYPE);
     foreach ($files as $file) {
         if (is_file($file)) {
             $mime = finfo_file($finfo, $file);
             list($category, $precision) = explode('/', $mime);
             if (!in_array($category, array('audio', 'image'))) {
                 $category = 'other';
             }
             $url = $theme->getMediasUrl(basename($file));
             switch ($category) {
                 case 'image':
                     $medias[$category]['files'][] = array('url' => $url, 'display' => "<img src='{$url}' class='media-image-preview' />");
                     break;
                 default:
                     $medias[$category]['files'][] = array('url' => $url, 'display' => Icon::make(array('icon' => $medias[$category]['icon'])) . basename($file));
                     break;
             }
         }
     }
     $this->addKeysToJavaScript($this->_plugin . '.theme-delete-media-confirm');
     return View::make(Plugin::current()->getView("theme-medias.tpl"), array('medias' => $medias));
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:31,代码来源:ThemeController.php

示例5: function

<?php

namespace Hawk\Plugins\LangSwitcher;

Event::on(\Hawk\Plugins\Main\MainController::EVENT_AFTER_GET_MENUS, function (Event $event) {
    $languages = Language::getAllActive();
    if (count($languages) > 0) {
        $menus = $event->getData('menus');
        $menu = new MenuItem(array('id' => uniqid(), 'plugin' => 'lang-switcher', 'name' => 'selector', 'label' => strtoupper(LANGUAGE)));
        foreach ($languages as $language) {
            $menu->visibleItems[] = new MenuItem(array('id' => uniqid(), 'plugin' => 'lang-switcher', 'name' => $language->tag, 'label' => Icon::make(array('size' => 'fw', 'icon' => $language->tag == LANGUAGE ? 'check' : '')) . strtoupper($language->tag), 'action' => 'javascript: $.cookie("language", "' . $language->tag . '", {path : "/"}); location = app.getUri("index");'));
        }
        $menus['settings'][] = $menu;
        $event->setData('menus', $menus);
    }
});
开发者ID:elvyrra,项目名称:hawk,代码行数:16,代码来源:start.php

示例6: edit

 /**
  * Edit a profile question
  */
 public function edit()
 {
     $q = ProfileQuestion::getByName($this->name);
     $roles = Role::getAll();
     // Get roles associate to this ProfileQuestion in json parameters
     if ($q) {
         $attributesRoles = $q->getRoles();
     } else {
         $attributesRoles = array();
     }
     $allowedTypes = ProfileQuestion::$allowedTypes;
     $param = array('id' => 'profile-question-form', 'model' => 'ProfileQuestion', 'reference' => array('name' => $this->name), 'labelWidth' => '200px', 'fieldsets' => array('general' => array('legend' => Lang::get($this->_plugin . '.profile-question-form-general-legend'), new TextInput(array('name' => 'name', 'unique' => true, 'maxlength' => 32, 'label' => Lang::get($this->_plugin . '.profile-question-form-name-label') . ' ' . Lang::get($this->_plugin . '.profile-question-form-name-description'), 'required' => true)), new SelectInput(array('name' => 'type', 'required' => true, 'options' => array_combine($allowedTypes, array_map(function ($type) {
         return Lang::get($this->_plugin . '.profile-question-form-type-' . $type);
     }, $allowedTypes)), 'label' => Lang::get($this->_plugin . '.profile-question-form-type-label'), 'attributes' => array('e-value' => 'type'))), new CheckboxInput(array('name' => 'displayInRegister', 'label' => Lang::get($this->_plugin . '.profile-question-form-displayInRegister-label'))), new CheckboxInput(array('name' => 'displayInProfile', 'label' => Lang::get($this->_plugin . '.profile-question-form-displayInProfile-label'))), new HiddenInput(array('name' => 'editable', 'value' => 1))), 'parameters' => array('legend' => Lang::get($this->_plugin . '.profile-question-form-parameters-legend'), new ObjectInput(array('name' => 'parameters', 'id' => 'question-form-parameters', 'hidden' => true, 'attributes' => array('e-value' => 'parameters'))), new CheckboxInput(array('name' => 'required', 'independant' => true, 'label' => Lang::get($this->_plugin . '.profile-question-form-required-label'), 'attributes' => array('e-value' => "required"))), new CheckboxInput(array('name' => 'readonly', 'independant' => true, 'label' => Lang::get($this->_plugin . '.profile-question-form-readonly-label'), 'attributes' => array('e-value' => "readonly"))), new DatetimeInput(array('name' => 'minDate', 'independant' => true, 'label' => Lang::get($this->_plugin . '.profile-question-form-minDate-label'), 'attributes' => array('e-value' => "minDate"))), new DatetimeInput(array('name' => 'maxDate', 'independant' => true, 'label' => Lang::get($this->_plugin . '.profile-question-form-maxDate-label'), 'attributes' => array('e-value' => "maxDate"))), new HtmlInput(array('name' => 'parameters-description', 'value' => '<p class="alert alert-info">' . Icon::make(array('icon' => 'exclamation-circle')) . Lang::get($this->_plugin . '.profile-question-form-translation-description') . '</p>')), new TextInput(array('name' => 'label', 'required' => true, 'independant' => true, 'label' => Lang::get($this->_plugin . '.profile-question-form-label-label'), 'default' => $this->name != '_new' ? Lang::get($this->_plugin . '.profile-question-' . $this->name . '-label') : '')), new TextareaInput(array('name' => 'options', 'independant' => true, 'required' => App::request()->getBody('type') == 'select' || App::request()->getBody('type') == 'radio', 'label' => Lang::get($this->_plugin . '.profile-question-form-options-label') . '<br />' . Lang::get($this->_plugin . '.profile-question-form-options-description'), 'labelClass' => 'required', 'attributes' => array('e-value' => "options"), 'cols' => 20, 'rows' => 10))), '_submits' => array(new SubmitInput(array('name' => 'valid', 'value' => Lang::get('main.valid-button'))), new DeleteInput(array('name' => 'delete', 'value' => Lang::get('main.delete-button'), 'notDisplayed' => $this->name == '_new')), new ButtonInput(array('name' => 'cancel', 'value' => Lang::get('main.cancel-button'), 'onclick' => 'app.dialog("close")')))), 'onsuccess' => 'app.dialog("close"); app.load(app.getUri("profile-questions"), {selector : "#admin-questions-tab"})');
     $form = new Form($param);
     if (!$form->submitted()) {
         $this->addJavaScript($this->getPlugin()->getJsUrl('question-form.js'));
         $content = View::make(Plugin::current()->getView("question-form.tpl"), array('form' => $form));
         return View::make(Theme::getSelected()->getView("dialogbox.tpl"), array('title' => Lang::get($this->_plugin . ".users-questions-title"), 'icon' => 'file-word-o', 'page' => $content));
     } else {
         if ($form->submitted() == "delete") {
             $this->delete();
             return $form->response(Form::STATUS_SUCCESS);
         } else {
             if ($form->check()) {
                 $form->register(Form::NO_EXIT);
                 Language::current()->saveTranslations(array('admin' => array('profile-question-' . $form->getData("name") . '-label' => App::request()->getBody('label'))));
                 // Create the lang options
                 if ($form->inputs['options']->required) {
                     $keys = array('admin' => array());
                     foreach (explode(PHP_EOL, $form->getData("options")) as $i => $option) {
                         if (!empty($option)) {
                             $keys['admin']['profile-question-' . $form->getData("name") . '-option-' . $i] = trim($option);
                         }
                     }
                     Language::current()->saveTranslations($keys);
                 }
                 return $form->response(Form::STATUS_SUCCESS);
             }
         }
     }
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:45,代码来源:QuestionController.php

示例7: with_icon

 /**
  * Adds an icon to the next button
  *
  * @param string  $icon        The name of the icon to call
  * @param array   $attributes  Attributes to pass to the generated icon
  * @param boolean $prependIcon Whether we should prepend the icon, or append it
  *
  * @return object Button instance
  */
 public function with_icon($icon, $attributes = array(), $prependIcon = true)
 {
     // Call Icon to create the icon
     $icon = Icon::make($icon, $attributes);
     // If there was no text, just use the icon, else put a space between
     $value = $this->currentButton['value'];
     if (empty($value)) {
         $value = $icon;
     } else {
         $value = $prependIcon ? $icon . ' ' . $value : $value . ' ' . $icon;
     }
     // Store modified value
     $this->currentButton['value'] = $value;
     return $this;
 }
开发者ID:dyon,项目名称:flatstrapper,代码行数:24,代码来源:Button.php

示例8: listKeys

 /**
  * Display the list of the translation keys
  *
  * @param array $filters The filters to display the list
  */
 public function listKeys($filters = array())
 {
     if (empty($filters)) {
         $filters = $this->getFilters();
     }
     // Find all files in main-plugin, plugins dans userfiles
     $files = array();
     $dirs = array(MAIN_PLUGINS_DIR, PLUGINS_DIR, USERFILES_PLUGINS_DIR . Lang::TRANSLATIONS_DIR);
     foreach ($dirs as $dir) {
         if (is_dir($dir)) {
             $result = App::fs()->find($dir, '*.*.lang', FileSystem::FIND_FILE_ONLY);
         }
         foreach ($result as $file) {
             list($plugin, $language, $ext) = explode('.', basename($file));
             if (empty($files[$plugin])) {
                 $files[$plugin] = array();
             }
             if (empty($files[$plugin][$language])) {
                 $files[$plugin][$language] = array();
             }
             $files[$plugin][$language][$dir == USERFILES_PLUGINS_DIR . Lang::TRANSLATIONS_DIR ? 'translation' : 'origin'] = $file;
         }
     }
     $keys = array();
     foreach ($files as $plugin => $languages) {
         foreach ($languages as $tag => $paths) {
             foreach ($paths as $name => $file) {
                 $translations = parse_ini_file($file);
                 foreach ($translations as $key => $value) {
                     if (!is_array($value)) {
                         // This is a single key
                         $langKey = "{$plugin}.{$key}";
                         if (empty($keys[$langKey])) {
                             $keys[$langKey] = array();
                         }
                         $keys[$langKey][$tag] = $value;
                     } else {
                         // This is a multiple key
                         foreach ($value as $multiplier => $val) {
                             $langKey = $plugin . '.' . $key . '[' . $multiplier . ']';
                             if (empty($keys[$langKey])) {
                                 $keys[$langKey] = array();
                             }
                             $keys[$langKey][$tag] = $val;
                         }
                     }
                 }
             }
         }
     }
     $data = array();
     foreach ($keys as $langKey => $values) {
         if ($filters['keys'] != 'missing' || empty($values[$filters['tag']])) {
             $data[] = (object) array('langKey' => $langKey, 'origin' => isset($values[Lang::DEFAULT_LANGUAGE]) ? $values[Lang::DEFAULT_LANGUAGE] : '', 'translation' => isset($values[$filters['tag']]) ? $values[$filters['tag']] : '');
         }
     }
     $param = array('id' => 'language-key-list', 'action' => App::router()->getUri('language-keys-list'), 'data' => $data, 'controls' => array(array('type' => 'submit', 'icon' => 'save', 'label' => Lang::get('main.valid-button'), 'class' => 'btn-primary'), array('icon' => 'plus', 'label' => Lang::get('language.new-lang'), 'href' => App::router()->getUri('edit-language', array('tag' => 'new')), 'target' => 'dialog', 'class' => 'btn-success'), array('href' => App::router()->getUri('import-language-keys'), 'target' => 'dialog', 'icon' => 'download', 'label' => Lang::get('language.import-btn'), 'class' => 'btn-info')), 'fields' => array('langKey' => array('label' => Lang::get('language.key-list-key-label')), 'origin' => array('label' => Lang::get('language.key-list-default-translation-label', array('tag' => Lang::DEFAULT_LANGUAGE))), 'translation' => array('label' => Lang::get('language.key-list-default-translation-label', array('tag' => $filters['tag'])), 'display' => function ($value, $field, $line) use($filters) {
         $key = str_replace(array('[', ']'), array('{', '}'), $line->langKey);
         return "<textarea name='translation[{$filters['tag']}][{$key}]' cols='40' rows='5'>{$value}</textarea>";
     }), 'clean' => array('search' => false, 'sort' => false, 'display' => function ($value, $field, $line) {
         return Icon::make(array('icon' => 'undo', 'class' => 'text-danger delete-translation', 'title' => Lang::get('language.delete-translation-btn'), 'data-key' => $line->langKey));
     })));
     $list = new ItemList($param);
     return $list->__toString();
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:70,代码来源:LanguageController.php

示例9: listUsers

 /**
  * Display the list of the users
  */
 public function listUsers()
 {
     $example = array('id' => array('$ne' => User::GUEST_USER_ID));
     $filters = UserFilterWidget::getInstance()->getFilters();
     if (isset($filters['status']) && $filters['status'] != -1) {
         $example['active'] = $filters['status'];
     }
     $param = array('id' => 'admin-users-list', 'model' => 'User', 'action' => App::router()->getUri('list-users'), 'reference' => 'id', 'filter' => new DBExample($example), 'controls' => array(array('icon' => 'plus', 'label' => Lang::get($this->_plugin . '.new-user-btn'), 'class' => 'btn-success', 'href' => App::router()->getUri("edit-user", array('username' => '_new')), 'target' => 'dialog')), 'fields' => array('actions' => array('independant' => true, 'display' => function ($value, $field, $user) {
         $return = Icon::make(array('icon' => 'pencil', 'class' => 'text-primary', 'href' => App::router()->getUri('edit-user', array('username' => $user->username)), 'target' => 'dialog'));
         if ($user->isRemovable()) {
             $return .= Icon::make(array('icon' => 'close', 'class' => 'text-danger delete-user', 'data-user' => $user->username));
             $return .= $user->active ? Icon::make(array('icon' => 'lock', 'class' => 'text-warning lock-user', 'data-user' => $user->username)) : Icon::make(array('icon' => 'unlock', 'class' => 'text-success unlock-user', 'data-user' => $user->username));
         }
         return $return;
     }, 'search' => false, 'sort' => false), 'username' => array('label' => Lang::get($this->_plugin . '.users-list-username-label')), 'email' => array('label' => Lang::get($this->_plugin . '.users-list-email-label')), 'roleId' => array('label' => Lang::get($this->_plugin . '.users-list-roleId-label'), 'sort' => false, 'search' => array('type' => 'select', 'options' => call_user_func(function () {
         $options = array();
         foreach (Role::getAll('id', array('id')) as $id => $role) {
             $options[$id] = Lang::get('roles.role-' . $id . '-label');
         }
         return $options;
     }), 'invitation' => Lang::get($this->_plugin . '.user-filter-status-all')), 'display' => function ($value) {
         return Lang::get('roles.role-' . $value . '-label');
     }), 'active' => array('label' => Lang::get($this->_plugin . '.users-list-active-label'), 'search' => false, 'sort' => false, 'class' => function ($value) {
         return 'bold ' . ($value ? 'text-success' : 'text-danger');
     }, 'display' => function ($value) {
         return $value ? Lang::get($this->_plugin . '.users-list-active') : Lang::get($this->_plugin . '.users-list-inactive');
     }), 'createTime' => array('label' => Lang::get($this->_plugin . '.users-list-createTime-label'), 'search' => false, 'display' => function ($value) {
         return date(Lang::get('main.date-format'), $value);
     })));
     $list = new ItemList($param);
     if (App::request()->getParams('refresh')) {
         return $list->display();
     } else {
         $this->addKeysToJavaScript("admin.user-delete-confirmation");
         return View::make(Plugin::current()->getView("users-list.tpl"), array('list' => $list));
     }
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:40,代码来源:UserController.php


注:本文中的Icon::make方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。