Exemplo n.º 1
0
function getDepartmentOption($orgid, $url = '', $all = false, $i = 0, $pname = array())
{
    $html = '';
    //$data[$orgid]['i']=$i;
    if ($i < 1) {
        if ($all) {
            $html .= '<li role="presentation">';
            $html .= '<a href="' . ($url ? $url . '&depid=0' : 'javascript:;') . '" tabindex="-1" role="menuitem" _orgid="0" ' . (!$url ? 'onclick="selDepart(this)"' : '') . '>';
            $html .= '<div class="child-org">';
            for ($j = 0; $j < $i - 1; $j++) {
                $html .= '<span class="child-tree tree-su">&nbsp;</span>';
            }
            $html .= '全部';
            $html .= '</div>';
            $html .= '</a></li>';
        }
        if ($org = C::t('organization')->fetch($orgid)) {
            $pname[$i] = $org['orgname'];
            $html .= '<li role="presentation">';
            $html .= '<a href="' . ($url ? $url . '&depid=' . $org['orgid'] : 'javascript:;') . '" tabindex="-1" role="menuitem" _orgid="' . $org['orgid'] . '" ' . (!$url ? 'onclick="selDepart(this)"' : '') . ' data-orgname=' . implode('-', $pname) . '>';
            $html .= '<div class="child-org">';
            for ($j = 0; $j < $i - 1; $j++) {
                $html .= '<span class="child-tree tree-su">&nbsp;</span>';
            }
            $html .= $org['orgname'];
            $html .= '</div>';
            $html .= '</a></li>';
        }
    }
    $i++;
    $count = C::t('organization')->fetch_all_by_forgid($orgid, true);
    if ($count) {
        $k = 1;
        foreach (C::t('organization')->fetch_all_by_forgid($orgid) as $key => $value) {
            $pname[$i] = $value['orgname'];
            $html .= '<li role="presentation">';
            $html .= '<a href="' . ($url ? $url . '&depid=' . $value['orgid'] : 'javascript:;') . '" tabindex="-1" role="menuitem" _orgid="' . $value['orgid'] . '" ' . (!$url ? 'onclick="selDepart(this)"' : '') . ' data-orgname=' . implode('-', $pname) . '>';
            $html .= '<div class="child-org">';
            for ($j = 0; $j < $i - 1; $j++) {
                $html .= '<span class="child-tree tree-su">&nbsp;</span>';
            }
            $html .= '<span class="child-tree ' . ($k < $count ? 'tree-heng' : 'tree-heng1') . '">&nbsp;</span>' . $value['orgname'];
            $html .= '</div>';
            $html .= '</a></li>';
            $html .= getDepartmentOption($value['orgid'], $url, false, $i, $pname);
            $k++;
        }
        //$html.='</tbody>';
    }
    return $html;
}
Exemplo n.º 2
0
 * @copyright   Leyun internet Technology(Shanghai)Co.,Ltd
 * @license     http://www.dzzoffice.com/licenses/license.txt
 * @package     DzzOffice
 * @link        http://www.dzzoffice.com
 * @author      zyx(zyx@dzz.cc)
 */
if (!defined('IN_DZZ')) {
    exit('Access Denied');
}
if (!$_G['uid']) {
    exit;
}
require libfile('function/organization');
$toporgid = 0;
$orgid = intval($_GET['orgid']);
if ($org = C::t('organization')->fetch($orgid)) {
    if ($org['forgid'] == 0) {
        $toporgid = $orgid;
    } else {
        //获取此部门的顶级机构
        $orguptree = getUpOrgidTree($orgid, true);
        $toporgid = $orguptree[count($orguptree) - 1];
    }
}
//机构列表
$orgtree = getDepartmentOption($toporgid, '', true);
//获取部门的用户列表;
$userlist = C::t('organization_user')->fetch_user_by_orgid($orgid);
//获取机构部门树
//$departmenttree=getDepartmentOption($orgid);
include template('misc_seluser');
Exemplo n.º 3
0
<?php

if (!defined('IN_DZZ')) {
    exit('Access Denied');
}
require libfile('function/organization');
if ($_GET['op'] == 'getDepartment') {
    $orgid = intval($_GET['orgid']);
    //获取机构部门树
    $departmenttree = getDepartmentOption($orgid);
    echo '<li role="presentation"><a href="javascript:;" tabindex="-1" role="menuitem" _orgid="0" onclick="selDepart(this)">请选择部门</a></li>';
    echo $departmenttree;
    exit;
} elseif ($_GET['op'] == 'getuserlist') {
    $orgid = intval($_GET['orgid']);
    //获取机构部门树
    $users = getUserByOrgid($orgid, 1);
    $html = '';
    foreach ($users as $uid => $value) {
        $html .= '<li uid="' . $value['uid'] . '" username="******" >';
        $html .= '<img src="avatar.php?uid=' . $value['uid'] . '" ><span>' . $value['username'] . '</span>';
        $html .= '<a class="pull-right add" href="javascript:;"  title="添加"><i class="glyphicon glyphicon-forward"></i></a></li>';
    }
    echo $html;
    exit;
}