Example #1
0
 function draw(&$form)
 {
     parent::draw($form);
     $text = new CHAW_text($this->title . $this->labelseparator);
     $text->set_br(0);
     if (!empty($this->title)) {
         $form->add_text($text);
     }
     $mySelect = new CHAW_select($this->key);
     global $_CAMILA;
     $_CAMILA['db']->SetFetchMode(ADODB_FETCH_ASSOC);
     $result = $_CAMILA['db']->Execute($this->query);
     if ($result === false) {
         camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
     }
     $val = '';
     while (!$result->EOF) {
         if ($result->fields[$this->lbkey] == $this->value) {
             $mySelect->add_option($result->fields[$this->lbvalue], $result->fields[$this->lbkey], HAW_SELECTED);
             $val = $result->fields[$this->lbvalue];
         } else {
             $mySelect->add_option($result->fields[$this->lbvalue], $result->fields[$this->lbkey]);
         }
         $result->MoveNext();
     }
     if ($this->updatable) {
         $form->add_select($mySelect);
         $text = new CHAW_text('');
         $form->add_text($text);
     } else {
         $text = new CHAW_text($val);
         $form->add_text($text);
     }
 }
 function validate()
 {
     if ($_REQUEST[$this->form->table . '_sess_mode'] != 'insert') {
         return true;
     }
     parent::validate();
     if ($this->value != '' and $this->maxlength > 0) {
         $this->form->validator->length($this->field, '<=', $this->maxlength);
     }
     if ($this->alphanumeric) {
         $this->form->validator->alphaNumeric($this->field);
     } else {
         $this->form->validator->alpha($this->field);
     }
     if ($this->value != '') {
         global $_CAMILA;
         $query = 'select * from ' . $this->form->table . ' where ' . $this->field . '=' . $_CAMILA['db']->Quote($this->value);
         $result = $_CAMILA['db']->Execute($query);
         if ($result === false) {
             camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
         }
         if ($result->RecordCount() > 0) {
             $this->form->validator->setError($this->field, 907);
         }
     }
 }
Example #3
0
 function draw(&$form)
 {
     parent::draw($form);
     if ($this->updatable) {
         if ($this->maxlength > 0) {
             global $_CAMILA;
             $code = '<script type="text/javascript" src="' . CAMILA_LIB_DIR . 'ylib/ylib.js"></script>';
             $code .= '<script type="text/javascript" src="' . CAMILA_LIB_DIR . 'ylib/y_util.js"></script>';
             $code .= '<script type="text/javascript" src="' . CAMILA_LIB_DIR . 'ylib/y_TextCounter.js"></script>';
             $_CAMILA['page']->camila_add_js($code, 'textcounter');
             $code = "<script> camila_addDOMLoadEvent ( function(){";
             $code .= ' var camila_counter = new ylib.widget.TextCounter("' . $this->key . '", ' . $this->maxlength . ', "' . camila_get_translation('camila.form.presmscharleft') . ' ","' . camila_get_translation('camila.form.postsmscharleft') . '");';
             $code .= "} );</script>";
             $_CAMILA['page']->camila_add_js($code);
             $code = "<script>document.write('<div>');</script>";
             $js = new CHAW_js($code);
             $form->add_userdefined($js);
         }
         $myTextarea = new CHAW_textarea($this->key, $this->value, $this->title . $this->labelseparator, $this->rows, $this->cols);
         $form->add_textarea($myTextarea);
         if ($this->maxlength > 0) {
             $js = new CHAW_js("<script>document.write('</div>')</script>");
             $form->add_userdefined($js);
         }
     } else {
         $myText = new CHAW_text($this->title . $this->labelseparator . ' ' . $this->value);
         $form->add_text($myText);
     }
 }
Example #4
0
 function draw(&$row, $fields)
 {
     global $_CAMILA;
     $formula = $this->report->queries[$this->field];
     $wTable = substr($formula, 0, strpos($formula, ','));
     $field = substr($formula, strlen($wTable) + 1);
     $query = substr($field, strpos($field, ',') + 1);
     $field = substr($field, 0, strpos($field, ','));
     $url = camila_worktable_get_table_id($wTable);
     $ttemp = new MiniTemplator();
     $ttemp->setTemplateString($query);
     foreach ($fields as $key) {
         if ($key->value != '') {
             $ttemp->setVariable($key->title, $key->value, true);
         } else {
             $ttemp->setVariable($key->title, '0', true);
         }
     }
     $ttemp->generateOutputToString($query);
     if ($field == camila_get_translation('camila.worktable.query.count')) {
         $fields = array('camila_session_id' => $_REQUEST['PHPSESSID'], 'camila_xml' => '', 'filter' => $query, 'camila_export_no_table_data' => 'y');
         $this->value = str_replace(array("\r", "\r\n", "\n"), '', strip_tags($this->httpGet($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], '/' . CAMILA_APP_DIR . '/' . $url, $fields, array('PHPSESSID2' => $_REQUEST['PHPSESSID']))));
     } else {
         $this->value = camila_get_translation('camila.worktable.query.count') . ' not yet supported :-(';
     }
     parent::draw($row, $fields);
 }
 function _get_select()
 {
     $mySelect = new CHAW_select($this->key);
     $node = $this->fs->_tree_get_group_root_node($this->usergroup);
     $attributes = array('name');
     $wlk = $this->fs->_tree_walk_preorder($node);
     while ($curr = $this->fs->_tree_walk_next($wlk)) {
         $level = $this->fs->_tree_walk_level($wlk);
         $spaces = str_repeat('--', $level - 1);
         $att = reset($attributes);
         while ($att) {
             if ($level == 0) {
                 $mySelect->add_option('(' . camila_get_translation('camila.fm.selectfolder') . ')', $wlk['row']['id']);
             } elseif ($wlk['row']['file'] == '') {
                 if ($wlk['row']['id'] == $_REQUEST['camila_dir']) {
                     $mySelect->add_option($spaces . $wlk['row'][$att], $wlk['row']['id'], HAW_SELECTED);
                 } else {
                     $mySelect->add_option($spaces . $wlk['row'][$att], $wlk['row']['id']);
                 }
             }
             $att = next($attributes);
         }
     }
     return $mySelect;
 }
