protected function request() { $f = new Form(); $f->start($_POST); if (isset($_REQUEST['choose'])) { $f->hidden('choose', 'yes'); } if (isset($_REQUEST['id'])) { $f->hidden('id', $_REQUEST['id']); } $f->text('name', 'Name:', 50, 'Name'); $f->button('action_find', 'Find', false); $f->button('action_new', 'New'); $f->end(); }
protected function action_choose() { $others = explode(",", $_POST['others']); $chosen_name = $this->GetNameByID($_POST['pk']); $f = new Form(); $f->start($_POST); $f->hidden('pk', $_POST['pk']); echo <<<EOT <p>Do you want this person: <p style='margin-left:20px;'>{$chosen_name} <p>to replace these checked persons? EOT; foreach ($others as $p) { $f->checkbox("replace[{$p}]", $this->GetNameByID($p)); } echo <<<EOT <p>The replaced persons will not be deleted, so you can copy<br>any required data into the person that replaces them. EOT; $f->button('action_replace', 'Replace'); echo "<button class=button type=button\n onclick='window.close();'>Cancel</button>"; $f->end(); }
protected function show_form($row) { $f = new Form(); $f->start($row); $f->hidden('member_id', $row['member_id']); $f->text('last', 'Last Name:', 30, 'Last Name'); $f->text('first', 'First:', 20, 'First Name', false); $f->text('street', 'Street:', 50, 'Street'); $f->text('city', 'City:', 20, 'City'); $f->text('state', 'State:', 10, 'State', false); $f->foreign_key('specialty_id', 'name', 'Specialty'); $f->radio('billing', 'Monthly', 'month'); $f->hspace(2); $f->radio('billing', 'Yearly', 'year', false); $f->hspace(2); $f->radio('billing', 'Recurring', 'recurring', false); $f->menu('contact', 'Contact:', array('phone', 'email', 'mail', 'none'), true, 'email'); $f->checkbox('premium', 'Premium:', false); $f->date('since', 'Member Since:', false); if ($this->ac->has_permission('member-edit')) { $f->button('action_save', 'Save'); } $f->end(); }
function show_form($data = null) { $new = is_null($data); if (empty($data['phone_method'])) { $data['phone_method'] = 'sms'; } $f = new Form(); $f->start($data); $f->errors($this->err_flds); $f->hidden('new', $new ? '1' : '0'); if ($new) { $readonly = false; $userid = ''; } else { $readonly = true; $userid = $data['userid']; } $f->text('userid', 'User ID:', 25, 'User ID', true, false, $readonly); $f->text('first', 'First Name:', 25, 'First Name'); $f->hspace(3); $f->text('last', 'Last Name:', 25, 'Last Name', false); $f->text('email', 'Email:', 75, '*****@*****.**'); $f->text('phone', 'Verification Phone:', 25, '303-555-1234'); $f->radio('phone_method', 'SMS (text)', 'sms'); $f->hspace(5); $f->radio('phone_method', 'Voice', 'voice', false); echo '<p class=label>Roles:'; if ($new && false) { $stmt = $this->db->query('select * from role order by role'); } else { $stmt = $this->db->query('select * from role left join (select * from user_role where userid = :userid) as ur using (role) order by role', array('userid' => $userid)); } for ($n = 1; $row = $stmt->fetch(); $n++) { echo '<br>'; $fld = "fld_{$n}"; $checked = isset($row['userid']) ? 'checked' : ''; echo "<input id={$fld} type=checkbox name=role[]\n value={$row['role']} {$checked}>"; $f->label($fld, $row['role'], false); } $f->button('action_save', 'Save'); $f->end(); $this->ac->show_permissions($userid); }