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


PHP ACLRole::toArray方法代码示例

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


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

示例1: array

$return = array('module' => 'ACLRoles', 'action' => 'index', 'record' => '');
if (!empty($_REQUEST['record'])) {
    $role->retrieve($_REQUEST['record']);
    $categories = ACLRole::getRoleActions($_REQUEST['record']);
    $role_name = $role->name;
    if (!empty($_REQUEST['isDuplicate'])) {
        //role id is stripped here in duplicate so anything using role id after this will not have it
        $role->id = '';
    } else {
        $return['record'] = $role->id;
        $return['action'] = 'DetailView';
    }
} else {
    $categories = ACLRole::getRoleActions('');
}
$sugar_smarty->assign('ROLE', $role->toArray());
$tdwidth = 10;
if (isset($_REQUEST['return_module'])) {
    $return['module'] = $_REQUEST['return_module'];
    if (isset($_REQUEST['return_action'])) {
        $return['action'] = $_REQUEST['return_action'];
    }
    if (isset($_REQUEST['return_record'])) {
        $return['record'] = $_REQUEST['return_record'];
    }
}
$sugar_smarty->assign('RETURN', $return);
$names = ACLAction::setupCategoriesMatrix($categories);
if (!empty($names)) {
    $tdwidth = 100 / sizeof($names);
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:31,代码来源:EditRole.php

示例2: getAllRoles

 /**
  * static getAllRoles($returnAsArray = false)
  *
  * @param boolean $returnAsArray - should it return the results as an array of arrays or as an array of ACLRoles
  *
  * @return either an array of array representations of acl roles or an array of ACLRoles
  */
 function getAllRoles($returnAsArray = false)
 {
     $db = DBManagerFactory::getInstance();
     $query = "SELECT acl_roles.* FROM acl_roles\n                    WHERE acl_roles.deleted=0 ORDER BY name";
     $result = $db->query($query);
     $roles = [];
     while ($row = $db->fetchByAssoc($result)) {
         $role = new ACLRole();
         $role->populateFromRow($row);
         if ($returnAsArray) {
             $roles[] = $role->toArray();
         } else {
             $roles[] = $role;
         }
     }
     return $roles;
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:24,代码来源:ACLRole.php

示例3: testtoArray

 public function testtoArray()
 {
     $aclRole = new ACLRole();
     //wihout any fields set
     $expected = array('id' => '', 'name' => '', 'description' => '');
     $actual = $aclRole->toArray();
     $this->assertSame($expected, $actual);
     //with fileds pre populated
     $aclRole->id = '1';
     $aclRole->name = 'test';
     $aclRole->description = 'some description text';
     $expected = array('id' => '1', 'name' => 'test', 'description' => 'some description text');
     $actual = $aclRole->toArray();
     $this->assertSame($expected, $actual);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:15,代码来源:ACLRoleTest.php


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