Example #6
0
function camila_news_counter_value($usergroup, $service_id)
{
    global $_CAMILA;
    $result = $_CAMILA['db']->Execute("select value from camila_news_counters where usergroup=? and service_id=?", array($usergroup, $service_id));
    if ($result === false) {
        camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
    }
    return $result->fields['value'];
}
function worktable_get_next_autoincrement_value($table, $column)
{
    global $_CAMILA;
    $result = $_CAMILA['db']->Execute('select max(' . $column . ') as id from ' . $table);
    if ($result === false) {
        camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
    }
    return intval($result->fields['id']) + 1;
}
Example #8
0
 function draw(&$row, $fields)
 {
     $size = $this->value;
     if ($size >= 1073741824) {
         $size = round($size / 1073741824 * 100) / 100 . ' GB';
     } elseif ($size >= 1048576) {
         $size = round($size / 1048576 * 100) / 100 . ' MB';
     } elseif ($size >= 1024) {
         $size = round($size / 1024 * 100) / 100 . ' KB';
     } else {
         $size = $size . ' B';
     }
     if ($size == 0) {
         $size = '-';
     }
     $this->value = str_replace('.', camila_get_translation('camila.decimal.separator'), $size);
     parent::draw($row, $fields);
 }
Example #9
0
function camila_export_action_select()
{
    global $_CAMILA;
    $mySelect = new CHAW_select('camila_export_action');
    require_once 'fs.class.php';
    $fs = new fs($_CAMILA['adm_user_group']);
    $mySelect->add_option(camila_get_translation('camila.export.download'), 'download');
    if (!CAMILA_FM_EXTFS_ENABLED) {
        if (!CAMILA_FM_EXPORT_SAVETO_DISABLED) {
            $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents'), '/', $_REQUEST['camila_export_last_action'] == '/' ? HAW_SELECTED : HAW_NOTSELECTED);
            $arr = $fs->scandir(CAMILA_FM_ROOTDIR, true, false);
            sort($arr);
            foreach ($arr as $value) {
                $item = substr($value, strlen(CAMILA_FM_ROOTDIR) + 1);
                if ($item != camila_get_translation('camila.documents.recyclebin')) {
                    if ('/' . $item == $_REQUEST['camila_export_last_action']) {
                        $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents') . '/' . $item, '/' . $item, HAW_SELECTED);
                    } else {
                        $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents') . '/' . $item, '/' . $item);
                    }
                }
            }
        }
    } else {
        $node = $fs->_tree_get_group_root_node($_CAMILA['adm_user_group']);
        $attributes = array('name');
        $wlk = $fs->_tree_walk_preorder($node);
        while ($curr = $fs->_tree_walk_next($wlk)) {
            $level = $fs->_tree_walk_level($wlk);
            $spaces = str_repeat('--', $level - 1);
            $att = reset($attributes);
            while ($att) {
                if ($level == 0) {
                    $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents'), $wlk['row']['id']);
                } elseif ($wlk['row']['file'] == '') {
                    $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents') . '/' . $spaces . $wlk['row'][$att], $wlk['row']['id']);
                }
                $att = next($attributes);
            }
        }
    }
    return $mySelect;
}
Example #10
0
 function draw(&$form)
 {
     parent::draw($form);
     $text = new CHAW_text($this->title . $this->labelseparator);
     $text->set_br(1);
     if (!empty($this->title)) {
         $form->add_text($text);
     }
     $select_all = new CHAW_js('<div class="camilacheckall" id="camilacheckall"><a id="CheckAll_' . $this->key . '" href="">' . camila_get_translation('camila.form.checkall') . '</a> ' . camila_get_translation('camila.form.checkallseparator') . ' <a id="UncheckAll_' . $this->key . '" href="">' . camila_get_translation('camila.form.uncheckall') . '</a></div>');
     $form->add_userdefined($select_all);
     global $_CAMILA;
     $_CAMILA['db']->SetFetchMode(ADODB_FETCH_ASSOC);
     $result = $_CAMILA['db']->Execute($this->query);
     if ($result === false) {
         camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
     }
     $count = 0;
     //          while (!$result->EOF) {
     for ($i = 0; $i < count($this->values); $i++) {
         //              $myHidden = new CHAW_hidden($this->key . '_labels_'.$count, $result->fields[$this->label_field]);
         //              $form->add_input($myHidden);
         if ($this->values[$i] == '') {
             $myImage = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/nocheck.wbmp', CAMILA_IMG_DIR . 'png/nocheck.png', '-');
             $myImage->set_br(0);
             $form->add_image($myImage);
             $text = new CHAW_text($this->labels[$i]);
             $form->add_text($text);
         } else {
             if (in_array($this->values[$i], $this->value)) {
                 $myCheckbox = new CHAW_checkbox($this->key . '_' . $i, $this->values[$i], $this->labels[$i], HAW_SELECTED);
             } else {
                 $myCheckbox = new CHAW_checkbox($this->key . '_' . $i, $this->values[$i], $this->labels[$i]);
             }
             $form->add_checkbox($myCheckbox);
             $this->checked++;
         }
         $count++;
         //              $result->MoveNext();
     }
     //          $myHidden = new CHAW_hidden($this->key . '_count', $count);
     //          $form->add_input($myHidden);
 }
