Автор: XE Developers (developers@xpressengine.com)
Наследование: implements Illuminate\Contracts\Support\Renderable, implements Xpressengine\Plugin\ComponentInterface, use trait Xpressengine\Plugin\ComponentTrait
Пример #1
0
 public function render()
 {
     $args = $this->arguments;
     PhpQuery::newDocument();
     $this->markup = PhpQuery::pq($this->template);
     $label = $this->markup['label'];
     $textarea = $this->markup['textarea'];
     $description = $this->markup['.help-block'];
     foreach ($args as $key => $arg) {
         switch ($key) {
             case 'class':
                 $textarea->addClass($arg);
                 break;
             case 'label':
                 $label->removeClass('hidden')->html($arg);
                 break;
             case 'description':
                 $description->html($arg);
                 break;
             case 'value':
                 $textarea->html($arg);
                 break;
             case 'id':
                 $label->attr('for', $arg);
                 // pass to default
             // pass to default
             default:
                 $textarea->attr($key, $arg);
                 break;
         }
     }
     return parent::render();
 }
 public function render()
 {
     $args = $this->arguments;
     $permissionInfo = $args['permission'];
     $title = $permissionInfo['title'];
     /** @var Permission $permission */
     $permission = $permissionInfo['permission'];
     // permission is collection of grant
     // grant is bundle of assigned
     // $grant = [
     //    'rating' => $visibleGrant['rating'],
     //    'group' => UserGroup::whereIn('id', $visibleGrant['group'])->get()->toArray(),
     //    'user' => User::whereIn('id', $visibleGrant['user'])->get()->toArray(),
     //    'except' => User::whereIn('id', $visibleGrant['except'])->get()->toArray(),
     // ];
     $groups = app('xe.user.groups')->all();
     $settings = [];
     $content = uio('permission', ['mode' => 'manual', 'title' => 'access', 'grant' => $this->getGrant($permission['access']), 'groups' => $groups]);
     $settings[] = $this->generateBox($title, $content);
     $this->template = implode(PHP_EOL, $settings);
     //        XeFrontend::js('/assets/core/permission/Permission.js')->unload();
     //        XeFrontend::js([
     //
     //            '/assets/core/permission/SettingsPermission.js',
     //            '/assets/core/permission/PermissionTag.js'
     //
     //        ])->load();
     return parent::render();
 }
Пример #3
0
 public function render()
 {
     $args = $this->arguments;
     PhpQuery::newDocument();
     $this->markup = PhpQuery::pq($this->template);
     $label = $this->markup['label'];
     $select = $this->markup['select'];
     // label
     if (isset($args['label'])) {
         $label->removeClass('hidden')->html($args['label']);
     }
     // id
     if (isset($args['id'])) {
         $label->attr('for', $args['id']);
         $select->attr('id', $args['id']);
     }
     // name
     if (isset($args['name'])) {
         $select->attr('name', $args['name']);
     }
     $menus = XeMenu::getAll(XeSite::getCurrentSiteKey());
     foreach ($menus as $menu) {
         $option = PhpQuery::pq('<option></option>');
         $option->appendTo($select)->attr('value', $menu->id)->html($menu->title);
         if (isset($args['selected']) && $menu->id == $args['selected']) {
             $option->attr('selected', 'selected');
         } elseif (isset($args['value']) && $menu->id == $args['value']) {
             $option->attr('selected', 'selected');
         }
     }
     return parent::render();
 }
 public function render()
 {
     $htmlString = [];
     $args = $this->arguments;
     $title = $args['title'];
     $type = $args['type'];
     $target = $args['target'];
     /** @var Factory $permissionFactory */
     $permissionFactory = app('xe.permission');
     $permission = $permissionFactory->make($type, $target);
     $actions = $permission->getActions();
     $registered = $permission->getRegistered();
     $groups = app('xe.member.groups')->all();
     $settings = [];
     $content = [];
     foreach ($actions as $action) {
         $pureGrant = $registered->pure($action);
         $mode = "manual";
         $content[] = uio('permission', ['mode' => $mode, 'title' => $action, 'grant' => $this->getGrant($registered, $action), 'groups' => $groups])->render();
     }
     $content = implode('<hr>', $content);
     $settings[] = $this->generateBox($title, $content);
     $this->template = implode(PHP_EOL, $settings);
     return parent::render();
 }
