Example #1
0
function findchilddept_comp(&$tarr, $parent, $level = 0)
{
    $level = $level + 1;
    $n = count($tarr);
    for ($x = 0; $x < $n; $x++) {
        if ($tarr[$x]['dept_parent'] == $parent && $tarr[$x]['dept_parent'] != $tarr[$x]['dept_id']) {
            showchilddept_comp($tarr[$x], $level);
            findchilddept_comp($tarr, $tarr[$x]['dept_id'], $level);
        }
    }
}
function findchilddept_comp(&$tarr, $parent, $level = 0)
{
    trigger_error("The findchilddept_comp function has been deprecated and will be removed in v4.0. There is no replacement.", E_USER_NOTICE);
    $level++;
    $n = count($tarr);
    for ($x = 0; $x < $n; $x++) {
        if ($tarr[$x]['dept_parent'] == $parent && $tarr[$x]['dept_parent'] != $tarr[$x]['dept_id']) {
            echo showchilddept_comp($tarr[$x], $level);
            findchilddept_comp($tarr, $tarr[$x]['dept_id'], $level);
        }
    }
}
Example #3
0
global $AppUI, $company_id, $canEdit;
$depts = CCompany::getDepartments($AppUI, $company_id);
$s = '<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">';
$s .= '<tr>';
if (count($depts)) {
    $s .= '<th>&nbsp;</th>';
    $s .= '<th width="100%">' . $AppUI->_('Name') . '</th>';
    $s .= '<th>' . $AppUI->_('Users') . '</th>';
} else {
    $s .= '<td>' . $AppUI->_('No data available') . '</td>';
}
$s .= '</tr>';
echo $s;
if (count($depts)) {
    foreach ($depts as $dept) {
        if ($dept['dept_parent'] == 0) {
            echo showchilddept_comp($dept);
            findchilddept_comp($depts, $dept['dept_id']);
        }
    }
}
echo '
<tr>
	<td colspan="3" nowrap="nowrap" rowspan="99" align="right" valign="top" style="background-color:#ffffff">';
if ($canEdit) {
    echo '<input type="button" class=button value="' . $AppUI->_('new department') . '" onclick="javascript:window.location=\'./index.php?m=departments&amp;a=addedit&amp;company_id=' . $company_id . '\';" />';
}
echo '
	</td>
</tr>
</table>';