• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SearchForm类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了SearchForm类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testGeneratedWhereClauseDoesNotHaveValueOfFieldNotSetInSearchForm

 /**
  * @ticket 44858
  */
 public function testGeneratedWhereClauseDoesNotHaveValueOfFieldNotSetInSearchForm()
 {
     //test to check that if value of a dropdown field is already set in REQUEST object (from any form such as mass update form instead of search form)
     //i.e. search is made on empty string, but REQUEST object gets value of that dropdown field from some other form on the same page
     //then on clicking serach button, value of that field should not be used as filter in where clause
     $this->markTestIncomplete('This test should actually check that the $whereArray is indeed populated');
     return;
     //array to simulate REQUEST object
     $requestArray['module'] = 'Accounts';
     $requestArray['action'] = 'index';
     $requestArray['searchFormTab'] = 'basic_search';
     $requestArray['account_type'] = 'Analyst';
     //value of a dropdown field set in REQUEST object
     $requestArray['query'] = 'true';
     $requestArray['button'] = 'Search';
     $requestArray['globalLinksOpen'] = 'true';
     $requestArray['current_user_only_basic'] = 0;
     $account = SugarTestAccountUtilities::createAccount();
     $searchForm = new SearchForm($account, 'Accounts');
     require 'modules/Accounts/vardefs.php';
     require 'modules/Accounts/metadata/SearchFields.php';
     require 'modules/Accounts/metadata/searchdefs.php';
     $searchForm->searchFields = $searchFields[$searchForm->module];
     $searchForm->searchdefs = $searchdefs[$searchForm->module];
     $searchForm->populateFromArray($requestArray, 'basic_search', false);
     $whereArray = $searchForm->generateSearchWhere(true, $account->module_dir);
     //echo var_export($whereArray, true);
     $this->assertEquals(0, count($whereArray));
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:32,代码来源:Bug44858Test.php


示例2: SearchPlusForm

 function SearchPlusForm($name = "SearchForm", $fieldName = "Search", $fieldLabel = '')
 {
     $action = $this->getRequest()->param("Action");
     $page = SearchPlusPage::get()->first();
     if ($page) {
         //!in_array($action, array("login", "logout")) &&
         if (!$fieldLabel) {
             if (isset($_REQUEST[$fieldName])) {
                 $searchText = $_REQUEST[$fieldName];
                 //we set $_REQUEST["Search"] below because it is also used by things like Text::ContextSummary
                 $_REQUEST["Search"] = $_REQUEST[$fieldName];
             } elseif (isset($_REQUEST["Search"])) {
                 $searchText = $_REQUEST["Search"];
             } else {
                 $searchText = 'Search';
             }
         } else {
             $searchText = '';
         }
         $field = new TextField($fieldName, $fieldLabel, $searchText);
         $fields = new FieldList($field);
         $actions = new FieldList(new FormAction('results', 'Search'));
         $form = new SearchForm($this, $name, $fields, $actions);
         $form->setFormAction($page->Link() . "results/");
         $form->setPageLength(Config::inst()->get("SearchPlusPage", "result_length"));
         $form->unsetValidator();
         return $form;
     } elseif (!$page) {
         user_error("You need to create a SearchPlusPage to have a search box", E_USER_NOTICE);
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-searchplus,代码行数:31,代码来源:SearchPlusSearchForm.php


示例3: testPublishedPagesMatchedByTitleInDefaultLanguage

 function testPublishedPagesMatchedByTitleInDefaultLanguage()
 {
     $sf = new SearchForm($this->mockController, 'SearchForm');
     $publishedPage = $this->objFromFixture('SiteTree', 'publishedPage');
     $publishedPage->publish('Stage', 'Live');
     $translatedPublishedPage = $publishedPage->createTranslation('de_DE');
     $translatedPublishedPage->Title = 'translatedPublishedPage';
     $translatedPublishedPage->Content = 'German content';
     $translatedPublishedPage->write();
     $translatedPublishedPage->publish('Stage', 'Live');
     $this->waitUntilIndexingFinished();
     // Translatable::set_current_locale() can't be used because the context
     // from the holder is not present here - we set the language explicitly
     // through a pseudo GET variable in getResults()
     $lang = 'en_US';
     $results = $sf->getResults(null, array('Search' => 'content', 'locale' => $lang));
     $this->assertContains($publishedPage->ID, $results->column('ID'), 'Published pages are found by searchform in default language');
     $this->assertNotContains($translatedPublishedPage->ID, $results->column('ID'), 'Published pages in another language are not found when searching in default language');
     $lang = 'de_DE';
     $results = $sf->getResults(null, array('Search' => 'content', 'locale' => $lang));
     $this->assertNotContains($publishedPage->ID, $results->column('ID'), 'Published pages in default language are not found when searching in another language');
     $actual = $results->column('ID');
     array_walk($actual, 'intval');
     $this->assertContains((int) $translatedPublishedPage->ID, $actual, 'Published pages in another language are found when searching in this language');
 }
开发者ID:roed,项目名称:silverstripe-translatable,代码行数:25,代码来源:TranslatableSearchFormTest.php


示例4: actionIndex

 public function actionIndex()
 {
     $this->pageTitle = Yii::t('title', 'Server droplist');
     $form = new SearchForm();
     $form->scenario = 'droplist';
     $model = null;
     if (isset($_POST['SearchForm'])) {
         $form->attributes = $_POST['SearchForm'];
         if ($form->validate()) {
             if (!empty($form->mobId) and !empty($form->item_id)) {
                 $where = 'mobId = ' . $form->mobId . ' AND itemid = ' . $form->item_id;
             } elseif (!empty($form->mobId)) {
                 $where = 'mobId = ' . $form->mobId;
             } elseif (!empty($form->item_id)) {
                 $where = 'item_id = ' . $form->item_id;
             } else {
                 $where = null;
             }
             $criteria = new CDbCriteria();
             $criteria->select = 'mobId, item_id, min, max, chance';
             $criteria->condition = $where;
             $criteria->order = 'chance DESC, max DESC';
             $criteria->limit = 100;
             $model = Droplist::model()->findAll($criteria);
         }
     }
     $this->render('/droplist', array('form' => $form, 'model' => $model));
 }
开发者ID:noiary,项目名称:Aion-Core-v4.7.5,代码行数:28,代码来源:DroplistController.php


示例5: createAction

 /**
  * Creates a new company
  */
 public function createAction()
 {
     if ($this->request->isPost()) {
         $form = new SearchForm();
         $company = new MeiuiSearch();
         $data = $this->request->getPost();
         if (!$form->isValid($data, $company)) {
             foreach ($form->getMessages() as $message) {
                 $this->flash->error($message);
             }
             return $this->forward('search/create');
         }
         if ($company->save() == false) {
             foreach ($company->getMessages() as $message) {
                 $this->flash->error($message);
             }
             return $this->forward('search/create');
         }
         $form->clear();
         $this->flash->success("search was created successfully");
         return $this->forward("search/list");
     } else {
         $this->view->form = new SearchForm(null, array('edit' => true));
     }
 }
开发者ID:xiaoyunqiang,项目名称:meiui,代码行数:28,代码来源:SearchController.php


示例6: testDisabledShowInSearchFlagNotIncluded

 function testDisabledShowInSearchFlagNotIncluded()
 {
     $sf = new SearchForm($this->mockController, 'SearchForm');
     $page = $this->objFromFixture('SiteTree', 'dontShowInSearchPage');
     $results = $sf->getResults(null, array('Search' => 'dontShowInSearchPage'));
     $this->assertNotContains($page->ID, $results->column('ID'), 'Page with "Show in Search" disabled doesnt show');
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:7,代码来源:SearchFormTest.php


示例7: SpeakerSearchForm

 public function SpeakerSearchForm()
 {
     $searchField = new TextField('mq', 'Search Speaker', $this->getSearchQuery());
     $searchField->setAttribute("placeholder", "first name, last name or irc nickname");
     $fields = new FieldList($searchField);
     $form = new SearchForm($this, 'SpeakerSearchForm', $fields);
     $form->setFormAction($this->Link('results'));
     return $form;
 }
开发者ID:rbowen,项目名称:openstack-org,代码行数:9,代码来源:SpeakerListPage.php


示例8: actionSearch

 public function actionSearch()
 {
     if (Yii::app()->getRequest()->getQuery('SearchForm')) {
         $form = new SearchForm();
         $form->setAttributes(Yii::app()->getRequest()->getQuery('SearchForm'));
         if ($form->validate()) {
             $category = $form->category ? StoreCategory::model()->findByPk($form->category) : null;
             $this->render('search', ['category' => $category, 'searchForm' => $form, 'dataProvider' => $this->productRepository->search($form->q, $form->category)]);
         }
     }
 }
开发者ID:RexGalicie,项目名称:yupe,代码行数:11,代码来源:CatalogController.php


示例9: actionResult

 public function actionResult()
 {
     $model = new SearchForm();
     $form = new CForm('application.views.search.form', $model);
     if ($form->submitted('search') && $form->validate()) {
         $result = $model->searchResult();
         //$this->redirect(array('search/index'));
         $this->render('index', array('form' => $form, 'result' => $result));
     } else {
         $this->render('index', array('form' => $form));
     }
 }
开发者ID:romero1989,项目名称:phpnetmap,代码行数:12,代码来源:SearchController.php


示例10: actionSearch

 public function actionSearch()
 {
     if (!Yii::app()->getRequest()->getQuery('SearchForm')) {
         throw new CHttpException(404);
     }
     $form = new SearchForm();
     $form->setAttributes(Yii::app()->getRequest()->getQuery('SearchForm'));
     if ($form->validate()) {
         $category = $form->category ? StoreCategory::model()->findByPk($form->category) : null;
         $this->render('search', ['category' => $category, 'searchForm' => $form, 'dataProvider' => $this->productRepository->getByFilter($this->attributeFilter->getMainAttributesForSearchFromQuery(Yii::app()->getRequest(), [AttributeFilter::MAIN_SEARCH_PARAM_NAME => $form->q]), $this->attributeFilter->getEavAttributesForSearchFromQuery(Yii::app()->getRequest()))]);
     }
 }
开发者ID:RonLab1987,项目名称:43berega,代码行数:12,代码来源:CatalogController.php


示例11: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $oLogItemNaoCadastrado = LogItemNaoCadastrado::model()->naoCadastrado()->exibir()->findAll();
     $oOrdemServico = new OrdemServico('search');
     $oOrdemServico->unsetAttributes();
     $oSearchForm = new SearchForm();
     $oOrdemServico->status = LogOrdemServico::ABERTA;
     if (isset($_GET['OrdemServico'])) {
         $oOrdemServico->attributes = $_GET['OrdemServico'];
         $oSearchForm->request = $_GET['OrdemServico'];
     }
     $this->render('index', array('oLogItemNaoCadastrado' => $oLogItemNaoCadastrado, 'oOrdemServico' => $oOrdemServico, 'exibeFormularioBusca' => $oSearchForm->checaRequisicaoVazia()));
 }
开发者ID:bgstation,项目名称:erp,代码行数:17,代码来源:SiteController.php


示例12: run

 public function run()
 {
     $search = new SearchForm();
     $controller = $this->getController();
     $controller->layout = 'form';
     if (isset($_GET['SearchForm'])) {
         $search->attributes = $_GET['SearchForm'];
         if ($search->validate()) {
             if ($search->searchq == '') {
                 $query = '%';
             } else {
                 $query = $search->searchq;
             }
             $kategorie = $search->kategorie;
             $wortart = $search->wortart;
             $klasse = '';
             // Suchoptionen filtern:
             $filteredResults = wortschatz::model()->filterSearchOptions($kategorie, $wortart, $klasse);
             // alle genauen Treffer:
             $exactSearchResults = wortschatz::model()->exactSearch($filteredResults, $query);
             $pages_exact = $exactSearchResults['pages'];
             $countAll_exact = $exactSearchResults['countAll'];
             $count_exact = $exactSearchResults['count'];
             $sort_exact = $exactSearchResults['sort'];
             $models_exact = $exactSearchResults['models'];
             $linkedExactResults = wortschatz::model()->addLinks($models_exact);
             $models_exact_linked = $linkedExactResults['models'];
             // alle LIKE-Treffer:
             $standardSearchResults = wortschatz::model()->standardSearch($filteredResults, $query);
             $pages_standard = $standardSearchResults['pages'];
             $countAll_standard = $standardSearchResults['countAll'];
             $count_standard = $standardSearchResults['count'];
             $sort_standard = $standardSearchResults['sort'];
             $models_standard = $standardSearchResults['models'];
             // LIKE-Treffer ohne genaue Treffer:
             $cleanedResults = wortschatz::model()->removeExactResults($models_standard, $models_exact);
             $linkedResults = wortschatz::model()->addLinks($cleanedResults['models']);
             $models_linked = $linkedResults['models'];
             if ($count_exact != 0 or $count_standard != 0) {
                 $controller->render('search', array('search' => $search, 'query' => $query, 'models' => $models_linked, 'pages' => $pages_standard, 'countAll' => $countAll_standard, 'count' => $count_standard, 'sort' => $sort_standard, 'models_exact' => $models_exact_linked, 'pages_exact' => $pages_exact, 'countAll_exact' => $countAll_exact, 'count_exact' => $count_exact, 'sort_exact' => $sort_exact));
             } else {
                 $controller->render('search', array('search' => $search, 'errortext' => 'Keine Daten gefunden'));
             }
         } else {
             $controller->render('search', array('search' => $search));
         }
     } else {
         $controller->render('search', array('search' => $search));
     }
 }
开发者ID:BackupTheBerlios,项目名称:swahili-dict,代码行数:50,代码来源:SearchAction_new.php


示例13: createComponentSearchForm

 protected function createComponentSearchForm()
 {
     if ($this->searchRequest->groups) {
         $groups = array_fill_keys($this->searchRequest->groups, true);
     } else {
         $groups = array();
         foreach ($this->context->groups->getList() as $group) {
             $groups[$group->id] = true;
         }
     }
     $form = new SearchForm($this->context->groups);
     $form->setDefaults(array('s' => $this->getParameter('s'), 'from' => $this->searchRequest ? $this->searchRequest->from : null, 'groups' => $groups));
     $form->onSuccess[] = callback($form, 'submitted');
     return $form;
 }
开发者ID:zoidbergthepopularone,项目名称:fitak,代码行数:15,代码来源:SearchPresenter.php


示例14: actionSaveSort

 public function actionSaveSort()
 {
     $objTypeId = Yii::app()->request->getParam('id', NULL);
     $sort = Yii::app()->request->getParam('sort');
     if (count($sort) >= param('searchMaxField', 15)) {
         HAjax::jsonError(tt('Search max field ') . param('searchMaxField', 3));
     }
     if ($objTypeId !== NULL && $sort && is_array($sort)) {
         $elements = SearchForm::getSearchFields();
         $sql = "DELETE FROM {{search_form}} WHERE obj_type_id=:id AND status!=:status";
         Yii::app()->db->createCommand($sql)->execute(array(':id' => $objTypeId, ':status' => SearchFormModel::STATUS_NOT_REMOVE));
         $i = 3;
         foreach ($sort as $field) {
             if (!isset($elements[$field])) {
                 continue;
             }
             $search = new SearchFormModel();
             $search->attributes = array('obj_type_id' => $objTypeId, 'field' => $field, 'status' => $elements[$field]['status'], 'sorter' => $i, 'formdesigner_id' => isset($elements[$field]['formdesigner_id']) ? $elements[$field]['formdesigner_id'] : 0);
             $search->save();
             $i++;
         }
         // delete assets js cache
         ConfigurationModel::clearGenerateJSAssets();
         HAjax::jsonOk();
     }
     HAjax::jsonError();
 }
开发者ID:barricade86,项目名称:raui,代码行数:27,代码来源:SearchController.php


示例15: init

 public function init()
 {
     parent::init();
     if (!issetModule('messages')) {
         throw404();
     }
     $this->cityActive = SearchForm::cityInit();
 }
开发者ID:barricade86,项目名称:raui,代码行数:8,代码来源:BaseMessagesController.php


示例16: actionSearch

    public function actionSearch()
    {
        $model = new SearchForm();
        $dataProvider = null;
        if (isset($_REQUEST['SearchForm'])) {
            $model->attributes = $_REQUEST['SearchForm'];
            if ($model->validate()) {
                $friendList = AuxiliaryFriendsOperator::getFriendIdList();
                $sqlCount = 'SELECT count(*)
					 FROM ' . Upload::model()->tableName() . ' u
					 LEFT JOIN  ' . Users::model()->tableName() . ' s ON s.Id = u.userId 
					 WHERE (u.userId in (' . $friendList . ') 
					 			OR 
						 		u.userId = ' . Yii::app()->user->id . '
						 		OR
						 		u.publicData = 1 )
					 	   AND	
					 	   (s.realname like "%' . $model->keyword . '%"
						   		OR
						   		u.description like "%' . $model->keyword . '%")';
                $count = Yii::app()->db->createCommand($sqlCount)->queryScalar();
                $sql = 'SELECT u.Id as id, u.description, s.realname, s.Id as userId
					 FROM ' . Upload::model()->tableName() . ' u
					 LEFT JOIN  ' . Users::model()->tableName() . ' s ON s.Id = u.userId 
					 WHERE (u.userId in (' . $friendList . ') 
					 			OR 
						 		u.userId = ' . Yii::app()->user->id . ' 
						 		OR
						 		u.publicData = 1)
					 	   AND
					 	   (s.realname like "%' . $model->keyword . '%"
					 			OR
					 	   		u.description like "%' . $model->keyword . '%")';
                $dataProvider = new CSqlDataProvider($sql, array('totalItemCount' => $count, 'sort' => array('attributes' => array('id', 'realname')), 'pagination' => array('pageSize' => Yii::app()->params->imageCountInOnePage, 'params' => array(CHtml::encode('SearchForm[keyword]') => $model->attributes['keyword']))));
            }
        }
        Yii::app()->clientScript->scriptMap['jquery.js'] = false;
        //TODO: added below line because gridview.js is loaded before.
        Yii::app()->clientScript->scriptMap['jquery.yiigridview.js'] = false;
        $this->renderPartial('searchImageResults', array('model' => $model, 'dataProvider' => $dataProvider), false, true);
    }
开发者ID:Avinash1000,项目名称:traceper,代码行数:41,代码来源:ImageController.php


示例17: actionList

 /**
  * Show all books.
  */
 public function actionList()
 {
     $criteria = new CDbCriteria();
     $criteria->with = 'author';
     $searchForm = new SearchForm();
     if (isset($_POST['SearchForm'])) {
         $searchForm->setAttributes($_POST['SearchForm']);
         $criteria = $searchForm->apllyFilter($criteria);
     }
     $pages = new CPagination(Books::model()->count());
     $pages->applyLimit($criteria);
     $sort = new CSort('Books');
     $sort->attributes = array('name', 'date', 'date_update', 'author' => array('asc' => 'author.lastname, author.firstname', 'desc' => 'author.lastname DESC, author.firstname DESC', 'label' => 'Автор'));
     $sort->defaultOrder = 'name';
     $sort->applyOrder($criteria);
     $books = Books::model()->findAll($criteria);
     $formWidget = $this->createWidget('FormWindow');
     $formWidget->afterClose = '$("#ui-datepicker-div").remove();$("#content").load("#");';
     $formWidget->run();
     $this->renderAjax('list', array('pages' => $pages, 'models' => $books, 'sort' => $sort, 'searchForm' => $searchForm));
 }
开发者ID:hit-shappens,项目名称:testapp,代码行数:24,代码来源:BooksController.php


示例18: __construct

 /**
  * the constructor of a Simple/basic SearchForm
  */
 function __construct($controller, $name, $fields = null, $actions = null)
 {
     if (!$fields) {
         $fields = new FieldSet($searchBy = new CompositeField(new HeaderField(_t('ProductSearchForm.SEARCHBY', 'Search Products'), 2), new HeaderField(_t('ProductSearchForm.WHERE', 'Where?'), 3), new LocationTreeDropdown('Location', ''), $categoryFields = new CompositeField(new HeaderField(_t('ProductSearchForm.SEARCHCRITERIA', 'Search Criteria'), 3), new MyTypeDropdown("ProductCategory1", 'Category #1', 'ProductCategory', null, null, false, array('Any' => 'Any Category')), new LiteralField('or1', ' or '), new MyTypeDropdown("ProductCategory2", 'Category #2', 'ProductCategory', null, null, true, array('' => '')), new LiteralField('or2', ' or '), new MyTypeDropdown("ProductCategory3", 'Category #3', 'ProductCategory', null, null, true, array('' => ''))), new TextField("keywords", _t('ProductSearchForm.KEYWORDS', 'Keywords'))), $sortBy = new CompositeField(new HeaderField(_t('ProductSearchForm.SORTBY', 'Sort Results By'), 3), new OptionsetField("sortby", "", array('PageTitle' => _t('ProductSearchForm.NAME', 'Name'), 'Category' => _t('ProductSearchForm.CATEGORY', 'Category'), 'Location' => _t('ProductSearchForm.LOCATION', 'Location')), 'PageTitle')));
         $searchBy->ID = "ProductSearchForm_SearchBy";
         $sortBy->ID = "ProductSearchForm_SortBy";
         $categoryFields->ID = "ProductSearchForm_SearchBy_Category";
     }
     if (!$actions) {
         $actions = new FieldSet(new FormAction("results", _t('ProductSearchForm.SEARCH', 'Search')));
     }
     parent::__construct($controller, $name, $fields, $actions);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-business-directory,代码行数:16,代码来源:ProductSearchForm.php


示例19: __construct

 /**
  * the constructor of a Simple/basic SearchForm
  */
 function __construct($controller, $name, $fields = null, $actions = null)
 {
     if (!$fields) {
         $fields = new FieldSet($searchBy = new CompositeField(new HeaderField('SearchByHeader', _t('AdvancedSearchForm.SEARCHBY', 'SEARCH BY')), new TextField("+", _t('AdvancedSearchForm.ALLWORDS', 'All Words')), new TextField("quote", _t('AdvancedSearchForm.EXACT', 'Exact Phrase')), new TextField("any", _t('AdvancedSearchForm.ATLEAST', 'At Least One Of the Words')), new TextField("-", _t('AdvancedSearchForm.WITHOUT', 'Without the Words'))), $sortBy = new CompositeField(new HeaderField('SortByHeader', _t('AdvancedSearchForm.SORTBY', 'SORT RESULTS BY')), new OptionsetField("sortby", "", array('Relevance' => _t('AdvancedSearchForm.RELEVANCE', 'Relevance'), 'LastUpdated' => _t('AdvancedSearchForm.LASTUPDATED', 'Last Updated'), 'PageTitle' => _t('AdvancedSearchForm.PAGETITLE', 'Page Title')), 'Relevance')), $chooseDate = new CompositeField(new HeaderField('LastUpdatedHeader', _t('AdvancedSearchForm.LASTUPDATEDHEADER', 'LAST UPDATED')), new DateField("From", _t('AdvancedSearchForm.FROM', 'From')), new DateField("To", _t('AdvancedSearchForm.TO', 'To'))));
         $searchBy->ID = "AdvancedSearchForm_SearchBy";
         $searchOnly->ID = "AdvancedSearchForm_SearchOnly";
         $sortBy->ID = "AdvancedSearchForm_SortBy";
         $chooseDate->ID = "AdvancedSearchForm_ChooseDate";
     }
     if (!$actions) {
         $actions = new FieldSet(new FormAction("results", _t('AdvancedSearchForm.GO', 'Go')));
     }
     parent::__construct($controller, $name, $fields, $actions);
 }
开发者ID:comperio,项目名称:silverstripe-framework,代码行数:17,代码来源:AdvancedSearchForm.php


示例20: __construct

 /**
  * the constructor of a Simple/basic SearchForm
  */
 function __construct($controller, $name, $fields = null, $actions = null)
 {
     // Need this before we call parent::_construct
     $this->controller = $controller;
     if (!$fields) {
         if ($this->controller->GeoLevelName() != 'No level' && $this->controller->getBusinessCount() != 0) {
             $searchBusinessHeading = 'Search Businesses in ' . $this->controller->Title;
         } else {
             $searchBusinessHeading = _t('BusinessSearchForm.SEARCHBUSINESSES', 'Search Our Network');
         }
         $fields = new FieldSet($searchBy = new CompositeField(new HeaderField($searchBusinessHeading, 2), new HeaderField(_t('BusinessSearchForm.BUSINESSDETAILS', 'Business Details'), 4), new NumericField("floid", _t('BusinessSearchForm.FLOID', 'FLO ID')), new TextField("keywords", _t('BusinessSearchForm.KEYWORDS', 'Name or keyword')), $this->getLocationFields(), $certFields = new CompositeField(new HeaderField(_t('BusinessSearchForm.SEARCHCRITERIA', 'Product Type / Function'), 4), new MyTypeDropdown("ProductCategory1", 'Product Type', 'ProductCategory', null, null, false, array('All' => 'All')), new MyTypeDropdown("CertificationType1", 'Function', 'CertificationType', null, null, false, array('All' => 'All')), new LiteralField('andOr1', '<span class="andOr" id="andOr1">or</span>'), new MyTypeDropdown("ProductCategory2", 'Product Type', 'ProductCategory', null, null, false, array('All' => 'All')), new MyTypeDropdown("CertificationType2", 'Function', 'CertificationType', null, null, false, array('All' => 'All')), new LiteralField('andOr2', '<span class="andOr" id="andOr2">or</span>'), new MyTypeDropdown("ProductCategory3", 'Product Type', 'ProductCategory', null, null, false, array('All' => 'All')), new MyTypeDropdown("CertificationType3", 'Function', 'CertificationType', null, null, false, array('All' => 'All')), new LiteralField('addCriteria', '<div id="addRemoveCriteria"><a href="#" id="addCriteria">Add criteria</a><span id="addRemovePipe"> | </span><a href="#" id="removeCriteria">Remove criteria</a></div>'), new OptionsetField('CertificationAndOr', '', array('AND' => 'Must match ALL of the selection below', 'OR' => 'Must match ANY of the selection below'), 'AND'))), $sortBy = new HiddenField('sortby', '', 'Location'));
         $searchBy->ID = "BusinessSearchForm_SearchBy";
         $sortBy->ID = "BusinessSearchForm_SortBy";
         $certFields->ID = "BusinessSearchForm_SearchBy_CertificationCriteria";
     }
     if (!$actions) {
         $actions = new FieldSet(new FormAction("results", _t('BusinessSearchForm.SEARCH', 'Search')));
     }
     parent::__construct($controller, $name, $fields, $actions);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-business-directory,代码行数:23,代码来源:BusinessSearchForm.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SearchHandler类代码示例发布时间:2022-05-23
下一篇:
PHP SearchEngine类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap