本文整理汇总了PHP中SavedSearch::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP SavedSearch::getById方法的具体用法?PHP SavedSearch::getById怎么用?PHP SavedSearch::getById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SavedSearch
的用法示例。
在下文中一共展示了SavedSearch::getById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionLoadSavedSearch
public function actionLoadSavedSearch($id, $redirectAction = 'list')
{
$savedSearch = SavedSearch::getById((int) $id);
ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($savedSearch);
$getParams = unserialize($savedSearch->serializedData);
$getParams = array_merge($getParams, array('savedSearchId' => $id));
$url = Yii::app()->createUrl($this->getModule()->getId() . '/' . $this->getId() . '/' . $redirectAction, $getParams);
$this->redirect($url);
}
示例2: testCreateAndGetAccountById
public function testCreateAndGetAccountById()
{
$user = User::getByUsername('super');
$savedSearch = new SavedSearch();
$savedSearch->owner = $user;
$savedSearch->name = 'Test Saved Search';
$savedSearch->serializedData = serialize(array('x', 'y'));
$savedSearch->viewClassName = 'someView';
$this->assertTrue($savedSearch->save());
$id = $savedSearch->id;
unset($savedSearch);
$savedSearch = SavedSearch::getById($id);
$this->assertEquals('Test Saved Search', $savedSearch->name);
$this->assertEquals(serialize(array('x', 'y')), $savedSearch->serializedData);
$this->assertEquals('someView', $savedSearch->viewClassName);
$deleted = $savedSearch->delete();
$this->assertTrue($deleted);
}
示例3: resolveSearchFormByStickyDataAndModel
/**
* @param array $stickyData
* @param SavedDynamicSearchForm $model
* @internal param $sourceData
*/
public static function resolveSearchFormByStickyDataAndModel($stickyData, SavedDynamicSearchForm $model)
{
assert('$stickyData != null && is_array($stickyData)');
if (isset($stickyData['savedSearchId']) && $stickyData['savedSearchId'] != '') {
try {
$savedSearch = SavedSearch::getById((int) $stickyData['savedSearchId']);
$model->savedSearchName = $savedSearch->name;
$model->savedSearchId = $savedSearch->id;
} catch (NotFoundException $e) {
}
}
if (isset($stickyData['anyMixedAttributes'])) {
$model->anyMixedAttributes = $stickyData['anyMixedAttributes'];
}
if (isset($stickyData['anyMixedAttributesScope'])) {
$model->setAnyMixedAttributesScope($stickyData['anyMixedAttributesScope']);
}
if (isset($stickyData['dynamicStructure'])) {
$model->dynamicStructure = $stickyData['dynamicStructure'];
}
if (isset($stickyData['dynamicClauses'])) {
$model->dynamicClauses = $stickyData['dynamicClauses'];
}
if (isset($stickyData[SearchForm::SELECTED_LIST_ATTRIBUTES]) && $model->getListAttributesSelector() != null) {
$model->getListAttributesSelector()->setSelected($stickyData[SearchForm::SELECTED_LIST_ATTRIBUTES]);
}
if (isset($stickyData[KanbanBoard::GROUP_BY_ATTRIBUTE_VISIBLE_VALUES]) && $model->getKanbanBoard() != null && !$model->getKanbanBoard()->getClearSticky()) {
$model->getKanbanBoard()->setIsActive();
$model->getKanbanBoard()->setGroupByAttributeVisibleValues($stickyData[KanbanBoard::GROUP_BY_ATTRIBUTE_VISIBLE_VALUES]);
}
if (isset($stickyData[KanbanBoard::SELECTED_THEME]) && $model->getKanbanBoard() != null && !$model->getKanbanBoard()->getClearSticky()) {
$model->getKanbanBoard()->setSelectedTheme($stickyData[KanbanBoard::SELECTED_THEME]);
}
// If the sort attribute is not in get request but in sticky data, set it into get array
$listModelClassName = get_class($model->getModel());
if (!isset($_GET[$listModelClassName . '_sort']) && isset($stickyData['sortAttribute'])) {
if ($stickyData['sortAttribute'] != '') {
$model->sortAttribute = $stickyData['sortAttribute'];
}
if (isset($stickyData['sortDescending'])) {
if ($stickyData['sortDescending'] == true) {
$model->sortDescending = ".desc";
}
}
}
}