예제 #1
0
function camila_selectformdeletelink(&$field, &$row, $fields)
{
    $arr = array();
    foreach ($fields as $key) {
        if (substr($key->field, 0, strlen('camilakey_')) == 'camilakey_') {
            $arr[$key->field] = $key->value;
        }
    }
    if ($_SERVER['QUERY_STRING'] != '') {
        $url = basename($_SERVER['PHP_SELF']) . "?" . $_SERVER['QUERY_STRING'] . "&camila_delete=" . urlencode(serialize($arr)) . '&camila_token=' . camila_token(serialize($arr));
    } else {
        $url = basename($_SERVER['PHP_SELF']) . "?camila_delete=" . serialize($arr) . '&camila_token=' . camila_token(serialize($arr));
    }
    $myLink = new CHAW_link("ELIMINA", $url);
    $myLink->set_br(0);
    $row->add_column($myLink);
}
예제 #2
0
 function draw_header(&$row, $link)
 {
     global $_CAMILA;
     $_CAMILA['page']->header_cols_count++;
     if ($_CAMILA['page']->camila_exporting() || isset($this->onprint) || !$this->orderable) {
         if ($this->title == 'camilakey_id') {
             $text = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/wrench_orange.wbmp', CAMILA_IMG_DIR . 'png/spacer.png', 'v');
             //$text = new CHAW_text('X');
             $text->set_id('camilatablemenu');
         } elseif (substr($this->title, 0, strlen('camilakey_')) == 'camilakey_' || substr($this->title, 0, strlen('camila_')) == 'camila_') {
             $text = new CHAW_text('');
         } else {
             $text = new CHAW_text($this->title);
         }
         $text->metatype = $this->metatype;
         $text->field = $this->field;
         $row->add_column($text);
     } else {
         $myLink = new CHAW_link($this->title, $link);
         $myLink->set_br(0);
         $orderby = $this->report->orderby;
         //if (strpos($this->report->orderby, '.') !== false)
         //    $orderby = substr($this->report->orderby, 0, strpos($this->report->orderby, '.')) . '__' . substr($this->report->orderby, strpos($this->report->orderby, '.') + 1);
         $ar = array();
         $ar[0] = $myLink;
         if ($orderby == $this->field) {
             if ($_REQUEST['d'] == '1' || $this->report->direction == 'desc') {
                 $image = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/icon_sort_up.wbmp', CAMILA_IMG_DIR . 'png/icon_sort_up.png', '^');
             } else {
                 $image = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/icon_sort_down.wbmp', CAMILA_IMG_DIR . 'png/icon_sort_down.png', 'v');
             }
             $image->set_br(0);
             $ar[0] = $myLink;
             $ar[1] = $image;
         } else {
             $ar[0] = $myLink;
         }
         $row->add_column($ar);
     }
 }
