/**
  * @return rendered content from view as string.
  */
 protected static function renderModalSearchList(CController $controller, $modalListLinkProvider, $stateMetadataAdapterClassName = null)
 {
     assert('$modalListLinkProvider instanceof ModalListLinkProvider');
     $className = $controller->getModule()->getPluralCamelCasedName() . 'ModalSearchAndListView';
     $modelClassName = $controller->getModule()->getPrimaryModelName();
     $searchViewClassName = $className::getSearchViewClassName();
     if ($searchViewClassName::getModelForMetadataClassName() != null) {
         $formModelClassName = $searchViewClassName::getModelForMetadataClassName();
         $model = new $modelClassName(false);
         $searchModel = new $formModelClassName($model);
     } else {
         throw new NotSupportedException();
     }
     $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('modalListPageSize', get_class($controller->getModule()));
     $dataProvider = $controller->makeRedBeanDataProviderByDataCollection($searchModel, $pageSize, $stateMetadataAdapterClassName);
     $searchAndListView = new $className($controller->getId(), $controller->getModule()->getId(), $controller->getAction()->getId(), $modalListLinkProvider, $searchModel, $model, $dataProvider, 'modal');
     $view = new ModalView($controller, $searchAndListView);
     return $view->render();
 }
Beispiel #2
0
 /**
  * Returns whether or not the given title is the default page title.
  * @param mixed $pageTitle the page title
  * @param CController $controller the controller
  * @return bool
  */
 protected function isDefaultPageTitle($pageTitle, $controller)
 {
     $name = ucfirst(basename($controller->getId()));
     return is_string($pageTitle) && ($pageTitle === Yii::app()->name . ' - ' . ucfirst($controller->getAction()->getId()) . ' ' . $name || $pageTitle === Yii::app()->name . ' - ' . $name);
 }