当前位置: 首页>>代码示例>>PHP>>正文


PHP SavedSearch::getByOwnerAndViewClassName方法代码示例

本文整理汇总了PHP中SavedSearch::getByOwnerAndViewClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP SavedSearch::getByOwnerAndViewClassName方法的具体用法?PHP SavedSearch::getByOwnerAndViewClassName怎么用?PHP SavedSearch::getByOwnerAndViewClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SavedSearch的用法示例。


在下文中一共展示了SavedSearch::getByOwnerAndViewClassName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderSavedSearchList

 protected function renderSavedSearchList()
 {
     $savedSearches = SavedSearch::getByOwnerAndViewClassName(Yii::app()->user->userModel, get_class($this));
     $idOrName = static::getSavedSearchListDropDown();
     $htmlOptions = array('id' => $idOrName, 'empty' => Zurmo::t('ZurmoModule', 'Load a saved search'));
     if (count($savedSearches) == 0) {
         $htmlOptions['style'] = "display:none;";
         $htmlOptions['class'] = 'ignore-style';
         $idOrName = static::getSavedSearchListDropDown();
         $htmlOptions = array('id' => $idOrName, 'empty' => Zurmo::t('ZurmoModule', 'Load a saved search'));
         $content = ZurmoHtml::dropDownList($idOrName, $this->model->savedSearchId, self::resolveSavedSearchesToIdAndLabels($savedSearches), $htmlOptions);
         $this->renderSavedSearchDropDownOnChangeScript($idOrName, $this->model->loadSavedSearchUrl);
         return $content;
     }
     $content = ZurmoHtml::dropDownList($idOrName, $this->model->savedSearchId, self::resolveSavedSearchesToIdAndLabels($savedSearches), $htmlOptions);
     $this->renderSavedSearchDropDownOnChangeScript($idOrName, $this->model->loadSavedSearchUrl);
     return $content;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:18,代码来源:SavedDynamicSearchView.php

示例2: testGetByOwnerAndViewClassName

 public function testGetByOwnerAndViewClassName()
 {
     $user = User::getByUsername('super');
     $steven = User::getByUsername('steven');
     $savedSearches = SavedSearch::getByOwnerAndViewClassName($user, 'someView');
     $this->assertEquals(0, count($savedSearches));
     $savedSearches = SavedSearch::getByOwnerAndViewClassName($steven, 'someView');
     $this->assertEquals(0, count($savedSearches));
     //create saved search for steven
     $savedSearch = new SavedSearch();
     $savedSearch->owner = $steven;
     $savedSearch->name = 'Test Saved Search';
     $savedSearch->serializedData = serialize(array('x', 'y'));
     $savedSearch->viewClassName = 'someView';
     $this->assertTrue($savedSearch->save());
     $savedSearches = SavedSearch::getByOwnerAndViewClassName($user, 'someView');
     $this->assertEquals(0, count($savedSearches));
     $savedSearches = SavedSearch::getByOwnerAndViewClassName($steven, 'someView');
     $this->assertEquals(1, count($savedSearches));
     $savedSearches = SavedSearch::getByOwnerAndViewClassName($steven, 'someView2');
     $this->assertEquals(0, count($savedSearches));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:22,代码来源:SavedSearchTest.php


注:本文中的SavedSearch::getByOwnerAndViewClassName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。