public function testGetListView() { $term = "green"; $pageSize = 5; $collection = new MixedModelsSearchResultsDataCollection($term, $pageSize, Yii::app()->user->userModel); $accountsView = $collection->getListView('contacts'); $this->assertInstanceOf('View', $accountsView); $this->assertAttributeInstanceOf('RedBeanModelDataProvider', 'dataProvider', $accountsView); //Get a listView with no empty results $accountsView = $collection->getListView('accounts', true); $this->assertInstanceOf('View', $accountsView); $this->assertAttributeInstanceOf('EmptyRedBeanModelDataProvider', 'dataProvider', $accountsView); }
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(); }