本文整理汇总了PHP中Surfer::get_phone_number方法的典型用法代码示例。如果您正苦于以下问题:PHP Surfer::get_phone_number方法的具体用法?PHP Surfer::get_phone_number怎么用?PHP Surfer::get_phone_number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Surfer
的用法示例。
在下文中一共展示了Surfer::get_phone_number方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_click_to_call
/**
* enable direct telephony service
*
* @param array of attributes for the first person to be called
* @return string interactive form plus related AJAX code, or an empty string
*/
public static function get_click_to_call($item)
{
global $context;
// to be put in resulting page
$text = '';
// this user profile has a phone number and we can use the OBS back-end
if (Surfer::get_id() != $item['id'] && $item['phone_number'] && isset($context['obs_api_key'])) {
// allow for several controls in the same page
$id = uniqid();
Skin::define_img('PHONE_IMG', 'pagers/phone.gif');
Skin::define_img('SPINNER_IMG', 'ajax/ajax_spinner.gif');
$text .= ' <div id="a_' . $id . '" style="display: inline;">' . '<button onclick="ClickToCall.start(\'#b_' . $id . '\'); return false;">' . sprintf(i18n::s('Click to call %s'), ucfirst($item['nick_name'])) . PHONE_IMG . '</button>' . ' <input type="text" id="b_' . $id . '" style="display: none;" value="' . Surfer::get_phone_number() . '" />' . '</div>' . '<span id="d_' . $id . '" style="display: none;">' . SPINNER_IMG . i18n::s('Calling...') . '</span>' . '<span id="e_' . $id . '" style="display: none;">' . '<button onclick="ClickToCall.stop(\'#b_' . $id . '\'); return false;">' . i18n::s('Stop the call') . '</button>' . '</span>' . '<span id="f_' . $id . '" style="display: none;">' . SPINNER_IMG . i18n::s('Stopping the call...') . '</span>';
Page::insert_script('var ClickToCall = {' . "\n" . "\n" . ' start: function(id) {' . "\n" . ' if(!$(id).is(":visible")) {' . "\n" . ' $(id).show("slide", ' . '{ direction: "right" }, ' . '500, ' . 'function() { $(id).focus().tipsy({fallback: "' . i18n::s('Your phone number in international format, starting with country code') . '", gravity: "w", fade: true}).tipsy("show") });' . "\n" . ' $(id).focus();' . "\n" . ' return;' . "\n" . ' }' . "\n" . ' if(!$(id).val()) {' . "\n" . ' $(id).focus();' . "\n" . ' return;' . "\n" . ' }' . "\n" . ' $(id).tipsy("hide");' . "\n" . ' $("#a_' . $id . '").hide();' . "\n" . ' $("#d_' . $id . '").show("slide", { direction: "right" }, 100);' . "\n" . ' Yacs.call( { method: "obs.call", params: { user: ' . $item['id'] . ', number: $(id).val() }, id: 123 }, ' . 'function(s) { $("#d_' . $id . '").hide(); ' . 'if(s.message) { alert(s.message);$("#a_' . $id . '").show("slide", { direction: "right" }, 500);$(id).focus(); } ' . 'else { ClickToCall.call_id = s.call_id; $("#e_' . $id . '").show("slide", { direction: "right" }, 500); } } ' . ' );' . "\n" . ' },' . "\n" . "\n" . ' stop: function(id) {' . "\n" . ' $("#e_' . $id . '").hide("slide", { direction: "left" }, 500);' . "\n" . ' $("#f_' . $id . '").show("slide", { direction: "right" }, 500);' . "\n" . ' Yacs.call( { method: "obs.release", params: { call_id: ClickToCall.call_id }, id: 123 }, ' . 'function(s) { $("#f_' . $id . '").hide("slide", { direction: "left" }, 500); ' . 'if(s.message) {alert(s.message);} $("#a_' . $id . '").show("slide", { direction: "right" }, 500); } );' . "\n" . ' }' . "\n" . "\n" . '}' . "\n");
}
// job done
return $text;
}