コード例 #1
0
ファイル: ops_list.php プロジェクト: steem/qwp
function list_users(&$msg, &$data)
{
    get_user_data_modal($user_modal);
    $user_id = P('id');
    $options = array('data modal' => $user_modal, 'left join' => array(array('qwp_role', 'r', 'r.id=u.role')), 'where' => 'u.id<>1 and role<>1');
    if ($user_id) {
        $data = array();
        if ($user_id != '1' && is_digits($user_id)) {
            $options['where'] .= ' and u.id=' . $user_id;
            qwp_db_get_data(array('qwp_user', 'u'), $data, null, $options);
        }
    } else {
        $options['default order'] = array('role', array('id', 'desc'));
        $options['search condition'] = array('condition' => array('fields' => array('u.name' => 'like', 'avatar' => 'set_avatar_condition', 'gender' => array('s' => array('<>', 'x'))), 'condition' => array('op' => 'or', 'fields' => array('phone' => 'like', 'account' => 'like', 'email' => 'like', 'name' => 'like'))));
        $options['search converter'] = 'convert_search_data';
        qwp_db_retrieve_data(array('qwp_user', 'u'), $data, $options);
    }
}
コード例 #2
0
ファイル: common.php プロジェクト: steem/qwp
function get_user_roles_ids()
{
    $options = array('where' => 'id<>1', 'flat' => true);
    qwp_db_get_data('qwp_role', $roles, 'id', $options);
    return $roles;
}
コード例 #3
0
ファイル: test.php プロジェクト: steem/qwp
<?php

/*!
 * qwp: https://github.com/steem/qwp
 *
 * Copyright (c) 2015 Steem
 * Released under the MIT license
 */
define('QWP_ROOT', dirname(__FILE__));
require_once QWP_ROOT . '/config.php';
require_once QWP_ROUTER_ROOT . '/required.php';
//$_GET['m'] = 'sample';
$_GET['m'] = 'passport';
$_GET['op'] = 'logout';
//$_GET['p'] = 'form';
/*$_POST['f'] = array(
    'user' => '*****@*****.**',
    'pwd' => '111111',
);*/
$test = array(array('table' => 'u', array('account', 'Account', 100), array('name', 'Name', 100), 'id,create_time', 'last_login_time'), array('table' => 'r', array('name', 'Role', 100)), array('table' => 'u', array('phone', 'Phone', 100), array('age', 'Age', 60)), 'alias' => array('r.name' => 'role_name'));
qwp_db_get_fields_from_modal($test, $fields);
qwp_db_get_table_header_from_modal($test, $header);
$options = array('data modal' => $test, 'left join' => array(array('qwp_role', 'r', 'r.id=u.role')), 'default order' => array('id', array('role', 'desc')), 'search condition' => array('values' => array('role' => '1', 'account' => 'te', 'u.name' => 'Test', 'age' => array(18, 32), 'phone' => '111'), 'condition' => array('fields' => array('role' => '<>', 'u.name' => 'like'), 'condition' => array('op' => 'or', 'fields' => array('phone' => 'like', 'account' => 'like')))), 'fields alias' => array('r.name' => 'role_name'));
qwp_db_retrieve_data(array('qwp_user', 'u'), $data, $options);
print_r($data);
$option = array('where' => 'id<>1');
qwp_db_get_data('qwp_role', $data, 'id,name', $option);
print_r($data);