Example #11
0
 function draw(&$form)
 {
     parent::draw($form);
     $text = new CHAW_text($this->title . $this->labelseparator);
     $text->set_br(1);
     if (!empty($this->title)) {
         $form->add_text($text);
     }
     if (count($this->labels) > 1) {
         $select_all = new CHAW_js('<div class="camilacheckall" id="camilacheckall"><a id="CheckAll_' . $this->key . '" href="">' . camila_get_translation('camila.form.checkall') . '</a> ' . camila_get_translation('camila.form.checkallseparator') . ' <a id="UncheckAll_' . $this->key . '" href="">' . camila_get_translation('camila.form.uncheckall') . '</a></div>');
         $form->add_userdefined($select_all);
     }
     global $_CAMILA;
     $count = 0;
     foreach ($this->values as $key => $value) {
         $myHidden = new CHAW_hidden($this->key . '_labels_' . $count, $this->labels[$count]);
         $form->add_input($myHidden);
         if ($this->values[$count] == '') {
             $myImage = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/nocheck.wbmp', CAMILA_IMG_DIR . 'png/nocheck.png', '-');
             $myImage->set_br(0);
             $form->add_image($myImage);
             $text = new CHAW_text($this->labels[$count]);
             $form->add_text($text);
         } else {
             if (in_array($fields[$count], $this->value)) {
                 $myCheckbox = new CHAW_checkbox($this->key . '_' . $count, $this->values[$count], $this->labels[$count], HAW_SELECTED);
             } else {
                 $myCheckbox = new CHAW_checkbox($this->key . '_' . $count, $this->values[$count], $this->labels[$count]);
             }
             if (($count + 1) % $this->cols != 0 && count($this->labels) > 1) {
                 $myCheckbox->set_br(0);
             }
             $form->add_checkbox($myCheckbox);
             $this->checked++;
         }
         $count++;
     }
     //          $myHidden = new CHAW_hidden($this->key . '_count', $count);
     //          $form->add_input($myHidden);
 }
Example #12
0
            closedir($dh2);
        }
    }
}
if (isset($_REQUEST['output']) && $_REQUEST['output'] != '') {
    $o = new CHAW_hidden('output', $_REQUEST['output']);
    $myForm->add_hidden($o);
}
$thePW4 = new CHAW_hidden('js', '');
$myForm->add_hidden($thePW4);
$code = "<script>document.forms[0].js.value = 'enabled';</script>";
$js = new CHAW_js($code, true);
$myForm->add_userdefined($js);
$myForm->add_raw($myParOpen);
$theSubmission = new CHAW_submit(camila_get_translation('camila.login.enter'), 'submit');
$myForm->add_submit($theSubmission);
$myForm->add_raw($myParClose);
if (!CAMILA_PRIVATE_SERVER) {
    $myHtmlCode = "<div class='camilaopenidlogin'><a href='cf_login_openid.php?action=verify&openid_identifier=https%3a%2f%2fwww.google.com%2faccounts%2fo8%2fid'>" . camila_get_translation('camila.login.openid.google') . "</a><br /></div>";
    $myGmailLoginBlock = new HAW_raw(HAW_HTML, $myHtmlCode);
    $myForm->add_raw($myGmailLoginBlock);
}
if ($_CAMILA['auth_failed']) {
    $text = new CHAW_text(camila_get_translation('camila.login.wrongpassword'));
    $myForm->add_text($text);
}
$_CAMILA['page']->add_form($myForm);
$myDivClose = new HAW_raw(HAW_HTML, '</div>');
$_CAMILA['page']->add_raw($myDivClose);
$myLogin = new CHAW_storepwd();
$_CAMILA['page']->add_userdefined($myLogin);
Example #13
0
<?php

