当前位置: 首页>>代码示例>>PHP>>正文


PHP SecurityGroup::get_linked_beans方法代码示例

本文整理汇总了PHP中SecurityGroup::get_linked_beans方法的典型用法代码示例。如果您正苦于以下问题:PHP SecurityGroup::get_linked_beans方法的具体用法?PHP SecurityGroup::get_linked_beans怎么用?PHP SecurityGroup::get_linked_beans使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SecurityGroup的用法示例。


在下文中一共展示了SecurityGroup::get_linked_beans方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAssignableUsers

 private function getAssignableUsers()
 {
     if ($this->distributionMethod == 'singleUser') {
         return array();
     }
     $distributionOptions = $this->getDistributionOptions();
     if (empty($distributionOptions)) {
         return array();
     }
     switch ($distributionOptions[0]) {
         case 'security_group':
             if (file_exists('modules/SecurityGroups/SecurityGroup.php')) {
                 require_once 'modules/SecurityGroups/SecurityGroup.php';
                 $security_group = new SecurityGroup();
                 $security_group->retrieve($distributionOptions[1]);
                 $group_users = $security_group->get_linked_beans('users', 'User');
                 $users = array();
                 $r_users = array();
                 if ($distributionOptions[2] != '') {
                     $r_users = $this->getRoleUsers($distributionOptions[2]);
                 }
                 foreach ($group_users as $group_user) {
                     if ($distributionOptions[2] != '' && !isset($r_users[$group_user->id])) {
                         continue;
                     }
                     $users[$group_user->id] = $group_user->name;
                 }
                 break;
             }
             //No Security Group module found - fall through.
         //No Security Group module found - fall through.
         case 'role':
             $users = $this->getRoleUsers($distributionOptions[2]);
             break;
         case 'all':
         default:
             $users = get_user_array(false);
             break;
     }
     return $users;
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:41,代码来源:AOPAssignManager.php

示例2: 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;
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:70,代码来源:AOR_Scheduled_Reports.php

示例3: 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.
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:windcrm,代码行数:101,代码来源:actionCreateRecord.php

示例4: 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};
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:101,代码来源:actionSendEmail.php


注:本文中的SecurityGroup::get_linked_beans方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。