function canApprove($ou, $u) { //$ou - OU ID //$u user Login (Lastname_FM) global $acl; // if ($u == 'Emelianov_AM') return true; foreach ($acl as $a) { if ($a[0] == $ou && $a[1] == $u) { return $a[2]; } } $dep = new WpList(1); $dep->where("id={$ou}"); $dep->retrive(); if ($dep->count > 0) { $par = new WpList(1); $par->where('id=' . $dep->id_1[0]); $par->retrive(); for ($i = 0; $i < $par->count; $i++) { if (canApprove($par->id[$i], $u)) { return true; } } } $acl[] = array($ou, $u, false); return false; }
$tst->orderBy('pages', TRUE); } else { $tst->orderBy($sort); } } else { $tst->orderBy('prnname'); } //$det = false; $cp[] = time(); if (isset($_GET['action']) && $_GET['action'] == 'userchoose') { $tpl->assign('TABLE_HEADER', ''); // $tpl->parse('TABLE_HEADER', '.tr_header_3'); if (($ulist = $cache->valueOf('PRINTJOB_ULIST')) === false) { //5.0.2 $tpl->assign(array('HEADER_1' => 'Имя', 'HEADER_2' => 'Имя', 'HEADER_3' => 'Имя')); $groups = new WpList(1); $groups->where("id_1=''"); $groups->retrive(); for ($i = 0; $i < $groups->count; $i++) { $group = new WpPerson(); $group->where("otdel='" . $groups->name[$i] . "'"); $group->retrive(); $users = new User5($group->lastname[0] . ' ' . $group->firstname[0], OUSER_CN); $users->toMulti(); $prevUserCN = $users->cn[0]; for ($j = 1; $j < $group->count; $j++) { $u = new User5($group->lastname[$j] . ' ' . $group->firstname[$j], OUSER_CN); if ($u->count > 0 && $u->cn != $prevUserCN) { $u->toMulti(); $users->push($u); }