/* This File is part of Camila PHP Framework
   Copyright (C) 2006-2009 Umberto Bresciani

   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/header.php';
camila_save_preferences();
$text = new CHAW_text(camila_get_translation('camila.manualredirect'), HAW_TEXTFORMAT_ITALIC);
$_CAMILA['page']->add_text($text);
$myLink = new CHAW_link(camila_get_translation('camila.clickhere'), $_REQUEST['camila_redirect']);
$_CAMILA['page']->add_link($myLink);
$_CAMILA['page']->set_redirection(0.1, $_REQUEST['camila_redirect']);
$_CAMILA['page']->create_page();
require '../camila/footer.php';
Example #14
0
function XLS_import2($file, $table, $db)
{
    $filename = basename($file);
    $sequence = intval(substr($filename, 0, strpos($filename, '_')));
    $res = $db->Execute('select id from ' . CAMILA_TABLE_WORKT . ' where filename=' . $db->qstr($filename));
    if ($res === false) {
        camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $db->ErrorMsg());
    }
    $id = $res->fields['id'];
    $result = array();
    $configurator = new configurator();
    $configurator->filename = $file;
    $configurator->sheetnum = 0;
    $configurator->interactive = false;
    $db->SetFetchMode(ADODB_FETCH_ASSOC);
    $configurator->db = $db;
    $configurator->configure_table($id, false);
    $record = array();
    $res = $db->Execute('select * from ' . CAMILA_TABLE_WORKT . ' where id=' . $db->qstr($id));
    if ($res === false) {
        camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $db->ErrorMsg());
    }
    $record['short_title'] = $res->fields['short_title'];
    $record['full_title'] = $res->fields['full_title'];
    $record['label_order'] = $sequence;
    $scriptname = $res->fields['scriptname'];
    $category = $res->fields['category'];
    $updateSQL = $db->AutoExecute(CAMILA_TABLE_PLANG, $record, 'UPDATE', 'page_url=' . $db->qstr($scriptname) . ' and lang=' . $db->qstr($_REQUEST['lang']));
    if (!$updateSQL) {
        camila_information_text(camila_get_translation('camila.worktable.db.error'));
    }
    if (trim($category) != '') {
        $res = $db->Execute('select page_url from ' . CAMILA_TABLE_PLANG . ' where short_title=' . $db->qstr($category) . ' AND page_url LIKE ' . $db->qstr('cf_app.php?cat%') . ' and lang=' . $db->qstr($_REQUEST['lang']));
        if ($res === false) {
            camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $db->ErrorMsg());
        }
        $cat_url = '-';
        if ($res->RecordCount() == 0) {
            $res = $db->Execute('select page_url from ' . CAMILA_TABLE_PLANG . ' where full_title<>' . $db->qstr('-') . ' AND page_url LIKE ' . $db->qstr('cf_app.php?cat%') . ' and lang=' . $db->qstr($_REQUEST['lang']));
            if ($res === false) {
                camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $db->ErrorMsg());
            }
            $cat_url = $res->fields['page_url'];
            $record = array();
            $record['label_order'] = $sequence;
            $record['short_title'] = $category;
            $record['full_title'] = '-';
            $updateSQL = $db->AutoExecute(CAMILA_TABLE_PLANG, $record, 'UPDATE', 'page_url=' . $db->qstr($cat_url) . ' and lang=' . $db->qstr($_REQUEST['lang']));
            if (!$updateSQL) {
                camila_information_text(camila_get_translation('camila.worktable.db.error'));
            }
        } else {
            $cat_url = $res->fields['page_url'];
        }
        $record = array();
        $record['parent'] = $cat_url;
        $updateSQL = $db->AutoExecute(CAMILA_TABLE_PAGES, $record, 'UPDATE', 'url=' . $db->qstr($scriptname));
        if (!$updateSQL) {
            camila_information_text(camila_get_translation('camila.worktable.db.error'));
        }
        $record = array();
        $record['visible'] = 'yes';
        $updateSQL = $db->AutoExecute(CAMILA_TABLE_PAGES, $record, 'UPDATE', 'url=' . $db->qstr($cat_url));
        if (!$updateSQL) {
            camila_information_text(camila_get_translation('camila.worktable.db.error'));
        }
    }
    $result['result'] = 2;
    //success
    $result['processed'] = 1;
    $result['failed'] = 0;
    return $result;
}
 /**
  * Add the tag to the footer or header elements.
  *
  * @return void 
  */
 public function close()
 {
     $this->pdf->AliasNbPages();
     $this->content = camila_get_translation('camila.report.navbox.page') . ' %s/{nb}';
     $this->parent->elements[] = $this;
 }
Example #16
0
    if ($_CAMILA['page_url'] != CAMILA_HOME) {
        $_CAMILA['page']->camila_collapsible_end();
    }
}
$text = new CHAW_text($_CAMILA['page_full_title'], $_CAMILA['page_title_attributes']);
$text->set_br(1);
$text->set_color($_CAMILA['page_title_color'], $_CAMILA['page_title_boxcolor']);
$_CAMILA['page']->add_text($text);
if (!$_CAMILA['page']->camila_exporting()) {
    $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) {
Example #17
0
$text->set_br(0);
$myForm->add_text($text);
$myForm->add_select($mySelect3);
$text = new CHAW_text('');
$text->set_br(2);
$myForm->add_text($text);
$text = new CHAW_text(camila_get_translation('camila.prefs.tables.fontsize'));
$text->set_br(0);
$myForm->add_text($text);
$myForm->add_select($mySelect2);
$text = new CHAW_text('');
$text->set_br(2);
$myForm->add_text($text);
if (!intval($_CAMILA['user_preferences']['c_rp'])) {
    $_CAMILA['user_preferences']['c_rp'] = CAMILA_REPORT_RPP;
}
$myInput = new CHAW_input('camila_rows_per_page', $_CAMILA['user_preferences']['c_rp'], camila_get_translation('camila.prefs.tables.rowsperpage'));
$myInput->set_br(2);
$myForm->add_input($myInput);
$url = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];
$url = ereg_replace("&" . "camila_preferences", "", $url);
$url = ereg_replace("\\?" . "camila_preferences", "", $url);
$myInput = new CHAW_hidden('camila_redirect', $url);
$myForm->add_input($myInput);
$theSubmission = new CHAW_submit(camila_get_translation('camila.save'), 'submit');
$myForm->add_submit($theSubmission);
$_CAMILA['page']->add_form($myForm);
$_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);
     }
 }
