public function create(Request $request, WidgetBoxHandler $handler, FrontendHandler $frontend) { $id = $request->get('id'); if (!$request->user()->isAdmin()) { throw new AccessDeniedHttpException(); } $widgetbox = $handler->find($id); if ($widgetbox) { throw new IDAlreadyExistsException(); } $frontend->css('assets/vendor/bootstrap/css/bootstrap.min.css')->loadAsync(); return apiRender('widgetbox.create', compact('id')); }
public function getPage() { $type = Input::get('type'); $id = Input::get('id'); $instanceId = Input::get('instanceId'); $items = []; /** @var AbstractToggleMenu $item */ foreach (XeToggleMenu::getItems($type, $instanceId, $id) as $item) { if ($item->allows() == false) { continue; } $items[] = ['text' => $item->getText(), 'type' => $item->getType(), 'action' => $item->getAction(), 'script' => $item->getScript(), 'icon' => $item->getIcon()]; } return apiRender('toggleMenu.get', ['items' => $items]); }
public function edit($provider) { $providers = $this->plugin->getProviders(); return apiRender('social_login::tpl.edit', compact('providers', 'provider')); }
public function getPrivacy() { $config = app('xe.config')->get('user.common'); $privacy = $config->get('privacy'); return apiRender('privacy', compact('privacy')); }
/** * get voted user modal * * @param Request $request request * @param string $menuUrl first segment * @param string $option options * @param string $id document id * @return mixed */ public function votedModal(Request $request, $menuUrl, $option, $id) { $item = $this->handler->getModel($this->config)->find($id); $this->handler->setModelConfig($item, $this->config); $counter = $this->handler->getVoteCounter(); $logModel = $counter->newModel(); $count = $logModel->where('counterName', $counter->getName())->where('targetId', $id)->where('counterOption', $option)->count(); return apiRender('votedModal', ['urlHandler' => $this->urlHandler, 'option' => $option, 'item' => $item, 'count' => $count]); }
public function getOperation(PluginHandler $handler, ComposerFileWriter $writer) { $operation = $handler->getOperation($writer); return apiRender('operation', compact('operation'), compact('operation')); }
/** * setup by code * * @param Request $request * @param WidgetParser $widgetParser * @param WidgetHandler $widgetHandler * @param SkinHandler $skinHandler * * @return mixed */ public function setup(Request $request, WidgetParser $widgetParser, WidgetHandler $widgetHandler, SkinHandler $skinHandler) { $this->validate($request, ['code' => 'required']); $code = $request->get('code'); $inputs = $widgetParser->parseCode($code); $widget = array_get($inputs, '@attributes.id'); $title = array_get($inputs, '@attributes.title', ''); // widget list $widgetList = $widgetHandler->getAll(); $widgets = []; $widgets[''] = '위젯을 선택하세요'; foreach ($widgetList as $id => $class) { $widgets[$id] = $class::getTitle(); } // skin list $skins = $skinHandler->getList($widget); // widget form $widgetForm = $widgetHandler->setup($widget, $inputs); // skin form $skinConfig = array_get($inputs, 'skin'); if ($skinConfig && array_has($skinConfig, '@attributes.id')) { $skin = array_get($skinConfig, '@attributes.id'); $skin = $skinHandler->get($skin); $skinForm = $skin->renderSetting($skinConfig); } else { $skinConfig = null; } return apiRender('widget.setup', compact('widgets', 'widget', 'title', 'skins', 'skin', 'widgetSelector', 'skinSelector', 'widgetForm', 'skinForm')); }