$action = get_user_actionmenu($userid); $table->addRow(array(array(new CCheckBox('group_userid[' . $userid . ']', NULL, NULL, $userid), new CLink($user['alias'], 'users.php?form=update' . url_param('config') . '&userid=' . $userid . '#form', 'action')), $user['name'], $user['surname'], user_type2str($user['type']), isset($users_groups[$userid]) ? $users_groups[$userid] : '', $online, $gui_access, $users_status, $action)); $row_count++; } $table->SetFooter(new CCol(new CButtonQMessage('delete_selected', S_DELETE_SELECTED, S_DELETE_SELECTED_USERS_Q))); $form->AddItem($table); $form->show(); $jsmenu = new CPUMenu(null, 270); $jsmenu->InsertJavaScript(); set_users_jsmenu_array(); } } else { if ($_REQUEST['config'] == 1) { // USER GROUPS if (isset($_REQUEST['form'])) { insert_usergroups_form(); } else { $numrows = new CSpan(null, 'info'); $numrows->addOption('name', 'numrows'); $header = get_table_header(array(S_USER_GROUPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows)); show_table_header($header); $form = new CForm(); $table = new CTableInfo(S_NO_USER_GROUPS_DEFINED); $table->setHeader(array(S_USERS_STATUS, S_GUI_ACCESS, array(new CCheckBox('all_groups', NULL, "CheckAll('" . $form->GetName() . "','all_groups');"), make_sorting_link(S_NAME, 'ug.name')), S_MEMBERS)); $result = DBselect('SELECT ug.usrgrpid, ug.name, ug.users_status, ug.gui_access ' . ' FROM usrgrp ug' . ' WHERE ' . DBin_node('ug.usrgrpid') . order_by('ug.name')); while ($row = DBfetch($result)) { $users = array(); $users_id = array(); $db_users = DBselect('SELECT DISTINCT u.alias,u.userid ' . ' FROM users u,users_groups ug ' . ' WHERE u.userid=ug.userid ' . ' AND ug.usrgrpid=' . $row['usrgrpid'] . ' ORDER BY u.alias'); while ($db_user = DBfetch($db_users)) { if (!empty($users)) {
if ($_REQUEST['go'] != 'none' && isset($go_result) && $go_result) { $url = new CUrl(); $path = $url->getPath(); insert_js('cookie.eraseArray("' . $path . '")'); } // Config $frmForm = new CForm(null, 'get'); $cmbConf = new CComboBox('config', 'usergrps.php'); $cmbConf->setAttribute('onchange', 'javascript: redirect(this.options[this.selectedIndex].value);'); $cmbConf->addItem('usergrps.php', S_USER_GROUPS); $cmbConf->addItem('users.php', S_USERS); $frmForm->addItem(array($cmbConf, SPACE, new CButton('form', S_CREATE_GROUP))); $usrgroup_wdgt = new CWidget(); $usrgroup_wdgt->addPageHeader(S_CONFIGURATION_OF_USERS_AND_USER_GROUPS, $frmForm); if (isset($_REQUEST['form'])) { $usrgroup_wdgt->addItem(insert_usergroups_form()); } else { $numrows = new CDiv(); $numrows->setAttribute('name', 'numrows'); $usrgroup_wdgt->addHeader(S_USER_GROUPS_BIG); $usrgroup_wdgt->addHeader($numrows); // Groups table $form = new CForm(); $form->setName('usrgrp_form'); $table = new CTableInfo(S_NO_USER_GROUPS_DEFINED); $table->setHeader(array(new CCheckBox('all_groups', NULL, "checkAll('" . $form->GetName() . "','all_groups','group_groupid');"), make_sorting_header(S_NAME, 'name'), '#', S_MEMBERS, S_USERS_STATUS, S_GUI_ACCESS, S_API_ACCESS, S_DEBUG_MODE)); $sortfield = getPageSortField('name'); $sortorder = getPageSortOrder(); $options = array('output' => API_OUTPUT_EXTEND, 'select_users' => API_OUTPUT_EXTEND, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1); $usrgrps = CUserGroup::get($options); // sorting