Example #19
0
 function create_page()
 {
     global $_CAMILA;
     require_once CAMILA_LIB_DIR . 'xml-2-pdf/Xml2Pdf.php';
     require_once CAMILA_LIB_DIR . 'minitemplator/MiniTemplator.class.php';
     $xmlfile = CAMILA_TMPL_DIR . '/' . $_CAMILA['lang'] . '/' . $_REQUEST['camila_xml2pdf'];
     $xml = '';
     $t = new MiniTemplator();
     $t->readTemplateFromFile($xmlfile);
     if ($_REQUEST['camila_xml2pdf_checklist_options_0'] != 'y') {
         $format = camila_get_locale_date_adodb_format();
         $text = date($format);
         $t->setVariable(camila_get_translation('camila.export.template.date'), isUTF8($text) ? utf8_decode($text) : $text, true);
         $text = date($format . ' H:i');
         $t->setVariable(camila_get_translation('camila.export.template.timestamp'), isUTF8($text) ? utf8_decode($text) : $text, true);
     }
     $i = 0;
     while (isset($this->element[$i])) {
         $page_element = $this->element[$i];
         switch ($page_element->get_elementtype()) {
             case HAW_FORM:
                 $i = 0;
                 while (isset($page_element->element[$i])) {
                     $form_element = $page_element->element[$i];
                     $form_fieldname = substr($form_element->name, strlen($_CAMILA['datagrid_form']->name) + 1);
                     $form_label = $_CAMILA['datagrid_form']->fields[$form_fieldname]->title;
                     switch ($form_element->get_elementtype()) {
                         //case HAW_IMAGE:
                         //case HAW_RADIO:
                         //case HAW_RULE:
                         case HAW_HIDDEN:
                         case HAW_INPUT:
                         case HAW_TEXTAREA:
                             $text = html_entity_decode($form_element->value);
                             for ($ii = 0; $ii < $form_element->br - 1; $ii++) {
                                 $text .= "\n";
                             }
                             $t->setVariable($form_element->label, isUTF8($text) ? utf8_decode($text) : $text, true);
                             $t->setVariable($form_label, isUTF8($text) ? utf8_decode($text) : $text, true);
                             break;
                         case HAW_SELECT:
                             foreach ($form_element->options as $key => $value) {
                                 if ($value['value'] == $form_element->value) {
                                     $text = $value['label'];
                                 }
                             }
                             $text = html_entity_decode($text);
                             $t->setVariable($form_element->label, isUTF8($text) ? utf8_decode($text) : $text, true);
                             $t->setVariable($form_label, isUTF8($text) ? utf8_decode($text) : $text, true);
                             break;
                         case HAW_CHECKBOX:
                             if (!$form_element->is_checked()) {
                                 break;
                             }
                             //$text = html_entity_decode($form_element->label);
                             $nl = 1;
                             if ($form_element->br > 0) {
                                 $nl = $form_element->br;
                             }
                             for ($ii = 0; $ii < $nl; $ii++) {
                                 $text .= "\n";
                             }
                             $t->setVariable($form_element->name, isUTF8($text) ? utf8_decode($text) : $text, true);
                             $t->setVariable($form_label, isUTF8($text) ? utf8_decode($text) : $text, true);
                             break;
                         case HAW_PLAINTEXT:
                             break;
                     }
                     $i++;
                 }
                 $t->addBlock('form');
                 break;
             case HAW_PLAINTEXT:
                 if ($this->element[$i]->text == camila_get_translation('camila.nodatafound') && $_CAMILA['datagrid_nodata'] == 1) {
                     $rowsperpage = 0;
                     if ($t->blockExists('row1')) {
                         $rowsperpage = 1;
                         while ($t->blockExists('row' . ($rowsperpage + 1))) {
                             $rowsperpage++;
                         }
                         if ($rowsperpage > 0) {
                             for ($ii = 0; $ii < $rowsperpage; $ii++) {
                                 $t->addBlock('row' . ($ii + 1));
                             }
                             $t->addBlock('table');
                         }
                     }
                 }
                 break;
             case HAW_LINK:
                 $link = $this->element[$i];
                 for ($ii = 0; $ii < $link->br; $ii++) {
                     $suffix .= "\n";
                 }
                 //$this->pdf_text(isUTF8($link->label) ? utf8_decode($link->label).$suffix : $link->label.$suffix);
                 break;
             case HAW_TABLE:
                 $table = $this->element[$i];
                 $cols = array();
                 $rowsperpage = 0;
                 $rownum = 1;
                 $pagnum = 1;
                 $multitable = false;
                 if ($t->blockExists('row1')) {
                     $multitable = true;
                     $rowsperpage = 1;
                     while ($t->blockExists('row' . ($rowsperpage + 1))) {
                         $rowsperpage++;
                     }
                 }
                 if ($_REQUEST['camila_xml2pdf_checklist_options_0'] != 'y') {
                     $row = $table->row[0];
                     for ($b = 0; $b < $row->number_of_columns; $b++) {
                         $column = $row->column[$b];
                         $cols[$b] = strtolower($column->text);
                     }
                     $t->setVariable(camila_get_translation('camila.xml2pdf.table.totalrows'), intval($table->number_of_rows) - 1);
                     for ($a = 1; $a < $table->number_of_rows; $a++) {
                         $row = $table->row[$a];
                         for ($b = 0; $b < $row->number_of_columns; $b++) {
                             $column = $row->column[$b];
                             if (is_object($column) && $column->get_elementtype() == HAW_PLAINTEXT) {
                                 $text = $column->get_text();
                             }
                             if (is_object($column) && $column->get_elementtype() == HAW_LINK) {
                                 $text = $column->get_label();
                             }
                             $t->setVariable($cols[$b], isUTF8($text) ? utf8_decode($text) : $text, true);
                             $t->setVariable(camila_get_translation('camila.xml2pdf.table.row.num'), $a);
                         }
                         if (!$multitable) {
                             $t->addBlock('row');
                         } else {
                             $t->addBlock('row' . $rownum);
                         }
                         $rownum++;
                         if ($rownum > $rowsperpage) {
                             $rownum = 1;
                             $pagnum++;
                             $t->addBlock('table');
                         }
                     }
                     if (!$multitable || $rownum > 1 && $rownum <= $rowsperpage || $multitable && $pagnum == 1) {
                         $t->addBlock('table');
                     }
                 } else {
                     if ($rowsperpage > 0) {
                         for ($ii = 0; $ii < $rowsperpage; $ii++) {
                             $t->addBlock('row' . ($ii + 1));
                         }
                         $t->addBlock('table');
                     }
                 }
                 $a = 1;
                 $row = $table->row[$a];
                 for ($b = 0; $b < $row->number_of_columns; $b++) {
                     $column = $row->column[$b];
                     if (is_object($column) && $column->get_elementtype() == HAW_PLAINTEXT) {
                         $text = $column->get_text();
                     }
                     if (is_object($column) && $column->get_elementtype() == HAW_LINK) {
                         $text = $column->get_label();
                     }
                     $t->setVariable($cols[$b], isUTF8($text) ? utf8_decode($text) : $text, true);
                     $t->setVariable(camila_get_translation('camila.xml2pdf.table.row.num'), $a);
                 }
                 break;
         }
         $i++;
     }
     $t->generateOutputToString($xml);
     $obj = new Xml2Pdf($xml);
     $pdf = $obj->render();
     $pdf->Output($this->title . '.pdf', 'D');
 }
