public function actionLeaderboard($type = null)
 {
     if ($type == null) {
         $type = GamePointUtil::LEADERBOARD_TYPE_WEEKLY;
     }
     if ($type == GamePointUtil::LEADERBOARD_TYPE_WEEKLY) {
         $activeActionElementType = 'LeaderboardWeeklyMenu';
     } elseif ($type == GamePointUtil::LEADERBOARD_TYPE_MONTHLY) {
         $activeActionElementType = 'LeaderboardMonthlyMenu';
     } elseif ($type == GamePointUtil::LEADERBOARD_TYPE_OVERALL) {
         $activeActionElementType = 'LeaderboardOverallMenu';
     } else {
         throw new NotSupportedException();
     }
     $metadata = array();
     //can put the typing information here easily. from the type.
     $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('listPageSize', get_class($this->getModule()));
     $gameLevel = new GameLevel(false);
     $dataProvider = RedBeanModelDataProviderUtil::makeDataProvider($metadata, get_class($gameLevel), 'LeaderboardDataProvider', 'notUsed', true, $pageSize);
     $dataProvider->setType($type);
     if (isset($_GET['ajax']) && $_GET['ajax'] == 'list-view') {
         $listView = new LeaderboardListView($this->getId(), $this->getModule()->getId(), get_class($gameLevel), $dataProvider, array());
         $view = new AccountsPageView($listView);
     } else {
         $mixedView = new LeaderboardActionBarAndListView($this->getId(), $this->getModule()->getId(), $gameLevel, 'GamificationModule', $dataProvider, $activeActionElementType);
         $view = new AccountsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $mixedView));
     }
     echo $view->render();
 }
 public function actionMassDelete()
 {
     $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('massDeleteProgressPageSize');
     $deptReference = new DepartmentReference(false);
     $activeAttributes = $this->resolveActiveAttributesFromMassDeletePost();
     $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(new DepartmentReferencesSearchForm($deptReference), $pageSize, Yii::app()->user->userModel->id, null, 'DepartmentReferencesSearchView');
     $selectedRecordCount = $this->getSelectedRecordCountByResolvingSelectAllFromGet($dataProvider);
     $deptReference = $this->processMassDelete($pageSize, $activeAttributes, $selectedRecordCount, 'DepartmentReferencesPageView', $deptReference, DepartmentReferencesModule::getModuleLabelByTypeAndLanguage('Plural'), $dataProvider);
     $massDeleteView = $this->makeMassDeleteView($deptReference, $activeAttributes, $selectedRecordCount, DepartmentReferencesModule::getModuleLabelByTypeAndLanguage('Plural'));
     $view = new DepartmentReferencesPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $massDeleteView));
     echo $view->render();
 }
 public function actionDetails($id)
 {
     $savedReport = static::getModelAndCatchNotFoundAndDisplayError('SavedReport', intval($id));
     ControllerSecurityUtil::resolveCanCurrentUserAccessModule($savedReport->moduleClassName);
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($savedReport);
     AuditEvent::logAuditEvent('ZurmoModule', ZurmoModule::AUDIT_EVENT_ITEM_VIEWED, array(strval($savedReport), 'ReportsModule'), $savedReport);
     $breadCrumbLinks = array(strval($savedReport));
     $breadCrumbView = new ReportBreadCrumbView($this->getId(), $this->getModule()->getId(), $breadCrumbLinks);
     $detailsAndRelationsView = $this->makeReportDetailsAndRelationsView($savedReport, Yii::app()->request->getRequestUri(), $breadCrumbView);
     $view = new ReportsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $detailsAndRelationsView));
     echo $view->render();
 }
 protected function preFilter($filterChain)
 {
     if (isset($_POST['ajax'])) {
         return true;
     }
     if (Yii::app()->emailHelper->outboundHost != null) {
         return true;
     }
     $messageView = new NoGlobalEmailConfigurationYetView();
     $pageViewClassName = $this->controller->getModule()->getPluralCamelCasedName() . 'PageView';
     $view = new $pageViewClassName(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this->controller, $messageView));
     echo $view->render();
     return false;
 }
 protected function preFilter($filterChain)
 {
     if (isset($_POST['ajax'])) {
         return true;
     }
     $isLdapExtensionLoaded = InstallUtil::isLdapInstalled();
     if ($isLdapExtensionLoaded) {
         return true;
     }
     $messageView = new NoLdapExtensionLoadedView();
     $pageViewClassName = $this->controller->getModule()->getPluralCamelCasedName() . 'PageView';
     $view = new $pageViewClassName(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this->controller, $messageView));
     echo $view->render();
     return false;
 }
 public function actionLeaderboard($type = null)
 {
     if ($type == null) {
         $type = GamePointUtil::LEADERBOARD_TYPE_WEEKLY;
     }
     if ($type == GamePointUtil::LEADERBOARD_TYPE_WEEKLY) {
         $activeActionElementType = 'LeaderboardWeeklyLink';
     } elseif ($type == GamePointUtil::LEADERBOARD_TYPE_MONTHLY) {
         $activeActionElementType = 'LeaderboardMonthlyLink';
     } elseif ($type == GamePointUtil::LEADERBOARD_TYPE_OVERALL) {
         $activeActionElementType = 'LeaderboardOverallLink';
     } else {
         throw new NotSupportedException();
     }
     $view = new TitleBarAndLeaderboardView($this->getId(), $this->getModule()->getId(), GamePointUtil::getUserLeaderboardData($type), $activeActionElementType);
     $view = new LeaderboardPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $view));
     echo $view->render();
 }
 /**
  * Check if user set their primary email address.
  * @param CFilterChain $filterChain
  * @return bool
  * @throws NotFoundException
  * @throws NotSupportedException
  */
 protected function preFilter($filterChain)
 {
     if ($this->userId != null) {
         $user = User::getById($this->userId);
     } else {
         throw new NotSupportedException();
     }
     if (isset($_POST['ajax'])) {
         return true;
     }
     if ($user->primaryEmail->emailAddress != null) {
         return true;
     }
     $messageView = new NoPrimaryEmailAddressForLoggedUserYetView($this->userId);
     $pageViewClassName = $this->controller->getModule()->getPluralCamelCasedName() . 'PageView';
     $view = new $pageViewClassName(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this->controller, $messageView));
     echo $view->render();
     return false;
 }
 protected function preFilter($filterChain)
 {
     if (isset($_POST['ajax'])) {
         return true;
     }
     //Added some logic for watching there is last unmatched mail deleted
     $pageSize = null;
     $emailMessage = new EmailMessage(false);
     $searchAttributes = array();
     $metadataAdapter = new ArchivedEmailMatchingSearchDataProviderMetadataAdapter($emailMessage, Yii::app()->user->userModel->id, $searchAttributes);
     $dataProvider = RedBeanModelDataProviderUtil::makeDataProvider($metadataAdapter->getAdaptedMetadata(), 'EmailMessage', 'RedBeanModelDataProvider', 'createdDateTime', true, $pageSize);
     $data = $dataProvider->getData();
     if (count($data) > 0) {
         return true;
     }
     $messageView = new ZeroEmailMessagesRequiringArchivingView();
     $pageViewClassName = $this->controller->getModule()->getPluralCamelCasedName() . 'PageView';
     $view = new $pageViewClassName(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this->controller, $messageView));
     echo $view->render();
     return false;
 }
 protected function preFilter($filterChain)
 {
     $getData = GetUtil::getData();
     $modelClassName = ArrayUtil::getArrayValue($getData, 'modelClassName');
     if ($modelClassName == null) {
         return true;
     }
     if ($modelClassName::getCount() != 0) {
         return true;
     }
     $moduleClassName = $modelClassName::getModuleClassName();
     $mashableRules = MashableUtil::createMashableInboxRulesByModel($modelClassName);
     if ($mashableRules->getZeroModelViewClassName() == null) {
         return true;
     }
     $messageViewClassName = $mashableRules->getZeroModelViewClassName();
     $messageView = new $messageViewClassName($this->controller->getId(), $moduleClassName::getDirectoryName(), $modelClassName);
     $pageViewClassName = $this->controller->getModule()->getPluralCamelCasedName() . 'PageView';
     $view = new $pageViewClassName(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this->controller, $messageView));
     echo $view->render();
     return false;
 }
 /**
  * Example of a sequential process.
  * @see TestCompleteSequentialProcessView
  * @see TestSequentialProcess
  * @param string $step
  */
 function actionSequentialProcess($step)
 {
     if (isset($_GET['nextParams'])) {
         $nextParams = $_GET['nextParams'];
     } else {
         $nextParams = null;
     }
     Yii::import('application.core.tests.unit.models.*');
     Yii::import('application.core.tests.unit.components.*');
     Yii::import('application.core.tests.unit.views.*');
     assert('$step == null || is_string($step)');
     assert('$nextParams == null || is_array($nextParams)');
     //////Do setup logic here if needed
     $a = new A();
     $b = new B();
     $sequentialProcess = new TestSequentialProcess($a, $b);
     $sequentialProcess->run($step, $nextParams);
     $nextStep = $sequentialProcess->getNextStep();
     $route = $this->getModule()->getId() . '/' . $this->getId() . '/sequentialProcess';
     if ($sequentialProcess->isComplete()) {
         //////Do completion logic here if needed
         $sequenceView = new TestCompleteSequentialProcessView($a, $b);
     } else {
         $sequenceView = SequentialProcessViewFactory::makeBySequentialProcess($sequentialProcess, $route);
     }
     if ($step == null) {
         $gridView = new GridView(2, 1);
         $titleBarView = new TitleBarView('Zurmo', 'Test Sequential Process');
         $wrapperView = new SequentialProcessContainerView($sequenceView, $sequentialProcess->getAllStepsMessage());
         $gridView->setView($titleBarView, 0, 0);
         $gridView->setView($wrapperView, 1, 0);
         $view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $gridView));
     } else {
         $view = new AjaxPageView($sequenceView);
     }
     echo $view->render();
 }
 public function actionAssemblyStep3($id)
 {
     if (empty($_SERVER['HTTP_REFERER'])) {
         $this->redirect(array('/costbook/default/Assembly'));
     }
     $Costbook = static::getModelAndCatchNotFoundAndDisplayError("Costbook", intval($id));
     $editAndDetailsView = new CostbookAssemblyStep3View('Edit', $this->getId(), $this->getModule()->getId(), $this->attemptToSaveModelFromPost($Costbook));
     $view = new CostbookPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $editAndDetailsView));
     echo $view->render();
 }
 /**
  * Depending on the user interface, the user views should utilize the admin or regular view.  This especially
  * important for mobile, since for mobile there are no admin views available yet.
  * @param $containedView
  * @param $breadCrumbLinks
  * @param $breadcrumbViewClassName
  * @return GridView
  */
 protected function resolveZurmoDefaultOrAdminView(View $containedView, $breadCrumbLinks, $breadcrumbViewClassName)
 {
     assert('is_array($breadCrumbLinks)');
     assert('is_string($breadcrumbViewClassName)');
     if (Yii::app()->userInterface->isMobile()) {
         return ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $containedView);
     } else {
         return ZurmoDefaultAdminViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $containedView, $breadCrumbLinks, $breadcrumbViewClassName);
     }
 }
