Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
SearchResultWidget Class Reference
Inheritance diagram for SearchResultWidget:
BaseJuiWidget

Public Member Functions

 run ()
 paginationUrl ($pageNumber)
- Public Member Functions inherited from BaseJuiWidget
 getViewFile ($viewName)

Public Attributes

 $phrase = ''
 $searchResult = ''
 $offset = 0
 $status = 'ok'
 $totalQty = 0
 $perPage = 20
 $baseHref = ''
 $usePersonalisation = true
 $pageNumber
 $existsMore = false
 $searchUrl

Detailed Description

Gentics Portal.Node PHP Author & Copyright (c) by Gentics Software GmbH sales.nosp@m.@gen.nosp@m.tics..nosp@m.com http://www.gentics.com Licenses can be found in the LICENSE.txt file in the root-folder of this installation You must not use this software without a valid license agreement.

Comment controller class file.

Author
Vitalii Kovalchuk vital.nosp@m.y.ko.nosp@m.valch.nosp@m.uk@o.nosp@m.berig.nosp@m..com

Definition at line 15 of file SearchResultWidget.php.

Member Function Documentation

SearchResultWidget::paginationUrl (   $pageNumber)

Create pagination urls

Returns
string

Definition at line 132 of file SearchResultWidget.php.

{
$url = AppHelper::removeParamsFromUrl(Yii::app()->request->requestUri, array('page'));
if($pageNumber > 1) {
$url = AppHelper::addParamsToUrl($url, array('page' => $pageNumber));
}
return $url;
}
SearchResultWidget::run ( )

Widget run method.

Returns
void

Definition at line 80 of file SearchResultWidget.php.

References $searchUrl.

{
$this->phrase = Yii::app()->request->getQuery('searchTerm', '');
$this->offset = (int)Yii::app()->request->getQuery('offset', 0);
$this->pageNumber = (int)Yii::app()->request->getQuery('page', 1);
if (trim($this->phrase)!='') {
$searchAdaptor = new SearchAdaptor(
$this->phrase,
isset($_GET['advanced']) ? $_GET : array(),
$this->usePersonalisation
);
if(!empty($this->searchUrl)) {
$searchAdaptor->searchApi->searchUrl = $this->searchUrl;
}
$searchAdaptor->pageNumber = $this->pageNumber;
$searchAdaptor->pageSize = Yii::app()->getModule('search')->perPage;
$this->searchResult = $searchAdaptor->fetchNext();
$this->existsMore = $searchAdaptor->existsMore();
// if (isset($_GET['advanced'])) {
// $this->searchResult = $searchApi->advancedSearch($this->phrase, $_GET, $this->usePersonalisation);
// } else {
// $this->searchResult = $searchApi->simpleSearch($this->phrase, $this->usePersonalisation);
// }
// $this->status = $this->searchResult['status'];
// unset($this->searchResult['status']);
//
// $this->totalQty = count($this->searchResult);
// $this->perPage = Yii::app()->getModule('search')->perPage;
/* check if offet is in range of results quantity */
// if ($this->offset>=count($this->searchResult)V || $this->offset<0) {
// $this->offset = 0;
// }
/* calculating pagination */
// $this->searchResult = array_slice($this->searchResult, $this->offset, $this->perPage);
$this->render('SearchResultWidget');
}
}

Member Data Documentation

SearchResultWidget::$searchUrl

Overrided search url

string

Definition at line 73 of file SearchResultWidget.php.

Referenced by run().


The documentation for this class was generated from the following file: