public function testGetViews() { $term = "green"; $pageSize = 5; $collection = new MixedModelsSearchResultsDataCollection($term, $pageSize, Yii::app()->user->userModel); $testViews = $collection->getViews(); $i = 1; $oldModuleName = ''; foreach ($testViews as $moduleName => $view) { if ($i++ % 2 === 1) { $oldModuleName = str_replace('titleBar-', '', $moduleName); $this->assertInstanceOf('TitleBarView', $view); } else { $this->assertEquals($oldModuleName, $moduleName); $this->assertInstanceOf('View', $view); $this->assertAttributeInstanceOf('EmptyRedBeanModelDataProvider', 'dataProvider', $view); } } }
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(); }