Пример #5
0
 public function render()
 {
     $args = $this->arguments;
     PhpQuery::newDocument();
     $this->markup = PhpQuery::pq($this->template);
     $label = $this->markup['label'];
     $input = $this->markup['input'];
     foreach ($args as $key => $arg) {
         switch ($key) {
             case 'class':
                 $input->addClass($arg);
                 break;
             case 'label':
                 $label->removeClass('hidden')->html($arg);
                 break;
             case 'id':
                 $label->attr('for', $arg);
                 // pass to default
             // pass to default
             default:
                 $input->attr($key, $arg);
                 break;
         }
     }
     return parent::render();
 }
Пример #6
0
 public function render()
 {
     /**
      * @var $menus array of \Xpressengine\Menu\Menu
      */
     $args = $this->arguments;
     $menus = $args['menus'];
     $htmlString = [];
     if (sizeof($menus) > 0) {
         /**
          * @var $menu MenuEntity
          */
         foreach ($menus as $menu) {
             $menuHeadString = $this->headHtml($menu);
             $treeString = $this->itemHtml($menu->id, $menu->getItems());
             $bottomString = $this->bottomHtml();
             $htmlString[] = $menuHeadString;
             $htmlString[] = $treeString;
             $htmlString[] = $bottomString;
         }
     }
     //        else {
     //            $htmlString[] = "<p>등록된 메뉴가 존재하지 않습니다.</p>";
     //        }
     $htmlString[] = $this->newMenuHtml();
     $this->template = implode('', $htmlString);
     return parent::render();
 }
Пример #7
0
 public function render()
 {
     $this->loadFiles();
     $args = $this->arguments;
     $seq = $this->seq();
     // set default file upload options
     $fileuploadOptions = ['previewMaxWidth' => 280, 'previewMaxHeight' => 120, 'previewCrop' => false, 'autoUpload' => false, 'acceptFileTypes' => "(\\.|\\/)(.*)\$", 'maxFileSize' => 5000000, 'replaceFileInput' => false, 'disableImageResize' => true, 'imageCrop' => false, 'imageMaxWidth' => 480, 'imageMaxHeight' => 240];
     // set file
     if (isset($args['file'])) {
         $file = File::find($args['file']);
         if ($file === null) {
             unset($args['file']);
         } else {
             $filename = $file->clientname;
             $args['file'] = $filename;
         }
     }
     // resolve arguments
     $fileuploadOptions = array_merge($fileuploadOptions, array_get($args, 'fileuploadOptions', []));
     $args = array_add($args, 'width', 420);
     $args = array_add($args, 'height', 240);
     array_set($fileuploadOptions, 'previewMaxWidth', $args['width']);
     array_set($fileuploadOptions, 'previewMaxHeight', $args['height']);
     $types = array_get($args, 'types');
     if ($types !== null) {
         array_set($fileuploadOptions, 'acceptFileTypes', '(\\.|\\/)(' . implode('|', (array) $types) . ')$');
     }
     array_set($args, 'fileuploadOptions', $fileuploadOptions);
     // render template
     $this->template = \View::make($this->view, ['args' => $args, 'seq' => $seq])->render();
     return parent::render();
 }
Пример #8
0
 public function render()
 {
     $args = $this->arguments;
     PhpQuery::newDocument();
     if (array_get($args, 'action') === null) {
         $this->template = '<div class="panel-group"></div>';
     } else {
         $this->template = '<form method="POST" enctype="multipart/form-data"></form>';
     }
     $this->markup = PhpQuery::pq($this->template);
     $form = $this->markup;
     foreach ($args as $key => $arg) {
         switch ($key) {
             case 'class':
                 $form->addClass($arg);
                 break;
             case 'inputs':
                 $this->appendInputs($form, $arg, array_get($args, 'value', []));
             default:
                 $form->attr($key, $arg);
                 break;
         }
     }
     return parent::render();
 }
