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


PHP SecurityGroup::getMembers方法代码示例

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


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

示例1: template_calendar

function template_calendar($args)
{
    global $timedate;
    if (isset($args['size']) && $args['size'] == 'small') {
        $args['calendar']->show_activities = false;
        $args['calendar']->show_week_on_month_view = false;
    }
    $newargs = array();
    $newargs['view'] = $args['view'];
    $newargs['calendar'] = $args['calendar'];
    if (!isset($args['size']) || $args['size'] != 'small') {
        template_cal_tabs($newargs);
    }
    if (isset($_REQUEST['view']) && $_REQUEST['view'] == 'shared') {
        global $ids;
        global $current_user;
        global $mod_strings;
        global $app_list_strings, $current_language, $currentModule, $action, $app_strings;
        $current_module_strings = return_module_language($current_language, 'Calendar');
        $ids = array();
        $user_ids = $current_user->getPreference('shared_ids');
        //get list of user ids for which to display data
        if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['shared_ids'])) {
            $ids = $user_ids;
        } elseif (isset($_REQUEST['shared_ids']) && count($_REQUEST['shared_ids']) > 0) {
            $ids = $_REQUEST['shared_ids'];
            $current_user->setPreference('shared_ids', $_REQUEST['shared_ids']);
        } else {
            //$ids = get_user_array(false);
            //$ids = array_keys($ids);
            $ids = array($current_user->id);
        }
        //get team id for which to display user list
        $tools = '<div align="right"><a href="index.php?module=' . $currentModule . '&action=' . $action . '&view=shared" class="tabFormAdvLink">&nbsp;<a href="javascript: toggleDisplay(\'shared_cal_edit\');" class="tabFormAdvLink">' . SugarThemeRegistry::current()->getImage('edit', 'alt="' . $current_module_strings['LBL_EDIT'] . '"  border="0"  align="absmiddle"') . '&nbsp;' . $current_module_strings['LBL_EDIT'] . '</a></div>';
        echo get_form_header($mod_strings['LBL_SHARED_CAL_TITLE'], $tools, false);
        if (empty($_SESSION['shared_ids'])) {
            $_SESSION['shared_ids'] = "";
        }
        echo "\n\t\t\t<script language=\"javascript\">\n\t\t\tfunction up(name) {\n\t\t\t\tvar td = document.getElementById(name+'_td');\n\t\t\t\tvar obj = td.getElementsByTagName('select')[0];\n\t\t\t\tobj =(typeof obj == \"string\") ? document.getElementById(obj) : obj;\n\t\t\t\tif(obj.tagName.toLowerCase() != \"select\" && obj.length < 2)\n\t\t\t\t\treturn false;\n\t\t\t\tvar sel = new Array();\n\n\t\t\t\tfor(i=0; i<obj.length; i++) {\n\t\t\t\t\tif(obj[i].selected == true) {\n\t\t\t\t\t\tsel[sel.length] = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(i in sel) {\n\t\t\t\t\tif(sel[i] != 0 && !obj[sel[i]-1].selected) {\n\t\t\t\t\t\tvar tmp = new Array(obj[sel[i]-1].text, obj[sel[i]-1].value);\n\t\t\t\t\t\tobj[sel[i]-1].text = obj[sel[i]].text;\n\t\t\t\t\t\tobj[sel[i]-1].value = obj[sel[i]].value;\n\t\t\t\t\t\tobj[sel[i]].text = tmp[0];\n\t\t\t\t\t\tobj[sel[i]].value = tmp[1];\n\t\t\t\t\t\tobj[sel[i]-1].selected = true;\n\t\t\t\t\t\tobj[sel[i]].selected = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction down(name) {\n\t\t\t\tvar td = document.getElementById(name+'_td');\n\t\t\t\tvar obj = td.getElementsByTagName('select')[0];\n\t\t\t\tif(obj.tagName.toLowerCase() != \"select\" && obj.length < 2)\n\t\t\t\t\treturn false;\n\t\t\t\tvar sel = new Array();\n\t\t\t\tfor(i=obj.length-1; i>-1; i--) {\n\t\t\t\t\tif(obj[i].selected == true) {\n\t\t\t\t\t\tsel[sel.length] = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(i in sel) {\n\t\t\t\t\tif(sel[i] != obj.length-1 && !obj[sel[i]+1].selected) {\n\t\t\t\t\t\tvar tmp = new Array(obj[sel[i]+1].text, obj[sel[i]+1].value);\n\t\t\t\t\t\tobj[sel[i]+1].text = obj[sel[i]].text;\n\t\t\t\t\t\tobj[sel[i]+1].value = obj[sel[i]].value;\n\t\t\t\t\t\tobj[sel[i]].text = tmp[0];\n\t\t\t\t\t\tobj[sel[i]].value = tmp[1];\n\t\t\t\t\t\tobj[sel[i]+1].selected = true;\n\t\t\t\t\t\tobj[sel[i]].selected = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t</script>\n\n\t\t\t<div id='shared_cal_edit' style='display: none;'>\n\t\t\t<form name='shared_cal' action=\"index.php\" method=\"post\" >\n\t\t\t<input type=\"hidden\" name=\"module\" value=\"" . $currentModule . "\">\n\t\t\t<input type=\"hidden\" name=\"action\" value=\"" . $action . "\">\n\t\t\t<input type=\"hidden\" name=\"view\" value=\"shared\">\n\t\t\t<input type=\"hidden\" name=\"edit\" value=\"0\">\n\t\t\t<table cellpadding=\"0\" cellspacing=\"3\" border=\"0\" align=\"center\">\n\t\t\t<tr><th valign=\"top\"  align=\"center\" colspan=\"2\">\n\t\t\t";
        echo $current_module_strings['LBL_SELECT_USERS'];
        echo "\n\t\t\t</th>\n\t\t\t</tr>\n\t\t\t<tr><td valign=\"top\">";
        /** BEGIN - SECURITY GROUPS */
        $securitygroup = $current_user->getPreference('securitygroup_id');
        if (!empty($securitygroup) && !isset($_REQUEST['securitygroup_id'])) {
            $securitygroup_id = $securitygroup;
        } elseif (isset($_REQUEST['securitygroup_id'])) {
            $securitygroup_id = $_REQUEST['securitygroup_id'];
            $current_user->setPreference('securitygroup_id', $_REQUEST['securitygroup_id']);
        } else {
            $securitygroup_id = '';
        }
        if (empty($_SESSION['securitygroup_id'])) {
            $_SESSION['securitygroup_id'] = "";
        }
        echo "<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" class=\"chartForm\" align=\"center\">\n\t\t\t<tr>\n\t\t\t\t<td valign='top' nowrap><b>" . $current_module_strings['LBL_SECURITYGROUPS'] . "></b></td>\n\t\t\t\t<td valign='top' id=\"teams\"><select id=\"securitygroup_id\" onchange='this.form.edit.value=1; this.form.submit();' name=\"securitygroup_id\">";
        global $current_user;
        require_once "modules/SecurityGroups/SecurityGroup.php";
        $group_array[""] = "";
        //for --None-- option
        if (is_admin($current_user)) {
            $securitygroups = SecurityGroup::getAllSecurityGroups();
            foreach ($securitygroups as $group) {
                $group_array[$group['id']] = $group['name'];
            }
        } else {
            $securitygroups = SecurityGroup::getUserSecurityGroups($current_user->id);
            foreach ($securitygroups as $group) {
                $group_array[$group['id']] = $group['name'];
            }
        }
        echo get_select_options_with_id($group_array, $securitygroup_id);
        echo "</select></td>\n\t\t\t</tr>\n\t\t\t</table>";
        /** END - SECURITY GROUPS */
        echo "\n            </td><td valign=\"top\">\n\n\t\t\t<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" class=\"edit view\" align=\"center\">\n\t\t\t<tr>\n\t\t\t\t<td valign='top' nowrap><b>" . $current_module_strings['LBL_USERS'] . "</b></td>\n\t\t\t\t<td valign='top' id=\"shared_ids_td\"><select id=\"shared_ids\" name=\"shared_ids[]\" multiple size='3'>";
        /** BEGIN - SECURITY GROUPS */
        if (!empty($securitygroup_id)) {
            require_once 'modules/SecurityGroups/SecurityGroup.php';
            $securitygroup = new SecurityGroup();
            $securitygroup->retrieve($securitygroup_id);
            $users_array = $securitygroup->getMembers();
            $user_ids = array();
            foreach ($users_array as $user) {
                $user_ids[$user['id']] = $user['user_name'];
            }
            echo get_select_options_with_id($user_ids, $ids);
        } else {
            echo get_select_options_with_id(get_user_array(false), $ids);
        }
        /** END - SECURITY GROUPS */
        echo "\t</select></td>\n\t\t\t\t<td><a onclick=\"up('shared_ids');\">" . SugarThemeRegistry::current()->getImage('uparrow_big', 'border="0" style="margin-bottom: 1px;" alt="' . $app_strings['LBL_SORT'] . '"') . "</a><br>\n\t\t\t\t<a onclick=\"down('shared_ids');\">" . SugarThemeRegistry::current()->getImage('downarrow_big', 'border="0" style="margin-top: 1px;"  alt="' . $app_strings['LBL_SORT'] . '"') . "</a></td>\n\t\t\t</tr>\n\t\t\t<tr>";
        echo "<td align=\"right\" colspan=\"2\"><input class=\"button\" type=\"submit\" title=\"" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "\" accessKey=\"" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "\" value=\"" . $app_strings['LBL_SELECT_BUTTON_LABEL'] . "\" /><input class=\"button\" onClick=\"javascript: toggleDisplay('shared_cal_edit');\" type=\"button\" title=\"" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "\" accessKey=\"" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "\" value=\"" . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . "\"/></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td></tr>\n\t\t\t</table>\n\t\t\t</form>";
    }
    // end "shared" view
    echo "</div></p>";
    if (isset($_REQUEST['edit']) && $_REQUEST['edit']) {
        echo " <script language=\"javascript\"> toggleDisplay('shared_cal_edit'); </script>";
    }
    echo "\n\t\t<table id=\"daily_cal_table_outside\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"monthBox\">\n\t\t<tr>\n\t\t<td>\n\t\t  <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"monthHeader\">\n\t\t  <tr>\n\t\t  <td width=\"1%\" nowrap>";
    if (!isset($args['size']) || $args['size'] != 'small') {
        template_get_previous_calendar($args);
//.........这里部分代码省略.........
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:101,代码来源:templates_calendar.php

示例2: testgetMembers

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


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