コード例 #1
0
 /**
  * Gets search options
  *
  * @return array
  */
 public function getSearchOptions()
 {
     $savedOptions = unserialize($this->searchOptions);
     // Merge with default options to be sure that we have correct value for any new options which are not saved in the profile.
     $defaultOptions = array();
     if (class_exists('Editor_Forms_SearchOptions')) {
         $defaultOptions = Editor_Forms_SearchOptions::getDefaultSearchOptions();
     }
     return array_merge($defaultOptions, $savedOptions);
 }
コード例 #2
0
 private function _switchUserToSearchProfile(OpenSKOS_Db_Table_Row_User $user, $profileId)
 {
     //!TODO Consider movin inside the user object.
     if ($user->isAllowedToUseSearchProfile($profileId)) {
         $profilesModel = new OpenSKOS_Db_Table_SearchProfiles();
         $profile = $profilesModel->find($profileId)->current();
         if (null !== $profile) {
             $detailedSearchOptions = $profile->getSearchOptions();
         } else {
             $detailedSearchOptions = Editor_Forms_SearchOptions::getDefaultSearchOptions();
         }
         $detailedSearchOptions['searchProfileId'] = $profileId;
         $user->setSearchOptions($detailedSearchOptions);
     }
 }