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


PHP SavedSearch类代码示例

本文整理汇总了PHP中SavedSearch的典型用法代码示例。如果您正苦于以下问题:PHP SavedSearch类的具体用法?PHP SavedSearch怎么用?PHP SavedSearch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SavedSearch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: testGetByOwnerAndViewClassName

 public function testGetByOwnerAndViewClassName()
 {
     $user = User::getByUsername('super');
     $steven = User::getByUsername('steven');
     $savedSearches = SavedSearch::getByOwnerAndViewClassName($user, 'someView');
     $this->assertEquals(0, count($savedSearches));
     $savedSearches = SavedSearch::getByOwnerAndViewClassName($steven, 'someView');
     $this->assertEquals(0, count($savedSearches));
     //create saved search for steven
     $savedSearch = new SavedSearch();
     $savedSearch->owner = $steven;
     $savedSearch->name = 'Test Saved Search';
     $savedSearch->serializedData = serialize(array('x', 'y'));
     $savedSearch->viewClassName = 'someView';
     $this->assertTrue($savedSearch->save());
     $savedSearches = SavedSearch::getByOwnerAndViewClassName($user, 'someView');
     $this->assertEquals(0, count($savedSearches));
     $savedSearches = SavedSearch::getByOwnerAndViewClassName($steven, 'someView');
     $this->assertEquals(1, count($savedSearches));
     $savedSearches = SavedSearch::getByOwnerAndViewClassName($steven, 'someView2');
     $this->assertEquals(0, count($savedSearches));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:22,代码来源:SavedSearchTest.php

示例3: renderSavedSearchList

 protected function renderSavedSearchList()
 {
     $savedSearches = SavedSearch::getByOwnerAndViewClassName(Yii::app()->user->userModel, get_class($this));
     $idOrName = static::getSavedSearchListDropDown();
     $htmlOptions = array('id' => $idOrName, 'empty' => Zurmo::t('ZurmoModule', 'Load a saved search'));
     if (count($savedSearches) == 0) {
         $htmlOptions['style'] = "display:none;";
         $htmlOptions['class'] = 'ignore-style';
         $idOrName = static::getSavedSearchListDropDown();
         $htmlOptions = array('id' => $idOrName, 'empty' => Zurmo::t('ZurmoModule', 'Load a saved search'));
         $content = ZurmoHtml::dropDownList($idOrName, $this->model->savedSearchId, self::resolveSavedSearchesToIdAndLabels($savedSearches), $htmlOptions);
         $this->renderSavedSearchDropDownOnChangeScript($idOrName, $this->model->loadSavedSearchUrl);
         return $content;
     }
     $content = ZurmoHtml::dropDownList($idOrName, $this->model->savedSearchId, self::resolveSavedSearchesToIdAndLabels($savedSearches), $htmlOptions);
     $this->renderSavedSearchDropDownOnChangeScript($idOrName, $this->model->loadSavedSearchUrl);
     return $content;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:18,代码来源:SavedDynamicSearchView.php

示例4: testSaveNumericFields

 public function testSaveNumericFields()
 {
     global $current_user;
     require_once 'modules/SavedSearch/SavedSearch.php';
     $focus = new SavedSearch();
     $focus->retrieve($this->saved_search_id);
     $_REQUEST = unserialize(base64_decode($focus->contents));
     $_REQUEST['start_range_amount_advanced'] = '$9,500.00';
     $_REQUEST['end_range_amount_advanced'] = '$49,500.00';
     $mockBean = new Bug42915MockOpportunity();
     $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
     //Now retrieve what we have saved and test
     $focus->retrieveSavedSearch($this->saved_search_id);
     $formatted_data = $focus->contents;
     $this->assertEquals(9500, $formatted_data['start_range_amount_advanced'], "Assert that value is unformatted value 9500");
     $this->assertEquals(49500, $formatted_data['end_range_amount_advanced'], "Assert that value is unformatted value 49500");
     $focus->populateRequest();
     $this->assertEquals('$9,500.00', $_REQUEST['start_range_amount_advanced'], "Assert that value is formatted value \$9,500.00");
     $this->assertEquals('$49,500.00', $_REQUEST['end_range_amount_advanced'], "Assert that value is formatted value \$49,500.00");
     $current_user->setPreference('num_grp_sep', '.');
     $current_user->setPreference('dec_sep', ',');
     $current_user->save();
     //Force reset on dec_sep and num_grp_sep because the dec_sep and num_grp_sep values are stored as static variables
     get_number_seperators(true);
     $focus = new SavedSearch();
     $focus->retrieveSavedSearch($this->saved_search_id);
     $focus->populateRequest();
     $this->assertEquals('$9.500,00', $_REQUEST['start_range_amount_advanced'], "Assert that value is formatted value \$9,500.00");
     $this->assertEquals('$49.500,00', $_REQUEST['end_range_amount_advanced'], "Assert that value is formatted value \$49,500.00");
     //Okay so now what happens if they don't specify currency or separator or decimal values?
     $_REQUEST['start_range_amount_advanced'] = '9500';
     $_REQUEST['end_range_amount_advanced'] = '49500';
     //Well then the populated values should be unformatted!
     $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
     $focus->retrieveSavedSearch($this->saved_search_id);
     $focus->populateRequest();
     $this->assertEquals(9500, $_REQUEST['start_range_amount_advanced'], "Assert that value is unformatted value 9500");
     $this->assertEquals(49500, $_REQUEST['end_range_amount_advanced'], "Assert that value is unformatted value 49500");
 }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:39,代码来源:Bug42915Test.php

示例5: testSuperUserAllDefaultControllerActions

 public function testSuperUserAllDefaultControllerActions()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $this->assertEquals(0, count(SavedSearch::getAll()));
     //Test a saved search that validates and passes
     //Test form that validates
     $this->setGetArray(array('viewClassName' => 'AccountsSearchView', 'modelClassName' => 'Account', 'formModelClassName' => 'AccountsSearchForm'));
     $this->setPostArray(array('ajax' => 'search-form', 'AccountsSearchForm' => array('savedSearchName' => 'a new name'), 'save' => 'saveSearch'));
     $this->runControllerWithExitExceptionAndGetContent('zurmo/default/validateDynamicSearch');
     $savedSearches = SavedSearch::getAll();
     $this->assertEquals(1, count($savedSearches));
     $this->assertEquals('a new name', $savedSearches[0]->name);
     //Test loading saved search
     Yii::app()->user->setState('AccountsSearchView', null);
     $this->setGetArray(array('savedSearchId' => $savedSearches[0]->id));
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/list');
     $id = $savedSearches[0]->id;
     $this->assertContains("<option value=\"{$id}\" selected=\"selected\">a new name</option>", $content);
     //Test deleting saved search
     $this->setGetArray(array('id' => $savedSearches[0]->id));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('zurmo/default/deleteSavedSearch', true);
     $this->assertEquals(0, count(SavedSearch::getAll()));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:24,代码来源:ZurmoSavedDynamicSearchSuperUserWalkthroughTest.php

示例6: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false, $id = null, $searchModuleBean)
 {
     global $current_user, $timedate;
     $focus = new SavedSearch();
     if ($id) {
         $focus->retrieve($id);
     }
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     $ignored_inputs = array('PHPSESSID', 'module', 'action', 'saved_search_name', 'saved_search_select', 'advanced', 'Calls_divs', 'ACLRoles_divs');
     $contents = $_REQUEST;
     if ($id == null) {
         $focus->name = $contents['saved_search_name'];
     }
     $focus->search_module = $contents['search_module'];
     foreach ($contents as $input => $value) {
         if (in_array($input, $ignored_inputs)) {
             unset($contents[$input]);
             continue;
         }
         //Filter date fields to ensure it is saved to DB format, but also avoid empty values
         if (!empty($value) && preg_match('/^(start_range_|end_range_|range_)?(.*?)(_advanced|_basic)$/', $input, $match)) {
             $field = $match[2];
             if (isset($searchModuleBean->field_defs[$field]['type'])) {
                 $type = $searchModuleBean->field_defs[$field]['type'];
                 //Avoid macro values for the date types
                 if (($type == 'date' || $type == 'datetime' || $type == 'datetimecombo') && !preg_match('/^\\[.*?\\]$/', $value)) {
                     $db_format = $timedate->to_db_date($value, false);
                     $contents[$input] = $db_format;
                 } else {
                     if ($type == 'int' || $type == 'currency' || $type == 'decimal' || $type == 'float') {
                         if (preg_match('/[^\\d]/', $value)) {
                             require_once 'modules/Currencies/Currency.php';
                             $contents[$input] = unformat_number($value);
                             //Flag this value as having been unformatted
                             $contents[$input . '_unformatted_number'] = true;
                             //If the type is of currency and there was a currency symbol (non-digit), save the symbol
                             if ($type == 'currency' && preg_match('/^([^\\d])/', $value, $match)) {
                                 $contents[$input . '_currency_symbol'] = $match[1];
                             }
                         } else {
                             //unset any flags
                             if (isset($contents[$input . '_unformatted_number'])) {
                                 unset($contents[$input . '_unformatted_number']);
                             }
                             if (isset($contents[$input . '_currency_symbol'])) {
                                 unset($contents[$input . '_currency_symbol']);
                             }
                         }
                     }
                 }
             }
         }
     }
     $contents['advanced'] = true;
     $focus->contents = base64_encode(serialize($contents));
     $focus->assigned_user_id = $current_user->id;
     $focus->new_schema = true;
     $saved_search_id = $focus->save();
     $GLOBALS['log']->debug("Saved record with id of " . $focus->id);
     $orderBy = empty($contents['orderBy']) ? 'name' : $contents['orderBy'];
     $search_query = "&orderBy=" . $orderBy . "&sortOrder=" . $contents['sortOrder'] . "&query=" . $_REQUEST['query'] . "&searchFormTab=" . $_REQUEST['searchFormTab'] . '&showSSDIV=' . $contents['showSSDIV'];
     if ($redirect) {
         $this->handleRedirect($focus->search_module, $search_query, $saved_search_id, 'true');
     }
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:67,代码来源:SavedSearch.php

示例7: testSaveDateFields

 /**
  * This test captures the scenario for date_modified field where range search is not enabled
  */
 public function testSaveDateFields()
 {
     require_once 'modules/SavedSearch/SavedSearch.php';
     $focus = new SavedSearch();
     $focus->retrieve($this->saved_search_id);
     $_REQUEST = unserialize(base64_decode($focus->contents));
     unset($_REQUEST['start_range_date_modified_advanced']);
     unset($_REQUEST['end_range_date_modified_advanced']);
     unset($_REQUEST['range_date_modified_advanced']);
     $_REQUEST['date_modified_advanced'] = '07/03/2009';
     //Special date :)
     $mockBean = new Bug42377MockOpportunity();
     $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
     //Now retrieve what we have saved and test
     $focus = new SavedSearch();
     $focus->retrieve($this->saved_search_id);
     $formatted_data = unserialize(base64_decode($focus->contents));
     $this->assertEquals($formatted_data['date_modified_advanced'], '2009-07-03', "Assert that value is in db format ('2009-07-03')");
     //Now test that when we populate the search form, we bring it back to user's date format
     $focus->retrieveSavedSearch($this->saved_search_id);
     $focus->populateRequest();
     $this->assertEquals($_REQUEST['date_modified_advanced'], '07/03/2009', "Assert that dates in db format were converted back to user's date preference");
     //Take this a step further, assume date format now changes, will date be populated correctly?
     global $current_user;
     $current_user->setPreference('datef', 'd/m/Y', 0, 'global');
     $current_user->save();
     //Now test that when we populate the search form, we bring it back to user's date format
     $focus->retrieveSavedSearch($this->saved_search_id);
     $focus->populateRequest();
     $this->assertEquals($_REQUEST['date_modified_advanced'], '03/07/2009', "Assert that dates in db format were converted back to user's date preference");
 }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:34,代码来源:Bug42378Test.php

示例8: getButtons

 /**
  * get the search buttons
  *
  * @return string html of contents
  */
 function getButtons()
 {
     global $app_strings;
     $SAVED_SEARCHES_OPTIONS = '';
     $savedSearch = new SavedSearch();
     $SAVED_SEARCHES_OPTIONS = $savedSearch->getSelect($this->module);
     $str = "<input tabindex='2' title='{$app_strings['LBL_SEARCH_BUTTON_TITLE']}' accessKey='{$app_strings['LBL_SEARCH_BUTTON_KEY']}' onclick='SUGAR.savedViews.setChooser()' class='button' type='submit' name='button' value='{$app_strings['LBL_SEARCH_BUTTON_LABEL']}' id='search_form_submit'/>&nbsp;";
     $str .= "<input tabindex='2' title='{$app_strings['LBL_CLEAR_BUTTON_TITLE']}' accessKey='{$app_strings['LBL_CLEAR_BUTTON_KEY']}' onclick='SUGAR.searchForm.clear_form(this.form); return false;' class='button' type='button' name='clear' value=' {$app_strings['LBL_CLEAR_BUTTON_LABEL']} ' id='search_form_clear'/>";
     if (!empty($SAVED_SEARCHES_OPTIONS) && $this->showSavedSearchOptions) {
         $str .= "   <span class='white-space'>\n                        &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<b>{$app_strings['LBL_SAVED_SEARCH_SHORTCUT']}</b>&nbsp;\n                        {$SAVED_SEARCHES_OPTIONS}\n                        <span id='go_btn_span' style='display:none'><input tabindex='2' title='go_select' id='go_select'  onclick='SUGAR.searchForm.clear_form(this.form);' class='button' type='button' name='go_select' value=' {$app_strings['LBL_GO_BUTTON_LABEL']} '/></span>\n                    </span>\n                    </form>";
     }
     $str .= "\n                <script>\n                    function toggleInlineSearch(){\n                        if (document.getElementById('inlineSavedSearch').style.display == 'none'){\n                            document.getElementById('showSSDIV').value = 'yes'\n                            document.getElementById('inlineSavedSearch').style.display = '';\n\n                            document.getElementById('up_down_img').src='" . SugarThemeRegistry::current()->getImageURL('basic_search.gif') . "';\n\n                        }else{\n\n                            document.getElementById('up_down_img').src='" . SugarThemeRegistry::current()->getImageURL('advanced_search.gif') . "';\n\n                            document.getElementById('showSSDIV').value = 'no';\n                            document.getElementById('inlineSavedSearch').style.display = 'none';\n                        }\n                    }\n\n\n                </script>\n            ";
     return $str;
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:19,代码来源:SearchForm.php

示例9: 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

示例10: displaySavedSearchSelect

 function displaySavedSearchSelect()
 {
     $savedSearch = new SavedSearch($this->listViewDefs[$this->module], $this->lv->data['pageData']['ordering']['orderBy'], $this->lv->data['pageData']['ordering']['sortOrder']);
     return $savedSearch->getSelect($this->module);
 }
开发者ID:jeffcao,项目名称:fzglsys_v5,代码行数:5,代码来源:SearchForm2.php

示例11: getSearchDataForSort

 private function getSearchDataForSort()
 {
     $savedSearch = new SavedSearch();
     $savedSearch->name = 'something';
     $savedSearch->viewClassName = 'view';
     $savedSearch->serializedData = 'someString';
     $saved = $savedSearch->save();
     $searchModel = new AAASavedDynamicSearchFormTestModel(new AAA(false));
     $listAttributesSelector = new ListAttributesSelector('AListView', 'TestModule');
     $searchModel->setListAttributesSelector($listAttributesSelector);
     $searchModel->dynamicStructure = '1 and 5';
     $searchModel->dynamicClauses = array('a', 'b');
     $searchModel->anyMixedAttributes = 'abcdef';
     $searchModel->savedSearchId = $savedSearch->id;
     $searchModel->setAnyMixedAttributesScope('xyz');
     $searchModel->getListAttributesSelector()->setSelected(array('aaaMember', 'aaaMember2'));
     $dataCollection = new SavedSearchAttributesDataCollection($searchModel);
     return array('dataCollection' => $dataCollection, 'savedSearch' => $savedSearch);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:19,代码来源:SavedSearchUtilTest.php

示例12: saveSearch

 public function saveSearch()
 {
     $this->layout->body_class = 'user';
     $title = Input::get('title', '');
     $filter = Input::get('filter', '');
     $location = Input::get('location', '');
     $query = Input::get('query', '');
     if (Auth::check()) {
         $search = new SavedSearch();
         $search->title = $title;
         $search->filter = $filter;
         $search->location = $location;
         $search->query = $query;
         $search->user = Auth::user()->id;
         $search->datetime = date("Y-m-d H:i:s");
         $search->save();
     }
 }
开发者ID:apetrailmukesh,项目名称:bootstrap,代码行数:18,代码来源:UserController.php

示例13: __construct

 function __construct()
 {
     $result = $GLOBALS['db']->query("SELECT id FROM saved_search");
     while ($row = $GLOBALS['db']->fetchByAssoc($result)) {
         $focus = new SavedSearch();
         $focus->retrieve($row['id']);
         $contents = unserialize(base64_decode($focus->contents));
         $has_team_name_saved = isset($contents['team_name_advanced']) || isset($contents['team_name_basic']) ? true : false;
         //If $contents['searchFormTab'] is set then this is coming from a 4.x saved search
         if (isset($contents['searchFormTab']) && $contents['searchFormTab'] == 'saved_views') {
             $new_contents = array();
             $module = $contents['search_module'];
             $advanced = !empty($contents['advanced']);
             $field_map = array();
             if (file_exists("custom/modules/{$module}/metadata/searchdefs.php")) {
                 require "custom/modules/{$module}/metadata/searchdefs.php";
                 $field_map = $advanced ? $searchdefs[$module]['layout']['advanced_search'] : $searchdefs[$module]['layout']['basic_search'];
             } else {
                 if (file_exists("modules/{$module}/metadata/SearchFields.php")) {
                     require "modules/{$module}/metadata/SearchFields.php";
                     $field_map = $searchFields[$module];
                 } else {
                     $bean = loadBean($module);
                     $field_map = $bean->field_name_map;
                 }
             }
             //Special case for team_id field (from 4.5.x)
             if (isset($contents['team_id'])) {
                 $contents['team_name'] = $contents['team_id'];
                 unset($contents['team_id']);
             }
             foreach ($contents as $key => $value) {
                 if (isset($field_map[$key])) {
                     $new_key = $key . ($advanced ? '_advanced' : '_basic');
                     if (preg_match('/^team_name_(advanced|basic)$/', $new_key)) {
                         if (!is_array($value)) {
                             $temp_value = array();
                             $teap_value[] = $value;
                             $value = $temp_value;
                         }
                         $team_results = $GLOBALS['db']->query("SELECT id, name FROM teams where id in ('" . implode("','", $value) . "')");
                         if (!empty($team_results)) {
                             $count = 0;
                             while ($team_row = $GLOBALS['db']->fetchByAssoc($team_results)) {
                                 $team_key = $new_key . '_collection_' . $count;
                                 $new_contents[$team_key] = $team_row['name'];
                                 $new_contents['id_' . $team_key] = $team_row['id'];
                                 $count++;
                             }
                             //while
                         }
                         //if
                         //Unset the original key
                         unset($new_contents[$key]);
                         //Add the any switch
                         $new_contents[$new_key . '_type'] = 'any';
                     } else {
                         $new_contents[$new_key] = $value;
                     }
                 } else {
                     $new_contents[$key] = $value;
                 }
             }
             $new_contents['searchFormTab'] = $advanced ? 'advanced_search' : 'basic_search';
             $content = base64_encode(serialize($new_contents));
             $GLOBALS['db']->query("UPDATE saved_search SET contents = '{$content}' WHERE id = '{$row['id']}'");
         } else {
             if ($has_team_name_saved) {
                 //Otherwise, if the boolean has_team_name_saved is set to true, we also need to parse (coming from 5.x)
                 if (isset($contents['team_name_advanced'])) {
                     $team_results = $GLOBALS['db']->query("SELECT name FROM teams where id = '{$contents['team_name_advanced']}'");
                     if (!empty($team_results)) {
                         $team_row = $GLOBALS['db']->fetchByAssoc($team_results);
                         $contents['team_name_advanced_collection_0'] = $team_row['name'];
                         $contents['id_team_name_advanced_collection_0'] = $contents['team_name_advanced'];
                         $contents['team_name_advanced_type'] = 'any';
                         unset($contents['team_name_advanced']);
                         $content = base64_encode(serialize($contents));
                         $GLOBALS['db']->query("UPDATE saved_search SET contents = '{$content}' WHERE id = '{$row['id']}'");
                     }
                 }
             }
         }
     }
     //while
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:86,代码来源:UpgradeSavedSearch.php

示例14: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false, $id = null)
 {
     global $current_user;
     $focus = new SavedSearch();
     if ($id) {
         $focus->retrieve($id);
     }
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     $ignored_inputs = array('PHPSESSID', 'module', 'action', 'saved_search_name', 'saved_search_select', 'advanced', 'Calls_divs', 'ACLRoles_divs');
     $contents = $_REQUEST;
     if ($id == null) {
         $focus->name = $contents['saved_search_name'];
     }
     $focus->search_module = $contents['search_module'];
     foreach ($contents as $input => $value) {
         if (in_array($input, $ignored_inputs)) {
             unset($contents[$input]);
         }
     }
     $contents['advanced'] = true;
     $focus->contents = base64_encode(serialize($contents));
     $focus->assigned_user_id = $current_user->id;
     $focus->new_schema = true;
     $saved_search_id = $focus->save();
     $GLOBALS['log']->debug("Saved record with id of " . $focus->id);
     $orderBy = empty($contents['orderBy']) ? 'name' : $contents['orderBy'];
     $search_query = "&orderBy=" . $orderBy . "&sortOrder=" . $contents['sortOrder'] . "&query=" . $_REQUEST['query'] . "&searchFormTab=" . $_REQUEST['searchFormTab'] . '&showSSDIV=' . $contents['showSSDIV'];
     $this->handleRedirect($focus->search_module, $search_query, $saved_search_id, 'true');
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:SavedSearch.php

示例15: testpopulateRequest

 public function testpopulateRequest()
 {
     $savedSearch = new SavedSearch();
     $savedSearch->contents = array('search_module' => 'Accounts', 'description' => 'test text', 'test_content' => 'some content', 'advanced' => true);
     $savedSearch->populateRequest();
     //verify thhat Request parameters are set
     $this->assertEquals('Accounts', $_REQUEST['search_module']);
     $this->assertEquals('test text', $_REQUEST['description']);
     $this->assertEquals('some content', $_REQUEST['test_content']);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:10,代码来源:SavedSearchTest.php


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