Exemple #13
0
 /**
  * Only supports saving 4 layoutTypes (max 2 column)
  *
  */
 public function actionEditDashboard($id)
 {
     $id = intval($id);
     $dashboard = Dashboard::getById(intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($dashboard);
     if (isset($_POST['Dashboard'])) {
         $oldLayoutType = $dashboard->layoutType;
         $dashboard->setAttributes($_POST['Dashboard']);
         assert('in_array($dashboard->layoutType, array_keys(Dashboard::getLayoutTypesData()))');
         if ($dashboard->save()) {
             if ($oldLayoutType != $dashboard->layoutType && $dashboard->layoutType == '100') {
                 $uniqueLayoutId = 'HomeDashboard' . $dashboard->layoutId;
                 $portletCollection = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition($uniqueLayoutId, Yii::app()->user->userModel->id, array());
                 Portlet::shiftPositionsBasedOnColumnReduction($portletCollection, 1);
             }
             GeneralCache::forgetAll();
             //Ensure menu refreshes
             $this->redirect(array('default/dashboardDetails', 'id' => $dashboard->id));
         }
     }
     $editView = new DashboardEditView($this->getId(), $this->getModule()->getId(), $dashboard, strval($dashboard));
     $view = new AccountsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $editView));
     echo $view->render();
 }
 public function actionConvert($id)
 {
     assert('!empty($id)');
     $contact = Contact::getById(intval($id));
     if (!LeadsUtil::isStateALead($contact->state)) {
         $urlParams = array('/contacts/' . $this->getId() . '/details', 'id' => $contact->id);
         $this->redirect($urlParams);
     }
     $convertToAccountSetting = LeadsModule::getConvertToAccountSetting();
     $selectAccountForm = new AccountSelectForm();
     $account = new Account();
     ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($contact);
     $userCanAccessContacts = RightsUtil::canUserAccessModule('ContactsModule', Yii::app()->user->userModel);
     $userCanAccessAccounts = RightsUtil::canUserAccessModule('AccountsModule', Yii::app()->user->userModel);
     $userCanCreateAccount = RightsUtil::doesUserHaveAllowByRightName('AccountsModule', AccountsModule::RIGHT_CREATE_ACCOUNTS, Yii::app()->user->userModel);
     LeadsControllerSecurityUtil::resolveCanUserProperlyConvertLead($userCanAccessContacts, $userCanAccessAccounts, $convertToAccountSetting);
     if (isset($_POST['AccountSelectForm'])) {
         $selectAccountForm->setAttributes($_POST['AccountSelectForm']);
         if ($selectAccountForm->validate()) {
             $account = Account::getById(intval($selectAccountForm->accountId));
             $this->actionSaveConvertedContact($contact, $account);
         }
     } elseif (isset($_POST['Account'])) {
         $account = LeadsUtil::attributesToAccountWithNoPostData($contact, $account, $_POST['Account']);
         $account->setAttributes($_POST['Account']);
         if ($account->save()) {
             $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($contact);
             ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($account, $explicitReadWriteModelPermissions);
             if (!$account->save()) {
                 throw new NotSupportedException();
             }
             $this->actionSaveConvertedContact($contact, $account);
         }
     } elseif (isset($_POST['AccountSkip']) || $convertToAccountSetting == LeadsModule::CONVERT_NO_ACCOUNT || $convertToAccountSetting == LeadsModule::CONVERT_ACCOUNT_NOT_REQUIRED && !$userCanAccessAccounts) {
         $this->actionSaveConvertedContact($contact);
     } else {
         $account = LeadsUtil::attributesToAccount($contact, $account);
     }
     $convertView = new LeadConvertView($this->getId(), $this->getModule()->getId(), $contact->id, strval($contact), $selectAccountForm, $account, $convertToAccountSetting, $userCanCreateAccount);
     $view = new LeadsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $convertView));
     echo $view->render();
 }
 public function actionMatchingList()
 {
     $userCanAccessContacts = RightsUtil::canUserAccessModule('ContactsModule', Yii::app()->user->userModel);
     $userCanAccessLeads = RightsUtil::canUserAccessModule('LeadsModule', Yii::app()->user->userModel);
     EmailMessagesControllerSecurityUtil::resolveCanUserProperlyMatchMessage($userCanAccessContacts, $userCanAccessLeads);
     $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('listPageSize', get_class($this->getModule()));
     $emailMessage = new EmailMessage(false);
     $searchAttributes = array();
     $metadataAdapter = new ArchivedEmailMatchingSearchDataProviderMetadataAdapter($emailMessage, Yii::app()->user->userModel->id, $searchAttributes);
     $dataProvider = RedBeanModelDataProviderUtil::makeDataProvider($metadataAdapter->getAdaptedMetadata(), 'EmailMessage', 'RedBeanModelDataProvider', 'createdDateTime', true, $pageSize);
     $titleBarAndListView = new TitleBarAndListView($this->getId(), $this->getModule()->getId(), $emailMessage, 'EmailMessage', $dataProvider, 'ArchivedEmailMatchingListView', Zurmo::t('EmailMessagesModule', 'Unmatched Archived Emails'), array(), false);
     $view = new EmailMessagesPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $titleBarAndListView));
     echo $view->render();
 }
 public function actionUserInterface($type = null)
 {
     if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
         throw new NotSupportedException();
     }
     if ($type == null) {
         $demoView = new MenuUserInterfaceDemoView();
         $view = new ZurmoConfigurationPageView(ZurmoDefaultAdminViewUtil::makeStandardViewForCurrentUser($this, $demoView));
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::STANDARD_VIEW) {
         $demoView = new StandardUserInterfaceDemoView();
         $demoView->message = 'Standard View';
         $view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $demoView));
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::STANDARD_BREADCRUMBS_VIEW) {
         $breadCrumbLinks = array('Breadcrumb 1' => array('/zurmo/demo/userInterface'), 'Breadcrumb 2');
         $demoView = new StandardUserInterfaceDemoView();
         $demoView->message = 'Standard View with BreadCrumbs';
         $view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $demoView, $breadCrumbLinks, 'SettingsBreadCrumbView'));
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::GRACEFUL_ERROR_VIEW) {
         $demoView = new StandardUserInterfaceDemoView();
         $demoView->message = 'Graceful Error View';
         $view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeErrorViewForCurrentUser($this, $demoView));
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::UNEXPECTED_ERROR_VIEW) {
         $view = new ErrorPageView('Unexpected error view');
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::AUTHORIZATION_VIEW) {
         $demoView = new StandardUserInterfaceDemoView();
         $demoView->message = 'Authorization View';
         $view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeAuthorizationViewForCurrentUser($this, $demoView));
         $view->setCssClasses(array_merge($view->getCssClasses(), array('ZurmoAuthorizationPageView')));
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::CONTACT_FORM_EXTERNAL_VIEW) {
         $containedView = new ContactExternalEditAndDetailsView('Edit', $this->getId(), $this->getModule()->getId(), new ContactWebFormsModelForm(new Contact()), ContactExternalEditAndDetailsView::getMetadata());
         $view = new ContactWebFormsExternalPageView(ZurmoExternalViewUtil::makeExternalViewForCurrentUser($containedView));
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::MARKETING_LISTS_EXTERNAL_PREVIEW_VIEW) {
         $splashView = new MarketingListsExternalActionsPreviewView();
         $view = new MarketingListsExternalActionsPageView($this, $splashView);
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::MARKETING_LISTS_MANAGE_SUBSCRIPTIONS_VIEW) {
         $marketingListMember = MarketingListMember::getSubset(null, 0, 1);
         $marketingLists = MarketingList::getByUnsubscribedAndAnyoneCanSubscribe($marketingListMember[0]->contact->id);
         $listView = new MarketingListsManageSubscriptionsListView($this->getId(), $this->getModule()->getId(), $marketingLists, -100, -100, -100, 'notUsed');
         $view = new MarketingListsManageSubscriptionsPageView($this, $listView);
         echo $view->render();
     } elseif ($type == MenuUserInterfaceDemoView::MOBILE_HEADER_VIEW) {
         Yii::app()->userInterface->setSelectedUserInterfaceType(UserInterface::MOBILE);
         $demoView = new StandardUserInterfaceDemoView();
         $demoView->message = 'Standard View';
         $view = new ZurmoConfigurationPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $demoView));
         echo $view->render();
     } else {
         throw new NotSupportedException();
     }
 }
 /**
  * @param Activity $activity
  * @param null $redirectUrl
  */
 protected function processEdit(Activity $activity, $redirectUrl = null)
 {
     $pageViewClassName = $this->getPageViewClassName();
     $view = new $pageViewClassName(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($activity, $redirectUrl), 'Edit')));
     echo $view->render();
 }
 /**
  * Action for displaying a mass delete form and also action when that form is first submitted.
  * When the form is submitted, in the event that the quantity of models to delete is greater
  * than the pageSize, then once the pageSize quantity has been reached, the user will be
  * redirected to the makeMassDeleteProgressView.
  * In the mass delete progress view, a javascript refresh will take place that will call a refresh
  * action, usually makeMassDeleteProgressView.
  * If there is no need for a progress view, then a flash message will be added and the user will
  * be redirected to the list view for the model.  A flash message will appear providing information
  * on the delete records.
  * @see Controller->makeMassDeleteProgressView
  * @see Controller->processMassDelete
  * @see
  */
 public function actionMassDelete()
 {
     $params = LabelUtil::getTranslationParamsForAllModules();
     $title = Zurmo::t('TasksModule', 'Mass Delete TasksModulePluralLabel', $params);
     $breadCrumbLinks = array($title);
     $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('massDeleteProgressPageSize');
     $task = new Task(false);
     $activeAttributes = $this->resolveActiveAttributesFromMassDeletePost();
     $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(new TasksSearchForm($task), $pageSize, Yii::app()->user->userModel->id, null, 'TasksSearchView');
     $selectedRecordCount = $this->getSelectedRecordCountByResolvingSelectAllFromGet($dataProvider);
     $task = $this->processMassDelete($pageSize, $activeAttributes, $selectedRecordCount, 'TasksPageView', $task, TasksModule::getModuleLabelByTypeAndLanguage('Plural'), $dataProvider);
     $massDeleteView = $this->makeMassDeleteView($task, $activeAttributes, $selectedRecordCount, TasksModule::getModuleLabelByTypeAndLanguage('Plural'));
     $view = new TasksPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $massDeleteView));
     echo $view->render();
 }
 /**
  * Action for displaying a mass delete form and also action when that form is first submitted.
  * When the form is submitted, in the event that the quantity of models to delete is greater
  * than the pageSize, then once the pageSize quantity has been reached, the user will be
  * redirected to the makeMassDeleteProgressView.
  * In the mass delete progress view, a javascript refresh will take place that will call a refresh
  * action, usually makeMassDeleteProgressView.
  * If there is no need for a progress view, then a flash message will be added and the user will
  * be redirected to the list view for the model.  A flash message will appear providing information
  * on the delete records.
  * @see Controller->makeMassDeleteProgressView
  * @see Controller->processMassDelete
  * @see
  */
 public function actionMassDelete()
 {
     $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('massDeleteProgressPageSize');
     $queueItem = new WorkflowMessageInQueue(false);
     $activeAttributes = $this->resolveActiveAttributesFromMassDeletePost();
     $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(new WorkflowMessageInQueuesSearchForm($queueItem), $pageSize, Yii::app()->user->userModel->id, null, 'WorkflowMessageInQueuesSearchView');
     $selectedRecordCount = static::getSelectedRecordCountByResolvingSelectAllFromGet($dataProvider);
     $queueItem = $this->processMassDelete($pageSize, $activeAttributes, $selectedRecordCount, 'WorkflowsPageView', $queueItem, Zurmo::t('WorkflowsModule', 'Message Queue'), $dataProvider, array($this->getId() . '/list'));
     $massDeleteView = $this->makeMassDeleteView($queueItem, $activeAttributes, $selectedRecordCount, Zurmo::t('WorkflowsModule', 'Message Queue'), 'MassDeleteView', false);
     $view = new WorkflowsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $massDeleteView));
     echo $view->render();
 }
 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();
 }
 /**
  * Creates by modal
  * @param Project $project
  * @param string $redirectUrl
  */
 protected function actionCreateByModel(Project $project, $redirectUrl = null)
 {
     $titleBarAndEditView = $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($project, $redirectUrl), 'Edit');
     $view = new ProjectsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $titleBarAndEditView));
     echo $view->render();
 }
 public function actionPushLayout($id)
 {
     $modelClassName = $this->getModelName();
     $model = $modelClassName::getById(intval($id));
     if (isset($_POST[$modelClassName])) {
         $groupsAndUsers = PushDashboardUtil::resolveGroupsAndUsersFromPost($_POST[$modelClassName]);
         PushDashboardUtil::pushLayoutToUsers($model, $groupsAndUsers);
         Yii::app()->user->setFlash('notification', Zurmo::t('ZurmoModule', 'Layout pushed successfully'));
         $this->redirect(array($this->getId() . '/details', 'id' => $id));
     }
     $editView = new PushDashboardEditView($this->getId(), $this->getModule()->getId(), $model, Zurmo::t('ZurmoModule', 'Push Layout'));
     $view = new ZurmoPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $editView));
     echo $view->render();
 }