예제 #3
0
 function xls_import($id, $returl = '')
 {
     global $_CAMILA;
     require_once CAMILA_DIR . 'datagrid/form.class.php';
     require_once CAMILA_DIR . 'datagrid/elements/form/hidden.php';
     require_once CAMILA_DIR . 'datagrid/elements/form/filebox.php';
     require_once CAMILA_DIR . 'datagrid/elements/form/static_listbox.php';
     //if ($returl != '')
     //    $form3 = new phpform('camilastep4', $returl);
     //else
     $form3 = new phpform('camilastep4', 'cf_worktable_wizard_step4.php');
     $form3->submitbutton = camila_get_translation('camila.wizard.next');
     $form3->drawrules = false;
     new form_hidden($form3, 'custom', $id);
     if ($returl != '') {
         new form_hidden($form3, 'returl', $_REQUEST['camila_returl']);
     }
     new form_filebox($form3, 'filename', camila_get_translation('camila.worktable.xls.choose'), 50, CAMILA_TMP_DIR);
     $sheet_list = '';
     for ($i = 0; $i < 10; $i++) {
         if ($i > 0) {
             $sheet_list .= ',';
         }
         $sheet_list .= $i . ';' . ($i + 1);
     }
     new form_static_listbox($form3, 'sheetnum', camila_get_translation('camila.worktable.xls.sheetnum'), $sheet_list);
     $success = true;
     if ($form3->process()) {
         $filename = $form3->fields['filename']->value[0];
         $sheetnum = $form3->fields['sheetnum']->value;
         $result = $_CAMILA['db']->Execute('select short_title, scriptname, tablename, filename, sheetnum 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'];
         $worktablename = $result->fields['short_title'];
         $worktablescript = $result->fields['scriptname'];
         if ($filename == '' && $result->fields['filename'] != '') {
             $filename = $result->fields['filename'];
             $sheetnum = $result->fields['sheetnum'];
         }
         if ($filename != '') {
             require_once CAMILA_LIB_DIR . 'php-excel-reader/excel_reader2.php';
             $data = new Spreadsheet_Excel_Reader(CAMILA_TMP_DIR . '/' . $filename);
             $excelColNames = array();
             $i = 0;
             while ($data->val(1, $i + 1, $sheetnum) != '') {
                 $name = $data->val(1, $i + 1, $sheetnum);
                 $excelColNames[$i] = camila_strtoupper_utf8(isUTF8($name) ? $name : utf8_encode($name));
                 $i++;
             }
             $result = $_CAMILA['db']->Execute('select * from ' . CAMILA_TABLE_WORKC . ' where (wt_id=' . $_CAMILA['db']->qstr($id) . ' and is_deleted<>' . $_CAMILA['db']->qstr('y') . ') order by sequence');
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             $fields = array();
             $types = array();
             $defVals = array();
             $forceCase = array();
             $orig_types = array();
             $fieldMapping = array();
             $forceArr = camila_get_translation_array('camila.worktable.options.force');
             $count = 0;
             while (!$result->EOF) {
                 $colName = $result->fields['col_name'];
                 $name = camila_strtoupper_utf8($result->fields['name']);
                 $fieldMapping[$colName] = isUTF8($name) ? $name : utf8_encode($name);
                 $fields[$count] = $colName;
                 $types[$count] = $result->fields['type'];
                 $orig_types[$count] = $result->fields['orig_type'];
                 $defVals[$count] = $result->fields['default_value'];
                 $forceCase[$count] = $result->fields['force_case'];
                 $count++;
                 $result->MoveNext();
             }
             $successCount = 0;
             $failCount = 0;
             //db fields
             for ($i = 2; $i <= $data->rowcount($sheetnum); $i++) {
                 $record = array();
                 $emptyrow = true;
                 //db fields
                 reset($fields);
                 foreach ($fields as $k => $v) {
                     //k  Field position into database
                     //k2 Position in Excel file
                     $k2 = array_search($fieldMapping[$v], $excelColNames);
                     //Is it in Excel file?
                     if ($k2 !== false) {
                         $excelColName = camila_strtoupper_utf8($data->value(1, $k2 + 1, $sheetnum));
                         //$excelColName = $v;
                         $worktableColName = array_search($excelColName, $fieldMapping);
                         $worktableColName = $v;
                         if ($worktableColName != '') {
                             if ($types[$k] == 'date' && $data->val($i, $k2 + 1, $sheetnum) != '') {
                                 $numValue = $data->sheets[$sheetnum]['cellsInfo'][$i][$k2 + 1]['raw'];
                                 $utcDays = floor($numValue - ($data->nineteenFour ? SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904 : SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS));
                                 $utcValue = $utcDays * SPREADSHEET_EXCEL_READER_MSINADAY;
                                 $dateinfo = gmgetdate($utcValue);
                                 $fractionalDay = $numValue - floor($numValue) + 1.0E-7;
                                 // The .0000001 is to fix for php/excel fractional diffs
                                 $totalseconds = floor(SPREADSHEET_EXCEL_READER_MSINADAY * $fractionalDay);
                                 $secs = $totalseconds % 60;
                                 $totalseconds -= $secs;
                                 $hours = floor($totalseconds / (60 * 60));
                                 $mins = floor($totalseconds / 60) % 60;
                                 $dt = date('Y-m-d', mktime($hours, $mins, $secs, $dateinfo["mon"], $dateinfo["mday"], $dateinfo["year"]));
                                 $record[$worktableColName] = $_CAMILA['db']->BindDate($dt);
                             } elseif ($orig_types[$k] == 'number' && $data->sheets[$sheetnum]['cellsInfo'][$i][$k2 + 1]['raw'] != '') {
                                 $record[$worktableColName] = $data->sheets[$sheetnum]['cellsInfo'][$i][$k2 + 1]['raw'];
                             } elseif ($types[$k] == 'hyperlink' && $data->hyperlink($i, $k2 + 1, $sheetnum) != '') {
                                 //$record[$worktableColName] = '<a href="' . $data->hyperlink($i, $k2+1, $sheetnum) . '" target="_blank">' . $data->value($i, $k2+1, $sheetnum) . '</a>';
                                 $record[$worktableColName] = $data->hyperlink($i, $k2 + 1, $sheetnum);
                             } else {
                                 $record[$worktableColName] = $data->value($i, $k2 + 1, $sheetnum);
                             }
                             if ($defVals[$k] != '' && $record[$worktableColName] == '') {
                                 $record[$worktableColName] = camila_parse_default_expression($defVals[$k], '_camila_seq_num_', true);
                             }
                             if ($record[$worktableColName] != '') {
                                 if ($forceCase[$k] == 'upper') {
                                     $record[$worktableColName] = mb_strtoupper($record[$worktableColName], 'UTF-8');
                                 }
                                 if ($forceCase[$k] == 'lower') {
                                     $record[$worktableColName] = mb_strtolower($record[$worktableColName], 'UTF-8');
                                 }
                                 $emptyrow = false;
                             }
                         }
                     } else {
                         if ($defVals[$k] != '') {
                             $record[$fields[$k]] = camila_parse_default_expression($defVals[$k], '_camila_seq_num_', true);
                         }
                     }
                 }
                 if (!$emptyrow) {
                     $now = $_CAMILA['db']->BindTimeStamp(gmdate("Y-m-d H:i:s", time()));
                     $id = $_CAMILA['db']->GenID('worktableseq', 100000);
                     foreach ($record as $k => $v) {
                         $record[$k] = str_replace('_camila_seq_num_', $id, $v);
                     }
                     $record['id'] = $id;
                     $record['created'] = $now;
                     $record['created_by'] = $_CAMILA['user'];
                     $record['created_src'] = 'import';
                     $record['created_by_surname'] = $_CAMILA['user_surname'];
                     $record['created_by_name'] = $_CAMILA['user_name'];
                     $record['last_upd'] = $now;
                     $record['last_upd_by'] = $_CAMILA['user'];
                     $record['last_upd_src'] = 'import';
                     $record['last_upd_by_surname'] = $_CAMILA['user_surname'];
                     $record['last_upd_by_name'] = $_CAMILA['user_name'];
                     $record['mod_num'] = 0;
                     $insertSQL = $_CAMILA['db']->AutoExecute($table, $record, 'INSERT');
                     if (!$insertSQL) {
                         //camila_information_text(camila_get_translation('camila.worktable.db.importerror'));
                         $failCount++;
                         $success = false;
                     } else {
                         $successCount++;
                     }
                 }
             }
         }
         camila_information_text(camila_get_translation('camila.worktable.db.importedrows') . ': ' . $successCount);
         camila_information_text(camila_get_translation('camila.worktable.db.skippedrows') . ': ' . $failCount);
         @unlink(CAMILA_TMP_DIR . '/' . $filename);
     } else {
         $result = $_CAMILA['db']->Execute('select tablename, filename, sheetnum from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id));
         if ($result === false) {
             camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
         }
         $filename = $result->fields['filename'];
         //            if ($filename != '') {
         $myText = new CHAW_text(camila_get_translation('camila.wizard.choosefileforimport'));
         $_CAMILA['page']->add_text($myText);
         $form3->draw();
         $success = false;
         //	    }
     }
     if ($success) {
         if ($worktablename != '') {
             $myLink = new CHAW_link($worktablename, $worktablescript);
             $myLink->set_br(0);
             $_CAMILA['page']->add_link($myLink);
             $myText = new CHAW_text(' - ' . camila_get_translation('camila.worktable.db.importok'));
             $_CAMILA['page']->add_text($myText);
         } else {
             $myText = new CHAW_text(camila_get_translation('camila.wizard.configurationapplied'));
             $_CAMILA['page']->add_text($myText);
         }
     }
 }
예제 #4
0
     if ($_SERVER['SERVER_ADDR'] != '') {
         $url = 'http://' . $_SERVER['SERVER_ADDR'] . ':' . $_SERVER['SERVER_PORT'] . '/' . CAMILA_APP_DIR;
         $link = new CHAW_link($url, $url);
         $_CAMILA['page']->add_link($link);
     }
 }
 $query = 'select * from ' . CAMILA_APPLICATION_PREFIX . 'camila_bookmarks order by sequence';
 $result = $_CAMILA['db']->Execute($query);
 if ($result === false) {
     camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
 }
 $myText = new CHAW_text('');
 $_CAMILA['page']->add_text($myText);
 while (!$result->EOF) {
     if (strpos($result->fields['url'], 'gby') === false) {
         $myLink = new CHAW_link($result->fields['title'], $result->fields['url']);
         $myLink->set_br(0);
         $_CAMILA['page']->add_link($myLink);
         $code = "<span id='" . $result->fields['id'] . "'>0</span>";
         $pos = strrpos($result->fields['url'], '?');
         if ($pos !== false) {
             $url = $result->fields['url'] . "&camila_json&camila_response_handler=camila_gva_set_response&tqx=reqId:" . $result->fields['id'];
         } else {
             $url = $result->fields['url'] . "?camila_json&camila_response_handler=camila_gva_set_response&tqx=reqId:" . $result->fields['id'];
         }
         $code .= "<script defer src = '" . $url . "'>\n";
         $code .= "</script>\n";
         $js = new CHAW_js($code);
         $_CAMILA['page']->add_userdefined($js);
         $myText = new CHAW_text('');
         $_CAMILA['page']->add_text($myText);
예제 #5
0
$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;
예제 #6
0
 function draw_footer()
 {
     if (!$this->drawnavigationbox) {
         return;
     }
     global $_CAMILA;
     if ($this->rows > 0 && !$_CAMILA['page']->camila_exporting()) {
         if ($this->page > 2) {
             $myLink = new CHAW_link(camila_get_translation('camila.report.navbox.first'), basename($_SERVER['PHP_SELF']) . $this->urlappend . '&f0=' . $_REQUEST['f0'] . '&camila_pagnum=1');
             $myLink->set_br(0);
             $_CAMILA['page']->add_link($myLink);
             $text = new CHAW_text(' | ');
             $text->set_br(0);
             $_CAMILA['page']->add_text($text);
         }
         if ($this->page > 1) {
             $myLink = new CHAW_link(camila_get_translation('camila.report.navbox.prev'), basename($_SERVER['PHP_SELF']) . $this->urlappend . '&f0=' . $_REQUEST['f0'] . '&camila_pagnum=' . ($this->page - 1));
             $myLink->set_br(0);
             $_CAMILA['page']->add_link($myLink);
         }
         $text = new CHAW_text(' ' . camila_get_translation('camila.report.navbox.page') . ' ' . $this->page . '/' . ceil($this->totalrows / $this->rows) . ' ');
         $text->set_br(0);
         $_CAMILA['page']->add_text($text);
         if ($this->page < ceil($this->totalrows / $this->rows)) {
             $myLink = new CHAW_link(camila_get_translation('camila.report.navbox.next'), basename($_SERVER['PHP_SELF']) . $this->urlappend . '&f0=' . $_REQUEST['f0'] . '&camila_pagnum=' . ($this->page + 1));
             $myLink->set_br(0);
             $_CAMILA['page']->add_link($myLink);
         }
         if ($this->page < ceil($this->totalrows / $this->rows) - 1) {
             $text = new CHAW_text(' | ');
             $text->set_br(0);
             $_CAMILA['page']->add_text($text);
             $myLink = new CHAW_link(camila_get_translation('camila.report.navbox.last'), basename($_SERVER['PHP_SELF']) . $this->urlappend . '&f0=' . $_REQUEST['f0'] . '&camila_pagnum=' . ceil($this->totalrows / $this->rows));
             $myLink->set_br(0);
             $_CAMILA['page']->add_link($myLink);
         }
         $text = new CHAW_text(' | ');
         $text->set_br(0);
         $_CAMILA['page']->add_text($text);
         $myLink = new CHAW_link(camila_get_translation('camila.report.navbox.allpages') . ' (' . $this->totalrows . ' ' . camila_get_translation('camila.report.navbox.rows') . ')', basename($_SERVER['PHP_SELF']) . $this->urlappend . '&f0=' . $_REQUEST['f0'] . '&camila_pagnum=-1');
         $myLink->set_br(0);
         if ($this->page > 0) {
             $_CAMILA['page']->add_link($myLink);
         }
         $text = new CHAW_text(' | ');
         $text->set_br(0);
         $_CAMILA['page']->add_text($text);
         $myLink = new CHAW_link(camila_get_translation('camila.report.navbox.countorderby'), basename($_SERVER['PHP_SELF']) . $this->urlappend . '&f0=' . $_REQUEST['f0'] . '&camila_pagnum=-1&camila_countorderby');
         $myLink->set_br(0);
         if ($this->page > 0 && !$this->gbyconditionpresent) {
             $_CAMILA['page']->add_link($myLink);
         }
     }
     if (!$_CAMILA['page']->camila_exporting()) {
         if ($this->defaultfields != '') {
             $text = new CHAW_text(' | ');
             $text->set_br(0);
             if ($this->rows > 0 && !$this->gbyconditionpresent) {
                 $_CAMILA['page']->add_text($text);
             }
             $myLink = new CHAW_link(camila_get_translation('camila.report.navbox.addremcols'), basename($_SERVER['PHP_SELF']) . $this->urlappend . '&f0=' . $_REQUEST['f0'] . '&camila_pagnum=' . $this->page . '&camila_editcols=y');
             $myLink->set_br(0);
             if ($this->page > 0 && !$this->gbyconditionpresent) {
                 $_CAMILA['page']->add_link($myLink);
             }
         }
         if (isset($this->additional_links)) {
             foreach ($this->additional_links as $key => $value) {
                 $text = new CHAW_text(' | ');
                 $text->set_br(0);
                 $_CAMILA['page']->add_text($text);
                 $link = new CHAW_link($key, $value);
                 if (is_object($this->additional_links_images[$key])) {
                     $link->add_image($this->additional_links_images[$key]);
                 }
                 $link->set_br(0);
                 $_CAMILA['page']->add_link($link);
             }
         }
         $text = new CHAW_text('');
         $_CAMILA['page']->add_text($text);
     }
 }
예제 #7
0
    $query = 'select * from ' . CAMILA_APPLICATION_PREFIX . 'camila_bookmarks where base_url=' . $_CAMILA['db']->qstr(basename($_SERVER['PHP_SELF'])) . ' and lang=' . $_CAMILA['db']->qstr($_CAMILA['lang']) . ' order by sequence';
    $result = $_CAMILA['db']->Execute($query);
    if ($result === false) {
        camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
    }
    $bookmark_count = 0;
    $camila_linkset_sep = new CHAW_text(' ' . camila_get_translation('camila.export.separator') . ' ');
    $camila_linkset_sep->set_br(0);
    $text = new CHAW_text('');
    $text->set_br(1);
    $_CAMILA['page']->add_text($text);
    while (!$result->EOF) {
        if ($bookmark_count > 0) {
            $_CAMILA['page']->add_text($camila_linkset_sep);
        }
        $camila_link = new CHAW_link($result->fields['title'], $result->fields['url']);
        $camila_link->set_br(0);
        $_CAMILA['page']->add_link($camila_link);
        $bookmark_count++;
        $result->MoveNext();
    }
    if ($bookmark_count == 0) {
        $text = new CHAW_text('');
        $text->set_br(1);
        $_CAMILA['page']->add_text($text);
    } else {
        $text = new CHAW_text('');
        $text->set_br(2);
        $_CAMILA['page']->add_text($text);
    }
}
예제 #8
0
 function _new()
 {
     if ($this->extfsenabled) {
         $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/static_listbox.php';
     require_once CAMILA_DIR . 'datagrid/elements/form/fm_dir_listbox.php';
     $form = new phpform('camila');
     $form->submitbutton = camila_get_translation('camila.save');
     $form->drawrules = false;
     new form_hidden($form, 'update', 'new');
     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', 'Nome file', true, 30);
     $types;
     foreach ($this->editabletypes as $k => $v) {
         $types .= $v . ';' . '.' . $v . ' - ' . camila_get_translation('camila.mimetype.' . $v) . ',';
     }
     new form_static_listbox($form, 'type', 'Tipo', $types, true);
     if ($this->extfsenabled) {
         new form_fm_dir_listbox($form, 'dir', camila_get_translation('camila.fm.intofolder'), $this->usergroup, true);
     }
     $fp = $form->process();
     if ($fp) {
         $filename = $form->fields['name']->value . '.' . $form->fields['type']->value;
         if ($this->extfsenabled) {
             $sfile = $filename . camila_hash(CAMILA_FM_PREFIX);
             $arr = array('name' => $sfile);
             $item = $this->stmt . '/' . $this->usergroup . '/' . $sfile;
             $f = fopen($item, 'w');
             $this->_addfile($this->usergroup, $form->fields['dir']->value, $filename, $sfile);
         } else {
             $arr = array('name' => $filename);
             $item = $this->stmt . '/' . $filename;
             $f = fopen($item, 'w');
         }
         camila_information_text(camila_get_translation('camila.fm.filecreated'));
         $myLink = new CHAW_link(camila_get_translation('camila.edit') . ' ' . $filename, basename($_SERVER['PHP_SELF']) . $_CAMILA['returl'] . '&camila_update=' . serialize($arr) . '&camila_token=' . camila_token(serialize($arr)));
         $myLink->set_br(2);
         $_CAMILA['page']->add_link($myLink);
     } else {
         $form->draw();
     }
     return $fp;
 }
예제 #9
0
 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();
     }
 }