/** * @param array $data * @param DynamicSearchForm $searchForm */ public static function resolveSearchFormByData(array $data, DynamicSearchForm $searchForm) { if (isset($data['savedSearchId']) && $data['savedSearchId'] != '') { $savedSearch = SavedSearch::getById((int) $data['savedSearchId']); $searchForm->savedSearchName = $savedSearch->name; $searchForm->savedSearchId = $savedSearch->id; $unserializedData = unserialize($savedSearch->serializedData); if (isset($unserializedData['anyMixedAttributes'])) { $searchForm->anyMixedAttributes = $unserializedData['anyMixedAttributes']; } if (isset($unserializedData['anyMixedAttributesScope'])) { $searchForm->setAnyMixedAttributesScope($unserializedData['anyMixedAttributesScope']); } if (isset($unserializedData[SearchForm::SELECTED_LIST_ATTRIBUTES]) && $searchForm->getListAttributesSelector() != null) { $searchForm->getListAttributesSelector()->setSelected($unserializedData[SearchForm::SELECTED_LIST_ATTRIBUTES]); } if (isset($unserializedData[KanbanBoard::GROUP_BY_ATTRIBUTE_VISIBLE_VALUES]) && $searchForm->getKanbanBoard() != null) { // ToDO: Line below is commented, until we find better way so when user save search under kanboard, // When it load it will load resuls in kanboard(for now search results are always loaded in list view) // $searchForm->getKanbanBoard()->setIsActive(); $searchForm->getKanbanBoard()->setGroupByAttributeVisibleValues($unserializedData[KanbanBoard::GROUP_BY_ATTRIBUTE_VISIBLE_VALUES]); } if (isset($unserializedData[KanbanBoard::SELECTED_THEME]) && $searchForm->getKanbanBoard() != null) { $searchForm->getKanbanBoard()->setSelectedTheme($unserializedData[KanbanBoard::SELECTED_THEME]); } if (isset($unserializedData['dynamicStructure'])) { $searchForm->dynamicStructure = $unserializedData['dynamicStructure']; } if (isset($unserializedData['dynamicClauses'])) { $searchForm->dynamicClauses = $unserializedData['dynamicClauses']; } if (isset($unserializedData['sortAttribute'])) { $searchForm->sortAttribute = $unserializedData['sortAttribute']; } if (isset($unserializedData['sortDescending'])) { $searchForm->sortDescending = $unserializedData['sortDescending']; } } }
/** * @param array $data * @param DynamicSearchForm $searchForm */ public static function resolveSearchFormByData(array $data, DynamicSearchForm $searchForm) { if (isset($data['savedSearchId']) && $data['savedSearchId'] != '') { $savedSearch = SavedSearch::getById((int) $data['savedSearchId']); $searchForm->savedSearchName = $savedSearch->name; $searchForm->savedSearchId = $savedSearch->id; $unserializedData = unserialize($savedSearch->serializedData); if (isset($unserializedData['anyMixedAttributes'])) { $searchForm->anyMixedAttributes = $unserializedData['anyMixedAttributes']; } if (isset($unserializedData['anyMixedAttributesScope'])) { $searchForm->setAnyMixedAttributesScope($unserializedData['anyMixedAttributesScope']); } if (isset($unserializedData[SearchForm::SELECTED_LIST_ATTRIBUTES]) && $searchForm->getListAttributesSelector() != null) { $searchForm->getListAttributesSelector()->setSelected($unserializedData[SearchForm::SELECTED_LIST_ATTRIBUTES]); } if (isset($unserializedData[KanbanBoard::GROUP_BY_ATTRIBUTE_VISIBLE_VALUES]) && $searchForm->getKanbanBoard() != null) { $searchForm->getKanbanBoard()->setIsActive(); $searchForm->getKanbanBoard()->setGroupByAttributeVisibleValues($unserializedData[KanbanBoard::GROUP_BY_ATTRIBUTE_VISIBLE_VALUES]); } if (isset($unserializedData[KanbanBoard::SELECTED_THEME]) && $searchForm->getKanbanBoard() != null) { $searchForm->getKanbanBoard()->setSelectedTheme($unserializedData[KanbanBoard::SELECTED_THEME]); } if (isset($unserializedData['dynamicStructure'])) { $searchForm->dynamicStructure = $unserializedData['dynamicStructure']; } if (isset($unserializedData['dynamicClauses'])) { $searchForm->dynamicClauses = $unserializedData['dynamicClauses']; } if (isset($unserializedData['sortAttribute'])) { $searchForm->sortAttribute = $unserializedData['sortAttribute']; } if (isset($unserializedData['sortDescending'])) { $searchForm->sortDescending = $unserializedData['sortDescending']; } } }