Exemple #23
0
 /**
  * Render that page view for the mashableInbox. If $modelClassName is set it will render the model listView
  * otherwise it will render a listView with all mashableInbox models merged
  * @param MashableInboxForm $mashableInboxForm
  * @param string $modelClassName
  */
 private function renderMashableInboxPageView($mashableInboxForm, $modelClassName)
 {
     $actionViewOptions = array();
     if ($modelClassName !== null) {
         $mashableUtilRules = MashableUtil::createMashableInboxRulesByModel($modelClassName);
         $listView = $mashableUtilRules->getListView($mashableInboxForm->optionForModel, $mashableInboxForm->filteredBy, $mashableInboxForm->searchTerm);
         $actionViewOptions = $mashableUtilRules->getActionViewOptions();
     } else {
         $listView = $this->getMashableInboxListView($mashableInboxForm, $this->pageSize);
     }
     $actionBarView = new MashableInboxActionBarForViews($this->getId(), $this->getModule()->getId(), $listView, $actionViewOptions, $mashableInboxForm, $modelClassName);
     $view = new MashableInboxPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $actionBarView));
     echo $view->render();
 }
 public function actionGlobalList()
 {
     if (!isset($_GET['MixedModelsSearchForm']['anyMixedAttributesScope']) || in_array('All', $_GET['MixedModelsSearchForm']['anyMixedAttributesScope'])) {
         $scopeData = null;
     } else {
         $scopeData = $_GET['MixedModelsSearchForm']['anyMixedAttributesScope'];
     }
     $term = $_GET['MixedModelsSearchForm']['term'];
     $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('listPageSize', get_class($this->getModule()));
     $dataCollection = new MixedModelsSearchResultsDataCollection($term, $pageSize, Yii::app()->user->userModel);
     if (Yii::app()->request->getIsAjaxRequest() && isset($_GET["ajax"])) {
         $selectedModule = $_GET["ajax"];
         $selectedModule = str_replace('list-view-', '', $selectedModule);
         $view = $dataCollection->getListView($selectedModule);
     } else {
         $listView = new MixedModelsSearchAndListView($dataCollection->getViews(), $term, $scopeData);
         $view = new MixedModelsSearchPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $listView));
     }
     echo $view->render();
 }
 /**
  * Action for displaying a mass delete form and also action when that form is first submitted.
  * When the form is submitted, in the event that the quantity of models to delete is greater
  * than the pageSize, then once the pageSize quantity has been reached, the user will be
  * redirected to the makeMassDeleteProgressView.
  * In the mass delete progress view, a javascript refresh will take place that will call a refresh
  * action, usually makeMassDeleteProgressView.
  * If there is no need for a progress view, then a flash message will be added and the user will
  * be redirected to the list view for the model.  A flash message will appear providing information
  * on the delete records.
  * @see Controler->makeMassDeleteProgressView
  * @see Controller->processMassDelete
  * @see
  */
 public function actionMassDelete()
 {
     $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('massDeleteProgressPageSize');
     $contact = new Contact(false);
     $activeAttributes = $this->resolveActiveAttributesFromMassDeletePost();
     $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(new ContactsSearchForm($contact), $pageSize, Yii::app()->user->userModel->id, 'ContactsStateMetadataAdapter', 'ContactsSearchView');
     $selectedRecordCount = static::getSelectedRecordCountByResolvingSelectAllFromGet($dataProvider);
     $contact = $this->processMassDelete($pageSize, $activeAttributes, $selectedRecordCount, 'ContactsPageView', $contact, ContactsModule::getModuleLabelByTypeAndLanguage('Plural'), $dataProvider);
     $massDeleteView = $this->makeMassDeleteView($contact, $activeAttributes, $selectedRecordCount, ContactsModule::getModuleLabelByTypeAndLanguage('Plural'));
     $view = new ContactsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $massDeleteView));
     echo $view->render();
 }
 protected function actionCreateByModel(Conversation $conversation, $redirectUrl)
 {
     $editView = new ConversationEditView($this->getId(), $this->getModule()->getId(), $this->attemptToSaveModelFromPost($conversation, $redirectUrl), Zurmo::t('ConversationsModule', 'Create Conversation'));
     $view = new ConversationsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $editView));
     echo $view->render();
 }
 protected function processEdit(AccountContactAffiliation $accountContactAffiliation, $redirectUrl = null)
 {
     $view = new AccountContactAffiliationsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($accountContactAffiliation, $redirectUrl), 'Edit')));
     echo $view->render();
 }
 /**
  * Combined details for the calendar.
  */
 public function actionCombinedDetails()
 {
     $dataProvider = CalendarUtil::getCalendarItemsDataProvider(Yii::app()->user->userModel);
     $interactiveCalendarView = new CombinedCalendarView($dataProvider, $this->getId(), $this->getModule()->getId());
     $view = new CalendarsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $interactiveCalendarView));
     echo $view->render();
 }
 /**
  * Process the editing of product
  * @param Product $product
  * @param string $redirectUrl
  */
 protected function processEdit(Product $product, $redirectUrl = null)
 {
     $view = new ProductsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($product, $redirectUrl), 'Edit')));
     echo $view->render();
 }
 protected function processMassAction($pageSize, $selectedRecordCount, $pageViewClassName, $listModel, $title, $actionId, $dataProvider = null)
 {
     // TODO: @Shoaibi/@Jason: Low: Candidate for MassActionController
     assert('$dataProvider == null || $dataProvider instanceof CDataProvider');
     $postSelectedRecordCount = Yii::app()->request->getPost('selectedRecordCount');
     $modelClassName = get_class($listModel);
     $postModelClassName = Yii::app()->request->getPost($modelClassName);
     if (isset($postSelectedRecordCount) || isset($postModelClassName)) {
         $page = static::resolvePageValueForMassAction($modelClassName);
         $insufficientPermissionSkipSavingUtil = static::resolveInsufficientPermissionSkipSavingUtilByMassActionId($actionId);
         $start = $selectedRecordCount > $pageSize ? 1 : $selectedRecordCount;
         $skipCount = $selectedRecordCount > $pageSize ? null : 0;
         $massActionSuccessful = static::processModelsForMassAction($listModel, $modelClassName, $selectedRecordCount, $dataProvider, $page, $pageSize, $insufficientPermissionSkipSavingUtil, $postModelClassName, $actionId);
         if ($massActionSuccessful) {
             $progressView = $this->makeMassActionProgressView($listModel, 1, $selectedRecordCount, $start, $pageSize, $title, $skipCount, $actionId);
             if ($selectedRecordCount > $pageSize) {
                 $view = new $pageViewClassName(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $progressView));
                 echo $view->render();
             } else {
                 $refreshScript = $progressView->renderRefreshScript();
                 Yii::app()->user->setFlash('notification', $refreshScript['message']);
                 $this->redirect($this->resolveReturnUrlForMassAction());
             }
             Yii::app()->end(0, false);
         }
     }
     return $listModel;
 }