public function actionDetails($id) { $contact = static::getModelAndCatchNotFoundAndDisplayError('Contact', intval($id)); ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($contact); if (!LeadsUtil::isStateALead($contact->state)) { $urlParams = array('/contacts/' . $this->getId() . '/details', 'id' => $contact->id); $this->redirect($urlParams); } else { AuditEvent::logAuditEvent('ZurmoModule', ZurmoModule::AUDIT_EVENT_ITEM_VIEWED, array(strval($contact), 'LeadsModule'), $contact); $getData = GetUtil::getData(); $isKanbanBoardInRequest = ArrayUtil::getArrayValue($getData, 'kanbanBoard'); if ($isKanbanBoardInRequest == 0 || $isKanbanBoardInRequest == null || Yii::app()->userInterface->isMobile() === true) { $breadCrumbView = StickySearchUtil::resolveBreadCrumbViewForDetailsControllerAction($this, 'LeadsSearchView', $contact); $detailsAndRelationsView = $this->makeDetailsAndRelationsView($contact, 'LeadsModule', 'LeadDetailsAndRelationsView', Yii::app()->request->getRequestUri(), $breadCrumbView); $view = new LeadsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $detailsAndRelationsView)); } else { $kanbanItem = new KanbanItem(); $kanbanBoard = new TaskKanbanBoard($kanbanItem, 'type', $contact, get_class($contact)); $kanbanBoard->setIsActive(); $params['relationModel'] = $contact; $params['relationModuleId'] = $this->getModule()->getId(); $params['redirectUrl'] = null; $listView = new TasksForLeadKanbanView($this->getId(), 'tasks', 'Task', null, $params, null, array(), $kanbanBoard); $view = new LeadsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $listView)); } echo $view->render(); } }
/** * @return string */ protected function getDefaultRoute() { $getData = GetUtil::getData(); if (isset($getData['id']) && $getData['id'] != '') { return Yii::app()->createUrl($this->moduleId . '/' . $this->controllerId . '/details/', array('id' => $getData['id'])); } else { return Yii::app()->createUrl($this->moduleId . '/' . $this->controllerId); } }
/** * Check if the request is to display kanban view * @return boolean */ public static function isKanbanRequest() { $getData = GetUtil::getData(); $isKanbanBoardInRequest = ArrayUtil::getArrayValue($getData, 'kanbanBoard'); if ($isKanbanBoardInRequest == 0 || $isKanbanBoardInRequest == null || Yii::app()->userInterface->isMobile() === true) { return false; } return true; }
/** * Override so the pagination link works properly. * (non-PHPdoc) * @see ListView::getCGridViewPagerParams() */ protected function getCGridViewPagerParams() { $defaultGridViewPagerParams = array('prevPageLabel' => '<span>previous</span>', 'nextPageLabel' => '<span>next</span>', 'class' => 'EndlessListLinkPager', 'paginationParams' => GetUtil::getData(), 'route' => $this->getGridViewActionRoute('matchingList', $this->moduleId)); if (empty($this->gridViewPagerParams)) { return $defaultGridViewPagerParams; } else { return array_merge($defaultGridViewPagerParams, $this->gridViewPagerParams); } }
/** * @param CController $controller * @param $stickySearchKey * @param RedBeanModel $model * @return mixed */ public static function resolveBreadCrumbViewForDetailsControllerAction(CController $controller, $stickySearchKey, RedBeanModel $model) { assert('is_string($stickySearchKey)'); if (ArrayUtil::getArrayValue(GetUtil::getData(), 'stickyOffset') !== null && StickySearchUtil::getDataByKey($stickySearchKey) != null) { $stickyLoadUrl = Yii::app()->createUrl($controller->getModule()->getId() . '/' . $controller->getId() . '/renderStickyListBreadCrumbContent', array('stickyKey' => $stickySearchKey, 'stickyOffset' => ArrayUtil::getArrayValue(GetUtil::getData(), 'stickyOffset'), 'stickyModelId' => $model->id)); } else { $stickyLoadUrl = null; } $className = static::resolveStickyDetailsAndRelationsBreadCrumbViewClassName(); return new $className($controller->getId(), $controller->getModule()->getId(), static::resolveBreadcrumbLinks($model), $controller->getModule()->getModuleLabelByTypeAndLanguage('Plural'), $stickyLoadUrl); }
protected static function getZurmoControllerUtil() { $getData = GetUtil::getData(); $relatedUserId = ArrayUtil::getArrayValue($getData, 'relatedUserId'); if ($relatedUserId == null) { $relatedUser = null; } else { $relatedUser = User::getById((int) $relatedUserId); } return new SocialItemZurmoControllerUtil($relatedUser); }
protected function getDefaultRoute() { if (Yii::app()->controller->action->id == 'copy') { $getData = GetUtil::getData(); return Yii::app()->createUrl($this->moduleId . '/' . $this->controllerId . '/details/', array('id' => $getData['id'])); } elseif (Yii::app()->request->getParam('redirectUrl') != null) { return Yii::app()->request->getParam('redirectUrl'); } elseif (!empty($this->modelId) && $this->modelId > 0) { return Yii::app()->createUrl($this->moduleId . '/' . $this->controllerId . '/details/', array('id' => $this->modelId)); } else { return Yii::app()->createUrl($this->moduleId . '/' . $this->controllerId); } }
protected function getDataProvider(Report $report, $stickyKey, $runReport) { assert('is_string($stickyKey) || is_int($stickyKey)'); assert('is_bool($runReport)'); $getData = GetUtil::getData(); if (isset($getData['clearRuntimeFilters']) && $getData['clearRuntimeFilters']) { StickyReportUtil::clearDataByKey($stickyKey); } if (null != ($stickyData = StickyReportUtil::getDataByKey($stickyKey))) { StickyReportUtil::resolveStickyDataToReport($report, $stickyData); } $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('reportResultsListPageSize', get_class($this->getModule())); $dataProvider = ReportDataProviderFactory::makeByReport($report, $pageSize); if ($runReport) { $dataProvider->setRunReport($runReport); } return $dataProvider; }
/** * Utilizes information from the dataCollection object to * make a RedBeanDataProvider. Either looks at saved search information or params in the $_GET array. * variables: * modelName_sort * modelName * where modelName is Account for example. * Typically utilized by a listView action. */ public function makeRedBeanDataProviderByDataCollection($searchModel, $pageSize, $stateMetadataAdapterClassName = null, $dataCollection = null) { assert('is_int($pageSize)'); assert('$stateMetadataAdapterClassName == null || is_string($stateMetadataAdapterClassName)'); assert('$dataCollection instanceof SearchAttributesDataCollection || $dataCollection == null'); $listModelClassName = get_class($searchModel->getModel()); if ($dataCollection == null) { $dataCollection = new SearchAttributesDataCollection($searchModel); } $searchAttributes = $dataCollection->resolveSearchAttributesFromSourceData(); $dataCollection->resolveAnyMixedAttributesScopeForSearchModelFromSourceData(); $dataCollection->resolveSelectedListAttributesForSearchModelFromSourceData(); $sanitizedSearchAttributes = GetUtil::sanitizePostByDesignerTypeForSavingModel($searchModel, $searchAttributes); $sortAttribute = SearchUtil::resolveSortAttributeFromGetArray($listModelClassName); $sortDescending = SearchUtil::resolveSortDescendingFromGetArray($listModelClassName); $metadataAdapter = new SearchDataProviderMetadataAdapter($searchModel, Yii::app()->user->userModel->id, $sanitizedSearchAttributes); $metadata = static::resolveDynamicSearchMetadata($searchModel, $metadataAdapter->getAdaptedMetadata(), $dataCollection); return RedBeanModelDataProviderUtil::makeDataProvider($metadata, $listModelClassName, 'RedBeanModelDataProvider', $sortAttribute, $sortDescending, $pageSize, $stateMetadataAdapterClassName); }
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; }
/** * Add where clause for searching for related models * @param $modelClassName * @param array $metadata * @param $joinTablesAdapter * @return string * @throws NotSupportedException */ public static function makeWhere($modelClassName, array $metadata, &$joinTablesAdapter) { $data = GetUtil::getData(); if (!isset($data['relationAttributeName']) || !$modelClassName::isRelation($data['relationAttributeName']) || intval($data['id']) <= 0) { throw new NotSupportedException(); } $relationAttributeName = $data['relationAttributeName']; $additionalMetaData = static::getAdditionalSearchMetadata($relationAttributeName, $data); $clausesCount = 0; if (isset($metadata['clauses'])) { $clausesCount = count($metadata['clauses']); $metadata['clauses'][count($metadata['clauses']) + 1] = $additionalMetaData; } else { $metadata['clauses'][1] = $additionalMetaData; } if ($clausesCount == 0) { $metadata['structure'] = '(1)'; } else { $count = $clausesCount + 1; $metadata['structure'] = $metadata['structure'] . ' and (' . $count . ')'; } return ModelDataProviderUtil::makeWhere($modelClassName, $metadata, $joinTablesAdapter); }
/** * Resolves pagination params * @return array */ protected function resolvePaginationParams() { return array_merge(GetUtil::getData(), array('portletId' => $this->params['portletId'], 'redirectUrl' => $this->params['redirectUrl'])); }
protected static function processDynamicSearchAttributesDataForSavingModelRecursively($searchModel, &$searchAttributeData) { $processRecursively = false; foreach ($searchAttributeData as $attributeName => $attributeData) { if (isset($attributeData['relatedModelData']) && is_array($attributeData) && $attributeData['relatedModelData'] == true) { assert('count($attributeData) == 2'); $processRecursively = true; break; } } if ($processRecursively) { $modelToUse = self::resolveModelToUseByModelAndAttributeName($searchModel, $attributeName); self::processDynamicSearchAttributesDataForSavingModelRecursively($modelToUse, $searchAttributeData[$attributeName]); } else { $searchAttributeData = GetUtil::sanitizePostByDesignerTypeForSavingModel($searchModel, $searchAttributeData); } }
protected function resolveRouteParameters() { return array_merge(GetUtil::getData(), array('id' => $this->modelId, 'action' => 'copy')); }
protected function renderConfigSaveAjax($formName, $moduleId, $controllerId, $actionSave) { return ZurmoHtml::ajax(array('type' => 'POST', 'data' => 'js:$("#' . $formName . '").serialize()', 'url' => Yii::app()->createUrl($moduleId . '/' . $controllerId . '/' . $actionSave, GetUtil::getData()), 'update' => '#modalContainer')); }
protected function getCGridViewPagerParams() { return array('firstPageLabel' => '<span>first</span>', 'prevPageLabel' => '<span>previous</span>', 'nextPageLabel' => '<span>next</span>', 'lastPageLabel' => '<span>last</span>', 'class' => 'SimpleListLinkPager', 'paginationParams' => GetUtil::getData(), 'route' => 'default/daysMeetingsFromCalendarModalList'); }
protected function getCGridViewPagerParams() { return array('firstPageLabel' => '<span>first</span>', 'prevPageLabel' => '<span>previous</span>', 'nextPageLabel' => '<span>next</span>', 'lastPageLabel' => '<span>last</span>', 'paginationParams' => GetUtil::getData(), 'route' => $this->getGridViewActionRoute('jobLogsModalList', $this->moduleId), 'class' => 'SimpleListLinkPager'); }
public function actionDrillDownDetails($id, $rowId) { $savedReport = SavedReport::getById((int) $id); ControllerSecurityUtil::resolveCanCurrentUserAccessModule($savedReport->moduleClassName); ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($savedReport, true); $report = SavedReportToReportAdapter::makeReportBySavedReport($savedReport); $report->resolveGroupBysAsFilters(GetUtil::getData()); if (null != ($stickyData = StickyReportUtil::getDataByKey($report->id))) { StickyReportUtil::resolveStickyDataToReport($report, $stickyData); } $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('reportResultsSubListPageSize', get_class($this->getModule())); $dataProvider = ReportDataProviderFactory::makeForSummationDrillDown($report, $pageSize); $dataProvider->setRunReport(true); $view = new SummationDrillDownReportResultsGridView('default', 'reports', $dataProvider, $rowId); $content = $view->render(); Yii::app()->getClientScript()->setToAjaxMode(); Yii::app()->getClientScript()->render($content); echo $content; }
/** * After a portlet action is completed, the portlet must be refreshed. This is the url to correctly * refresh the portlet content. */ protected function getPortletDetailsUrl() { return Yii::app()->createUrl('/' . $this->moduleId . '/defaultPortlet/myListDetails', array_merge(GetUtil::getData(), array('portletId' => $this->params['portletId'], 'uniqueLayoutId' => $this->uniqueLayoutId))); }
protected function getCGridViewPagerParams() { return array('firstPageLabel' => '<span>first</span>', 'prevPageLabel' => '<span>previous</span>', 'nextPageLabel' => '<span>next</span>', 'lastPageLabel' => '<span>last</span>', 'class' => 'SimpleListLinkPager', 'paginationParams' => array_merge(GetUtil::getData(), array('portletId' => $this->params['portletId'])), 'route' => 'defaultPortlet/myListDetails'); }
protected function registerAjaxScript() { if ($this->nextParams != null) { $urlParams = array_merge(GetUtil::getData(), array('nextParams' => $this->nextParams)); } else { $getString = GetUtil::getData(); unset($getString['nextParams']); $urlParams = $getString; } $urlParams = array_merge($urlParams, array('step' => $this->nextStep)); $url = Yii::app()->createUrl($this->route, $urlParams); $script = ZurmoHtml::ajax(array('type' => 'GET', 'dataType' => 'html', 'url' => $url, 'update' => '#' . $this->containerViewId)); $script .= '$(\'#' . $this->getProgressBarId() . '\').progressbar({value: ' . $this->getProgressValue() . '});'; Yii::app()->clientScript->registerScript('sequentialProcess', $script); }
/** * @return array */ protected function getCGridViewPagerParams() { $defaultGridViewPagerParams = array('firstPageLabel' => '<span>first</span>', 'prevPageLabel' => '<span>previous</span>', 'nextPageLabel' => '<span>next</span>', 'lastPageLabel' => '<span>last</span>', 'class' => 'SimpleListLinkPager', 'paginationParams' => GetUtil::getData(), 'route' => 'defaultPortlet/details'); return $this->resolveDefaultGridViewPagerParams($defaultGridViewPagerParams); }
protected function getModalListLinkProvider() { $getData = GetUtil::getData(); $modalTransferInformation = ArrayUtil::getArrayValue($getData, 'modalTransferInformation'); if ($modalTransferInformation != null) { return new ImageSelectFromRelatedEditModalListLinkProvider($modalTransferInformation['sourceIdFieldId'], $modalTransferInformation['sourceNameFieldId'], $modalTransferInformation['modalId']); } else { return new ImageSelectFromRelatedEditModalListLinkProvider(null, null); } }
/** * Resolves portlet configurable parameters * @param boolean $portletsAreMovable * @param boolean $portletsAreRemovable */ protected function resolvePortletConfigurableParams(&$portletsAreMovable, &$portletsAreRemovable) { assert('is_bool($portletsAreMovable)'); assert('is_bool($portletsAreRemovable)'); $getData = GetUtil::getData(); if (isset($getData['lockPortlets'])) { $lockPortlets = (bool) $getData['lockPortlets']; if ($lockPortlets) { ZurmoDefaultViewUtil::setLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView', true); } else { ZurmoDefaultViewUtil::setLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView', false); } } $isViewLocked = ZurmoDefaultViewUtil::getLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView'); //Default case for the first time if ($isViewLocked === null) { ZurmoDefaultViewUtil::setLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView', true); $isViewLocked = true; } if ($isViewLocked == true) { $portletsAreRemovable = false; $portletsAreMovable = false; } }
protected function getCGridViewAjaxUrl() { $params = array_merge(GetUtil::getData(), array('portletId' => $this->params['portletId'])); return Yii::app()->createUrl('home/defaultPortlet/myListDetails', $params); }
protected function resolveModelClassName() { $modelClassName = ArrayUtil::getArrayValue(GetUtil::getData(), 'modelClassName'); if (isset($modelClassName)) { return $modelClassName; } if (isset($this->model->modelClassName)) { return $this->model->modelClassName; } return 'Contact'; }
/** * @param string $moduleName * @param bool $forceEmptyResults * Return an empty listView * @return View */ public function getListView($moduleName, $forceEmptyResults = false) { assert('is_string($moduleName)'); $pageSize = $this->pageSize; $module = Yii::app()->findModule($moduleName); $searchFormClassName = $module::getGlobalSearchFormClassName(); $modelClassName = $module::getPrimaryModelName(); $model = new $modelClassName(false); $searchForm = new $searchFormClassName($model); $sanitizedSearchAttributes = MixedTermSearchUtil::getGlobalSearchAttributeByModuleAndPartialTerm($module, $this->term); $metadataAdapter = new SearchDataProviderMetadataAdapter($searchForm, $this->user->id, $sanitizedSearchAttributes); $listViewClassName = $module::getPluralCamelCasedName() . 'ForMixedModelsSearchListView'; $sortAttribute = SearchUtil::resolveSortAttributeFromGetArray($modelClassName); $sortDescending = SearchUtil::resolveSortDescendingFromGetArray($modelClassName); if ($forceEmptyResults) { $dataProviderClass = 'EmptyRedBeanModelDataProvider'; $emptyText = ''; } else { $dataProviderClass = 'RedBeanModelDataProvider'; $emptyText = null; } $dataProvider = RedBeanModelDataProviderUtil::makeDataProvider($metadataAdapter->getAdaptedMetadata(false), $modelClassName, $dataProviderClass, $sortAttribute, $sortDescending, $pageSize, $module->getStateMetadataAdapterClassName()); $listView = new $listViewClassName('default', $module->getId(), $modelClassName, $dataProvider, GetUtil::resolveSelectedIdsFromGet(), '-' . $moduleName, array('route' => '', 'class' => 'SimpleListLinkPager', 'firstPageLabel' => '<span>first</span>', 'prevPageLabel' => '<span>previous</span>', 'nextPageLabel' => '<span>next</span>', 'lastPageLabel' => '<span>last</span>')); $listView->setRowsAreSelectable(false); $listView->setEmptyText($emptyText); return $listView; }
/** * @return string */ protected function getDataUrl() { return Yii::app()->createUrl(static::getControllerId() . '/default/relationsAndAttributesTreeForMergeTags', GetUtil::getData()); }
/** * @return array */ protected function getCGridViewPagerParams() { return array('firstPageLabel' => '<span>first</span>', 'prevPageLabel' => '<span>previous</span>', 'nextPageLabel' => '<span>next</span>', 'lastPageLabel' => '<span>last</span>', 'class' => 'SimpleListLinkPager', 'paginationParams' => GetUtil::getData(), 'route' => $this->getDefaultRoute()); }
/** * Processing before redirecting * @param RedBeanModel $model */ protected function beforeRedirect($model) { assert('$model instanceof RedBeanModel'); $getData = GetUtil::getData(); if ($this->getAction()->id == 'listViewMerge') { Yii::app()->gameHelper->muteScoringModelsOnSave(); ListViewMergeUtil::processCopyRelationsAndDeleteNonPrimaryModelsInMerge($model, $getData); Yii::app()->gameHelper->unmuteScoringModelsOnSave(); } }