本文整理汇总了PHP中ACLRole::get_linked_beans方法的典型用法代码示例。如果您正苦于以下问题:PHP ACLRole::get_linked_beans方法的具体用法?PHP ACLRole::get_linked_beans怎么用?PHP ACLRole::get_linked_beans使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACLRole
的用法示例。
在下文中一共展示了ACLRole::get_linked_beans方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRoleUsers
private function getRoleUsers($roleId)
{
require_once 'modules/ACLRoles/ACLRole.php';
$role = new ACLRole();
$role->retrieve($roleId);
$role_users = $role->get_linked_beans('users', 'User');
$r_users = array();
foreach ($role_users as $role_user) {
$r_users[$role_user->id] = $role_user->name;
}
return $r_users;
}
示例2: NotifySalesManagers
function NotifySalesManagers($bean)
{
global $sugar_config;
$amount_limit = 1000;
if ($bean->sales_stage === "Negotiation/Review" && $bean->fetched_row['sales_stage'] === "Proposal/Price Quote" && $bean->amount >= $amount_limit) {
SugarApplication::appendErrorMessage('You have changed the opportunity ' . $bean->name . ' (greater than ' . $amount_limit . ') to Negotiation/Review.');
$emailsTo = array();
$emailSubject = "Opportunity Alert";
$emailBody = "The Opportunity " . $bean->name . " has changed to Negotiation/Review<br />\n\t\t\tYou can see the opportunity here:<br />\n\t\t\t<a href=\"" . $sugar_config['site_url'] . "/index.php?module=Opportunities&action=DetailView&record=" . $bean->id . "\">" . $bean->name . "</a>";
$role_id = "<sales-manager-role-id>";
$aclrole = new ACLRole();
if (!is_null($aclrole->retrieve($role_id))) {
$users = $aclrole->get_linked_beans('users', 'User');
foreach ($users as $user) {
$emailsTo[] = $user->email1;
}
}
$this->SendEmail($emailsTo, $emailSubject, $emailBody);
}
}
示例3: unserialize
function get_email_recipients()
{
$params = unserialize(base64_decode($this->email_recipients));
$emails = array();
if (isset($params['email_target_type'])) {
foreach ($params['email_target_type'] as $key => $field) {
switch ($field) {
case 'Email Address':
$emails[] = $params['email'][$key];
break;
case 'Specify User':
$user = new User();
$user->retrieve($params['email'][$key]);
$emails[] = $user->emailAddress->getPrimaryAddress($user);
break;
case 'Users':
$users = array();
switch ($params['email'][$key][0]) {
case 'security_group':
if (file_exists('modules/SecurityGroups/SecurityGroup.php')) {
require_once 'modules/SecurityGroups/SecurityGroup.php';
$security_group = new SecurityGroup();
$security_group->retrieve($params['email'][$key][1]);
$users = $security_group->get_linked_beans('users', 'User');
$r_users = array();
if ($params['email'][$key][2] != '') {
require_once 'modules/ACLRoles/ACLRole.php';
$role = new ACLRole();
$role->retrieve($params['email'][$key][2]);
$role_users = $role->get_linked_beans('users', 'User');
foreach ($role_users as $role_user) {
$r_users[$role_user->id] = $role_user->name;
}
}
foreach ($users as $user_id => $user) {
if ($params['email'][$key][2] != '' && !isset($r_users[$user->id])) {
unset($users[$user_id]);
}
}
break;
}
//No Security Group module found - fall through.
//No Security Group module found - fall through.
case 'role':
require_once 'modules/ACLRoles/ACLRole.php';
$role = new ACLRole();
$role->retrieve($params['email'][$key][2]);
$users = $role->get_linked_beans('users', 'User');
break;
case 'all':
default:
global $db;
$sql = "SELECT id from users WHERE status='Active' AND portal_only=0 ";
$result = $db->query($sql);
while ($row = $db->fetchByAssoc($result)) {
$user = new User();
$user->retrieve($row['id']);
$users[$user->id] = $user;
}
break;
}
foreach ($users as $user) {
$emails[] = $user->emailAddress->getPrimaryAddress($user);
}
break;
}
}
}
return $emails;
}
示例4: array
function set_record(SugarBean $record, SugarBean $bean, $params = array(), $in_save = false)
{
global $app_list_strings, $timedate;
$record_vardefs = $record->getFieldDefinitions();
if (isset($params['field'])) {
foreach ($params['field'] as $key => $field) {
if ($field == '') {
continue;
}
switch ($params['value_type'][$key]) {
case 'Field':
if ($params['value'][$key] == '') {
continue;
}
$data = $bean->field_defs[$params['value'][$key]];
if ($data['type'] == 'relate' && isset($data['id_name'])) {
$params['value'][$key] = $data['id_name'];
}
$value = $bean->{$params}['value'][$key];
break;
case 'Date':
$dformat = 'Y-m-d H:i:s';
if ($record_vardefs[$field]['type'] == 'date') {
$dformat = 'Y-m-d';
}
switch ($params['value'][$key][3]) {
case 'business_hours':
if (file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php')) {
require_once 'modules/AOBH_BusinessHours/AOBH_BusinessHours.php';
$businessHours = new AOBH_BusinessHours();
$dateToUse = $params['value'][$key][0];
$sign = $params['value'][$key][1];
$amount = $params['value'][$key][2];
if ($sign != "plus") {
$amount = 0 - $amount;
}
if ($dateToUse == "now") {
$value = $businessHours->addBusinessHours($amount);
} else {
if ($dateToUse == "field") {
$dateToUse = $params['field'][$key];
$value = $businessHours->addBusinessHours($amount, $timedate->fromDb($bean->{$dateToUse}));
} else {
$value = $businessHours->addBusinessHours($amount, $timedate->fromDb($bean->{$dateToUse}));
}
}
$value = $timedate->asDb($value);
break;
}
$params['value'][$key][3] = 'hours';
//No business hours module found - fall through.
//No business hours module found - fall through.
default:
if ($params['value'][$key][0] == 'now') {
$date = gmdate($dformat);
} else {
if ($params['value'][$key][0] == 'field') {
$date = $record->fetched_row[$params['field'][$key]];
} else {
$date = $bean->fetched_row[$params['value'][$key][0]];
}
}
if ($params['value'][$key][1] != 'now') {
$value = date($dformat, strtotime($date . ' ' . $app_list_strings['aow_date_operator'][$params['value'][$key][1]] . $params['value'][$key][2] . ' ' . $params['value'][$key][3]));
} else {
$value = date($dformat, strtotime($date));
}
break;
}
break;
case 'Round_Robin':
case 'Least_Busy':
case 'Random':
switch ($params['value'][$key][0]) {
case 'security_group':
if (file_exists('modules/SecurityGroups/SecurityGroup.php')) {
require_once 'modules/SecurityGroups/SecurityGroup.php';
$security_group = new SecurityGroup();
$security_group->retrieve($params['value'][$key][1]);
$group_users = $security_group->get_linked_beans('users', 'User');
$users = array();
$r_users = array();
if ($params['value'][$key][2] != '') {
require_once 'modules/ACLRoles/ACLRole.php';
$role = new ACLRole();
$role->retrieve($params['value'][$key][2]);
$role_users = $role->get_linked_beans('users', 'User');
foreach ($role_users as $role_user) {
$r_users[$role_user->id] = $role_user->name;
}
}
foreach ($group_users as $group_user) {
if ($params['value'][$key][2] != '' && !isset($r_users[$group_user->id])) {
continue;
}
$users[$group_user->id] = $group_user->name;
}
break;
}
//No Security Group module found - fall through.
//.........这里部分代码省略.........
示例5: getEmailsFromParams
private function getEmailsFromParams(SugarBean $bean, $params)
{
$emails = array();
//backward compatible
if (isset($params['email_target_type']) && !is_array($params['email_target_type'])) {
$email = '';
switch ($params['email_target_type']) {
case 'Email Address':
$params['email'] = array($params['email']);
break;
case 'Specify User':
$params['email'] = array($params['email_user_id']);
break;
case 'Related Field':
$params['email'] = array($params['email_target']);
break;
}
$params['email_target_type'] = array($params['email_target_type']);
$params['email_to_type'] = array('to');
}
//end backward compatible
if (isset($params['email_target_type'])) {
foreach ($params['email_target_type'] as $key => $field) {
switch ($field) {
case 'Email Address':
if (trim($params['email'][$key]) != '') {
$emails[$params['email_to_type'][$key]][] = $params['email'][$key];
}
break;
case 'Specify User':
$user = new User();
$user->retrieve($params['email'][$key]);
$user_email = $user->emailAddress->getPrimaryAddress($user);
if (trim($user_email) != '') {
$emails[$params['email_to_type'][$key]][] = $user_email;
$emails['template_override'][$user_email] = array('Users' => $user->id);
}
break;
case 'Users':
$users = array();
switch ($params['email'][$key][0]) {
case 'security_group':
if (file_exists('modules/SecurityGroups/SecurityGroup.php')) {
require_once 'modules/SecurityGroups/SecurityGroup.php';
$security_group = new SecurityGroup();
$security_group->retrieve($params['email'][$key][1]);
$users = $security_group->get_linked_beans('users', 'User');
$r_users = array();
if ($params['email'][$key][2] != '') {
require_once 'modules/ACLRoles/ACLRole.php';
$role = new ACLRole();
$role->retrieve($params['email'][$key][2]);
$role_users = $role->get_linked_beans('users', 'User');
foreach ($role_users as $role_user) {
$r_users[$role_user->id] = $role_user->name;
}
}
foreach ($users as $user_id => $user) {
if ($params['email'][$key][2] != '' && !isset($r_users[$user->id])) {
unset($users[$user_id]);
}
}
break;
}
//No Security Group module found - fall through.
//No Security Group module found - fall through.
case 'role':
require_once 'modules/ACLRoles/ACLRole.php';
$role = new ACLRole();
$role->retrieve($params['email'][$key][2]);
$users = $role->get_linked_beans('users', 'User');
break;
case 'all':
default:
global $db;
$sql = "SELECT id from users WHERE status='Active' AND portal_only=0 ";
$result = $db->query($sql);
while ($row = $db->fetchByAssoc($result)) {
$user = new User();
$user->retrieve($row['id']);
$users[$user->id] = $user;
}
break;
}
foreach ($users as $user) {
$user_email = $user->emailAddress->getPrimaryAddress($user);
if (trim($user_email) != '') {
$emails[$params['email_to_type'][$key]][] = $user_email;
$emails['template_override'][$user_email] = array('Users' => $user->id);
}
}
break;
case 'Related Field':
$emailTarget = $params['email'][$key];
$relatedFields = array_merge($bean->get_related_fields(), $bean->get_linked_fields());
$field = $relatedFields[$emailTarget];
if ($field['type'] == 'relate') {
$linkedBeans = array();
$idName = $field['id_name'];
$id = $bean->{$idName};
//.........这里部分代码省略.........