/** * On an module remove hook call this listener * * Listens for the 'user.account.create' event. * * @param Zikula_Event $event Event. */ public static function onCreateUser(Zikula_Event $event) { if (!ModUtil::getVar('Dashboard', 'widgetsnewuser', false)) { return; } $user = $event->getSubject(); $helper = new Dashboard_Helper_WidgetHelper(ServiceUtil::getService('doctrine.entitymanager')); $widgets = $helper->getRegisteredWidgets($user['uid']); foreach ($widgets as $widget) { Dashboard_Util::addUserWidget($user['uid'], $widget); } }
public function view() { if (!SecurityUtil::checkPermission('Dashboard::', '::', ACCESS_READ)) { return LogUtil::registerPermissionError(); } $uid = $this->request->getSession()->get('uid'); $helper = new Dashboard_Helper_WidgetHelper($this->entityManager); $dashboard = $helper->getUserWidgets($uid); $this->view->assign('userWidgets', $dashboard); $widgets = $helper->getRegisteredWidgets($uid); $this->view->assign('widgets', $widgets); $checkbox = (int) $this->request->getSession()->get('dashboard/available_widget_checkbox', false); $this->view->assign('available_checkbox', $checkbox); return $this->view->fetch('User/view.html.tpl'); }
/** * Display block. * * @param array $blockInfo a blockinfo structure * * @return string html block */ public function display($blockInfo) { if (!SecurityUtil::checkPermission('Dashboard::', "::", ACCESS_READ)) { return; } // Break out options from our content field $vars = BlockUtil::varsFromContent($blockInfo['content']); if ($this->view->getCaching()) { $this->view->setCacheId($blockInfo['bkey'] . '/bid' . $blockInfo['bid'] . '/' . UserUtil::getGidCacheString()); if ($this->view->is_cached('Block/dashboard.html.tpl')) { $blockInfo['content'] = $this->view->fetch('Block/dashboard.html.tpl'); return BlockUtil::themeBlock($blockInfo); } } $uid = $this->request->getSession()->get('uid'); $helper = new Dashboard_Helper_WidgetHelper($this->entityManager); $dashboard = $helper->getUserWidgets($uid); $this->view->assign('userWidgets', $dashboard); // get the block content $blockInfo['content'] = $this->view->fetch('Block/dashboard.html.tpl'); // pass the block array back to the theme for display return BlockUtil::themeBlock($blockInfo); }