function operation($id, $operation, $returl) { global $_CAMILA; if ($operation == 'delete') { require_once CAMILA_DIR . 'datagrid/form.class.php'; require_once CAMILA_DIR . 'datagrid/elements/form/hidden.php'; $form3 = new phpform('camila', 'cf_worktable_admin.php'); $form3->submitbutton = camila_get_translation('camila.worktable.delete'); $form3->drawrules = false; new form_hidden($form3, 'custom', $id); new form_hidden($form3, 'worktable_op', $operation); if ($returl != '') { new form_hidden($form3, 'returl', $returl); } if ($form3->process()) { $result = $_CAMILA['db']->Execute('select tablename,scriptname from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id)); if ($result === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg()); } $table = $result->fields['tablename']; $script = $result->fields['scriptname']; $result = $_CAMILA['db']->Execute('delete from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id)); if ($result === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg()); } $result = $_CAMILA['db']->Execute('delete from ' . CAMILA_TABLE_WORKC . ' where (wt_id=' . $_CAMILA['db']->qstr($id) . ' and is_deleted<>' . $_CAMILA['db']->qstr('y') . ')'); if ($result === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg()); } $stmt = sprintf($_CAMILA['db']->_dropSeqSQL, $table); $result = $_CAMILA['db']->Execute($stmt); //if ($result === false) // camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg()); $record = array(); $record['visible'] = 'no'; $record['active'] = 'no'; $updateSQL = $_CAMILA['db']->AutoExecute(CAMILA_TABLE_PAGES, $record, 'UPDATE', 'url=' . $_CAMILA['db']->qstr($script)); //if (!$updateSQL) { // camila_information_text(camila_get_translation('camila.worktable.db.error')); // $success3 = false; //} } else { camila_information_text(camila_get_translation('camila.worktable.delete.areyousure')); $result = $_CAMILA['db']->Execute('select short_title from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id)); if ($result === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg()); } $name = $result->fields['short_title']; $myText = new CHAW_text($name, HAW_TEXTFORMAT_BOLD); $myText->set_br(2); $_CAMILA['page']->add_text($myText); $form3->draw(); $success = false; } } elseif ($operation == 'rebuild') { require_once CAMILA_DIR . 'datagrid/form.class.php'; require_once CAMILA_DIR . 'datagrid/elements/form/hidden.php'; $form3 = new phpform('camila', 'cf_worktable_admin.php'); $form3->submitbutton = camila_get_translation('camila.worktable.delete'); $form3->drawrules = false; new form_hidden($form3, 'custom', $id); new form_hidden($form3, 'worktable_op', $operation); if ($returl != '') { new form_hidden($form3, 'returl', $returl); } if ($form3->process()) { $this->configure_table($id, true, $returl); } else { camila_information_text(camila_get_translation('camila.worktable.rebuild.areyousure')); $result = $_CAMILA['db']->Execute('select short_title from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id)); if ($result === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg()); } $name = $result->fields['short_title']; $myText = new CHAW_text($name, HAW_TEXTFORMAT_BOLD); $myText->set_br(2); $_CAMILA['page']->add_text($myText); $form3->draw(); $success = false; } } elseif ($operation == 'showtemplatefields') { $stmt = "select wt_id,name,name_abbrev,col_name as colname_form, col_name as colname_table from " . CAMILA_TABLE_WORKC . ' where (wt_id=' . $_CAMILA['db']->qstr($id) . ' and is_deleted<>' . $_CAMILA['db']->qstr('y') . ') order by name'; require_once CAMILA_DIR . 'datagrid/report.class.php'; $report = new report($stmt); $report->mapping = camila_get_translation('camila.worktable.mapping.worktable'); $report->process(); $report->fields['colname_form']->onprint = camila_configurator_template_fieldname_form; $report->fields['colname_form']->dummy = true; $report->fields['colname_form']->orderable = false; $report->fields['colname_table']->onprint = camila_configurator_template_fieldname_table; $report->fields['colname_table']->dummy = true; $report->fields['colname_table']->orderable = false; $report->fields['wt_id']->print = false; $report->fields['name']->orderable = false; $report->fields['name_abbrev']->orderable = false; $report->drawfilterbox = false; $report->drawnavigationbox = false; $report->draw(); } if ($success) { $myText = new CHAW_text(camila_get_translation('camila.worktable.db.importok')); $_CAMILA['page']->add_text($myText); } }
$export_deck_title->set_br(2); $export_deck_title->set_color($_CAMILA['page_title_color'], $_CAMILA['page_title_boxcolor']); $_CAMILA['page']->add_text($export_deck_title); $form = new phpform('camila'); $form->submitbutton = camila_get_translation('camila.export.xml2pdf'); $form->drawrules = false; $form->preservecontext = true; global $_CAMILA; $pos = strrpos($_CAMILA['page_url'], '?'); if ($pos !== false) { new form_hidden($form, substr($_CAMILA['page_url'], $pos + 1)); } new form_template_file_listbox($form, 'xml2pdf', camila_get_translation('camila.export.template'), CAMILA_TMPL_DIR . '/' . $_CAMILA['lang'], false, $_CAMILA['adm_usergroup'], '', true); new form_text_separator(&$form, camila_get_translation('camila.export.options')); $nodata = 'n'; new form_checklist($form, xml2pdf_checklist_options, '', array(camila_get_translation('camila.export.nodata')), array('y')); new form_text_separator(&$form, ''); $form->process(); $form->draw(); $export_format = 'camila_xml2pdf'; $url = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']; $url = ereg_replace("&" . $export_format, '', $url); $url = ereg_replace("\\?" . $export_format, '', $url); $myLink = new CHAW_link(camila_get_translation('camila.back.page'), $url); $myImage = new HAW_image(CAMILA_IMG_DIR . 'wbmp/resultset_previous.wbmp', CAMILA_IMG_DIR . 'png/resultset_previous.png', '-'); $myLink->add_image($myImage); $_CAMILA['page']->add_link($myLink); $_CAMILA['page']->use_simulator(CAMILA_CSS_DIR . 'skin0.css'); require CAMILA_DIR . 'deck_settings.php'; require CAMILA_DIR . 'footer.php'; exit;
function _newdir() { $this->_tree_checkup(); require_once CAMILA_DIR . 'datagrid/form.class.php'; require_once CAMILA_DIR . 'datagrid/elements/form/hidden.php'; require_once CAMILA_DIR . 'datagrid/elements/form/textbox.php'; require_once CAMILA_DIR . 'datagrid/elements/form/fm_dir_listbox.php'; $form = new phpform('camila'); $form->submitbutton = camila_get_translation('camila.create'); $form->drawrules = false; new form_hidden($form, 'update', 'newdir'); global $_CAMILA; $pos = strrpos($_CAMILA['page_url'], '?'); if ($pos !== false) { new form_hidden($form, substr($_CAMILA['page_url'], $pos + 1)); } new form_textbox($form, 'name', camila_get_translation('camila.fm.createdirwithname'), true, 30); new form_fm_dir_listbox($form, 'dir', camila_get_translation('camila.fm.intofolder'), $this->usergroup, true); $fp = $form->process(); if ($fp) { $this->_createdir($this->usergroup, $form->fields['dir']->value, $form->fields['name']->value); camila_information_text(camila_get_translation('camila.fm.dircreated')); } else { $form->draw(); } return $fp; }
function draw_filter() { if (!$this->drawfilterbox) { return; } global $_CAMILA; if (!$_CAMILA['page']->camila_exporting()) { require_once CAMILA_DIR . 'datagrid/form.class.php'; require_once CAMILA_DIR . 'datagrid/elements/form/hidden.php'; require_once CAMILA_DIR . 'datagrid/elements/form/static_listbox.php'; require_once CAMILA_DIR . 'datagrid/elements/form/textbox.php'; $count = 0; $options = ''; $options_array = array(); $fields_array = array(); $addfilterconds = ''; reset($this->fields); while ($fld = each($this->fields)) { if ($fld[1]->print && $fld[1]->onprint == '' && substr($fld[1]->field, 0, 10) != 'camilakey_' && substr($fld[1]->field, 0, 8) != 'cf_bool_' && substr($fld[1]->field, 0, 11) != 'cf_formula_' && substr($fld[1]->field, 0, 11) != 'cf_query_' && !($fld[1]->field == 'count(*)' && $this->gbyconditionpresent)) { $options .= '_' . $fld[1]->metatype . '_' . $fld[1]->field . ';' . $fld[1]->title . ','; $options_array[$count][0] = '_' . $fld[1]->metatype . '_' . $fld[1]->field; $options_array[$count][1] = $fld[1]->title; $fields_array['_' . $fld[1]->metatype . '_' . $fld[1]->field] = $fld[1]->title; $count++; } if (substr($fld[1]->field, 0, 8) == 'cf_bool_') { $addfilterconds .= ',' . $fld[1]->field . '_n' . ';' . '(' . camila_get_translation('camila.report.condstring.hide') . ' ' . $this->map($fld[1]->field) . ')'; $addfilterconds .= ',' . $fld[1]->field . '_y' . ';' . '(' . camila_get_translation('camila.report.condstring.show') . ' ' . $this->map($fld[1]->field) . ')'; } } $form = new phpform('camila', null, HAW_METHOD_GET); $form->submitbutton = camila_get_translation('camila.filterbutton'); $form->drawrules = false; $process = false; if ($this->filternum == 0) { $this->filternum = 1; } $hidden = split('&', substr($this->urlappend, 1)); foreach ($hidden as $k => $v) { $split = explode('=', $v); $l = substr($split[0], -1); if (!(strlen($split[0]) == 10 && substr($split[0], 0, 8) == 'camila_w' && ($l == 'f' || $l == 'v' || $l == 'c' || $l == 'w'))) { new form_hidden($form, $split[0], $split[1]); } else { if (substr($split[0], 0, 8) == 'camila_w' && $l == 'f') { $field = $split[1]; if (substr($split[1], 0, 1) == '_' && substr($split[1], 2, 1) == '_') { $field = substr($split[1], 3); } if (!in_array($field, $this->fields) && strpos($options, $field . ';') == false) { $options .= $split[1] . ';' . $this->map($field) . ','; $options_array[$count][0] = $split[1]; $options_array[$count][1] = $this->map($field); $fields_array[$split[1]] = $options_array[$count][1]; $count++; } } $process = true; } } $filterstring = ''; $condstring = camila_get_translation('camila.report.condstring') . $addfilterconds; for ($i = 1; $i <= $this->filternum; $i++) { $val = null; if ($i == $this->filternum) { $val = 'ignore'; } if ($i > 1) { new form_static_listbox($form, 'w' . $i . 'w', camila_get_translation('camila.report.filter') . ' ' . $i, 'and;' . camila_get_translation('camila.report.and') . ',or;' . camila_get_translation('camila.report.or'), false, $val); } new form_static_listbox($form, 'w' . $i . 'f', camila_get_translation('camila.report.filter') . ' ' . $i, $options_array, false, $val); new form_static_listbox($form, 'w' . $i . 'c', camila_get_translation('camila.report.filter') . ' ' . $i, $condstring, false, $val); $searchtextbox = 'w' . $i . 'v'; new form_textbox($form, $searchtextbox, camila_get_translation('camila.report.filter') . ' ' . $i, false, 50, 50, $val); if ($_CAMILA['page']->camila_worktable && count($this->tables) == 1) { $form->fields[$searchtextbox]->autosuggest_table = $this->tables[0]; $script = 'function (input) { field = document.getElementById("camila_w1f").value; field = field.substring(3); return "index.php?input="+input+"&camila_autosuggest_filterbox&table=' . $this->tables[0] . '&field="+field+"&id=id&infofields="+field+"&pickfields="+field+"&maxresults=5&"; }'; $form->fields[$searchtextbox]->autosuggest_advanced_script = $script; } if ($i > 1) { $filterstring .= ' ' . camila_get_translation('camila.report.' . $_REQUEST['camila_w' . $i . 'w']) . ' '; } if ($_REQUEST['camila_w' . $i . 'f'] != '') { if (substr($_REQUEST['camila_w' . $i . 'c'], 0, 8) != 'cf_bool_') { $filterstring .= '"' . $fields_array[$_REQUEST['camila_w' . $i . 'f']] . '" ' . $form->fields['w' . $i . 'c']->options2[$_REQUEST['camila_w' . $i . 'c']]; } else { $filterstring .= $form->fields['w' . $i . 'c']->options2[$_REQUEST['camila_w' . $i . 'c']]; } } if ($_REQUEST['camila_w' . $i . 'v'] != '' && substr($_REQUEST['camila_w' . $i . 'c'], 0, 8) != 'cf_bool_') { $filterstring .= ' "' . $_REQUEST['camila_w' . $i . 'v'] . '"'; } } if (isset($_REQUEST['camila_share_key'])) { new form_hidden($form, 'share_key', $_REQUEST['camila_share_key']); } if ($process) { $form->process(true); } $_CAMILA['page']->camila_collapsible_start('reportfilter', true, camila_get_translation('camila.report.filters')); $form->draw(); $myLink = new CHAW_link(camila_get_translation('camila.report.addfilter'), basename($_SERVER['PHP_SELF']) . $this->urlappend . '&camila_addfilter=1'); $_CAMILA['page']->add_link($myLink); if ($filterstring != '') { $text = new CHAW_text("\n" . camila_get_translation('camila.report.tablefiltereddata') . "\n" . $filterstring, HAW_TEXTFORMAT_BOLD); if ($_CAMILA['page']->camila_worktable) { $_CAMILA['page']->camila_worktable_filter = $filterstring; } $_CAMILA['page']->add_text($text); } $_CAMILA['page']->camila_collapsible_end(); $text = new CHAW_text(''); $_CAMILA['page']->add_text($text); } }
function draw() { if ($this->mapping != '') { $this->selform->mapping = $this->mappingseparator . $this->mapping . $this->mappingseparator; } if ($this->formupdatelinktext != '') { $this->selform->formupdatelinktext = $this->formupdatelinktext; } if ($this->_data_inserted == true) { if ($this->selform != 0) { $this->selform->draw(); } global $_CAMILA; $pos = strpos($_CAMILA['page_url'], '?'); if ($pos === false) { $link = basename($_SERVER['PHP_SELF']) . '?camila_update=new'; } else { $link = $_CAMILA['page_url'] . '&camila_update=new'; } if ($this->caninsert) { $myLink = new CHAW_link(camila_get_translation('camila.report.insertnew'), $link); $myLink->set_br(2); $_CAMILA['page']->add_link($myLink); } if (isset($_REQUEST['submitandnew_button_header']) && $this->caninsert) { $_CAMILA['page']->set_redirection(1, $link); } return; } if ($this->selform != 0 && !isset($_GET['camila_delete']) && !isset($_GET['camila_update']) && !isset($_POST["{$this->table}_sess_mode"])) { $this->selform->draw(); } global $_CAMILA; if ($this->selform == 0 || isset($_REQUEST['camila_delete']) || isset($_GET['camila_update']) || $_REQUEST[$this->table . '_sess_mode'] == 'update' || $_REQUEST[$this->table . '_sess_mode'] == 'insert') { if (!isset($_REQUEST['camila_popup']) && !$_CAMILA['page']->camila_exporting() && (isset($_REQUEST['camila_returl']) && $_REQUEST['camila_returl'] != '') && (!is_object($this->validator) || count($this->validator->getErrors()) == 0)) { $myLink = new CHAW_link(camila_get_translation('camila.back.table'), $_REQUEST['camila_returl']); $myLink->set_br(2); $_CAMILA['page']->add_link($myLink); } //if (!$this->_data_inserted && !$this->_data_updated) phpform::draw(); } }