### filterWithoutField
**字段權限控制:用于對字段的過濾 - 包括列表和表單**
**參數**
\* 第一個參數是權限名稱
\* 第二個參數是需要過濾的數組
\* 第三個參數是過濾類型: form => 表單(默認:權限類型為表字段) ,list => 列表(權限類型為表字段) , 'keyForm' => 表單(權限類型為0或者1)
\* 第四個參數:需要過濾的字段
\* 第五個參數:獲取其他模塊的權限
~~~
function filterWithoutField( $key,$rows, $type = 'form',$filterArr,$modelName ) {
//update by chengl 2012-02-01 加入另外模塊權限判斷
$limit=$this->this_limit;
if(!empty($modelName)){
$otherdatasDao=new model_common_otherdatas();
$limit =$otherdatasDao->getUserPriv($modelName,$_SESSION ['USER_ID'],$_SESSION['DEPT_ID'],$_SESSION['USER_JOBSID']);
}
if ($type == 'form') {
$limitArr = isset($limit [$key]) ? explode ( ',', $limit [$key] ) : array();
foreach ( $rows as $k => $v ) {
if (in_array ( $k, $filterArr )) {
if(!in_array ( $k, $limitArr )){
$rows [$k] = '******';
}
}
}
}elseif ($type == 'list') {
$limitArr = isset($limit [$key]) ? explode ( ',', $limit [$key] ) : array();
$i = 0;
foreach ( $rows as $k => $v ) {
foreach ( $v as $myKey => $myVal ) {
if (in_array ( $myKey, $filterArr )) {
if(!in_array ( $myKey, $limitArr )){
$rows [$i] [$myKey] = '******';
}
}
}
$i ++;
}
}elseif ($type == 'keyForm') {
$limitArr = isset($limit [$key])&&!empty($limit [$key]) ? 1 : 0;
// print_r($key);
foreach ( $rows as $k => $v ) {
if (in_array ( $k, $filterArr )) {
if($limitArr == 0){
$rows [$k] = '******';
}
}
}
}elseif ($type == 'keyList') {
$limitArr = isset($limit [$key])&&!empty($limit [$key]) ? 1 : 0;
$i = 0;
foreach ( $rows as $k => $v ) {
foreach ( $v as $myKey => $myVal ) {
if (in_array ( $myKey, $filterArr )) {
if($limitArr == 0){
$rows [$i] [$myKey] = '******';
}
}
}
$i ++;
}
}
return $rows;
}
~~~
- 架構
- 基礎框架文檔
- base/action(C層基類)
- protected 類定義
- __construct構造函數
- c_list
- c_index
- c_page
- c_pageJson
- c_listJson
- c_getByAjax
- c_getCountByName
- c_toAdd
- c_add
- c_init
- c_edit
- c_deletes
- c_ajaxdeletes
- c_saveBatch
- c_checkRepeat
- getDatadicts
- showDatadicts
- getDataNameByCode
- assign
- display
- view
- assignFunc
- model/base(M層基類)
- protected類定義(model)
- __construct
- find
- get_table_fields
- findAll
- findSql
- create
- delete
- findBy
- updateField
- query
- findCount
- update
- filterFunc
- filterField
- filterWithoutField
- filterCustom
- createBatch
- pageBySql
- listBySql
- pageBySqlId
- deletes
- 事務控制
- 獲取對象數組
- addBatch_d
- add_d
- edit_d
- isRepeat
- 列表組件文檔
- 基礎表格
- 數據獲取
- 表格數據顯示
- 常用控制參數
- 表格右鍵擴展
- 表格擴展按鈕
- 快速搜索
- 高級搜索(自定義視圖)
- 表格注冊事件
- 主從表格
- 可編輯表格
- 模塊開發
- 開發案例
- 開發準則