$edit = new Form('users_form', false, false, false, $_REQUEST['table']); $edit->get($_REQUEST['id']); if ($_REQUEST['table'] == 'admin_groups') { $edit->textInput('name', 'Name'); if ($_REQUEST['id']) { $edit->permissionEditor('admin', $_REQUEST['id']); } } else { $edit->passiveField('id', 'ID'); $edit->textInput('user', $CFG->user_username, true, false, false, false, false, false, false, false, 1, $CFG->user_unique_error); $edit->passwordInput('pass', $CFG->user_password, true); $edit->passwordInput('pass1', $CFG->user_password, true, false, false, false, false, false, 'pass'); $edit->textInput('first_name', $CFG->user_first_name, true); $edit->textInput('last_name', $CFG->user_last_name, true); $edit->textInput('phone', $CFG->user_phone); $edit->textInput('country_code', 'Country Code'); $edit->textInput('email', $CFG->user_email); $edit->selectInput('f_id', $CFG->user_group, false, $_REQUEST['f_id'], false, 'admin_groups', array('name')); $edit->checkBox('is_admin', $CFG->user_is_admin); $edit->checkBox('verified_authy', 'Use Authy?'); } $edit->submitButton('submit', $CFG->save_caption); //$edit->button(false,$CFG->cancel_button,false,false,false,false,'onclick="$(\'#edit_box\').fadeOut(\'slow\');"'); $edit->cancelButton($CFG->cancel_button); $edit->display(); } else { $users = new MultiList(false, true, $CFG->path_users); $users->addTable('admin_groups', array('name'), $CFG->url, false, false, 'edit_box'); $users->addTable('admin_users', array('id', 'first_name', 'last_name', 'company'), $CFG->url, 'admin_groups', false, 'edit_box'); $users->display(); }
$sql = "ALTER TABLE admin_tabs ADD admin_tabs.is_ctrl_panel ENUM( 'Y', 'N' ) NOT NULL"; db_query($sql); } if (!in_array('for_group', $table_fields)) { $sql = "ALTER TABLE admin_tabs ADD admin_tabs.for_group INT( 10 ) UNSIGNED NOT NULL"; db_query($sql); } } $record = new Record($_REQUEST['table'], $_REQUEST['id']); $record->field('name', 'Name:'); $record->field('url', 'Url'); $record->field('order', 'Order'); if ($_REQUEST['table'] == 'admin_tabs') { $record->field('hidden', 'Hidden?'); $record->field('is_ctrl_panel', 'Is Control Panel?'); $record->field('for_group', 'For Group', 'admin_groups', array('name')); } elseif ($_REQUEST['table'] == 'admin_pages') { if (in_array('icon', $table_fields)) { $record->field('icon', 'Icon'); } } $record->display(); $form = new Form('dummy'); $form->button(false, $CFG->ok_button, false, false, false, false, 'onclick="closePopup(this);"'); $form->display(); } else { $list = new MultiList(false, true, 'Backstage'); $list->addTable('admin_tabs', array('name'), 'edit_tabs', false, false, 'edit_box'); $list->addTable('admin_pages', array('name'), 'edit_tabs', 'admin_tabs', false, 'edit_box', true); $list->display(); }
private function displayItems($tables, $rows = false, $f_id = 0, $level = 1, $p_id = 0) { global $CFG; $pm_method = $CFG->pm_editor ? ' class="pm_method"' : ''; if ($tables) { $parent_id = $rows ? $p_id : $f_id; $this->levels[$level][$parent_id] = $parent_id; $HTML = ''; foreach ($tables as $name => $properties) { $HTML .= "<ul id=\"mlist_{$this->i}_level_{$level}_{$parent_id}\" class=\"mlist_{$this->i}_level_{$level}\">"; $properties['url'] = empty($properties['url']) ? $CFG->url : $properties['url']; $properties['url_is_tab'] = empty($properties['url_is_tab']) ? $CFG->is_tab : $properties['url_is_tab']; if (!empty($properties['parent']) && $f_id == 0) { continue; } $HTML .= "<input id=\"table\" type=\"hidden\" name=\"table\" value=\"{$name}\" />"; $HTML .= "<input id=\"enabled\" type=\"hidden\" name=\"enabled\" value=\"{$this->dragdrop}\" />"; $HTML .= "<input id=\"p_id\" type=\"hidden\" name=\"p_id\" value=\"{$p_id}\" />"; $HTML .= "<input id=\"f_id\" type=\"hidden\" name=\"f_id\" value=\"{$f_id}\" />"; if ($CFG->pm_editor) { $HTML .= Form::peLabel($properties['method_id'], 'addTable'); } $table = $rows ? $rows : DB::getCats($name, $f_id); if ($table) { foreach ($table as $id => $row) { $hidden = $row['row']['hidden'] == 'Y' ? 'hidden' : ''; $HTML .= "<li id=\"{$row['row']['id']}\" class=\"li_{$level} ml_li {$hidden}\">"; $HTML .= !empty($row['children']) ? '<div onclick="ml_expand(this)" class="more"></div><div onclick="ml_collapse(this)" class="less"></div>' : ''; $HTML .= "<div class=\"ml_item\">"; if ($CFG->url == 'edit_tabs' && !empty($row['row']['url'])) { $is_tab = $name == 'admin_tabs' ? '1' : '0'; if (User::permission(0, 0, $properties['url'], false, $properties['url_is_tab']) > 1) { $HTML .= '<a class="edit_page" href="index.php?current_url=edit_page&table=' . $name . '&id=' . $row['row']['id'] . '&is_tab=' . $is_tab . '"></a>'; } } if (is_array($properties['table_fields'])) { foreach ($properties['table_fields'] as $field) { $value = Grid::detectData($field, $row['row'][$field], $this->fields[$name]); $HTML .= !empty($properties['url']) ? Link::url($properties['url'], $row['row'][$field], "table={$name}&id={$row['row']['id']}&f_id={$row['row']['f_id']}&p_id={$row['row']['p_id']}&action=record&is_tab=" . $properties['url_is_tab'], false, false, $properties['target_elem_id']) : $value; } $del_function = $CFG->url == 'edit_tabs' ? 'deletePage(this)' : 'ml_delete(this)'; if (User::permission(0, 0, $properties['url'], false, $properties['url_is_tab']) > 1) { $HTML .= Link::url($properties['url'], false, "table={$name}&id={$row['row']['id']}&f_id={$row['row']['f_id']}&p_id={$row['row']['p_id']}&action=record&is_tab=" . $properties['url_is_tab'], false, false, $properties['target_elem_id'], 'view', false, false, false, false, $CFG->view_hover_caption) . Link::url($properties['url'], false, "table={$name}&id={$row['row']['id']}&f_id={$row['row']['f_id']}&p_id={$row['row']['p_id']}&action=form&is_tab=" . $properties['url_is_tab'], false, false, $properties['target_elem_id'], 'edit', false, false, false, false, $CFG->edit_hover_caption) . "<a href=\"#\" class=\"delete\" title=\"{$CFG->delete_hover_caption}\" onclick=\"{$del_function}\" class=\"button\"></a>"; } } else { foreach ($row['row'] as $field) { $HTML .= '<span>' . $field . '</span>'; } } $HTML .= $this->row_end_button ? $this->row_end_button : ''; if (User::permission(0, 0, $properties['url'], false, $properties['url_is_tab']) > 1 && $accepts_children) { $HTML .= $properties['accept_children'] ? Link::url($properties['url'], '<div class="add_new"></div>' . $CFG->add_new_caption, "table={$name}&f_id={$f_id}&p_id={$p_id}&action=form&is_tab=" . $properties['url_is_tab'], false, false, $properties['target_elem_id']) : ''; } $HTML .= '</div>'; if (!empty($row['children'])) { $HTML .= MultiList::displayItems(array($name => $properties), $row['children'], false, $level + 1, $id); } foreach ($this->tables as $name1 => $properties1) { if ($properties1['parent'] == $name) { $HTML .= MultiList::displayItems(array($name1 => $properties1), false, $id, $level + 1); } } $HTML .= '</li>'; } } $HTML .= '</ul>'; $HTML .= "<div class=\"add_elem\">" . Link::url($properties['url'], '<div class="add_new"></div>' . $CFG->add_new_caption, "table={$name}&f_id={$f_id}&p_id={$p_id}&action=form&is_tab=" . $CFG->is_tab, false, false, $properties['target_elem_id']) . "</div>"; } return $HTML; } }