function udm_output_userlist_csv($udm, $options = array()) { global $ID, $MM_email_from; // - returns current user variable $udm->set_sql['from'] = $options['usertable']; $udm->set_sql['where'] = "(modin=" . $udm->instance; if ($options['allow_include_modins'] && isset($options['include_modin'])) { $udm->set_sql['where'] .= $options['include_modin'] == "*" ? " OR modin !=" . $udm->instance : " OR modin in(" . $options['include_modin'] . ") "; } $udm->set_sql['where'] .= ")"; $udm->set_sql['select'] = $options['display_fields'] . $options['hidden_fields']; $udm->set_sql['orderby'] = $options['sort_by']; if ($udm->getSet($options)) { $output = list_export($udm, $options, $_REQUEST['id']); #$output.=list_output_dynamic($udm, $options); #$output.="</form>"; } else { $output = "This Module is currently empty"; } if ($udm->authorized) { return $output; } else { return 'You do not have permission to view this list'; } }
} /* 导出所有数据或选中数据 */ /* 构建数据提取SQL - 导出所有比自己角色等级低的管理员 */ $sql = 'SELECT ' . $fields['sql'] . ' FROM ' . tname('admin') . ' LEFT JOIN ' . tname('role') . ' USING(role_id) WHERE'; $sql .= admin_id() == 1 ? ' (' . tname('admin') . '.role_id = 0' : ' 1<>1'; $sql .= ' OR (' . tname('role') . '.lft>' . $_PRIV['role']['lft']; $sql .= ' AND ' . tname('role') . '.rht<' . $_PRIV['role']['rht'] . '))'; if ($_GET['limit'] == 'choice') { if (is_string($_GET['ids']) || $_GET['ids'] != '') { $sql .= ' AND admin_id IN("' . implode('","', explode(',', $_GET['ids'])) . '")'; } else { $sql .= ' LIMIT 0,0'; } } /* 导出数据 */ list_export('admin.csv', $db->getAll($sql)); } else { /* 权限检查 */ admin_privilege_valid('admin.php', 'list'); /* 取得管理员的非增加、列表操作 */ $m_aa = admin_module_acts('admin.php'); $m_ac = filter_module_acts($m_aa, array('add', 'list'), false); /* 管理员列表(子级管理员) - 如果是当前管理员ID为1,则列出所有无角色的管理员 */ $tpl['list'] = list_admin(array('role_info' => $_PRIV['role'])); /* 管理员列表 - 数据重构,绑定操作权限 */ foreach ($tpl['list']['data'] as $i => $r) { /* 编辑操作 */ $attribs = array(); $attribs['edit']['onclick'] = "wnd_admin_fill(this,'edit',{$r[admin_id]})"; /* 删除操作 */ $attribs['del']['onclick'] = "ListTable.del(this,{$r[admin_id]},'";