/** * {@inheritdoc} */ public function getDescription(WidgetInterface $widget = null) { if (null === $widget) { return __('Weather Widget'); } return $widget->get('location', __('No location chosen.')); }
/** * {@inheritdoc} */ public function render(WidgetInterface $widget, $options = []) { if (ini_get('xdebug.max_nesting_level') < 1000) { ini_set('xdebug.max_nesting_level', 1000); } $layout = isset($options['layout']) ? $options['layout'] : 'extension://system/views/widgets/menu/nav.razr'; $root = $this['menus']->getTree($widget->get('menu', 0), ['access' => true, 'active' => true, 'status' => 1]); $startLevel = (int) $widget->get('start_level', 1) - 1; $maxDepth = $startLevel + ($widget->get('depth') ?: INF); foreach (new \RecursiveIteratorIterator($root, \RecursiveIteratorIterator::CHILD_FIRST) as $node) { $parent = $node->getParent(); $parent->setAttribute('parent', true); $depth = $node->getDepth(); if ($depth > $maxDepth) { $node->setParent(); } if ($node->getAttribute('active')) { $parent->setAttribute('active', true); if ($depth == $startLevel) { $root = $node; } } } if ($root->getDepth() != $startLevel) { return ''; } $root->setParent(); return $this['view']->render($layout, compact('widget', 'options', 'root')); }
/** * {@inheritdoc} */ public function getDescription(WidgetInterface $widget = null) { if (null === $widget) { return __('Feed Widget'); } return $widget->get('title', __('No title given.')); }
/** * {@inheritdoc} */ public function render(WidgetInterface $widget, $options = []) { $query = $this['users']->getUserRepository()->query(); if ($widget->get('show') == 'registered') { $query->orderBy('registered', 'DESC'); } else { $query->where('access > ?', [date('Y-m-d H:i:s', time() - 300)])->orderBy('access', 'DESC'); } $users = $query->limit($widget->get('count') ?: 8)->get(); return $this['view']->render('extension://system/views/admin/dashboard/user/index.razr', compact('widget', 'users', 'options')); }
/** * {@inheritdoc} */ public function render(WidgetInterface $widget, $options = []) { $user = $this['user']; if ($user->isAuthenticated()) { $redirect = $widget->get('redirect.logout') ?: $this['url']->current(true); return $this['view']->render('extension://system/views/widgets/login/logout.razr', compact('widget', 'user', 'options', 'redirect')); } $redirect = $widget->get('redirect.login') ?: $this['url']->current(true); $last_username = $this['session']->get(Auth::LAST_USERNAME); $remember_me_param = RememberMe::REMEMBER_ME_PARAM; return $this['view']->render('extension://system/views/widgets/login/login.razr', compact('widget', 'options', 'user', 'last_username', 'remember_me_param', 'redirect')); }
/** * {@inheritdoc} */ public function render(WidgetInterface $widget, $options = []) { return $this['content']->applyPlugins($widget->get('content'), ['widget' => $widget, 'markdown' => $widget->get('markdown')]); }