Пример #9
0
 public function render()
 {
     $args = $this->arguments;
     PhpQuery::newDocument();
     $this->markup = PhpQuery::pq($this->template);
     $labelEl = $this->markup['label'];
     $selectEl = $this->markup['select'];
     $selectedValue = array_get($args, 'selected', null);
     if ($selectedValue === null) {
         $selectedValue = array_get($args, 'value', null);
     }
     foreach ($args as $key => $arg) {
         switch ($key) {
             case 'class':
                 $selectEl->addClass($arg);
                 break;
             case 'label':
                 $labelEl->removeClass('hidden')->html($arg);
                 break;
             case 'options':
                 $options = $arg;
                 if (is_callable($options)) {
                     $options = $options();
                 }
                 foreach ($options as $value => $option) {
                     if (is_array($option) === false) {
                         $text = $option;
                         if (is_string($value) === false) {
                             $value = $option;
                         }
                         $selected = '';
                     } else {
                         $value = array_get($option, 'value', $value);
                         $text = array_get($option, 'text', $value);
                     }
                     if ($selectedValue === null) {
                         $selected = array_get($option, 'selected', false) ? 'selected="selected"' : '';
                     } else {
                         $selected = $value === $selectedValue ? 'selected="selected"' : '';
                     }
                     $optionEl = PhpQuery::pq("<option value=\"{$value}\" {$selected} \">{$text}</option>");
                     $selectEl->append($optionEl);
                 }
                 break;
             case 'id':
                 $labelEl->attr('for', $arg);
                 // pass to default
             // pass to default
             default:
                 if (is_string($arg)) {
                     $selectEl->attr($key, $arg);
                 }
                 break;
         }
     }
     return parent::render();
 }
Пример #10
0
 /**
  * render
  *
  * @return string
  */
 public function render()
 {
     $args = $this->arguments;
     /** @var \Xpressengine\Menu\ModuleHandler $typeHandler */
     $typeHandler = app('xe.module');
     $types = $typeHandler->getAllModuleInfo();
     $selectedTypeId = array_get($args, 'selectedType', static::$defaultSelectedId);
     $this->template = view($this->view, compact('types', 'selectedTypeId'))->render();
     $this->loadFiles();
     return parent::render();
 }
Пример #11
0
 /**
  * render
  *
  * @return string
  */
 public function render()
 {
     $args = $this->arguments;
     $menuType = $args['menuType'];
     $action = $args['action'];
     $param = $args['param'];
     $content = $menuType->{$action}($param);
     $this->template = view('uiobjects/menu/menuType', compact('content'))->render();
     $this->template = $content;
     return parent::render();
 }
Пример #12
0
 public function render()
 {
     $this->loadAssets();
     $args = $this->arguments;
     $seq = $this->seq();
     // set width, height
     $args = array_add($args, 'width', 420);
     $args = array_add($args, 'height', 420);
     // render template
     $this->template = \View::make($this->view, ['args' => $args, 'seq' => $seq])->render();
     return parent::render();
 }
Пример #13
0
 /**
  * UIObject가 출력될 때 호출되는 메소드이다.
  *
  * @return string
  */
 public function render()
 {
     $args = $this->arguments;
     $prefix = array_get($args, 'prefixName', 'theme_');
     /** @var ThemeHandler $themeHandler */
     $themeHandler = app('xe.theme');
     $themes = $themeHandler->getAllTheme();
     $siteThemes = $themeHandler->getSiteThemeId();
     $selectedThemeId = array_get($args, 'selectedTheme', $siteThemes);
     $this->template = view('uiobjects/theme/themeList', compact('themes', 'selectedThemeId', 'prefix'))->render();
     return parent::render();
 }
Пример #14
0
 public function render()
 {
     $htmlString = [];
     $args = $this->arguments;
     $grant = $args['grant'];
     $groups = $args['groups'];
     $inputTitle = $args['title'];
     if (isset($args['mode'])) {
         $htmlString[] = $this->generateHeaderHtml($inputTitle, $args['mode']);
     }
     $htmlString[] = $this->generateRatingHtml($inputTitle, $grant['rating']);
     $htmlString[] = $this->generateGroupHtml($inputTitle, $groups, $grant['group']);
     $htmlString[] = $this->generateUsersHtml($inputTitle, $grant['user']);
     $htmlString[] = $this->generateExceptHtml($inputTitle, $grant['except']);
     $this->template = implode('', $htmlString);
     return parent::render();
 }
Пример #15
0
 public function render()
 {
     $args = $this->arguments;
     $prefix = array_get($args, 'prefixName', 'theme_');
     /** @var ThemeHandler $themeHandler */
     $themeHandler = app('xe.theme');
     if (!isset($args['themes'])) {
         $themes = $themeHandler->getAllTheme();
     }
     if (!isset($args['selectedTheme'])) {
         $selectedThemeId = $themeHandler->getSiteThemeId();
     } else {
         $selectedThemeId = array_get($args, 'selectedTheme');
     }
     $this->loadFiles();
     $this->template = view($this->view, compact('themes', 'selectedThemeId', 'prefix'))->render();
     return parent::render();
 }
