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


PHP SavedSearch::getById方法代码示例

本文整理汇总了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);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:9,代码来源:ZurmoModuleController.php

示例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);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:18,代码来源:SavedSearchTest.php

示例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";
             }
         }
     }
 }
开发者ID:KulturedKitsch,项目名称:kulturedkitsch.info,代码行数:51,代码来源:SavedSearchUtil.php


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