本文整理汇总了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;
}
示例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));
}