Example #20
0
   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/header.php';
if (!CAMILA_FM_AJAXPLORER_ENABLED) {
    require CAMILA_DIR . 'datagrid/fs_report.class.php';
    global $_CAMILA;
    if ($_CAMILA['adm_user_group'] != CAMILA_ADM_USER_GROUP) {
        $report = new fs_report(CAMILA_FM_ROOTDIR, CAMILA_FM_EXTFS_ENABLED, $_CAMILA['adm_user_group'], camila_get_translation('camila.documents'), 'name', 'asc', false, false, false, false);
    } else {
        if ($_CAMILA['adm_user_group'] == CAMILA_ADM_USER_GROUP) {
            $report = new fs_report(CAMILA_FM_ROOTDIR, CAMILA_FM_EXTFS_ENABLED, $_CAMILA['adm_user_group'], camila_get_translation('camila.documents'), 'name', 'asc');
        }
    }
    $report->process();
    $report->draw();
    require '../camila/footer.php';
    exit;
} else {
    /**
     * Copyright 2007-2009 Charles du Jeu
     * This file is part of AjaXplorer.
     * The latest code can be found at http://www.ajaxplorer.info/
     * 
     * This program is published under the LGPL Gnu Lesser General Public License.
     * You should have received a copy of the license along with AjaXplorer.
     * 
Example #21
0
function camila_parse_default_expression($expression, $id, $dataImport = false)
{
    global $_CAMILA;
    if ($dataImport == true && $expression == camila_get_translation('camila.date.today')) {
        return $_CAMILA['db']->BindTimeStamp(gmdate("Y-m-d", time()));
    }
    if ($dataImport == true && $expression == camila_get_translation('camila.time.now')) {
        return $_CAMILA['db']->BindTimeStamp(gmdate("Y-m-d H:i:s", time()));
    }
    if ($dataImport == true && $expression == camila_get_translation('camila.worktable.field.default.lastval')) {
        return '';
    }
    require_once CAMILA_LIB_DIR . 'minitemplator/MiniTemplator.class.php';
    $ttemp = new MiniTemplator();
    $ttemp->setTemplateString($expression);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.id'), $id, true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.j'), date('j'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.d'), date('d'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.z'), date('z'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.W'), date('W'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.dayoftheweek'), camila_get_translation('camila.week.day.' . date('w')), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.month'), camila_get_translation('camila.month.' . date('n')), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.n'), date('n'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.m'), date('m'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.y'), date('y'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.Y'), date('Y'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.g'), date('g'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.h'), date('h'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.G'), date('G'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.H'), date('H'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.i'), date('i'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.s'), date('s'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.A'), date('A'), true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.login'), $_CAMILA['user'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.name'), $_CAMILA['user_name'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.surname'), $_CAMILA['user_surname'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib01'), $_CAMILA['user_attrib_01'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib02'), $_CAMILA['user_attrib_02'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib03'), $_CAMILA['user_attrib_03'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib04'), $_CAMILA['user_attrib_04'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib05'), $_CAMILA['user_attrib_05'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib06'), $_CAMILA['user_attrib_06'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib07'), $_CAMILA['user_attrib_07'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib08'), $_CAMILA['user_attrib_08'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib09'), $_CAMILA['user_attrib_09'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib10'), $_CAMILA['user_attrib_10'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib11'), $_CAMILA['user_attrib_11'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib12'), $_CAMILA['user_attrib_12'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib13'), $_CAMILA['user_attrib_13'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib14'), $_CAMILA['user_attrib_14'], true);
    $ttemp->setVariable(camila_get_translation('camila.worktable.field.default.user.attrib15'), $_CAMILA['user_attrib_15'], true);
    $dir = CAMILA_TMPL_DIR . '/' . $_CAMILA['lang'] . '/';
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if (substr($file, -4) == '.txt') {
                $ttemp->setVariable(substr($file, 0, -4), file_get_contents($dir . $file), true);
            }
        }
        closedir($dh);
    }
    $ttemp->generateOutputToString($expression);
    return $expression;
}
Example #22
0
/* This File is part of Camila PHP Framework
   Copyright (C) 2006-2009 Umberto Bresciani
   
   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/header.php';
camila_logout();
$text = new CHAW_text(camila_get_translation('camila.logout.successful'), HAW_TEXTFORMAT_BOLD);
$text->set_br(2);
$_CAMILA['page']->add_text($text);
$text = new CHAW_text(camila_get_translation('camila.logout.redirect1'), HAW_TEXTFORMAT_ITALIC);
$_CAMILA['page']->add_text($text);
$text = new CHAW_text(camila_get_translation('camila.logout.redirect2'), HAW_TEXTFORMAT_ITALIC);
$text->set_br(0);
$_CAMILA['page']->add_text($text);
$myLink = new CHAW_link(camila_get_translation('camila.clickhere'), CAMILA_HOME);
$_CAMILA['page']->add_link($myLink);
$_CAMILA['page']->set_redirection(3, CAMILA_HOME);
require '../camila/footer.php';
 function _checkboxes($processing)
 {
     global $_CAMILA;
     $sql2 = 'select ' . $this->bkey . ',' . $this->value_field . ' from ' . $this->intertable . ' where ' . $this->akey . '=\'' . $this->form->fields[$this->formkey]->value . '\'';
     $res2 = $_CAMILA['db']->GetAssoc($sql2);
     if ($res2 === false) {
         camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
     }
     $_CAMILA['db']->SetFetchMode(ADODB_FETCH_ASSOC);
     $result = $_CAMILA['db']->Execute($this->query);
     if ($result === false) {
         camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
     }
     $count = 0;
     while (!$result->EOF) {
         if (!$processing && array_key_exists($result->fields[$this->key_field], $res2) || $processing && $_REQUEST[$this->key][$result->fields[$this->key_field]] != '') {
             $this->checked++;
             if ($processing) {
                 $myCheckbox = new CHAW_input($this->key . '[' . $result->fields[$this->key_field] . ']', $_REQUEST[$this->key][$result->fields[$this->key_field]], $result->fields[$this->label_field]);
             } else {
                 $myCheckbox = new CHAW_input($this->key . '[' . $result->fields[$this->key_field] . ']', $res2[$result->fields[$this->key_field]], $result->fields[$this->label_field]);
             }
         } else {
             $myCheckbox = new CHAW_input($this->key . '[' . $result->fields[$this->key_field] . ']', '', $result->fields[$this->label_field]);
         }
         $this->checklist_values[$result->fields[$this->key_field]] = $result->fields[$this->value_field];
         $this->checklist_checkboxes[$count] = $myCheckbox;
         $count++;
         $result->MoveNext();
     }
     $this->_checkboxes_loaded = true;
 }
Example #24
0
 function process()
 {
     if ($this->updatable && isset($_REQUEST[$this->key])) {
         $this->value = str_replace(camila_get_translation('camila.decimal.separator'), '.', $_REQUEST[$this->key]);
     }
 }
Example #25
0
 function validate()
 {
     if (!$this->updatable || strpos(strtolower($this->validation), 'ignore') !== false) {
         return true;
     }
     if (strpos(strtolower($this->validation), 'uppercase') !== false) {
         $this->value = $this->strtoupper_utf8($this->value);
     }
     if (strpos(strtolower($this->validation), 'lowercase') !== false) {
         $this->value = $this->strtolower_utf8($this->value);
     }
     if (strpos(strtolower($this->validation), 'ucwords') !== false) {
         $this->value = ucwords($this->value);
     }
     if (strpos(strtolower($this->validation), 'ucwordsforce') !== false) {
         $this->value = ucwords(strtolower($this->value));
     }
     if (strpos(strtolower($this->validation), 'ucfirst') !== false) {
         $this->value = ucfirst($this->value);
     }
     if (strpos(strtolower($this->validation), 'ucfirstforce') !== false) {
         $this->value = ucfirst(strtolower($this->value));
     }
     if ($this->required && strpos(strtolower($this->validation), 'fit') !== false) {
         $this->form->validator->length($this->field, '=', $this->maxlength);
     }
     if ($this->required) {
         $this->form->validator->filledIn($this->field);
     }
     if (strpos(strtolower($this->validation), 'unique') !== false) {
         if ($this->value != '') {
             global $_CAMILA;
             $sess = $_REQUEST['camila_update'];
             if ($sess == '') {
                 $sess = $_REQUEST[$this->form->table . '_sess_key'];
             }
             $stmt = '';
             if ($sess != 'new') {
                 $ar = unserialize($sess);
                 reset($this->form->keys);
                 $i = 0;
                 while ($akey = each($this->form->keys)) {
                     $stmt .= ' AND ';
                     $k = trim($this->form->keys[$i]);
                     $v = $ar['camilakey_' . $k];
                     $stmt .= $k . ' <> ' . $_CAMILA['db']->Quote($v);
                     $i++;
                 }
             }
             $query = 'select * from ' . $this->form->table . ' where ' . $this->field . '=' . $_CAMILA['db']->Quote($this->value) . $stmt;
             $result = $_CAMILA['db']->Execute($query);
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             if ($result->RecordCount() > 0) {
                 $this->form->validator->setError($this->field, 907);
             }
         }
     }
 }
Example #26
0
<?php

/* This File is part of Camila PHP Framework
   Copyright (C) 2006-2009 Umberto Bresciani

   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/header.php';
$query = 'SELECT url,short_title FROM ' . CAMILA_TABLE_PAGES . ', ' . CAMILA_TABLE_PLANG . ' WHERE (' . CAMILA_TABLE_PAGES . '.url = ' . CAMILA_TABLE_PLANG . '.page_url) and level>=' . $_CAMILA[user_level] . ' AND visible=' . $_CAMILA['db']->qstr('yes') . ' AND active=' . $_CAMILA['db']->qstr('yes') . ' and parent=' . $_CAMILA['db']->qstr($_CAMILA['page_url']) . " and lang=" . $_CAMILA['db']->qstr($_CAMILA['lang']) . " ORDER by label_order";
$result = $_CAMILA['db']->Execute($query);
if ($result === false) {
    camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
}
while (!$result->EOF) {
    $link = new CHAW_link($result->fields['short_title'], $result->fields['url']);
    $_CAMILA['page']->add_link($link);
    $result->MoveNext();
}
require '../camila/footer.php';
Example #27
0
<?php

/* This File is part of Camila PHP Framework
   Copyright (C) 2006-2009 Umberto Bresciani

   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/header.php';
if (CAMILA_USER_CAN_CHANGE_PWD) {
    require_once CAMILA_DIR . "datagrid/db_form.class.php";
    require_once CAMILA_DIR . "datagrid/elements/form/password_change.php";
    $form = new dbform(CAMILA_TABLE_USERS, 'id');
    new form_password_change($form, 'password', camila_get_translation('camila.form.password'));
    $form->keyvalue = array(intval($_CAMILA['user_id']));
    $form->process();
    $form->draw();
}
require '../camila/footer.php';
Example #28
0
 function _editcolumns()
 {
     global $_CAMILA;
     $form = new CHAW_form($_SERVER['PHP_SELF']);
     foreach ($_REQUEST as $key => $value) {
         if (!is_array($value)) {
             $myInput = new CHAW_hidden($key, $value);
             if ($key == 'camila_editcols' || substr($key, 0, 1) == 'f' && $value == 'y') {
                 $export_format = $key;
             } else {
                 $form->add_input($myInput);
             }
         } else {
             foreach ($value as $k => $v) {
                 $myInput = new CHAW_hidden($key . '[' . $k . ']', $v);
                 $form->add_input($myInput);
             }
         }
     }
     $select_all = new CHAW_js('<div class="camilacheckall" id="camilacheckall"><a id="CheckAll_' . $this->key . '" href="">' . camila_get_translation('camila.form.checkall') . '</a> ' . camila_get_translation('camila.form.checkallseparator') . ' <a id="UncheckAll_' . $this->key . '" href="">' . camila_get_translation('camila.form.uncheckall') . '</a></div>');
     $form->add_userdefined($select_all);
     $arr = unserialize($_COOKIE[$this->editcolumscookiename]);
     if ($_COOKIE[$this->editcolumscookiename] == '' || count($arr) > 0 && $arr[$b] == 'f' . $b) {
         $new_stmt .= $this->stmtfields[$a] . ',';
         $count++;
     }
     for ($a = 0; $a < $this->stmtnumoffields; $a++) {
         $b = $a + 1;
         if ($_COOKIE[$this->editcolumscookiename] == '') {
             if (isset($_REQUEST['f' . $b]) && $_REQUEST['f' . $b] == 'y' || in_array('f' . $b, $_REQUEST['camila_f']) || isset($_REQUEST['camila_f' . $b]) && $_REQUEST['camila_f' . $b] == 'y') {
                 $myCheckbox = new CHAW_checkbox('camila_f' . '[' . $b . ']', 'f' . $b, $this->map($this->stmtfields[$a]), HAW_SELECTED);
             } else {
                 $myCheckbox = new CHAW_checkbox('camila_f' . '[' . $b . ']', 'f' . $b, $this->map($this->stmtfields[$a]));
             }
             if ($b % 2 != 0) {
                 $myCheckbox->set_br(0);
             }
             $myCheckbox->cols = 2;
         } else {
             $arr = unserialize($_COOKIE[$this->editcolumscookiename]);
             if ($arr[$b] == 'f' . $b) {
                 $myCheckbox = new CHAW_checkbox('camila_f' . '[' . $b . ']', 'f' . $b, $this->map($this->stmtfields[$a]), HAW_SELECTED);
             } else {
                 $myCheckbox = new CHAW_checkbox('camila_f' . '[' . $b . ']', 'f' . $b, $this->map($this->stmtfields[$a]));
             }
             if ($b % 2 != 0) {
                 $myCheckbox->set_br(0);
             }
             $myCheckbox->cols = 2;
         }
         $form->add_checkbox($myCheckbox);
     }
     $myHidden = new CHAW_hidden('count', $count);
     $form->add_hidden($myHidden);
     $text = new CHAW_text('');
     $text->set_br(2);
     $form->add_text($text);
     $theSubmission = new CHAW_submit('Ok', 'camila_save');
     $form->add_submit($theSubmission);
     $_CAMILA['page']->add_form($form);
 }
Example #29
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;
Example #30
0
$myForm->add_hidden($hidden);
$hidden = new CHAW_hidden("camila_redirect", basename($_SERVER['PHP_SELF']));
if ($_SERVER['QUERY_STRING'] != '') {
    $hidden = new CHAW_hidden('camila_redirect', basename($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']));
}
if (basename($_SERVER['PHP_SELF']) != CAMILA_LOGIN_HOME) {
    $myForm->add_hidden($hidden);
}
$text = new CHAW_text('');
$myForm->add_text($text);
$cognome = new CHAW_input('username', CAMILA_ANON_USER, camila_get_translation('camila.login.username'));
$cognome->set_size(20);
$cognome->set_maxlength(20);
$myForm->add_input($cognome);
$thePW1 = new CHAW_input('pwd', CAMILA_ANON_USER, camila_get_translation('camila.login.password'));
$thePW1->set_size(CAMILA_PASSWORD_LENGTH);
$thePW1->set_maxlength(CAMILA_PASSWORD_LENGTH);
$thePW1->set_type(HAW_INPUT_PASSWORD);
$myForm->add_input($thePW1);
if (isset($_REQUEST['output']) && $_REQUEST['output'] != '') {
    $o = new CHAW_hidden('output', $_REQUEST['output']);
    $myForm->add_hidden($o);
}
$thePW4 = new CHAW_hidden('js', '');
$myForm->add_hidden($thePW4);
$code = "<script>document.forms[0].js.value = 'enabled';</script>";
$js = new CHAW_js($code, true);
$myForm->add_userdefined($js);
$theSubmission = new CHAW_submit(camila_get_translation('camila.login.renewsession'), 'submit');
$myForm->add_submit($theSubmission);
$_CAMILA['page']->add_form($myForm);