Пример #16
0
 /**
  * render
  *
  * @return string
  */
 public function render()
 {
     XeFrontend::js('/assets/vendor/lodash/lodash.min.js')->load();
     XeFrontend::js(['/assets/vendor/vendor.bundle.js', '/assets/core/permission/permission.bundle.js'])->load();
     XeFrontend::css('/assets/core/permission/permission.css')->load();
     XeFrontend::translation(['xe::inheritMode', 'xe::memberRatingAdministrator', 'xe::memberRatingManager', 'xe::member', 'xe::guest', 'xe::memberRating', 'xe::includeUserOrGroup', 'xe::excludeUser', 'xe::includeVGroup', 'xe::explainIncludeUserOrGroup', 'xe::explainExcludeUser']);
     $htmlString = [];
     $args = $this->arguments;
     $inheritMode = null;
     $grant = $args['grant'];
     $title = $args['title'];
     if (isset($args['mode'])) {
         $inheritMode = $args['mode'];
     }
     $permissionJsonString = $this->getPermissionJsonString($grant, $inheritMode);
     $htmlString[] = $this->loadReactComponent($title . 'xe_permission', $title, $permissionJsonString);
     $this->template = implode('', $htmlString);
     return parent::render();
 }
Пример #17
0
 public function render()
 {
     /**
      * @var $menu     \Xpressengine\Menu\MenuEntity
      * @var $maxDepth int
      * @var $subRoot  string
      */
     $args = $this->arguments;
     $menu = $args['menu'];
     $maxDepth = isset($args['maxDepth']) ? $args['maxDepth'] : 2;
     $subRoot = isset($args['subRoot']) ? $args['subRoot'] : '';
     $this->maxShowItemDepth = $maxDepth;
     if (isset($args['subRoot'])) {
         $menuItems = $menu->getItem($subRoot)->getChildren();
     } else {
         $menuItems = $menu->getItems();
     }
     $htmlString = $this->generateTreeHtml($menuItems);
     $this->template = $htmlString;
     return parent::render();
 }
Пример #18
0
 public function render()
 {
     $args = $this->arguments;
     PhpQuery::newDocument();
     $this->markup = PhpQuery::pq($this->template);
     $label = $this->markup['label'];
     $this->box = $this->markup['.checkbox'];
     $checkboxes = array_get($args, 'checkboxes');
     $nameGlobal = array_get($args, 'name');
     $labelText = array_get($args, 'label');
     if ($labelText !== null) {
         $label->removeClass('hidden')->html($labelText);
     }
     // checkbox가 따로 있을 경우
     if ($checkboxes !== null) {
         foreach ((array) $checkboxes as $arg) {
             $checkboxObj = PhpQuery::pq("<label class=\"checkbox-inline\"><input type=\"checkbox\"><span></span></label>");
             $arg = array_add($arg, 'name', $nameGlobal . '[]');
             $this->appendCheckbox($checkboxObj, $arg);
         }
         // checkbox가 따로 없을 경우
     } else {
         $checkboxObj = PhpQuery::pq("<input type=\"checkbox\">");
         foreach ($args as $key => $arg) {
             switch ($key) {
                 case 'class':
                     $checkboxObj->addClass('class', $arg);
                     break;
                 case 'id':
                     $label->attr('for', $arg);
                     // pass to default
                 // pass to default
                 default:
                     $checkboxObj->attr($key, $arg);
                     break;
             }
         }
     }
     return parent::render();
 }
