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


PHP SecurityGroup::getMembershipCount方法代码示例

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


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

示例1: SecurityGroup

 function popup_select(&$bean, $event, $arguments)
 {
     global $sugar_config;
     //only process if action is Save (meaning a user has triggered this event and not the portal or automated process)
     if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'Save' && isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true && empty($bean->fetched_row['id']) && $bean->module_dir != "Users") {
         require_once 'modules/SecurityGroups/SecurityGroup.php';
         $groupFocus = new SecurityGroup();
         $security_modules = $groupFocus->getSecurityModules();
         //if(in_array($bean->module_dir,$security_modules)) {
         if (in_array($bean->module_dir, array_keys($security_modules))) {
             //check if user is in more than 1 group. If so then set the session var otherwise inherit it's only group
             global $current_user;
             $memberships = $groupFocus->getMembershipCount($current_user->id);
             if ($memberships > 1) {
                 $_REQUEST['return_module'] = $bean->module_dir;
                 $_REQUEST['return_action'] = "DetailView";
                 $_REQUEST['return_id'] = $bean->id;
                 $_SESSION['securitygroups_popup_' . $bean->module_dir] = $bean->id;
             } else {
                 if ($memberships == 1) {
                     $groupFocus->inheritOne($current_user->id, $bean->id, $bean->module_dir);
                 }
             }
         }
     }
     if (isset($sugar_config['securitysuite_user_popup']) && $sugar_config['securitysuite_user_popup'] == true && empty($bean->fetched_row['id']) && $bean->module_dir == "Users" && $_REQUEST['action'] != 'SaveSignature') {
         //Bug: 589
         $_REQUEST['return_module'] = $bean->module_dir;
         $_REQUEST['return_action'] = "DetailView";
         $_REQUEST['return_id'] = $bean->id;
         $_SESSION['securitygroups_popup_' . $bean->module_dir] = $bean->id;
     }
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:33,代码来源:AssignGroups.php

示例2: inherit

 function inherit(&$focus, $isUpdate)
 {
     global $sugar_config;
     SecurityGroup::assign_default_groups($focus, $isUpdate);
     //this must be first because it does not check for dups
     SecurityGroup::inherit_assigned($focus, $isUpdate);
     SecurityGroup::inherit_parent($focus, $isUpdate);
     //don't do creator inheritance if popup selector method is chosen and a user is making the request...
     //don't if saving from a popup (subpanel_field_name check. Save2 is the action but to be safe use the subpanel check)
     if (isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true && isset($_REQUEST['action']) && $_REQUEST['action'] == 'Save' || !empty($_REQUEST['subpanel_field_name'])) {
         //check to see if a member of more than 1 group...if not then just inherit the one.
         //Otherwise, this is taken on the edit view on create now
         $groupFocus = new SecurityGroup();
         $security_modules = $groupFocus->getSecurityModules();
         if (in_array($focus->module_dir, array_keys($security_modules))) {
             //check if user is in more than 1 group. If so then set the session var otherwise inherit it's only group
             global $current_user;
             $memberships = $groupFocus->getMembershipCount($current_user->id);
             if ($memberships > 1) {
                 return;
             }
         }
     }
     SecurityGroup::inherit_creator($focus, $isUpdate);
 }
开发者ID:isrealconsulting,项目名称:ic-suite,代码行数:25,代码来源:SecurityGroup.php

示例3: display


