Ejemplo n.º 1
0
 public static function resolveSearchFormByGetData(array $getData, DynamicSearchForm $searchForm)
 {
     if (isset($getData['savedSearchId']) && $getData['savedSearchId'] != '') {
         $savedSearch = SavedSearch::getById((int) $getData['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'];
         }
     }
 }
 /**
  * @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'];
         }
     }
 }
 public function getAttributesMappedToRealAttributesMetadata()
 {
     return array_merge(parent::getAttributesMappedToRealAttributesMetadata(), array('AAAName' => array(array('aaaMember'), array('aaaMember2')), 'differentOperatorA' => array(array('aaaMember', null, null, 'resolveValueByRules')), 'differentOperatorB' => array(array('aaaMember', null, 'endsWith')), 'concatedName' => array(array('aaaMember'), array('aaaMember2'), array('concatedAttributeNames' => array('aaaMember', 'aaaMember2')))));
 }
 public function getAttributesMappedToRealAttributesMetadata()
 {
     return array_merge(parent::getAttributesMappedToRealAttributesMetadata(), array('anyA' => array(array('primaryA', 'name'), array('secondaryA', 'name')), 'ABName' => array(array('aName'), array('bName')), 'differentOperatorA' => array(array('primaryA', 'name', null, 'resolveValueByRules')), 'differentOperatorB' => array(array('aName', null, 'endsWith')), 'dateDateTimeADate__Date' => array(array('manyMany', 'aDate', null, 'resolveRelatedAttributeValueByRules')), 'dateDateTimeADateTime__DateTime' => array(array('manyMany', 'aDateTime', null, 'resolveRelatedAttributeValueByRules'))));
 }
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), array('savedSearchId' => Zurmo::t('Core', 'Id'), 'savedSearchName' => Zurmo::t('Core', 'Name'), 'loadSavedSearchUrl' => 'LoadSavedSearchUrl'));
 }