Пример #19
0
 /**
  * render
  *
  * @return string
  */
 public function render()
 {
     XeFrontend::js('/assets/vendor/lodash/lodash.min.js')->load();
     XeFrontend::js('/assets/core/permission/PermissionTag.js')->type('text/jsx')->load();
     XeFrontend::js('/assets/core/permission/PermissionTagSuggestion.js')->type('text/jsx')->load();
     XeFrontend::js('/assets/core/permission/PermissionInclude.js')->type('text/jsx')->load();
     XeFrontend::js('/assets/core/permission/PermissionExclude.js')->type('text/jsx')->load();
     XeFrontend::js('/assets/core/permission/Permission.js')->type('text/jsx')->load();
     XeFrontend::css('/assets/core/permission/permission.css')->load();
     $permissioinScriptString = [];
     $permissioinScriptString[] = "<script type='text/jsx'>";
     $permissioinScriptString[] = "\$('.__xe__uiobject_permission').each(function(i) {";
     $permissioinScriptString[] = "var el = \$(this),";
     $permissioinScriptString[] = "data = el.data('data');";
     $permissioinScriptString[] = "key= el.data('key');";
     $permissioinScriptString[] = "type = el.data('type');";
     $permissioinScriptString[] = "memberUrl = el.data('memberUrl');";
     $permissioinScriptString[] = "groupUrl= el.data('groupUrl');";
     $permissioinScriptString[] = "vgroupAll= el.data('vgroupAll');";
     $permissioinScriptString[] = "React.render(<Permission ";
     $permissioinScriptString[] = "\n                                    key={key}\n                                    memberSearchUrl={memberUrl}\n                                    groupSearchUrl={groupUrl}\n                                    permission={data}\n                                    type={type}\n                                    vgroupAll={vgroupAll}\n                                    />";
     $permissioinScriptString[] = ", this);\n";
     $permissioinScriptString[] = "});";
     $permissioinScriptString[] = "</script>";
     $permissioinScriptString = implode('', $permissioinScriptString);
     XeFrontend::html('permissionUiobject')->content($permissioinScriptString)->load();
     $htmlString = [];
     $args = $this->arguments;
     $inheritMode = null;
     $grant = $args['grant'];
     $title = $args['title'];
     if (isset($args['mode'])) {
         $inheritMode = $args['mode'];
     }
     $permissionJsonString = $this->getPermissionJsonString($grant, $inheritMode);
     $htmlString[] = $this->loadReactComponent($title . 'xe_permission', $title, $permissionJsonString);
     $this->template = implode('', $htmlString);
     return parent::render();
 }
Пример #20
0
 public function render()
 {
     $args = $this->arguments;
     $widgetbox = null;
     $id = array_get($args, 'id');
     if ($id === null) {
         $widgetbox = array_get($args, 'widgetbox');
     }
     $handler = app('xe.widgetbox');
     $parser = app('xe.widget.parser');
     if ($widgetbox === null) {
         $widgetbox = $handler->find($id);
     }
     $content = null;
     if ($widgetbox) {
         $content = $widgetbox->content;
         $this->loadFiles();
     }
     $link = array_get($args, 'link');
     $this->template = view($this->view, compact('widgetbox', 'id', 'content', 'link'))->render();
     return parent::render();
 }
Пример #21
0
 public function render()
 {
     $args = $this->arguments;
     PhpQuery::newDocument();
     // action, style에 따라 다른 form을 생성
     $this->initTemplate();
     $this->markup = PhpQuery::pq($this->template);
     $form = $this->markup;
     foreach ($args as $key => $arg) {
         switch ($key) {
             case 'class':
                 $form->addClass($arg);
                 break;
             case 'inputs':
             case 'fields':
                 $this->appendFields($form, $arg, array_get($args, 'value', []));
             default:
                 $form->attr($key, $arg);
                 break;
         }
     }
     return parent::render();
 }
Пример #22
0
 public function render()
 {
     $args = $this->arguments;
     $show_code = array_get($args, 'show_code', true);
     $handler = app('xe.widget');
     $widgetList = $handler->getAll();
     $widgets = [];
     $widgets[''] = '위젯을 선택하세요';
     foreach ($widgetList as $id => $class) {
         $widgets[$id] = $class::getTitle();
     }
     //if (!isset($args['selectedWidget'])) {
     //    reset($widgetList);
     //    $selectedWidgetId = key($widgetList);
     //} else {
     //    $selectedWidgetId = array_get($args, 'selectedWidget');
     //}
     // except skin setting
     // $form = $handler->setup($selectedWidgetId);
     $this->loadFiles();
     $id = array_get($args, 'id', 'widget-generator-' . static::seq());
     $this->template = view($this->view, compact('widgets', 'id', 'show_code'))->render();
     return parent::render();
 }
Пример #23
0
 public function render()
 {
     $category = $this->arguments;
     return View::make('uiobjects.settings.chakIt', ['category' => $category, 'chakApiKey' => $this->chakApikey])->render();
     return parent::render();
 }
Пример #24
0
 /**
  * Rendered current object
  *
  * @return string
  */
 public function render()
 {
     $driver = isset($this->arguments['driver']) ? $this->arguments['driver'] : static::$manager->getDefaultDriver();
     $this->template = static::$manager->driver($driver)->render();
     return parent::render();
 }