function items_groups() { $tt = $_GET["tt"]; $search = $_POST["query"]; $search = "*{$search}*"; $search = str_replace("**", "*", $search); $search = str_replace("**", "*", $search); $field_user = $_GET["field-user"]; $ad = new external_ad_search(); $array = $ad->SearchGroups($search, $_GET["DN"], $_POST["rp"]); $data = array(); $data['page'] = 1; $data['total'] = $array["count"]; $data['rows'] = array(); $fontsize = 13; $c = 0; for ($i = 0; $i < $array["count"]; $i++) { $c++; $color = "black"; $DN = $array[$i]["dn"]; $samaccountname = $array[$i]["samaccountname"][0]; $description = $array[$i]["description"][0]; $itemsNum = $array[$i]["member"]["count"]; if ($samaccountname == null) { $samaccountname = $array[$i]["cn"][0]; } if (!is_numeric($itemsNum)) { $itemsNum = 0; } $select = " "; $DN_enc = urlencode($DN); $FicheGroup = "Loadjs('domains.edit.group.php?ou=ABC&js=yes&group-id={$DN_enc}',true)"; $editjs = "<a href=\"javascript:Blur();\" OnClick=\"{$FicheGroup}\" style='text-decoration:underline;font-size:{$fontsize}px;font-weight:bold;'>"; if ($field_user != null) { $base64 = base64_encode($DN); $select = imgsimple("arrow-right-24.png", null, "EditField{$tt}('{$base64}','{$samaccountname}')"); } if ($description != null) { $description = "<br><span style='font-size:10px;font-style:italic;font-weight:normal'>{$description}</span>"; } $data['rows'][] = array('id' => md5($DN), 'cell' => array("<img src='img/wingroup.png'>", "<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$editjs}{$samaccountname}</a>{$description}</span>", "<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$editjs}{$itemsNum}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$select}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$link}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$delete}</span>")); } $array = $ad->SearchUsers($search, $_GET["DN"], $_POST["rp"]); for ($i = 0; $i < $array["count"]; $i++) { if ($c > $_POST["rp"]) { break; } $c++; $color = "black"; $DN = $array[$i]["dn"]; $samaccountname = $array[$i]["samaccountname"][0]; $description = $array[$i]["description"][0]; $itemsNum = "-"; if ($samaccountname == null) { $samaccountname = $array[$i]["cn"][0]; } $select = " "; $jsUser = MEMBER_JS($samaccountname, 0, 0, $DN); $editjs = "<a href=\"javascript:Blur();\" {$jsUser} style='text-decoration:underline;font-size:{$fontsize}px;font-weight:bold;'>"; if ($description != null) { $description = "<br><span style='font-size:10px;font-style:italic;font-weight:normal'>{$description}</span>"; } $data['rows'][] = array('id' => md5($DN), 'cell' => array("<img src='img/user-18.png'>", "<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$editjs}{$samaccountname}{$description}</span>", "<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$itemsNum}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$itemsNum}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$link}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$delete}</span>")); } if ($c == 0) { json_error_show("{$search} no data"); } $data['total'] = $c; echo json_encode($data); }