$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 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); } }
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 _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; }
$export_deck_title->set_color($_CAMILA['page_title_color'], $_CAMILA['page_title_boxcolor']); $_CAMILA['page']->add_text($export_deck_title); $form = new phpform('camila_bookmark'); $form->submitbutton = camila_get_translation('camila.save'); $form->drawrules = false; $form->preservecontext = true; global $_CAMILA; new form_hidden($form, 'base_url', basename($_SERVER['PHP_SELF'])); new form_textbox($form, 'title', 'Titolo', true, 50, 50); $export_format = 'camila_bookmark'; //$url = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']; //$url = ereg_replace("&" . $export_format, '', $url); //$url = ereg_replace("\?" . $export_format, '', $url); $url = $_SERVER['PHP_SELF'] . '?filter=' . $_REQUEST['camila_bookmark']; new form_hidden($form, 'url', $url); if ($form->process()) { $record = array(); $record['id'] = $_CAMILA['db']->GenID(CAMILA_APPLICATION_PREFIX . 'bookmarkseq', 10000) . camila_hash(10); $record['lang'] = $_CAMILA['lang']; $record['url'] = $form->fields['url']->value; $record['base_url'] = $form->fields['base_url']->value; $record['title'] = $form->fields['title']->value; $insertSQL = $_CAMILA['db']->AutoExecute(CAMILA_APPLICATION_PREFIX . 'camila_bookmarks', $record, 'INSERT'); if (!$insertSQL) { camila_information_text(camila_get_translation('camila.worktable.db.error')); $success = false; } $url = $form->fields['url']->value; } else { $form->draw(); }
Camila PHP Framework is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Camila PHP Framework is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Camila PHP Framework; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ //require(CAMILA_LIB_DIR . '/axmls/adodb-xmlschema.inc.php'); require_once CAMILA_DIR . '/datagrid/form.class.php'; require_once CAMILA_DIR . '/datagrid/elements/form/static_listbox.php'; require_once CAMILA_DIR . '/datagrid/elements/form/textarea.php'; require_once CAMILA_DIR . '/datagrid/elements/form/hidden.php'; $form = new phpform('camila', basename($_SERVER['PHP_SELF']) . '?dbquery'); //new form_static_listbox($form, 'sql', 'Prefix', CAMILA_APP_DB_.','.CAMILA_DB_, true); //new form_static_listbox($form, 'file', 'Schema', $options, true); new form_textarea($form, 'custom', 'SQL Query', true, 10, 70); //new form_hidden($form, 'custom', 'sqlquery'); if ($form->process() || isset($_REQUEST['camila_custom'])) { require CAMILA_DIR . 'datagrid/report.class.php'; $report = new report($form->fields['custom']->value == '' ? $_REQUEST['camila_custom'] : $form->fields['custom']->value); $report->process(); $report->draw(); } else { $form->draw(); }
function process() { if ($this->mapping != '') { $this->selform->mapping = $this->mappingseparator . $this->mapping . $this->mappingseparator; } if ($this->selform != 0) { $selformprocessed = $this->selform->process(); } elseif (isset($_REQUEST['camila_update']) || isset($_REQUEST['camila_delete'])) { if (isset($_REQUEST['camila_update'])) { $this->keyvalue = unserialize(stripslashes($_REQUEST['camila_update'])); $check = camila_token($_REQUEST['camila_update']); } else { $this->keyvalue = unserialize(stripslashes($_REQUEST['camila_delete'])); $check = camila_token($_REQUEST['camila_delete']); } if ($check != $_REQUEST['camila_token'] && $_REQUEST['camila_update'] != 'new') { camila_error_page(camila_get_translation(camila . pageforbidden)); } } //if (!($this->selform == 0 || isset($_GET['camila_update']) )) // return false; if (!parent::process() && !$this->noproc) { // if this form didn't processed, see if select processed // first check if there is a select form $selected = false; if ($this->selform != 0) { // See if any key was selected by selform $selected = $selformprocessed; if ($selected && !$this->selform->value) { $selected = false; } if ($selected) { $this->keyvalue = $this->selform->value; } } // If there was no selform, or selform selected nothing // try to see if the user has set keyvalue // how user can set keyvalue? using $form->keyvalue = "xxx,xxx" if (!$selected && count($this->keyvalue) > 0) { $selected = true; } // Something filled keyvalue, try loading the values into phpdbform if ($selected) { if ($this->select_data()) { // found data! $this->mode = 'update'; } else { // some error occurred, clear phpdbform and set insertmode $this->clear(); $this->mode = 'insert'; } // nothing was selected, go to insertmode if (isset($_GET['camila_delete'])) { $this->mode = 'delete'; } } else { $this->mode = 'insert'; } // if there is a select form, fill it with data if ($this->selform != 0) { $this->selform->select_data(); } return; } // the form processed anything, let's work // first get key and value from session if (isset($_REQUEST[$this->table . '_sess_mode'])) { $this->mode = $_REQUEST[$this->table . '_sess_mode']; // can be a hack... if ($this->mode != 'insert' && $this->mode != 'update' && $this->mode != 'delete') { die('Invalid mode:' . $this->mode); } $temp = $_REQUEST[$this->table . '_sess_key']; //if (get_magic_quotes_gpc()) // $temp = stripslashes($temp); $this->keyvalue = unserialize($temp); } if (!$this->noproc) { // if delete button was pressed, goto deletemode if (isset($_REQUEST['camila_delete'])) { $this->mode = 'delete'; } if ($this->mode == 'update') { if ($this->selform != 0) { $this->selform->value = $this->keyvalue; } // update data if (isset($this->onupdate)) { if (call_user_func($this->onupdate, &$this)) { $this->update_data(); } } else { $this->update_data(); } $this->_data_updated = true; reset($this->fields); while ($field = each($this->fields)) { if (substr(trim($field[1]->field), 0, strlen('camilafield_')) == 'camilafield_') { $this->fields[$field[1]->field]->process(); //$req[$this->fields[$field[1]->field]->field] = $this->fields[$field[1]->field]->value; } } } elseif ($this->mode == 'insert') { // insert data if (isset($this->oninsert)) { if (call_user_func($this->oninsert, &$this)) { $this->insert_data(); $this->_data_inserted = true; } } else { $this->insert_data(); $this->_data_inserted = true; } reset($this->fields); while ($field = each($this->fields)) { if (substr(trim($field[1]->field), 0, strlen('camilafield_')) == 'camilafield_') { $this->fields[$field[1]->field]->process(); //// //$req[$this->fields[$field[1]->field]->field] = $this->fields[$field[1]->field]->value; } } // clear values $this->clear(); } elseif ($this->mode == 'delete') { if (isset($this->ondelete)) { if (call_user_func($this->ondelete, &$this)) { $this->delete_data(); } } else { $this->delete_data(); } $this->clear(); $this->keyvalue = ''; $this->mode = 'insert'; } } else { //$this->draw_errors(); if ($this->mode == 'update') { if ($this->selform != 0) { $this->selform->value = $this->keyvalue; } // update data } } // if there is a select form, fill it with data if ($this->selform != 0) { $this->selform->select_data(); } }