include_once 'includes/edit_tabs.php'; } elseif ($CFG->url == 'edit_page') { include_once 'includes/edit_page.php'; } elseif ($CFG->url == 'users') { include_once 'includes/users.php'; } elseif ($CFG->url == 'settings') { include_once 'includes/settings.php'; } elseif ($CFG->url == 'my-account') { include_once 'includes/account.php'; } else { $form_name = ereg_replace("[^a-zA-Z_\\-]", "", $_REQUEST['form_name']); if (!empty($form_name) && $form_name != 'form_filters' && $form_name != 'loginform' && !$_REQUEST['return_to_self']) { $form = new Form($form_name); $form->verify(); $form->save(); $form->show_errors(); $form->show_messages(); } $control = new Control($CFG->url, $CFG->action, $CFG->is_tab); } if ($CFG->print) { echo '</div>'; } echo ' <div class="clear"> </div> <input type="hidden" id="page_url" value="' . $CFG->editor_page_id . '" /> <input type="hidden" id="page_is_tab" value="' . $CFG->editor_is_tab . '" /> <input type="hidden" id="page_action" value="' . $CFG->action . '" /> <script type="text/javascript">footerToBottom(\'credits\');scaleBackstage();</script>'; if (!$CFG->bypass || $CFG->url != 'edit_page') { echo '</div>';
$download->show_errors(); $download->show_messages(); $download->selectInput('currency', 'Currency', 1, false, false, 'currencies', array('currency')); $download->submitButton('Download', 'Download Withdrawals CSV'); $download->display(); $CFG->form_legend = 'Account For Widtdrawals From Escrows'; $withdraw = new Form('withdraw', false, false, 'form1'); $withdraw->verify(); if ($_REQUEST['withdraw'] && !is_array($withdraw->errors)) { if ($withdraw->info['currency'] > 0 && $withdraw->info['amount'] > 0) { db_start_transaction(); $currency_info = DB::getRecord('currencies', $withdraw->info['currency'], 0, 1, false, false, false, 1); if (!$currency_info) { $withdraw->errors[] = 'Invalid currency.'; } elseif (!($currency_info[strtolower($currency_info['currency']) . '_escrow'] - $withdraw->info['amount'] > 0)) { $withdraw->errors[] = 'Balance too low to satisfy withdrawal.'; } else { $status = DB::getRecord('status', 1, 0, 1, false, false, false, 1); $sql = 'UPDATE status SET ' . strtolower($currency_info['currency']) . '_escrow = ' . strtolower($currency_info['currency']) . '_escrow - ' . $withdraw->info['amount'] . ' WHERE id = 1'; db_query($sql); $withdraw->messages[] = $withdraw->info['amount'] . ' subtracted from ' . $currency_info['currency']; } db_commit(); } } $withdraw->show_errors(); $withdraw->show_messages(); $withdraw->selectInput('currency', 'Currency', 1, false, false, 'currencies', array('currency')); $withdraw->textInput('amount', 'Amount', 1); $withdraw->submitButton('Withdraw', 'Withdraw'); $withdraw->display();
function display($use_fckeditor = false, $require_email = false, $ask_website = false, $editor_height = false) { global $CFG; if ($CFG->backstage_mode && !($this->record_id > 0) && !$this->show_all) { return false; } $use_fckeditor = $this->use_fckeditor ? $this->use_fckeditor : $use_fckeditor; $require_email = $this->require_email ? $this->require_email : $require_email; $ask_website = $this->ask_website ? $this->ask_website : $ask_website; $editor_height = $this->editor_height ? $this->editor_height : $editor_height; if ($_REQUEST['comments_' . $this->i] && !$this->comments_closed) { if (!empty($_REQUEST['comments_' . $this->i]['comments1'])) { $_REQUEST['comments_' . $this->i]['comments'] = $_REQUEST['comments_' . $this->i]['comments1']; unset($_REQUEST['comments_' . $this->i]['comments1']); } $CFG->save_called = false; $form = new Form('comments_' . $this->i, false, false, $this->class . '_form', 'comments'); $form->verify(); if (!$form->errors) { $form->save(); Messages::add($CFG->comments_sent_message); Messages::display(); } else { $form->show_errors(); } } $comments = Comments::get(); $c = count(Comments::get(false, true)); $show = $this->autoshow ? '' : 'style="display:none;"'; if ($this->label) { if ($CFG->pm_editor) { $method_name = Form::peLabel($this->label['method_id'], 'label'); } echo '<div class="grid_label"><div class="label">' . $this->label['text'] . ' ' . $method_name . '</div><div class="clear"></div></div>'; } if (!$this->short_version) { if ($comments) { echo '<div class="expand">' . str_ireplace('[field]', $c, $CFG->comments_there_are) . ' ' . (!$_REQUEST['comments_' . $this->i] ? '<a href="#" onclick="showComments(' . $this->i . ',this);return false;">' . $CFG->comments_expand . '</a>' : '') . '<a style="display:none;" href="#" onclick="hideComments(' . $this->i . ',this);return false;">' . $CFG->comments_hide . '</a></div>'; } else { echo '<div class="expand">' . $CFG->comments_none . ' <a href="#" onclick="showComments(' . $this->i . ',this);return false;">' . $CFG->comments_be_first . '</a><a style="display:none;" href="#" onclick="hideComments(' . $this->i . ',this);return false;">' . $CFG->comments_hide . '</a></div>'; } } echo ' <div id="comments_' . $this->i . '" class="' . $this->class . '" ' . (!$_REQUEST['comments_' . $this->i] ? $show : '') . '>'; if ($comments) { Comments::show($comments); } echo ' <div id="movable_form" style="display:none;">'; if (!$this->comments_closed) { Comments::showForm($use_fckeditor, $require_email, $ask_website, 1, $editor_height); } echo ' </div>'; if (!$this->comments_closed) { Comments::showForm($use_fckeditor, $require_email, $ask_website, 0, $editor_height); } echo ' <div style="clear:both;height:0;"></div> </div>'; }
function show_filters() { global $CFG; if ($this->inset_id > 0 || $CFG->is_form_inset) { return false; } if (is_array($this->filters) || $this->mode == 'graph' || $this->mode == 'graph_line' || $this->mode == 'graph_pie') { $form_filters = new Form('form_filters' . $this->i, false, 'GET', 'form_filters', false); $form_filters->show_errors(); $filter_results = $this->filter_results ? $this->filter_results : array(); $form_filters_info = $form_filters->info ? $form_filters->info : array(); $form_filters->info = array_merge($filter_results, $form_filters_info); if (is_array($this->filters)) { foreach ($this->filters as $filter) { $name = $filter['field_name']; $caption = !empty($filter['caption']) ? $caption : $name; $value = $this->filter_results[$name] ? $this->filter_results[$name] : $filter['value']; if ($filter['type'] != 'radio' && $filter['type'] != 'start_date' && $filter['type'] != 'end_date' && $group) { $form_filters->endGroup(); $group = false; } switch ($filter['type']) { case 'per_page': $options_array = is_array($filter['options_array']) ? $filter['options_array'] : array(10 => 10, 30 => 30, 50 => 50); $caption = !empty($filter['caption']) ? $filter['caption'] : $CFG->results_per_page_text; $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterPerPage'; $form_filters->selectInput('per_page', $caption, false, $this->rows_per_page, $options_array, false, false, false, false, $filter['class']); break; case 'search': $search_i = $search_i > 0 ? $search_i + 1 : 1; $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterSearch'; $form_filters->textInput('search' . '|' . $search_i, $filter['caption'], false, $value, false, false, $filter['class']); foreach ($filter['subtable_fields'] as $s_field => $s_subtable) { $s_subtable = $s_subtable && $s_subtable != $s_field ? $s_subtable : $this->table; $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="search_fields' . $this->i . '[' . $s_field . '|' . $search_i . ']" value="' . $s_subtable . '" />'); $CFG->o_method_suppress = false; } break; case 'autocomplete': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterAutocomplete'; $form_filters->autoComplete($name, $filter['caption'], false, $value, false, $filter['options_array'], $filter['subtable'], $filter['subtable_fields'], false, false, $filter['class']); break; case 'tokenizer': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterTokenizer'; $form_filters->autoComplete($name, $filter['caption'], false, $value, false, $filter['options_array'], $filter['subtable'], $filter['subtable_fields'], false, false, $filter['class'], false, false, false, false, false, false, false, false, false, false, false, 1); break; case 'cats': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterCats'; //$form_filters->fauxSelect('catsel',$filter['caption'],0,false,false,false,$filter['subtable'],$filter['subtable_fields'],false,$filter['class'],false,false,false,false,false,false,false,false,false,false,false,$filter['concat_char'],1); $form_filters->catSelect($filter['subtable'], $filter['caption'], 0, $filter['class'], false, false, false, $filter['subtable_fields'], $filter['concat_char'], false, false, 1); break; case 'first_letter': $range = range('A', 'Z'); $HTML = ''; foreach ($range as $l) { $HTML .= Link::url($this->link_url, $l, 'fl' . $this->i . '=' . $l . '&fl_field' . $this->i . '=' . $name . '&fl_subtable' . $this->i . '=' . $filter['subtable'] . '&is_tab=' . $this->is_tab, false, false, 'content'); } $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterFirstLetter'; $form_filters->HTML($HTML); break; case 'select': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterSelect'; $form_filters->selectInput($name, $filter['caption'], false, $value, $filter['options_array'], $filter['use_enum_values'] && !$filter['subtable'] ? $this->table : $filter['subtable'], $filter['subtable_fields'], $filter['f_id'], false, $filter['class'], false, false, $filter['f_id_field'], false, $filter['depends_on'], false, false, false, false, false, $filter['level'], $filter['use_enum_values']); break; case 'checkbox': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterCheckbox'; $form_filters->checkBox($name, $filter['caption'], false, false, $filter['class'], false, false, $value); break; case 'radio': if (!$group) { $CFG->o_method_suppress = true; $form_filters->startGroup(); } $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterRadio'; $form_filters->radioInput($name, $filter['caption'], false, $value, false, $filter['class'], false, false, $filter['checked']); if (!$group) { $group = true; } else { $CFG->o_method_suppress = true; $form_filters->endGroup(); $group = false; } break; case 'start_date': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterDateStart'; $form_filters->dateWidget($name, $filter['caption'], false, $filter['time'], $filter['ampm'], $filter['req_start'], $filter['req_end'], $value, false, false, $filter['class'], $filter['format']); $form_filters->dateWidget($name, $CFG->grid_until_label, false, $filter['time'], $filter['ampm'], $filter['req_start'], $filter['req_end'], $value, $filter['link_to'], false, $filter['class'], $filter['format'], false, false, true); break; case 'month': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterMonth'; $form_filters->selectInput($name . '_month', $filter['caption'], false, $value, String::getMonthNames($filter['language'])); $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="month_fields[]" value="' . $name . '_month" />'); break; case 'year': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterYear'; $back_to = $filter['back_to'] ? $filter['back_to'] : 1975; $years = range(date('Y'), $back_to); $years = array_combine($years, $years); $form_filters->selectInput($name . '_year', $filter['caption'], false, $value, $years); $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="year_fields[]" value="' . $name . '_year" />'); break; } } } if ($this->mode == 'graph' || $this->mode == 'graph_line' || $this->mode == 'graph_pie') { $CFG->o_method_suppress = true; $form_filters->selectInput('graph_value_column', $CFG->value_column_label, false, false, $this->value_columns); $CFG->o_method_suppress = true; $form_filters->selectInput('graph_name_column', $CFG->name_column_label, false, false, $this->name_columns); if ($this->mode != 'graph_pie') { $CFG->o_method_suppress = true; $form_filters->selectInput('graph_x_axis', $CFG->x_axis, false, false, $this->x_columns); $CFG->o_method_suppress = true; $form_filters->checkBox('graph_combine', $CFG->combine_label, false); } } if ($group) { $form_filters->endGroup(); } $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="mode" value="' . $this->mode . '" />'); $CFG->o_method_suppress = true; $form_filters->HTML('<div class="clear"></div>'); $CFG->o_method_suppress = true; $form_filters->submitButton('submit', $CFG->filter_submit_text, false, 'not_method'); $CFG->o_method_suppress = true; $form_filters->resetButton($CFG->grid_default_reset, false, 'not_method'); echo ' <div class="grid_filters area"> <div class="box_tl"></div> <div class="box_tr"></div> <div class="box_bl"></div> <div class="box_br"></div> <div class="t_shadow"></div> <div class="r_shadow"></div> <div class="b_shadow"></div> <div class="l_shadow"></div> <div class="box_b"></div> <div class="box_t"></div> <div class="contain">'; $form_filters->display(); echo '</div></div>'; } }
$sql = "UPDATE {$f_table} SET {$f_table}.order = ({$f_table}.order + 1) WHERE {$f_table}.order >= {$form->info['order']} AND {$l_field} = {$l_id}"; db_query($sql); } else { unset($form->info['order']); } $form->verify(); $form->save(); $form->show_errors(); $form->show_messages(); if ($f_table == 'admin_controls' && !$form->errors) { $CFG->save_called = false; if ($form->info['class'] == 'Excel') { $form1 = new Form($f_name, false, false, false, $f_table); $form1->info['action'] = 'form'; $form1->save(); $form1->show_errors(); $form1->show_messages(); } elseif ($form->info['class'] == 'Form') { } } if ($f_table = 'admin_controls_methods' && ($form->info['method'] == 'emailNotify' || $form->info['method'] == 'createRecord' || $form->info['method'] == 'editRecord')) { if ($form->info['argument_day'] || $form->info['argument_month'] || $form->info['argument_year'] || $form->info['argument_run_in_cron']) { $sql = "SELECT id FROM admin_cron WHERE control_id = " . $form->info['control_id'] . " AND method_id = " . $form->record_id; $result = db_query_array($sql); if (!$result) { DB::insert('admin_cron', array('control_id' => $form->info['control_id'], 'method_id' => $form->record_id, 'day' => $form->info['argument_day'], 'month' => $form->info['argument_month'], 'year' => $form->info['argument_year'], 'send_condition' => $form->info['argument_send_condition'])); } else { DB::update('admin_cron', array('day' => $form->info['argument_day'], 'month' => $form->info['argument_month'], 'year' => $form->info['argument_year'], 'send_condition' => $form->info['argument_send_condition']), $result[0]['id']); } } }
if (!$show_form) { $disable->verify(); $disable->show_errors(); $disable->HTML('<img class="qrcode" src="includes/qrcode.php?sec=1&code=otpauth://totp/Backstage2?secret=' . $key . '" />'); $disable->textInput('token', 'Enter token', true); $disable->submitButton('submit', 'Disable 2FA'); $disable->display(); } } } if ($show_form) { Messages::display(); $CFG->form_legend = 'My User Info.'; $edit = new Form('users_form', false, false, false, 'admin_users', true); $edit->verify(); $edit->show_errors(); $edit->save(); $edit->get(User::$info['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('email', $CFG->user_email); $edit->submitButton('submit', $CFG->save_caption); $edit->cancelButton($CFG->cancel_button); if ($edit->info['verified_authy'] == 'Y') { $edit->button('my-account', 'Disable Google 2FA', array('action' => 'disable')); } else { $edit->button('my-account', 'Enable Google 2FA', array('action' => 'enable'));
$cancelled++; } } db_commit(); fclose($handle); if ($transactions > 0) { $upload->messages[] = $transactions . ' new transactions were credited.'; } if ($cancelled > 0) { $upload->errors[] = $cancelled . ' transactions could not be credited because of an information mismatch.'; } } unlink($CFG->dirroot . $CFG->temp_file_location . $CFG->temp_files[$key]); unset($CFG->temp_files); } $upload->show_errors(); $upload->show_messages(); $upload->fileInput('deposits', 'Deposits Export File', 1, array('csv'), false, false, false, 1, false, false, false, false, false, 1); $upload->submitButton('Upload', 'Upload'); $upload->display(); /* $CFG->form_legend = 'Export Fiat Withdrawals'; $download = new Form('withadrawals',false,false,'form1'); $download->verify(); if ($_REQUEST['withadrawals'] && !is_array($download->errors)) { if ($download->info['currency'] > 0) { $currency_info = DB::getRecord('currencies',$download->info['currency'],0,1,false,false,false,1); if (!$currency_info) { $download->errors[] = 'Invalid currency.'; } else {
$errors[$file_name] = $CFG->file_save_error; } } } } } $skins_raw = scandir('css'); if (is_array($skins_raw)) { foreach ($skins_raw as $skin) { $skins[$skin] = $skin; } } $settings = new Form('new_settings', false, false, false, 'settings', true); $settings->record_id = 1; $settings->info = Settings::getStructured(); $settings->show_errors(); $settings->show_messages(); $settings->startFieldset('Appearance'); $settings->fileInput('logo', 'Logo', false, false, false, false, array('logo' => array('width' => 190, 'height' => 55)), 1, false, false, false, false, 1, 1); $settings->autoComplete('skin', 'Skin', false, false, false, $skins); $settings->endFieldset(); $settings->startFieldset('URL Rewriting'); $settings->checkBox('url_rewrite', 'Url Rewrite'); $settings->endFieldset(); $settings->startFieldset('Locale'); $settings->textInput('locale', 'Locale'); $settings->endFieldset(); $settings->startFieldset('Form Behavior'); $settings->textInput('pass_regex', 'Pass Regex'); $settings->textInput('verify_default_error', 'Default Verify Error'); $settings->textInput('verify_email_error', 'Email Error');
function show_filters() { global $CFG; if ($this->inset_id > 0) { return false; } if (is_array($this->filters)) { $form_filters = new Form('form_filters', false, 'GET', 'form_filters', false); $form_filters->show_errors(); $form_filters->info = $form_filters->info ? $form_filters->info : $this->filter_results; foreach ($this->filters as $filter) { $name = $filter['field_name']; $caption = !empty($filter['caption']) ? $caption : $name; if ($filter['type'] != 'radio' && $filter['type'] != 'start_date' && $filter['type'] != 'end_date' && $group) { $form_filters->endGroup(); $group = false; } switch ($filter['type']) { case 'per_page': $options_array = is_array($filter['options_array']) ? $filter['options_array'] : array(10 => 10, 30 => 30, 50 => 50); $caption = !empty($filter['caption']) ? $filter['caption'] : $CFG->results_per_page_text; $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterPerPage'; $form_filters->selectInput('per_page', $caption, false, $this->rows_per_page, $options_array, false, false, false, false, $filter['class']); break; case 'search': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterSearch'; $form_filters->textInput('search', $filter['caption'], false, false, false, false, $filter['class']); foreach ($filter['subtable_fields'] as $s_field => $s_subtable) { $s_subtable = $s_subtable && $s_subtable != $s_field ? $s_subtable : $this->table; $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="search_fields[' . $s_field . ']" value="' . $s_subtable . '" />'); } break; case 'autocomplete': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterAutocomplete'; $form_filters->autoComplete($name, $filter['caption'], false, $filter['value'], false, $filter['options_array'], $filter['subtable'], $filter['subtable_fields'], false, false, $filter['class']); $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="subtables[' . $name . '][subtable]" value="' . $filter['subtable'] . '" />'); $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="subtables[' . $name . '][subtable_fields]" value="' . implode('|', $filter['subtable_fields']) . '" />'); $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="subtables[' . $name . '][f_id_field]" value="' . $filter['f_id_field'] . '" />'); break; case 'tokenizer': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterTokenizer'; $form_filters->autoComplete($name, $filter['caption'], false, $filter['value'], false, $filter['options_array'], $filter['subtable'], $filter['subtable_fields'], false, false, $filter['class'], false, false, false, false, false, false, false, false, false, false, false, 1); break; case 'cats': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterCats'; $form_filters->catSelect($filter['subtable'], $filter['caption'], 0, $filter['class'], false, false, false, $filter['subtable_fields'], $filter['concat_char']); break; case 'first_letter': $range = range('A', 'Z'); $HTML = ''; foreach ($range as $l) { $HTML .= Link::url($this->link_url, $l, 'fl=' . $l . '&fl_field=' . $name . '&fl_subtable=' . $filter['subtable'] . '&is_tab=' . $this->is_tab, false, false, 'content'); } $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterFirstLetter'; $form_filters->HTML($HTML); break; case 'select': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterSelect'; $form_filters->selectInput($name, $filter['caption'], false, false, $filter['options_array'], $filter['subtable'], $filter['subtable_fields'], false, false, $filter['class'], false, false, $filter['f_id_field'], false, $filter['depends_on']); $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="subtables[' . $name . '][subtable]" value="' . $filter['subtable'] . '" />'); $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="subtables[' . $name . '][subtable_fields]" value="' . implode('|', $filter['subtable_fields']) . '" />'); $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="subtables[' . $name . '][f_id_field]" value="' . $filter['f_id_field'] . '" />'); break; case 'checkbox': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterCheckbox'; $form_filters->checkBox($name, $filter['caption'], false, false, $filter['class'], false, false, $filter['checked']); break; case 'radio': if (!$group) { $CFG->o_method_suppress = true; $form_filters->startGroup(); } $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterRadio'; $form_filters->radioInput($name, $filter['caption'], false, $filter['value'], false, $filter['class'], false, false, $filter['checked']); if (!$group) { $group = true; } else { $CFG->o_method_suppress = true; $form_filters->endGroup(); $group = false; } break; case 'start_date': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterDateStart'; $form_filters->dateWidget($name, $filter['caption'], false, $filter['time'], $filter['ampm'], $filter['req_start'], $filter['req_end'], $filter['value'], false, false, $filter['class'], $filter['format']); break; case 'end_date': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterDateEnd'; $form_filters->dateWidget($name, $filter['caption'], false, $filter['time'], $filter['ampm'], $filter['req_start'], $filter['req_end'], $filter['value'], $filter['link_to'], false, $filter['class'], $filter['format'], false, false, true); break; case 'month': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterMonth'; $form_filters->selectInput($name . '_month', $filter['caption'], false, false, String::getMonthNames($filter['language'])); $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="month_fields[]" value="' . $name . '_month" />'); break; case 'year': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterYear'; $back_to = $filter['back_to'] ? $filter['back_to'] : 1975; $years = range(date('Y'), $back_to); $years = array_combine($years, $years); $form_filters->selectInput($name . '_year', $filter['caption'], false, false, $years); $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="year_fields[]" value="' . $name . '_year" />'); break; } } if ($group) { $form_filters->endGroup(); } $CFG->o_method_suppress = true; $form_filters->HTML('<input type="hidden" name="mode" value="' . $this->mode . '" />'); $CFG->o_method_suppress = true; $form_filters->submitButton('submit', $CFG->filter_submit_text, false, 'not_method'); $CFG->o_method_suppress = true; $form_filters->resetButton('Reset', false, 'not_method'); $form_filters->display(); } }
function show_filters() { global $CFG; if ($this->inset_id > 0) { return false; } if (is_array($this->filters)) { $form_filters = new Form('form_filters', false, 'GET', 'form_filters cal', false); $form_filters->show_errors(); foreach ($this->filters as $filter) { $name = $filter['field_name']; $caption = !empty($filter['caption']) ? $caption : $name; if ($filter['type'] != 'radio' && $filter['type'] != 'start_date' && $filter['type'] != 'end_date' && $group) { $form_filters->endGroup(); $group = false; } switch ($filter['type']) { case 'autocomplete': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterAutocomplete'; $form_filters->autoComplete($name, $filter['caption'], false, $filter['value'], false, $filter['options_array'], $filter['subtable'], $filter['subtable_fields'], false, false, $filter['class']); break; case 'tokenizer': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterTokenizer'; $row = DB::getRecord($filter['subtable'], $this->record_id, 0, 1); if (is_array($filter['subtable_fields'])) { foreach ($filter['subtable_fields'] as $field) { $row1[] = $row[$field]; } $show = implode(' ', $row1); } else { $show = implode(' ', $row); } $filter['value'] = !empty($filter['value']) && $this->mode == 'day' ? $filter['value'] : array($this->record_id => $show); $form_filters->autoComplete($name, $filter['caption'], false, $filter['value'], false, $filter['options_array'], $filter['subtable'], $filter['subtable_fields'], false, false, $filter['class'], false, false, false, false, false, false, false, false, false, false, false, 1); break; case 'select': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterSelect'; $form_filters->selectInput($name, $filter['caption'], false, false, $filter['options_array'], $filter['subtable'], $filter['subtable_fields'], false, false, $filter['class'], false, false, $filter['f_id_field'], false, $filter['depends_on']); break; case 'checkbox': $CFG->o_method_id = $filter['method_id']; $CFG->o_method_name = 'filterCheckbox'; $form_filters->checkBox($name, $filter['caption'], false, false, $filter['class'], false, false, $filter['checked']); break; } } if ($group) { $form_filters->endGroup(); } $CFG->o_method_suppress = true; $form_filters->HTML(' <input type="hidden" id="cal_mode" name="mode" value="' . $this->mode . '" /> <input type="hidden" id="cal_y" name="' . 'cal_' . $this->i . '_y' . '" value="' . $this->y . '" /> <input type="hidden" id="cal_m" name="' . 'cal_' . $this->i . '_m' . '" value="' . $this->m . '" /> <input type="hidden" id="cal_d" name="' . 'cal_' . $this->i . '_d' . '" value="' . $this->d . '" /> '); $CFG->o_method_suppress = true; $form_filters->submitButton('submit', $CFG->filter_submit_text, false, 'not_method'); $CFG->o_method_suppress = true; $form_filters->resetButton('Reset', false, 'not_method'); $form_filters->display(); } }