本文整理汇总了PHP中EmailUI::generateComposePackageForQuickCreateFromComposeUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailUI::generateComposePackageForQuickCreateFromComposeUrl方法的具体用法?PHP EmailUI::generateComposePackageForQuickCreateFromComposeUrl怎么用?PHP EmailUI::generateComposePackageForQuickCreateFromComposeUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailUI
的用法示例。
在下文中一共展示了EmailUI::generateComposePackageForQuickCreateFromComposeUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($defines)
{
global $app_strings, $current_user, $sugar_config, $beanList, $beanFiles;
$title = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_TITLE'];
$accesskey = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_KEY'];
$value = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_LABEL'];
$parent_type = $defines['focus']->module_dir;
$parent_id = $defines['focus']->id;
//martin Bug 19660
$userPref = $current_user->getPreference('email_link_type');
$defaultPref = $sugar_config['email_default_client'];
if ($userPref != '') {
$client = $userPref;
} else {
$client = $defaultPref;
}
if ($client != 'sugar') {
$class = $beanList[$parent_type];
require_once $beanFiles[$class];
$bean = new $class();
$bean->retrieve($parent_id);
// awu: Not all beans have emailAddress property, we must account for this
if (isset($bean->emailAddress)) {
$to_addrs = $bean->emailAddress->getPrimaryAddress($bean);
$button = "<input class='button' type='button' value='{$value}' name='{$title}' accesskey='{$accesskey}' title='{$title}' onclick=\"location.href='mailto:{$to_addrs}';return false;\" />";
} else {
$button = "<input class='button' type='button' value='{$value}' name='{$title}' accesskey='{$accesskey}' title='{$title}' onclick=\"location.href='mailto:';return false;\" />";
}
} else {
//Generate the compose package for the quick create options.
$composeData = "parent_id={$parent_id}&parent_type={$parent_type}";
require_once 'modules/Emails/EmailUI.php';
$eUi = new EmailUI();
$j_quickComposeOptions = $eUi->generateComposePackageForQuickCreateFromComposeUrl($composeData);
$button = "<input title='{$title}' accesskey='{$accesskey}' onclick='SUGAR.quickCompose.init({$j_quickComposeOptions});' class='button' type='submit' name='button' value='{$value}'";
}
return $button;
}
示例2: getEmailLink
/**
* returns opening <a href=xxxx for a contact, account, etc
* cascades from User set preference to System-wide default
* @return string link
* @param attribute the email addy
* @param focus the parent bean
* @param contact_id
* @param return_module
* @param return_action
* @param return_id
* @param class
*/
function getEmailLink($attribute, &$focus, $contact_id = '', $ret_module = '', $ret_action = 'DetailView', $ret_id = '', $class = '')
{
$emailLink = '';
global $sugar_config;
if (!isset($sugar_config['email_default_client'])) {
$this->setDefaultsInConfig();
}
$userPref = $this->getPreference('email_link_type');
$defaultPref = $sugar_config['email_default_client'];
if ($userPref != '') {
$client = $userPref;
} else {
$client = $defaultPref;
}
if ($client == 'sugar') {
$email = '';
$to_addrs_ids = '';
$to_addrs_names = '';
$to_addrs_emails = '';
$fullName = !empty($focus->name) ? $focus->name : '';
if (!empty($focus->{$attribute})) {
$email = $focus->{$attribute};
}
if (empty($ret_module)) {
$ret_module = $focus->module_dir;
}
if (empty($ret_id)) {
$ret_id = $focus->id;
}
if ($focus->object_name == 'Contact') {
// Bug #48555 Not User Name Format of User's locale.
$focus->_create_proper_name_field();
$fullName = $focus->name;
$contact_id = $focus->id;
$to_addrs_ids = $focus->id;
$to_addrs_names = $fullName;
$to_addrs_emails = $focus->email1;
}
$emailLinkUrl = 'contact_id=' . $contact_id . '&parent_type=' . $focus->module_dir . '&parent_id=' . $focus->id . '&parent_name=' . urlencode($fullName) . '&to_addrs_ids=' . $to_addrs_ids . '&to_addrs_names=' . urlencode($to_addrs_names) . '&to_addrs_emails=' . urlencode($to_addrs_emails) . '&to_email_addrs=' . urlencode($fullName . ' <' . $email . '>') . '&return_module=' . $ret_module . '&return_action=' . $ret_action . '&return_id=' . $ret_id;
//Generate the compose package for the quick create options.
require_once 'modules/Emails/EmailUI.php';
$eUi = new EmailUI();
$j_quickComposeOptions = $eUi->generateComposePackageForQuickCreateFromComposeUrl($emailLinkUrl, true);
$emailLink = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({$j_quickComposeOptions});' class='{$class}'>";
} else {
// straight mailto:
$emailLink = '<a href="mailto:' . $focus->{$attribute} . '" class="' . $class . '">';
}
return $emailLink;
}
示例3: displayList
function displayList(&$layout_def)
{
global $current_user;
global $beanList;
global $focus;
global $sugar_config;
global $locale;
if (isset($layout_def['varname'])) {
$key = strtoupper($layout_def['varname']);
} else {
$key = $this->_get_column_alias($layout_def);
$key = strtoupper($key);
}
$value = $layout_def['fields'][$key];
if (isset($_REQUEST['action'])) {
$action = $_REQUEST['action'];
} else {
$action = '';
}
if (isset($_REQUEST['module'])) {
$module = $_REQUEST['module'];
} else {
$module = '';
}
if (isset($_REQUEST['record'])) {
$record = $_REQUEST['record'];
} else {
$record = '';
}
if (!empty($focus->name)) {
$name = $focus->name;
} else {
if (!empty($focus->first_name) && !empty($focus->last_name)) {
$name = $locale->getLocaleFormattedName($focus->first_name, $focus->last_name);
}
if (empty($name)) {
$name = '*';
}
}
$userPref = $current_user->getPreference('email_link_type');
$defaultPref = $sugar_config['email_default_client'];
if ($userPref != '') {
$client = $userPref;
} else {
$client = $defaultPref;
}
if ($client == 'sugar') {
$fullComposeUrl = 'load_id=' . $layout_def['fields']['ID'] . '&load_module=' . $this->layout_manager->defs['module_name'] . '&parent_type=' . $this->layout_manager->defs['module_name'] . '&parent_id=' . $layout_def['fields']['ID'];
if (isset($layout_def['fields']['FULL_NAME'])) {
$fullComposeUrl .= '&parent_name=' . urlencode($layout_def['fields']['FULL_NAME']);
}
$fullComposeUrl .= '&return_module=' . $module . '&return_action=' . $action . '&return_id=' . $record;
require_once 'modules/Emails/EmailUI.php';
$eUi = new EmailUI();
$j_quickComposeOptions = $eUi->generateComposePackageForQuickCreateFromComposeUrl($fullComposeUrl);
$link = "<a href='javascript:void(0);' onclick='SUGAR.quickCompose.init({$j_quickComposeOptions});'>";
} else {
$link = '<a href="mailto:' . $value . '" >';
}
return $link . $value . '</a>';
}