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


PHP Func::array_transparent方法代码示例

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


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

示例1: array_sort_by_subkey

 static function array_sort_by_subkey(&$arr_data, $subkey, $asc = true)
 {
     $arr_res = Func::array_transparent($arr_data, $subkey);
     if ($asc) {
         ksort($arr_res);
     } else {
         krsort($arr_res);
     }
     $arr_data = array();
     foreach ($arr_res as $key => $value) {
         $arr_data = array_merge($arr_data, $value);
     }
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:13,代码来源:func.php

示例2: getGroupPermissions

 function getGroupPermissions($nGroupID, $sItemType = 'module')
 {
     $nGroupID = intval($nGroupID);
     $sQuery = "SELECT M.*, (P.item_id IS NOT NULL) as permissed\n                    FROM " . TABLE_MODULE_METHODS . " M\n                    LEFT JOIN " . TABLE_USERS_GROUPS_PERMISSIONS . " P\n                            ON P.unit_type='group'\n                               AND P.unit_id = {$nGroupID}\n                               AND P.item_type = " . $this->db->str2sql($sItemType) . '
                            AND P.item_id = M.id
                 WHERE M.module=M.method
                 ORDER BY M.number, M.id
              ';
     $aData = $this->db->select($sQuery);
     $sQuery = "SELECT M.*, (P.item_id IS NOT NULL) as permissed\n                    FROM " . TABLE_MODULE_METHODS . " M\n                    LEFT JOIN " . TABLE_USERS_GROUPS_PERMISSIONS . " P\n                            ON P.unit_type='group'\n                               AND P.unit_id = {$nGroupID}\n                               AND P.item_type = " . $this->db->str2sql($sItemType) . '
                            AND P.item_id = M.id
                 WHERE M.module!=M.method
                 ORDER BY M.number, M.id
              ';
     $aSubData = $this->db->select($sQuery);
     $aSubData = Func::array_transparent($aSubData, 'module');
     for ($i = 0; $i < count($aData); $i++) {
         $aData[$i]['subitems'] = array();
         if (isset($aSubData[$aData[$i]['module']])) {
             $aData[$i]['subitems'] = $aSubData[$aData[$i]['module']];
         }
     }
     return $aData;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:24,代码来源:users.bl.class.php

示例3: admin_listing

 function admin_listing()
 {
     if (!$this->haveAccessTo('admins-listing')) {
         return $this->showAccessDenied();
     }
     $bShowDeleted = true;
     //prepare order
     $this->prepareOrder($orderBy, $orderDirection, 'login,asc');
     //get users
     $this->generatePagenationPrevNext('SELECT U.user_id, U.login, U.email, U.password, U.blocked, U.deleted, U.activated
                     , U.social, U.vk_id
                FROM ' . TABLE_USERS . ' U
                WHERE U.admin = 1 ' . (!FORDEV ? ' AND U.user_id!=1 ' : '') . '
                ORDER BY U.' . $orderBy . ' ' . $orderDirection, $aData, 'users', 15);
     //get 'all admins groups'
     $aUsersGroups = $this->db->select(' SELECT G.*, U.user_id
                 FROM ' . TABLE_USERS . ' U, ' . TABLE_USER_IN_GROUPS . ' UIG, ' . TABLE_USERS_GROUPS . ' G
                 WHERE G.adminpanel=1 AND UIG.group_id = G.group_id AND U.user_id = UIG.user_id 
                 ORDER BY G.group_id ');
     $aUsersGroups = Func::array_transparent($aUsersGroups, 'user_id');
     foreach ($aData['users'] as &$v) {
         $v = func::array_2_htmlspecialchars($v);
         $v['tuid'] = $this->makeTUID($v['user_id']);
         $v['groups'] = '';
         if (isset($aUsersGroups[$v['user_id']])) {
             $v['groups'] = $aUsersGroups[$v['user_id']];
         }
     }
     $this->tplAssign('aData', $aData);
     return $this->tplFetch('admin.admin.listing.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:31,代码来源:users.adm.class.php

示例4: getBannersByPosition

 private function getBannersByPosition($mPosition = null)
 {
     $sWhere = '';
     if (!empty($mPosition)) {
         if (is_array($mPosition)) {
             $sWhere = ' AND ' . $this->db->prepareIN('position', $mPosition, false, true, false);
         } else {
             $sWhere = ' AND position = ' . $this->db->str2sql($mPosition);
         }
     }
     $aData = $this->db->select('SELECT * FROM ' . TABLE_BANNERS . ' 
                            WHERE enabled = 1 ' . $sWhere . ' AND show_start <= DATE_FORMAT(NOW(),"%Y-%m-%d 00:00")
                            ORDER BY position');
     for ($i = 0; $i < count($aData); $i++) {
         $aData[$i]['positioninfo'] = $this->positions[$aData[$i]['position']];
         $aData[$i]['img'] = BANNERS_PATH . $aData[$i]['id'] . '_thumb_' . $aData[$i]['banner'];
         $aData[$i]['img_work'] = SITEURL . '/bn/show/' . $aData[$i]['id'] . '/';
         $aData[$i]['flash'] = unserialize($aData[$i]['flash']);
         if ($aData[$i]['clickurl']) {
             $aData[$i]['clickurl'] = SITEURL . '/bn/click/' . $aData[$i]['id'];
         } else {
             $aData[$i]['clickurl'] = '';
         }
     }
     $aData = Func::array_transparent($aData, 'position');
     return $aData;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:27,代码来源:banners.class.php

示例5: mm_listing

 function mm_listing()
 {
     if (!FORDEV || !$this->security->isSuperAdmin()) {
         return $this->showAccessDenied();
     }
     if (bff::$isAjax) {
         switch (func::GET('act')) {
             case 'rotate':
                 $res = $this->db->rotateTablednd(TABLE_MODULE_METHODS, '', 'id', 'number');
                 $this->ajaxResponse($res ? Errors::SUCCESS : Errors::IMPOSSIBLE);
                 break;
             case 'delete':
                 if (!($nRecordID = $this->input->id('rec', 'p'))) {
                     break;
                 }
                 $aResult = $this->db->one_array('SELECT *
                            FROM ' . TABLE_MODULE_METHODS . '
                            WHERE id = ' . $nRecordID);
                 if (empty($aResult)) {
                     $this->ajaxResponse(Errors::IMPOSSIBLE);
                 }
                 if ($aResult['module'] == $aResult['method']) {
                     //если модуль, получаем методы
                     $aMethodsID = $this->db->select_one_column('SELECT id FROM ' . TABLE_MODULE_METHODS . '
                                WHERE module=' . $this->db->str2sql($aResult['module']) . ' AND module!=method
                                ORDER BY number, id');
                     //удалить методы
                     $this->db->execute('DELETE FROM ' . TABLE_MODULE_METHODS . ' WHERE id IN (' . implode(',', $aMethodsID) . ')');
                     $this->db->execute('DELETE FROM ' . TABLE_USERS_GROUPS_PERMISSIONS . ' WHERE item_type = ' . $this->db->str2sql('module') . ' and item_id IN (' . implode(',', $aMethodsID) . ')');
                 }
                 //удалить модули и методы
                 $this->db->execute('DELETE FROM ' . TABLE_MODULE_METHODS . ' WHERE id = ' . $nRecordID);
                 $this->db->execute('DELETE FROM ' . TABLE_USERS_GROUPS_PERMISSIONS . ' WHERE unit_type=' . $this->db->str2sql('group') . ' AND item_type=' . $this->db->str2sql('module') . ' AND item_id=' . $nRecordID);
                 $this->ajaxResponse(Errors::SUCCESS);
                 break;
         }
         $this->ajaxResponse(Errors::IMPOSSIBLE);
     }
     $aData = $this->db->select(' SELECT M.*, 1 as numlevel
                 FROM ' . TABLE_MODULE_METHODS . ' M  
                 WHERE M.module=M.method
                 ORDER BY M.number, M.id');
     $aSubData = $this->db->select('SELECT M.*, 2 as numlevel
                 FROM ' . TABLE_MODULE_METHODS . ' M
                 WHERE M.module!=M.method
                 ORDER BY M.number, M.id');
     $aSubData = Func::array_transparent($aSubData, 'module');
     for ($i = 0; $i < count($aData); $i++) {
         $aData[$i]['subitems'] = array();
         if (isset($aSubData[$aData[$i]['module']])) {
             $aData[$i]['subitems'] = $aSubData[$aData[$i]['module']];
         }
     }
     $this->includeJS('tablednd');
     $this->tplAssign('aData', $aData);
     return $this->tplFetch('admin.mm.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:57,代码来源:dev.adm.class.php


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