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

Public Member Functions

 actionAutosuggest ()
 actionTestDriver ()

Additional Inherited Members

- Public Attributes inherited from Controller
 $menu = array()
 $breadcrumbs = array()
- Protected Member Functions inherited from BaseController
 beforeAction ($action)

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.

Definition at line 12 of file SearchController.php.

Member Function Documentation

SearchController::actionAutosuggest ( )

action for autosuggestion a search request

Returns
bool

Definition at line 19 of file SearchController.php.

{
$phrase = Yii::app()->request->getQuery('searchTerm', '');
$secureAutosuggestUrl = Yii::app()->request->getQuery('autosuggestUrl');
$result = array('data'=>array());
$params = array(
'filter' => $phrase,
'type' => 'php',
);
$searchApi = new SearchApi();
if(!empty($secureAutosuggestUrl)){
$url = Yii::app()->securityManager->validateData($secureAutosuggestUrl);
if(!empty($url)){
$searchApi->autosuggestUrl = $url;
}
}
$data = $searchApi->getRepositoryApi()->requestAutosuggest($params);
if ($data = unserialize($data)) {
if ($data['status']=='ok') {
unset($data['status']);
$result['qty'] = count($data);
foreach ($data as $resultItem) {
$result['data'][$resultItem['attributes']['word']] = $resultItem['attributes']['word'];
}
}
}
echo json_encode($result['data']);
}

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