//.........这里部分代码省略.........
        $this->th->ss->assign('view', $this->view);
        //Calculate time & date formatting (may need to calculate this depending on a setting)
        global $timedate;
        $this->th->ss->assign('CALENDAR_DATEFORMAT', $timedate->get_cal_date_format());
        $this->th->ss->assign('USER_DATEFORMAT', $timedate->get_user_date_format());
        $time_format = $timedate->get_user_time_format();
        $this->th->ss->assign('TIME_FORMAT', $time_format);
        $date_format = $timedate->get_cal_date_format();
        $time_separator = ':';
        if (preg_match('/\\d+([^\\d])\\d+([^\\d]*)/s', $time_format, $match)) {
            $time_separator = $match[1];
        }
        // Create Smarty variables for the Calendar picker widget
        $t23 = strpos($time_format, '23') !== false ? '%H' : '%I';
        if (!isset($match[2]) || $match[2] == '') {
            $this->th->ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . '%M');
        } else {
            $pm = $match[2] == 'pm' ? '%P' : '%p';
            $this->th->ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . '%M' . $pm);
        }
        $this->th->ss->assign('CALENDAR_FDOW', $current_user->get_first_day_of_week());
        $this->th->ss->assign('TIME_SEPARATOR', $time_separator);
        $seps = get_number_seperators();
        $this->th->ss->assign('NUM_GRP_SEP', $seps[0]);
        $this->th->ss->assign('DEC_SEP', $seps[1]);
        if ($this->view == 'EditView') {
            $height = $current_user->getPreference('text_editor_height');
            $width = $current_user->getPreference('text_editor_width');
            $height = isset($height) ? $height : '300px';
            $width = isset($width) ? $width : '95%';
            $this->th->ss->assign('RICH_TEXT_EDITOR_HEIGHT', $height);
            $this->th->ss->assign('RICH_TEXT_EDITOR_WIDTH', $width);
        } else {
            $this->th->ss->assign('RICH_TEXT_EDITOR_HEIGHT', '100px');
            $this->th->ss->assign('RICH_TEXT_EDITOR_WIDTH', '95%');
        }
        $this->th->ss->assign('SHOW_VCR_CONTROL', $this->showVCRControl);
        $str = $this->showTitle($showTitle);
        //Use the output filter to trim the whitespace
        $this->th->ss->load_filter('output', 'trimwhitespace');
        $str .= $this->th->displayTemplate($this->module, $form_name, $this->tpl, $ajaxSave, $this->defs);
        /* BEGIN - SECURITY GROUPS */
        //if popup select add panel if user is a member of multiple groups to metadataFile
        global $sugar_config;
        if (isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true && empty($this->focus->fetched_row['id']) && $this->focus->module_dir != "Users" && $this->focus->module_dir != "SugarFeed") {
            //there are cases such as uploading an attachment to an email template where the request module may
            //not be the same as the current bean module. If that happens we can just skip it
            //however...let quickcreate through
            if ($this->view != 'QuickCreate' && (empty($_REQUEST['module']) || $_REQUEST['module'] != $this->focus->module_dir)) {
                return $str;
            }
            require_once 'modules/SecurityGroups/SecurityGroup.php';
            $groupFocus = new SecurityGroup();
            $security_modules = $groupFocus->getSecurityModules();
            if (in_array($this->focus->module_dir, array_keys($security_modules))) {
                global $current_user;
                $group_count = $groupFocus->getMembershipCount($current_user->id);
                if ($group_count > 1) {
                    $groups = $groupFocus->getUserSecurityGroups($current_user->id);
                    $group_options = '';
                    foreach ($groups as $group) {
                        $group_options .= '<option value="' . $group['id'] . '" label="' . $group['name'] . '" selected="selected">' . $group['name'] . '</option>';
                    }
                    //multilingual support
                    global $current_language;
                    $ss_mod_strings = return_module_language($current_language, 'SecurityGroups');
                    $lbl_securitygroups_select = $ss_mod_strings['LBL_GROUP_SELECT'];
                    $lbl_securitygroups = $ss_mod_strings['LBL_LIST_FORM_TITLE'];
                    $group_panel = <<<EOQ
<div class="edit view edit508 " id="detailpanel_securitygroups">
    <h4>&nbsp;&nbsp;
    {$lbl_securitygroups_select}
    </h4>
    <table width="100%" cellspacing="1" cellpadding="0" border="0" class="edit view panelContainer" id="LBL_PANEL_SECURITYGROUPS">
    <tbody><tr>
    <td width="12.5%" valign="top" scope="col" id="account_type_label">
        {$lbl_securitygroups}:
    </td>
    <td width="37.5%" valign="top">
        <select title="" id="securitygroup_list" name="securitygroup_list[]" multiple="multiple" size="{$group_count}">
        {$group_options}
        </select>
    </td>
    </tr>
    </tbody></table>
</div>
EOQ;
                    $group_panel = preg_replace("/[\r\n]+/", "", $group_panel);
                    $group_panel_append = <<<EOQ
<script>
    \$('#{$form_name}_tabs div:first').append(\$('{$group_panel}'));
</script>
EOQ;
                    $str .= $group_panel_append;
                }
            }
        }
        /* END - SECURITY GROUPS */
        return $str;
    }
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:101,代码来源:EditView2.php

示例4: testgetMembershipCount

 public function testgetMembershipCount()
 {
     //unset and reconnect Db to resolve mysqli fetch exeception
     global $db;
     unset($db->database);
     $db->checkConnection();
     $securityGroup = new SecurityGroup();
     $result = $securityGroup->getMembershipCount('1');
     $this->assertEquals(0, $result);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:10,代码来源:SecurityGroupTest.php


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