function getPathByOrgid($orgid, $path = array())
{
    if ($org = C::t('organization')->fetch($orgid)) {
        $path[$org['orgid']] = $org['orgname'];
        if ($org['forgid'] > 0) {
            $path = getPathByOrgid($org['forgid'], $path);
        }
    }
    return $path;
}
Example #2
0
    $_GET['vid'] = 0;
    require './admin/member/verify.php';
    exit;
}
if ($_GET['do'] == 'setuserstatus') {
    C::t('user')->update(intval($_GET['uid']), array('status' => intval($_GET['status'])));
    echo json_encode(array('msg' => 'success'));
    exit;
}
if (!submitcheck('deletesubmit')) {
    require libfile('function/organization');
    $orgid = intval($_GET['orgid']);
    $keyword = trim($_GET['keyword']);
    $department = '请选择机构或部门';
    if ($org = C::t('organization')->fetch($orgid)) {
        $patharr = getPathByOrgid($orgid);
        $department = implode(' - ', array_reverse($patharr));
    }
    $page = empty($_GET['page']) ? 1 : intval($_GET['page']);
    $perpage = 20;
    $gets = array('mod' => 'member', 'keyword' => $keyword, 'orgid' => $orgid, 'groupid' => $groupid);
    $theurl = BASESCRIPT . "?" . url_implode($gets);
    $order = 'ORDER BY uid DESC';
    $start = ($page - 1) * $perpage;
    $sql = '1';
    $param[] = array('user');
    if ($keyword) {
        if ($count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('user') . " WHERE username like '%{$keyword}%' or email like '%{$keyword}%'")) {
            $user = DB::fetch_all("SELECT * FROM " . DB::table('user') . " WHERE username like '%{$keyword}%' or email like '%{$keyword}%' {$order} limit {$start},{$perpage}");
            $multi = multi($count, $perpage, $page, $theurl, 'pull-right');
        }
Example #3
0
 if ($operation == 'basic') {
     $navtitle = '基本设置';
     $spacesize = DB::result_first("select maxspacesize from " . DB::table('usergroup_field') . " where groupid='9'");
     include_once libfile('function/organization');
     if ($setting['defaultdepartment']) {
         $patharr = getPathByOrgid($setting['defaultdepartment']);
         $defaultdepartment = implode(' - ', array_reverse($patharr));
     }
     if (empty($defaultdepartment)) {
         $defaultdepartment = '不加入机构或部门';
         $setting['defaultdepartment'] = 'other';
     }
     //$orgtree=getDepartmentOption(0);
 } elseif ($operation == 'qywechat') {
     if ($setting['synorgid']) {
         $patharr = getPathByOrgid($setting['synorgid']);
         $syndepartment = implode(' - ', array_reverse($patharr));
     }
     if (empty($syndepartment)) {
         $syndepartment = '全部用户';
         $setting['syndepartment'] = '0';
     }
 } elseif ($operation == 'desktop') {
     if ($setting['desktop_default'] && !is_array($setting['desktop_default'])) {
         $setting['desktop_default'] = unserialize($setting['desktop_default']);
     }
     if (!$setting['desktop_default']) {
         $setting['desktop_default'] = array('iconview' => 2, 'taskbar' => 'bottom', 'iconposition' => 0, 'direction' => 0);
     }
     if ($_G['setting']['dzz_iconview']) {
         $iconview = $_G['setting']['iconview'];
Example #4
0
     }
     //处理上司职位;
     C::t('organization_upjob')->insert_by_uid($uid, intval($_GET['upjobid']));
     showmessage('修改用户信息成功', ADMINSCRIPT . '?mod=orguser#user_' . $uid, array());
 } else {
     require_once libfile('function/organization');
     $user = C::t('user')->fetch_by_uid($uid);
     $userfield = C::t('user_field')->fetch($uid);
     //$user['status']=$user['status']>0?0:1;
     $departs = array();
     $data_depart = array();
     //$departs=getDepartmentByUid($uid);
     $orgids = C::t('organization_user')->fetch_orgids_by_uid($uid);
     $departs = C::t('organization')->fetch_all($orgids);
     foreach ($departs as $key => $value) {
         $orgpath = getPathByOrgid($value['orgid']);
         $value['depart'] = implode('-', array_reverse($orgpath));
         $value['ismoderator'] = C::t('organization_admin')->ismoderator_by_uid_orgid($value['orgid'], $_G['uid']);
         $value['jobs'] = C::t('organization_job')->fetch_all_by_orgid($value['orgid']);
         $value['user'] = C::t('organization_user')->fetch_by_uid_orgid($uid, $value['orgid']);
         $value['jobid'] = $value['user']['jobid'];
         $value['jobname'] = $value['jobs'][$value['jobid']] ? $value['jobs'][$value['jobid']]['name'] : '无';
         $data_depart[$key] = $value;
     }
     //$orgtree_admin=getDepartmentOption_admin(0);
     if ($upjob = C::t('organization_upjob')->fetch_by_uid($uid)) {
         $upjob['jobs'] = C::t('organization_job')->fetch_all_by_orgid($upjob['orgid']);
     } else {
         $upjob = array('jobid' => 0, 'depart' => '请选择机构或部门', 'name' => '无');
     }
     //$orgtree_all=getDepartmentOption_admin(0,'',true);
Example #5
0
$space['regdate'] = dgmdate($space['regdate']);
if ($space['lastvisit']) {
    $profiles['lastvisit'] = array('title' => '最后访问', 'value' => dgmdate($space['lastvisit']));
}
$profiles['regdate'] = array('title' => '注册时间', 'value' => $space['regdate']);
$user = array();
$space['fusesize'] = formatsize($space['usesize']);
if (!$_G['cache']['usergroups']) {
    loadcache('usergroups');
}
$usergroup = $_G['cache']['usergroups'][$space['groupid']];
$profiles['usergroup'] = array('title' => '用户组', 'value' => $usergroup['grouptitle']);
//资料用户所在的部门
$department = '';
foreach (C::t('organization_user')->fetch_orgids_by_uid($uid) as $orgid) {
    $orgpath = getPathByOrgid($orgid);
    $department .= '<span class="label label-primary">' . implode('-', array_reverse($orgpath)) . '</span>';
}
if (empty($department)) {
    $department = '未加入机构或部门';
}
$profiles['department'] = array('title' => '所属部门', 'value' => $department);
if ($usergroup['maxspacesize'] == 0) {
    $space['maxspacesize'] = 0;
} elseif ($usergroup['maxspacesize'] < 0) {
    if ($space['addsize'] + $space['buysize'] > 0) {
        $space['maxspacesize'] = ($space['addsize'] + $space['buysize']) * 1024 * 1024;
    } else {
        $space['maxspacesize'] = -1;
    }
} else {
Example #6
0
function space_merge(&$values, $tablename, $isarchive = false)
{
    global $_G;
    $uid = empty($values['uid']) ? $_G['uid'] : $values['uid'];
    $var = "user_{$uid}_{$tablename}";
    if ($uid) {
        $ext = '';
        //$isarchive ? '_archive' :'' ;
        if (!isset($_G[$var])) {
            if (($_G[$var] = C::t('user_' . $tablename . $ext)->fetch($uid)) !== false) {
                //C::t('user_'.$tablename.$ext)->insert(array('uid'=>$uid));
                if ($tablename == 'field') {
                    $_G['setting']['privacy'] = empty($_G['setting']['privacy']) ? array() : (is_array($_G['setting']['privacy']) ? $_G['setting']['privacy'] : dunserialize($_G['setting']['privacy']));
                    $_G[$var]['privacy'] = empty($_G[$var]['privacy']) ? array() : is_array($_G[$var]['privacy']) ? $_G[$var]['privacy'] : dunserialize($_G[$var]['privacy']);
                } elseif ($tablename == 'profile1') {
                    include_once libfile('function/organization');
                    if ($_G[$var]['department'] && ($orgtree = getPathByOrgid(intval($_G[$var]['department'])))) {
                        $_G[$var]['department_tree'] = implode('-', array_reverse($orgtree));
                    } else {
                        $_G[$var]['department_tree'] = '请选择机构或部门';
                    }
                }
            } else {
                $_G[$var] = array();
            }
        }
        $values = array_merge($values, $_G[$var]);
    }
}
Example #7
0
function profile_show($fieldid, $space = array(), $getalone = false)
{
    global $_G;
    if (empty($_G['cache']['profilesetting'])) {
        loadcache('profilesetting');
    }
    $field = $_G['cache']['profilesetting'][$fieldid];
    if (empty($field) || !$field['available'] || !$getalone && in_array($fieldid, array('uid', 'birthmonth', 'birthyear'))) {
        return false;
    }
    if ($fieldid == 'gender') {
        return lang('message', 'gender_' . intval($space['gender']));
    } elseif ($fieldid == 'birthday' && !$getalone) {
        $return = $space['birthyear'] ? $space['birthyear'] . ' ' . lang('message', 'year') . ' ' : '';
        if ($space['birthmonth'] && $space['birthday']) {
            $return .= $space['birthmonth'] . ' ' . lang('message', 'month') . ' ' . $space['birthday'] . ' ' . lang('message', 'day');
        }
        return $return;
    } elseif ($fieldid == 'department') {
        if ($space['department']) {
            include_once libfile('function/organization');
            $orgtree = getPathByOrgid($space['department']);
            return implode('-', array_reverse($orgtree));
        } else {
            return '未选择机构和部门';
        }
    } else {
        return nl2br($space[$fieldid]);
    }
}