本文整理汇总了PHP中PhoneNumber类的典型用法代码示例。如果您正苦于以下问题:PHP PhoneNumber类的具体用法?PHP PhoneNumber怎么用?PHP PhoneNumber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PhoneNumber类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: beforeDelete
/**
* (non-PHPdoc)
* @see Model::beforeDelete()
*/
function beforeDelete($cascade = true)
{
App::import('Model', 'PhoneNumber');
$my_model = new PhoneNumber();
$this->recursive = 1;
$businessDetail = $this->find('first', array('conditions' => array('BusinessDetail.id' => $this->id)));
$this->_business_delete_id = $businessDetail['BusinessDetail']['businesses_id'];
foreach ($businessDetail['PhoneNumber'] as $phone) {
$my_model->delete($phone['id']);
}
return true;
}
开发者ID:JesusRugama,项目名称:Promobot,代码行数:16,代码来源:BusinessDetail.php
示例2: getPhone
protected function getPhone($phoneId)
{
// Phone
$phone = 'Privacy';
$numberId = (int) $phoneId;
if ($numberId > 0) {
$phoneNumber = new PhoneNumber();
$phoneNumber->numberId = $numberId;
$phoneNumber->populate();
if ($phoneNumber->type == 'REMINDERS') {
$phone = $phoneNumber->number;
}
}
return $phone;
}
开发者ID:dragonlet,项目名称:clearhealth,代码行数:15,代码来源:PatientRemindersController.php
示例3: runTest
public function runTest()
{
extract($this->_options, EXTR_SKIP);
$phone = new PhoneNumber($this->fieldValue);
$phone->defaultAreaCode = $defaultAreaCode;
list($areaCode, $first3Digits, $last4Digits) = $phone->split();
// Check to make sure it is a valid phone number.
if (!$areaCode || !$first3Digits || !$last4Digits) {
$this->validator->registerInvalid($this->field, $this->formatError($error));
return false;
}
if ($modify) {
$this->validator->setFieldValue($this->field, $areaCode . '-' . $first3Digits . '-' . $last4Digits);
}
return true;
}
开发者ID:jfro,项目名称:php-simpledb,代码行数:16,代码来源:IsPhone.php
示例4: send_message
function send_message($from, $to, $message)
{
$from = PhoneNumber::normalizePhoneNumberToE164($from);
$to = PhoneNumber::normalizePhoneNumberToE164($to);
try {
$account = OpenVBX::getAccount();
$response = $account->messages->sendMessage($from, $to, $message);
} catch (Exception $e) {
throw new VBX_Sms_messageException($e->getMessage());
}
if (!in_array($response->status, array('sent', 'queued'))) {
throw new VBX_Sms_messageException('SMS delivery failed. An unknown error occurred' . ' during delivery.');
}
}
开发者ID:tjoozey,项目名称:openvbx,代码行数:14,代码来源:vbx_sms_message.php
示例5: send_message
function send_message($from, $to, $message)
{
$from = PhoneNumber::normalizePhoneNumberToE164($from);
$to = PhoneNumber::normalizePhoneNumberToE164($to);
$twilio = new TwilioRestClient($this->twilio_sid, $this->twilio_token, $this->twilio_endpoint);
error_log("Sending sms from {$from} to {$to} with content: {$message}");
$response = $twilio->request("Accounts/{$this->twilio_sid}/SMS/Messages", 'POST', array("From" => $from, "To" => $to, "Body" => $message));
$status = isset($response->ResponseXml) ? $response->ResponseXml->SMSMessage->Status : 'failed';
if ($response->IsError || $status != 'sent' && $status != 'queued') {
error_log("SMS not sent - Error Occurred");
error_log($response->ErrorMessage);
throw new VBX_Sms_messageException($response->ErrorMessage);
}
}
开发者ID:JeffaCubed,项目名称:OpenVBX,代码行数:14,代码来源:vbx_sms_message.php
示例6: populateHeader
public function populateHeader(SimpleXMLElement $xml)
{
$patientName = array();
$patientName['given'] = $this->patient->person->firstName;
$patientName['family'] = $this->patient->person->lastName;
$patientName['suffix'] = $this->patient->person->suffix;
$providerName = array();
$providerName['prefix'] = $this->user->person->prefix;
$providerName['given'] = $this->user->person->firstName;
$providerName['family'] = $this->user->person->lastName;
$building = $this->building;
$buildingName = $building->displayName;
$realmCode = $xml->addChild('realmCode');
$realmCode->addAttribute('code', 'US');
$typeId = $xml->addChild('typeId');
$typeId->addAttribute('root', '2.16.840.1.113883.1.3');
$typeId->addAttribute('extension', 'POCD_HD000040');
$templateId = $xml->addChild('templateId');
$templateId->addAttribute('root', '2.16.840.1.113883.3.27.1776');
$templateId->addAttribute('assigningAuthorityName', 'CDA/R2');
$templateId = $xml->addChild('templateId');
$templateId->addAttribute('root', '2.16.840.1.113883.10.20.3');
$templateId->addAttribute('assigningAuthorityName', 'HL7/CDT Header');
$templateId = $xml->addChild('templateId');
$templateId->addAttribute('root', '1.3.6.1.4.1.19376.1.5.3.1.1.1');
$templateId->addAttribute('assigningAuthorityName', 'IHE/PCC');
$templateId = $xml->addChild('templateId');
$templateId->addAttribute('root', '2.16.840.1.113883.3.88.11.32.1');
$templateId->addAttribute('assigningAuthorityName', 'HITSP/C32');
$id = $xml->addChild('id');
$id->addAttribute('root', '2.16.840.1.113883.3.72');
$id->addAttribute('extension', 'HITSP_C32v2.5');
$id->addAttribute('assigningAuthorityName', 'ClearHealth');
$code = $xml->addChild('code');
$code->addAttribute('code', '34133-9');
$displayName = 'Summarization of episode note';
$code->addAttribute('displayName', $displayName);
$code->addAttribute('codeSystem', '2.16.840.1.113883.6.1');
$code->addAttribute('codeSystemName', 'LOINC');
$xml->addChild('title', html_convert_entities($this->_title));
$effectiveTime = $xml->addChild('effectiveTime');
$dateEffective = self::formatDate();
$effectiveTime->addAttribute('value', $dateEffective);
$confidentialityCode = $xml->addChild('confidentialityCode');
$confidentialityCode->addAttribute('code', 'N');
//$confidentialityCode->addAttribute('codeSystem','2.16.840.1.113883.5.25');
$languageCode = $xml->addChild('languageCode');
$languageCode->addAttribute('code', 'en-US');
// RECORD TARGET
$recordTarget = $xml->addChild('recordTarget');
$patientRole = $recordTarget->addChild('patientRole');
$id = $patientRole->addChild('id');
//$id->addAttribute('root','CLINICID');
$id->addAttribute('root', 'MRN');
//$id->addAttribute('extension','PatientID');
$id->addAttribute('extension', html_convert_entities($this->patient->recordNumber));
// Address
$address = new Address();
$address->personId = $this->_patientId;
$addressIterator = $address->getIteratorByPersonId();
foreach ($addressIterator as $address) {
break;
// retrieves the top address
}
$addr = $patientRole->addChild('addr');
if ($address->addressId > 0) {
$addr->addAttribute('use', 'HP');
$addr->addChild('streetAddressLine', html_convert_entities(strlen($address->line2) > 0 ? $address->line1 . ' ' . $address->line2 : $address->line1));
$addr->addChild('city', html_convert_entities($address->city));
$addr->addChild('state', html_convert_entities($address->state));
$addr->addChild('postalCode', html_convert_entities($address->zipCode));
}
// Telecom
$phone = null;
$phoneNumber = new PhoneNumber();
$phoneNumber->personId = $this->_patientId;
foreach ($phoneNumber->getPhoneNumbers(false) as $phone) {
break;
// retrieves the top phone
}
$telecom = $patientRole->addChild('telecom');
if ($phone && strlen($phone['number']) > 0) {
$telecom->addAttribute('use', 'HP');
$telecom->addAttribute('value', 'tel:' . html_convert_entities($phone['number']));
}
// Patient
$patient = $patientRole->addChild('patient');
$name = $patient->addChild('name');
$name->addChild('given', html_convert_entities($patientName['given']));
$name->addChild('family', html_convert_entities($patientName['family']));
$name->addChild('suffix', html_convert_entities($patientName['suffix']));
$genderCode = $patient->addChild('administrativeGenderCode');
$genderCode->addAttribute('code', html_convert_entities($this->patient->person->gender));
$genderCode->addAttribute('displayName', html_convert_entities($this->patient->person->displayGender));
$genderCode->addAttribute('codeSystem', '2.16.840.1.113883.5.1');
$genderCode->addAttribute('codeSystemName', 'HL7 AdministrativeGender');
$birthTime = $patient->addChild('birthTime');
$birthTime->addAttribute('value', date('Ymd', strtotime($this->patient->person->dateOfBirth)));
/*$maritalStatusCode = $patient->addChild('maritalStatusCode');
$maritalStatusCode->addAttribute('code','');
//.........这里部分代码省略.........
开发者ID:dragonlet,项目名称:clearhealth,代码行数:101,代码来源:CCD.php
示例7: fad710e267c002f374f607e125e6219e044710bba
private function fad710e267c002f374f607e125e6219e044710bba()
{
$i24931bf8d8dd5bf8b970fbea0e59a47ff06bffa1 = $iea9d992f624fb48911a6ab7dc62eed1a4c5e3706 = "";
$ib1199182837e705aae8d93f525c88b1184f9395d = $this->f1b1c636527127b1c174f4aa075d5334084c79b0e($this->v82b103019f8b63abe35e23c8982897d7b3b13cd2, $this->v5a4616ba4ac4a7f21e69ba2afe5e994ae9927078);
if ($this->va917c2d49152f506b70362a47d4a4b689d3e7541 != -1) {
$ia917c2d49152f506b70362a47d4a4b689d3e7541 = $this->va917c2d49152f506b70362a47d4a4b689d3e7541;
} elseif (isset($ib1199182837e705aae8d93f525c88b1184f9395d["senderID"]) && PhoneNumber::isPhoneNumber($ib1199182837e705aae8d93f525c88b1184f9395d["senderID"])) {
$ia917c2d49152f506b70362a47d4a4b689d3e7541 = $ib1199182837e705aae8d93f525c88b1184f9395d["senderID"];
if ($ib1199182837e705aae8d93f525c88b1184f9395d["senderID"] != "") {
$iea9d992f624fb48911a6ab7dc62eed1a4c5e3706 = " class=\"hidden\"";
$i24931bf8d8dd5bf8b970fbea0e59a47ff06bffa1 = "";
} else {
$iea9d992f624fb48911a6ab7dc62eed1a4c5e3706 = "";
}
} else {
$ia917c2d49152f506b70362a47d4a4b689d3e7541 = -1;
}
if (strlen($this->v24931bf8d8dd5bf8b970fbea0e59a47ff06bffa1) > 0 && $this->va917c2d49152f506b70362a47d4a4b689d3e7541 == -1) {
$i24931bf8d8dd5bf8b970fbea0e59a47ff06bffa1 = $this->v24931bf8d8dd5bf8b970fbea0e59a47ff06bffa1;
$ia917c2d49152f506b70362a47d4a4b689d3e7541 = -1;
$iea9d992f624fb48911a6ab7dc62eed1a4c5e3706 = "";
}
if ($this->v19b8b7cad3f484c5fd3981e8d383972bf5b46508) {
$iea9d992f624fb48911a6ab7dc62eed1a4c5e3706 = " class=\"hidden\"";
$if7a6d77e9294fd1c231b0e08d721dfa1f192bec6 = " class=\"hidden\"";
$i011b2a01ee0a992d7ea6a807884909e65aefd0c7 = "";
} else {
$if7a6d77e9294fd1c231b0e08d721dfa1f192bec6 = "";
$i011b2a01ee0a992d7ea6a807884909e65aefd0c7 = " class=\"hidden\"";
}
$i02fcabda2448d40bdb76bd10f9e95950039649ee = ' <form action="" method="post"> <table class="formTable profile"> <tbody> <tr' . $if7a6d77e9294fd1c231b0e08d721dfa1f192bec6 . '> <td>' . self::getLabel(v_smswizard_existingown, 'class="bold"') . '</td> <td>' . self::getSelect(array("name" => "ownsenderID", "id" => "selectOwnSender", "onchange" => "ownSender();"), $this->f2e417c6ce6885ef9fd0253ef02610a4fe8446157(), $ia917c2d49152f506b70362a47d4a4b689d3e7541) . ' *</td> </tr> <tr id="newOwnSender"' . $iea9d992f624fb48911a6ab7dc62eed1a4c5e3706 . '> <td>' . self::getLabel(v_smswizard_newownnrid, 'class="bold"') . '</td> <td>' . self::getInput(array("name" => "newownsenderID", "type" => "text", "value" => $i24931bf8d8dd5bf8b970fbea0e59a47ff06bffa1)) . ' * ' . self::getNote(v_smswizard_intformat) . '</td> </tr> <tr id="newOwnSender"' . $i011b2a01ee0a992d7ea6a807884909e65aefd0c7 . '> <td>' . self::getLabel(v_smswizard_smscode, 'class="bold"') . '</td> <td>' . self::getInput(array("name" => "validateCode", "type" => "text", "value" => $this->va673093194bc7ce7672ed2857425609839b3119d)) . ' *</td> </tr> <tr> <td></td> <td>' . self::getInput(array("name" => "submitAddOwnNumberSenderID", "type" => "submit", "value" => v_smswizard_confirm)) . '</td> </tr> </tbody> </table> <div class="small note"><sup>*</sup> ' . v_adminsmsprofile_required . '</div>' . self::getInput(array("name" => "info", "type" => "hidden", "value" => $this->vb2bdeb39d0b431e06e364d808d2f32fddee67ca3)) . self::getInput(array("name" => "country", "type" => "hidden", "value" => $this->v5a4616ba4ac4a7f21e69ba2afe5e994ae9927078)) . self::getInput(array("name" => "type", "type" => "hidden", "value" => $this->v82b103019f8b63abe35e23c8982897d7b3b13cd2)) . self::getInput(array("name" => "action", "type" => "hidden", "value" => $this->vb17553f86a6e6460083956094e21682b0eb19a5b)) . self::getInput(array("name" => "isms", "type" => "hidden", "value" => implode(";", $this->vf261e0e1babe742f7019d4d5742b8f9a0dc76be1))) . self::getInput(array("name" => "sendedCode", "type" => "hidden", "value" => $this->v19b8b7cad3f484c5fd3981e8d383972bf5b46508));
if (method_exists($this, "addToPostAdapter")) {
$i02fcabda2448d40bdb76bd10f9e95950039649ee .= $this->addToPostAdapter(true);
}
$i02fcabda2448d40bdb76bd10f9e95950039649ee .= '</form>';
return $i02fcabda2448d40bdb76bd10f9e95950039649ee;
}
开发者ID:mirzavu,项目名称:clothfarm,代码行数:37,代码来源:settings.php
示例8: actionSearch
/**
* Search X2Engine for a record.
*
* This is the action called by the search bar in the main menu.
*/
public function actionSearch()
{
ini_set('memory_limit', -1);
$term = isset($_GET['term']) ? $_GET['term'] : "";
if (empty($term)) {
$dataProvider = new CArrayDataProvider(array());
Yii::app()->user->setFlash('error', Yii::t('app', "Search term cannot be empty."));
$this->render('search', array('dataProvider' => $dataProvider));
} else {
if (substr($term, 0, 1) != "#") {
$modules = Modules::model()->findAllByAttributes(array('searchable' => 1));
$comparisons = array();
$other = array();
foreach ($modules as $module) {
$module->name == 'products' ? $type = ucfirst('Product') : ($type = ucfirst($module->name));
$module->name == 'quotes' ? $type = ucfirst('Quote') : ($type = $type);
$module->name == 'opportunities' ? $type = ucfirst('Opportunity') : ($type = $type);
$criteria = new CDbCriteria();
$fields = Fields::model()->findAllByAttributes(array('modelName' => $type, 'searchable' => 1));
$temp = array();
$fieldNames = array();
if (count($fields) < 1) {
$criteria->compare('id', '<0', true, 'AND');
}
foreach ($fields as $field) {
$temp[] = $field->id;
$fieldNames[] = $field->fieldName;
$criteria->compare($field->fieldName, $term, true, "OR");
if ($field->type == 'phone') {
$tempPhone = preg_replace('/\\D/', '', $term);
$phoneLookup = PhoneNumber::model()->findByAttributes(array('modelType' => $field->modelName, 'number' => $tempPhone, 'fieldName' => $field->fieldName));
if (isset($phoneLookup)) {
$criteria->compare('id', $phoneLookup->modelId, true, "OR");
}
}
}
if (Yii::app()->user->getName() != 'admin' && X2Model::model($type)->hasAttribute('visibility') && X2Model::model($type)->hasAttribute('assignedTo')) {
$condition = 'visibility="1" OR (assignedTo="Anyone" AND visibility!="0") OR assignedTo="' . Yii::app()->user->getName() . '"';
/* x2temp */
$groupLinks = Yii::app()->db->createCommand()->select('groupId')->from('x2_group_to_user')->where('userId=' . Yii::app()->user->getId())->queryColumn();
if (!empty($groupLinks)) {
$condition .= ' OR assignedTo IN (' . implode(',', $groupLinks) . ')';
}
$condition .= 'OR (visibility=2 AND assignedTo IN
(SELECT username FROM x2_group_to_user WHERE groupId IN
(SELECT groupId FROM x2_group_to_user WHERE userId=' . Yii::app()->user->getId() . ')))';
$criteria->addCondition($condition);
}
if ($module->name == 'actions') {
$criteria->with = array('actionText');
$criteria->compare('actionText.text', $term, true, "OR");
}
if (class_exists($type)) {
$arr = X2Model::model($type)->findAll($criteria);
$comparisons[$type] = $temp;
$other[$type] = $arr;
}
}
$high = array();
$medium = array();
$low = array();
$userHigh = array();
$userMedium = array();
$userLow = array();
$records = array();
$userRecords = array();
$regEx = "/" . preg_quote($term, '/') . "/i";
foreach ($other as $key => $recordType) {
$fieldList = $comparisons[$key];
foreach ($recordType as $otherRecord) {
if ($key == 'Actions') {
if ($otherRecord->hasAttribute('assignedTo') && $otherRecord->assignedTo == Yii::app()->user->getName()) {
$userHigh[] = $otherRecord;
} else {
$high[] = $otherRecord;
}
} else {
foreach ($fieldList as $field) {
$fieldRecord = Fields::model()->findByPk($field);
$fieldName = $fieldRecord->fieldName;
if (preg_match($regEx, $otherRecord->{$fieldName}) > 0) {
switch ($fieldRecord->relevance) {
case "High":
if (!in_array($otherRecord, $high, true) && !in_array($otherRecord, $medium, true) && !in_array($otherRecord, $low, true) && !in_array($otherRecord, $userHigh, true) && !in_array($otherRecord, $userMedium, true) && !in_array($otherRecord, $userLow, true)) {
if ($otherRecord->hasAttribute('assignedTo') && $otherRecord->assignedTo == Yii::app()->user->getName()) {
$userHigh[] = $otherRecord;
} else {
$high[] = $otherRecord;
}
}
break;
case "Medium":
if (!in_array($otherRecord, $high, true) && !in_array($otherRecord, $medium, true) && !in_array($otherRecord, $low, true) && !in_array($otherRecord, $userHigh, true) && !in_array($otherRecord, $userMedium, true) && !in_array($otherRecord, $userLow, true)) {
if ($otherRecord->hasAttribute('assignedTo') && $otherRecord->assignedTo == Yii::app()->user->getName()) {
$userMedium[] = $otherRecord;
//.........这里部分代码省略.........
开发者ID:tymiles003,项目名称:X2CRM,代码行数:101,代码来源:SearchController.php
示例9: getExpectedCost
/**
* Gets the expected cost category of a short number (however, nothing is implied about its
* validity). If the country calling code is unique to a region, this method behaves exactly the
* same as {@link #getExpectedCostForRegion(String, String)}. However, if the country calling
* code is shared by multiple regions, then it returns the highest cost in the sequence
* PREMIUM_RATE, UNKNOWN_COST, STANDARD_RATE, TOLL_FREE. The reason for the position of
* UNKNOWN_COST in this order is that if a number is UNKNOWN_COST in one region but STANDARD_RATE
* or TOLL_FREE in another, its expected cost cannot be estimated as one of the latter since it
* might be a PREMIUM_RATE number.
*
* For example, if a number is STANDARD_RATE in the US, but TOLL_FREE in Canada, the expected cost
* returned by this method will be STANDARD_RATE, since the NANPA countries share the same country
* calling code.
*
* Note: If the region from which the number is dialed is known, it is highly preferable to call
* {@link #getExpectedCostForRegion(String, String)} instead.
*
* @param $number PhoneNumber the short number for which we want to know the expected cost category
* @return int the highest expected cost category of the short number in the region(s) with the given
* country calling code
*/
public function getExpectedCost(PhoneNumber $number)
{
$regionCodes = $this->phoneUtil->getRegionCodesForCountryCode($number->getCountryCode());
if (count($regionCodes) == 0) {
return ShortNumberCost::UNKNOWN_COST;
}
$shortNumber = $this->phoneUtil->getNationalSignificantNumber($number);
if (count($regionCodes) == 1) {
return $this->getExpectedCostForRegion($shortNumber, $regionCodes[0]);
}
$cost = ShortNumberCost::TOLL_FREE;
foreach ($regionCodes as $regionCode) {
$costForRegion = $this->getExpectedCostForRegion($shortNumber, $regionCode);
switch ($costForRegion) {
case ShortNumberCost::PREMIUM_RATE:
return ShortNumberCost::PREMIUM_RATE;
case ShortNumberCost::UNKNOWN_COST:
$cost = ShortNumberCost::UNKNOWN_COST;
break;
case ShortNumberCost::STANDARD_RATE:
if ($cost != ShortNumberCost::UNKNOWN_COST) {
$cost = ShortNumberCost::STANDARD_RATE;
}
break;
case ShortNumberCost::TOLL_FREE:
// Do nothing
break;
}
}
return $cost;
}
开发者ID:wasabiNorman,项目名称:libphonenumber-for-php,代码行数:52,代码来源:ShortNumberInfo.php
示例10: actionVoip
/**
* Records a phone call as a notification.
*
* Given a phone number, if a contact matching that phone number exists, a
* notification assigned to that contact's assignee will be created.
* Software-based telephony systems such as Asterisk can thus immediately
* notify sales reps of a phone call by making a cURL request to a url
* formatted as follows:
*
* api/voip/data/[phone number]
*
* (Note: the phone number itself must not contain anything but digits, i.e.
* no periods or dashes.)
*
* For Asterisk, one possible integration method is to insert into the
* dialplan, at the appropriate position, a call to a script that uses
* {@link http://phpagi.sourceforge.net/ PHPAGI} to extract the phone
* number. The script can then make the necessary request to this action.
* @param bool $actionHist If set to 1, create an action history item for the contact.
*/
public function actionVoip($actionHist = 0)
{
if (isset($_GET['data'])) {
$matches = array();
if (preg_match('/\\d{10,}/', $_GET['data'], $matches)) {
$number = ltrim($matches[0], '1');
$phoneCrit = new CDbCriteria(array('condition' => "modelType='Contacts' AND number LIKE :number", 'params' => array(':number' => "%{$number}%")));
$phoneCrit->join = 'join x2_contacts on modelId=x2_contacts.id AND ' . Contacts::model()->getHiddenCondition('x2_contacts');
$phoneNumber = PhoneNumber::model()->find($phoneCrit);
if (!empty($phoneNumber)) {
$contact = X2Model::model('Contacts')->findByPk($phoneNumber->modelId);
if (isset($contact)) {
$contact->disableBehavior('changelog');
$contact->updateLastActivity();
$assignees = array($contact->assignedTo);
if ($contact->assignedTo == 'Anyone' || $contact->assignedTo == null) {
$users = User::model()->findAll();
$assignees = array_map(function ($u) {
return $u->username;
}, $users);
}
$multiUser = count($assignees) > 1;
$usersSuccess = array();
$usersFailure = array();
// Format the phone number:
$formattedNumber = '';
$strNumber = (string) $number;
$strl = strlen($strNumber);
$formattedNumber = substr($strNumber, $strl - 4, $strl);
$formattedNumber = substr($strNumber, $strl - 7, 3) . "-{$formattedNumber}";
if ($strl >= 10) {
$formattedNumber = substr($strNumber, $strl - 10, 3) . "-{$formattedNumber}";
if ($strl > 10) {
$formattedNumber = substr($strNumber, 0, $strl - 10) . "-{$formattedNumber}";
}
}
$time = time();
// Create notifications:
foreach ($assignees as $user) {
$notif = new Notification();
$notif->type = 'voip_call';
$notif->user = $user;
$notif->modelType = 'Contacts';
$notif->modelId = $contact->id;
$notif->value = $formattedNumber;
$notif->createDate = $time;
if ($notif->save()) {
$usersSuccess[] = $user;
} else {
$usersFailure = array();
}
}
if ($actionHist) {
// Create an action:
$action = new Actions();
$action->assignedTo = 'Anyone';
$action->visibility = 1;
$action->associationId = $contact->id;
$action->associationType = 'contacts';
$action->associationName = $contact->name;
$action->dueDate = $time;
$action->createDate = $time;
$action->completeDate = $time;
$action->lastUpdated = $time;
$action->type = 'call';
$action->complete = 'Yes';
$action->completedBy = 'Anyone';
$action->save();
$action->actionText = Yii::t('app', 'Phone system reported inbound call from contact.');
}
$failure = count($usersSuccess) == 0;
$partialFailure = count($usersFailure) > 0;
if ($failure) {
$message = 'Saving notifications failed.';
} else {
/*X2Flow::trigger('RecordVoipInboundTrigger', array(
'model' => $contact,
'number' => $matches[0]
));*/
$message = 'Notifications created for user(s): ' . implode(',', $usersSuccess);
//.........这里部分代码省略.........
开发者ID:tymiles003,项目名称:X2CRM,代码行数:101,代码来源:ApiController.php
示例11: populate
function populate()
{
parent::populate();
$this->address = Address::factory_address($this->id);
$this->phone_numbers = PhoneNumber::factory_phone_numbers($this->id);
}
开发者ID:sivarajankumar,项目名称:openemr,代码行数:6,代码来源:InsuranceCompany.class.php
示例12: generate_extension
private function generate_extension()
{
if (Request::segment(1) == "register") {
$domain_id = Cookie::get('domain_hash');
} else {
$domain_id = Request::segment(2) == "manage" ? Request::segment(3) : Auth::user()->domain_id;
}
$extensions = explode(",", str_replace(" ", "", Config::get('settings.reserved_extension')));
$users = User::where('domain_id', $domain_id)->get();
foreach ($users as $user) {
foreach (PhoneNumber::where('user_id', $user['id'])->get() as $phone_number) {
$extensions[] = $phone_number['extension'];
}
}
$rand_ext = rand(100000, 999999);
if (in_array($rand_ext, $extensions) && Cookie::get('rndext') == $rand_ext) {
$this->generate_extension();
} else {
return $rand_ext;
}
}
开发者ID:digideskio,项目名称:voip-id,代码行数:21,代码来源:PhoneNumberController.php
示例13: mergeFrom
/**
* Merges the information from another phone number into this phone number.
*
* @param PhoneNumber $other The phone number to copy.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function mergeFrom(PhoneNumber $other)
{
if ($other->hasCountryCode()) {
$this->setCountryCode($other->getCountryCode());
}
if ($other->hasNationalNumber()) {
$this->setNationalNumber($other->getNationalNumber());
}
if ($other->hasExtension()) {
$this->setExtension($other->getExtension());
}
if ($other->hasItalianLeadingZero()) {
$this->setItalianLeadingZero($other->isItalianLeadingZero());
}
if ($other->hasNumberOfLeadingZeros()) {
$this->setNumberOfLeadingZeros($other->getNumberOfLeadingZeros());
}
if ($other->hasRawInput()) {
$this->setRawInput($other->getRawInput());
}
if ($other->hasCountryCodeSource()) {
$this->setCountryCodeSource($other->getCountryCodeSource());
}
if ($other->hasPreferredDomesticCarrierCode()) {
$this->setPreferredDomesticCarrierCode($other->getPreferredDomesticCarrierCode());
}
return $this;
}
开发者ID:hdkhanhkhtn,项目名称:libphonenumber-for-php,代码行数:35,代码来源:PhoneNumber.php
示例14: make_call_path
function make_call_path($to, $callerid, $path, $rest_access)
{
$twilio = new TwilioRestClient($this->twilio_sid, $this->twilio_token);
$recording_url = site_url("twiml/redirect/{$path}/{$rest_access}");
$response = $twilio->request("Accounts/{$this->twilio_sid}/Calls", 'POST', array("Caller" => PhoneNumber::normalizePhoneNumberToE164($callerid), "Called" => PhoneNumber::normalizePhoneNumberToE164($to), "Url" => $recording_url));
if ($response->IsError) {
error_log($from);
error_log(var_export($response, true));
throw new VBX_CallException($response->ErrorMessage);
}
}
开发者ID:JeffaCubed,项目名称:OpenVBX,代码行数:11,代码来源:vbx_call.php
示例15: ob_start
<?php
ob_start();
require_once "includes/functions.php";
$phoneNumber = new PhoneNumber();
if (array_key_exists('delete_phone_numbers', $_POST)) {
$insert_id = $_POST['insert_id'];
$phoneNumber->delete();
header("Location: portfolio.php?insert_id=" . $insert_id);
}
if (array_key_exists('modify_phone_numbers', $_POST)) {
$phoneNumbers = $phoneNumber->getPhoneNumbersFromPhoneId($_POST);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Phone Number Update</title>
</head>
<body>
<div class="container">
<ul class="nav">
<li><a href="listcontacts.php">List of All Contacts</a></li>
</ul>
<div class="header">
</div><!-- end .header -->
<div class="content">
开发者ID:elminero,项目名称:contact_v1.1,代码行数:31,代码来源:updatephonenumber.php
示例16: afterSave
/**
* Runs when a model is saved.
* Scans attributes for phone numbers and index them in <tt>x2_phone_numbers</tt>.
* Updates <tt>x2_relationships</tt> table based on link type fields.
* Fires onAfterSave event.
*/
public function afterSave()
{
if ($this->_runAfterCreate) {
$this->afterCreate();
} else {
$this->afterUpdate();
}
$phoneFields = array();
$linkFields = array();
// look through fields for phone numbers and relationships
foreach (self::$_fields[$this->tableName()] as &$_field) {
if ($_field->type === 'phone') {
$phoneFields[$_field->fieldName] = $this->getAttribute($_field->fieldName);
} elseif ($_field->type === 'link') {
$nameAndId = Fields::nameAndId($this->getAttribute($_field->fieldName));
$linkFields[$_field->fieldName] = array('id' => $nameAndId[1], 'type' => $_field->linkType);
}
}
// deal with phone numbers
if (count($phoneFields)) {
X2Model::model('PhoneNumber')->deleteAllByAttributes(array('modelId' => $this->id, 'modelType' => get_class($this)));
}
// clear out old phone numbers
foreach ($phoneFields as $field => &$number) {
// create new entries in x2_phone_numbers
if (!empty($number)) {
$num = new PhoneNumber();
$num->number = preg_replace('/\\D/', '', $number);
// eliminate everything other than digits
$num->modelId = $this->id;
$num->modelType = get_class($this);
$num->fieldName = $field;
$num->save();
}
}
/////////////// deal with relationships ///////////////
$oldAttributes = $this->getOldAttributes();
$relationSql = '(firstType=:type1 AND firstId=:id1 AND secondType=:type2 AND secondId=:id2) OR
(firstType=:type2 AND firstId=:id2 AND secondType=:type1 AND secondId=:id1)';
foreach ($linkFields as $fieldName => &$relation) {
list($oldLinkName, $oldLinkId) = Fields::nameAndId(isset($oldAttributes[$fieldName]) ? $oldAttributes[$fieldName] : '');
if ($relation['id'] == $oldLinkId) {
// skip field if it hasn't changed
continue;
}
// forget old relationship (wouldn't it be nice...)
if (!empty($oldLinkId)) {
CActiveRecord::model('Relationships')->deleteAll($relationSql, array(':type1' => get_class($this), ':id1' => $this->id, ':type2' => $relation['type'], ':id2' => $oldLinkId));
}
// save new relationship
if (!empty($relation['id']) && ctype_digit((string) $relation['id'])) {
if (!CActiveRecord::model('Relationships')->exists($relationSql, array(':type1' => get_class($this), ':id1' => $this->id, ':type2' => $relation['type'], ':id2' => $relation['id']))) {
$rel = new Relationships();
$rel->firstType = get_class($this);
$rel->secondType = $relation['type'];
$rel->firstId = $this->id;
$rel->secondId = $relation['id'];
$rel->save();
}
}
}
parent::afterSave();
// raise onAfterSave event for behaviors, such as X2ChangeLogBehavior
}
开发者ID:keyeMyria,项目名称:CRM,代码行数:70,代码来源:X2Model.php
示例17: handlerSSSourceData
public static function handlerSSSourceData(Audit $audit)
{
$data = array();
if ($audit->objectClass != 'ESignature') {
return $data;
}
$eSignature = new ESignature();
$eSignature->eSignatureId = $audit->objectId;
$eSignature->populate();
if ($eSignature->objectClass != 'Medication') {
return $data;
}
$data['_audit'] = $audit;
$medication = new Medication();
$medication->medicationId = (int) $eSignature->objectId;
$medication->populate();
$data['PrescriberOrderNumber'] = $medication->medicationId;
$medData = array();
$medData['DrugDescription'] = $medication->description;
$medData['Strength'] = $medication->strength;
$medData['StrengthUnits'] = $medication->unit;
$medData['Quantity'] = $medication->quantity;
$medData['Directions'] = $medication->directions;
$medData['Refills'] = $medication->refills;
$medData['Substitutions'] = $medication->substitution;
$medData['WrittenDate'] = date('Ymd', strtotime($medication->datePrescribed));
$data['medication'] = $medData;
$pharmacy = new Pharmacy();
$pharmacy->pharmacyId = $medication->pharmacyId;
$pharmacy->populate();
$pharmacyData = array();
$pharmacyData['NCPDPID'] = $pharmacy->NCPDPID;
$pharmacyData['StoreName'] = $pharmacy->StoreName;
$pharmacyData['AddressLine1'] = $pharmacy->AddressLine1 . ' ' . $pharmacy->AddressLine2;
$pharmacyData['City'] = $pharmacy->City;
$pharmacyData['State'] = $pharmacy->State;
$pharmacyData['ZipCode'] = $pharmacy->Zip;
$pharmacyData['PhoneNumber'] = $pharmacy->PhonePrimary;
$data['pharmacy'] = $pharmacyData;
$provider = new Provider();
$provider->personId = $medication->prescriberPersonId;
$provider->populate();
$prescriberData = array();
$prescriberData['DEANumber'] = $provider->deaNumber;
$prescriberData['SPI'] = $provider->sureScriptsSPI;
$prescriberData['ClinicName'] = '';
$prescriberData['LastName'] = $provider->person->lastName;
$prescriberData['FirstName'] = $provider->person->firstName;
$prescriberData['Suffix'] = '';
$address = new Address();
$address->personId = $provider->personId;
$address->populateWithPersonId();
$prescriberData['AddressLine1'] = $address->line1 . ' ' . $address->line2;
$prescriberData['City'] = $address->city;
$prescriberData['State'] = 'AZ';
//$address->state;
$prescriberData['ZipCode'] = $address->postalCode;
$phoneNumber = new PhoneNumber();
$phoneNumber->personId = $provider->personId;
$phoneNumber->populateWithPersonId();
$prescriberData['PhoneNumber'] = $phoneNumber->number;
$data['prescriber'] = $prescriberData;
$patient = new Patient();
$patient->personId = $medication->personId;
$patient->populate();
$patientData = array();
$patientData['LastName'] = $patient->person->lastName;
$patientData['FirstName'] = $patient->person->firstName;
$enumeration = new Enumeration();
$enumeration->enumerationId = $patient->person->gender;
$enumeration->populate();
$gender = $enumeration->key;
$patientData['Gender'] = $gender;
$patientData['DateOfBirth'] = date('Ymd', strtotime($patient->person->dateOfBirt
|
请发表评论