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


PHP ca_lists::itemIDsToItemValues方法代码示例

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


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

示例1: getAccessStatuses

 /**
  * Return array of access statuses with access levels for current user. Levels are:
  *		0 = no access
  *		1 = read 
  * 		null = use whatever the default is
  *
  * The array is indexed on access status value (eg. 0, 1, 2...) not name; the values are level values.
  * 
  * If the $pn_access_level parameter is set to 0 or 1, then a simple list of access status values for which the user
  * has that access level is returned
  *
  * @return array
  */
 public function getAccessStatuses($pn_access_level = null)
 {
     if (!$this->getPrimaryKey()) {
         return null;
     }
     // get user roles
     $va_roles = $this->getUserRoles();
     foreach ($this->getGroupRoles() as $vn_role_id => $va_role_info) {
         $va_roles[$vn_role_id] = $va_role_info;
     }
     $va_access_by_item_id = array();
     if (is_array($va_roles)) {
         foreach ($va_roles as $vn_role_id => $va_role_info) {
             if (is_array($va_access_status_settings = $va_role_info['vars']['access_status_settings'])) {
                 foreach ($va_access_status_settings as $vn_item_id => $vn_access) {
                     if (!isset($va_access_by_item_id[$vn_item_id])) {
                         $va_access_by_item_id[$vn_item_id] = $vn_access;
                         continue;
                     }
                     if (is_null($vn_access)) {
                         continue;
                     }
                     if ($vn_access >= (int) $va_access_by_item_id[$vn_item_id]) {
                         $va_access_by_item_id[$vn_item_id] = $vn_access;
                     }
                 }
             }
         }
     }
     if (!sizeof($va_access_by_item_id)) {
         return array();
     }
     $va_item_values = ca_lists::itemIDsToItemValues(array_keys($va_access_by_item_id), array('transaction' => $this->getTransaction()));
     if (!is_array($va_item_values) || !sizeof($va_item_values)) {
         return array();
     }
     $va_ret = array();
     if (is_array($va_item_values)) {
         foreach ($va_item_values as $vn_item_id => $vn_val) {
             $va_ret[$vn_val] = $va_access_by_item_id[$vn_item_id];
         }
     }
     if (!is_null($pn_access_level) && in_array($pn_access_level, array(0, 1))) {
         $va_filtered_ret = array();
         foreach ($va_ret as $vn_val => $vn_access) {
             if ($vn_access == $pn_access_level) {
                 $va_filtered_ret[] = $vn_val;
             }
         }
         return $va_filtered_ret;
     }
     return $va_ret;
 }
开发者ID:kai-iak,项目名称:providence,代码行数:66,代码来源:ca_users.php


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