public function actionPushDashboard($id) { $dashboard = Dashboard::getById(intval($id)); $modelClassName = get_class($dashboard); if (isset($_POST[$modelClassName])) { $groupsAndUsers = PushDashboardUtil::resolveGroupsAndUsersFromPost($_POST[$modelClassName]); PushDashboardUtil::pushDashboardToUsers($dashboard, $groupsAndUsers); Yii::app()->user->setFlash('notification', Zurmo::t('HomeModule', 'Dashboard pushed successfully')); $this->redirect(array('default/dashboardDetails', 'id' => $dashboard->id)); } $editView = new PushDashboardEditView($this->getId(), $this->getModule()->getId(), $dashboard, Zurmo::t('HomeModule', 'Push Dashboard')); $view = new HomePageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $editView)); echo $view->render(); }
public function actionCreateDashboard() { $dashboard = new Dashboard(); if (isset($_POST['Dashboard'])) { $dashboard->owner = Yii::app()->user->userModel; $dashboard->layoutId = Dashboard::getNextLayoutId(); $dashboard->setAttributes($_POST['Dashboard']); assert('in_array($dashboard->layoutType, array_keys(Dashboard::getLayoutTypesData()))'); if ($dashboard->save()) { GeneralCache::forgetAll(); //Ensure menu refreshes $this->redirect(array('default/dashboardDetails', 'id' => $dashboard->id)); } } $editView = new DashboardEditView($this->getId(), $this->getModule()->getId(), $dashboard, Zurmo::t('HomeModule', 'Create Dashboard')); $view = new HomePageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $editView)); echo $view->render(); }