本文整理汇总了PHP中Client::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::search方法的具体用法?PHP Client::search怎么用?PHP Client::search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::search方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: retrieveDoctorProfileOld
/**
* @param int $practoAccntId
*
* @return \ConsultBundle\Entity\DoctorEntity|null
*/
public function retrieveDoctorProfileOld($practoAccntId = 5)
{
//$this->client = new Client();
$params['index'] = $this->index;
$params['type'] = 'search';
$params['_source'] = array('doctor_id', 'doctor_name', 'practo_account_id', 'specialties.specialty', 'profile_picture');
$params['body']['query']['match']['practo_account_id'] = $practoAccntId;
$results = $this->client->search($params);
if (count($results['hits']['hits']) === 0) {
return null;
}
$doc = null;
foreach ($results['hits']['hits'] as $result) {
$doc = $this->populateDoctorObject($result['_source']);
}
if (is_null($doc)) {
return null;
}
return $doc;
}
示例2: ini_set
ini_set('memory_limit', '1000M');
Client::init();
/**
* SEARCH ACCESS
* This features is only used in map/rsm/str/grf viewer
* If you are not using them, you can comment this block
*/
if (isset($_POST['filter']) && is_string($_POST['filter'])) {
header('Status: 200 OK', true, 200);
header('Content-type: text/plain');
if (!$CONFIGS['CLIENT_ENABLESEARCH']) {
exit;
}
$filter = ini_get('magic_quotes_gpc') ? stripslashes($_POST['filter']) : $_POST['filter'];
$filter = utf8_decode('/' . $filter . '/i');
$list = Client::search($filter);
die(implode("\n", $list));
}
/**
* DIRECT ACCESS
*/
if (empty($_SERVER['REDIRECT_STATUS']) || $_SERVER['REDIRECT_STATUS'] != 404 || empty($_SERVER['REQUEST_URI'])) {
Debug::write('Direct access, no file requested ! You have to request a file (from the url), for example: <a href="data/clientinfo.xml">data/clientinfo.xml</a>', 'error');
Debug::output();
}
// Decode path
$path = str_replace('\\', '/', utf8_decode(urldecode($_SERVER['REQUEST_URI'])));
$path = preg_replace('/\\?.*/', '', $path);
// remove query
$directory = basename(dirname(__FILE__));
// Check Allowed directory
示例3: foreach
<?php
// Ensure we've searched and are looking at a page.
if ($_POST['search'] || !empty($_REQUEST['page'])) {
$hasResults = false;
?>
<div id="resultsBox">
<div style="float:right; margin-top:12px; margin-right: 20px;">
<input type="submit" name="submit" id="submit" value="Submit" />
</div><!-- End of Submit Request -->
<h3 style= "margin-left: 400px; margin-top: 12px; color: #E0E0E0;"><u>Search Results</u></h3>
<div id="resultsTableBox">
<?php
// Get the list of potential candidates.
if (($candidates = Client::search($_POST['workType'], $_POST['experience'], $_POST['education'], $_POST['salary'], $_POST['zip'], $_POST['distance'], !empty($_REQUEST['page']) ? $_REQUEST['page'] : 1)) !== false && count($candidates->data) >= 1) {
$hasResults = true;
?>
<table style="margin-left: 20px; width:885px; table-layout:fixed;">
<tr>
<?php
if (!empty($_POST['candidates'])) {
$i = 0;
foreach ($_POST['candidates'] as $candidate) {
$staff = new Staff($candidate);
?>
<td align="center">
<img class="image" id="pic" name="pic" src="<?php
echo !empty($staff->picture) && file_exists("uploads/pictures/" . $staff->picture) ? 'uploads/pictures/' . $staff->picture : "styles/noperson.png";
?>
" /><br />
示例4: actionAjaxClientSearch
/**
* @throws CHttpException
*/
public function actionAjaxClientSearch()
{
if (!Yii::app()->getRequest()->getQuery('q')) {
throw new CHttpException(404);
}
$query = Yii::app()->getRequest()->getQuery('q');
$model = new Client('search');
$model->first_name = $query;
$model->last_name = $query;
$model->middle_name = $query;
$model->nick_name = $query;
$data = [];
foreach ($model->search()->getData() as $client) {
$data[] = ['id' => $client->id, 'name' => sprintf('%s (%s %s)', $client->getFullName(), $client->phone, $client->email)];
}
Yii::app()->ajax->raw($data);
}
示例5: actionSendMailshot
/**
* This got messy
*
* @param $instructionId
* @throws CHttpException
*/
public function actionSendMailshot($instructionId)
{
$model = new Client('search');
if (isset($_POST['send']) && $_POST['send']) {
$instruction = Deal::model()->findByPk($instructionId);
$type = MailshotType::model()->findByPk($_POST['MailshotType']);
$model->attributes = $_GET['Client'];
$dataProvider = $model->search();
$dataProvider->setPagination(['pageSize' => 100]);
if (!$type) {
throw new CHttpException(404, 'Mailshot Type [name: ' . $_POST['MailshotType'] . '] was not found');
}
if (!$instruction) {
throw new CHttpException(404, 'Instruction [id: ' . $instructionId . '] was not found');
}
$mailshot = new MandrillMailshot();
$mailshot->instructionId = $instruction->dea_id;
$mailshot->type = $type->name;
$mailshot->save();
if ($type->templatePath && file_exists($type->templatePath)) {
ob_start();
include $type->templatePath;
$htmlTemplate = ob_get_clean();
} else {
$htmlTemplate = $this->execTemplate($type->htmlTemplate);
}
$textTemplate = $this->execTemplate($type->textTemplate);
$mandrillMessagePreset = new MandrillMessage();
$mandrillMessagePreset->setFrom(Yii::app()->params['mailshot']['sender_email'], Yii::app()->params['mailshot']['sender_name']);
$mandrillMessagePreset->setHtmlBody($htmlTemplate);
$mandrillMessagePreset->setTextBody($textTemplate);
$mandrillMessagePreset->setSubject($type->subject);
$mandrillMessagePreset->setPreserveRecepients(false);
$mandrillMessagePreset->setGlobalMergeVar('MAILSHOT_ID', $mailshot->id);
$mandrillMessagePreset->setGlobalMergeVar('INSTRUCTION_ID', $instruction->dea_id);
$mandrillMessagePreset->setGlobalMergeVar('INSTRUCTION_PRICE', Locale::formatCurrency($instruction->dea_marketprice));
$mandrillMessagePreset->setGlobalMergeVar('INSTRUCTION_TITLE', $instruction->title);
$mandrillMessagePreset->setGlobalMergeVar('INSTRUCTION_STRAPLINE', $instruction->dea_strapline);
$mandrillMessagePreset->setGlobalMergeVar('OFFICE_TITLE', $instruction->branch->office->title);
$mandrillMessagePreset->setGlobalMergeVar('OFFICE_NUMBER', $instruction->branch->bra_tel);
if (isset($_POST['test']) && $_POST['test']) {
$mandrillMessagePreset->enableTest();
}
$iterator = new DataProviderIterator($dataProvider);
/** @var $mandrillMessage MandrillMessage */
$mandrillMessage = null;
$x = 0;
$staffEmails = array_fill_keys(Yii::app()->params['mailshot']['alwaysSendTo'], '?');
if (Yii::app()->params['mandrill']['test_run']) {
$testEmails = Yii::app()->params['mandrill']['test_emails'];
}
/** @var $client Client */
foreach ($iterator as $client) {
$email = $client->cli_email;
if (isset($testEmails)) {
if (!$testEmails) {
break;
}
$email = array_shift($testEmails);
}
if (!$email) {
continue;
}
//we are sending emails to our staff in a different message
if (array_key_exists($email, $staffEmails)) {
continue;
}
if ($x % Yii::app()->params['mandrill']['mails_in_message'] === 0) {
if ($mandrillMessage) {
$mandrillMessage->send();
$mailshot->addMessage($mandrillMessage);
}
$mandrillMessage = clone $mandrillMessagePreset;
}
$mandrillMessage->addTo($email, $client->getFullName());
$mandrillMessage->setRecepientMergeVar($email, 'CLIENT_FULLNAME', $client->getFullName());
$mandrillMessage->setRecepientMergeVar($email, 'CLIENT_SALUTATION', $client->cli_salutation);
$mandrillMessage->setRecepientMergeVar($email, 'CLIENT_ID', $client->cli_id);
$mandrillMessage->setRecepientMergeVar($email, 'CLIENT_EMAIL', $email);
$mandrillMessage->setRecepientMetaData($email, 'clientId', $client->cli_id);
$x++;
}
if (!$mandrillMessage->id) {
$mandrillMessage->send();
$mailshot->addMessage($mandrillMessage);
}
/**
* doing a trick. will send an email to everyone in staff list to avoid complains
*/
$staffMessage = clone $mandrillMessagePreset;
$clients = Client::model()->findAll('cli_email IN (' . implode(', ', $staffEmails) . ')', array_keys($staffEmails));
foreach ($clients as $client) {
$email = $client->cli_email;
$staffMessage->addTo($email, $client->getFullName());
//.........这里部分代码省略.........