function draw(&$form)
 {
     parent::draw($form);
     if (!$this->_checkboxes_loaded) {
         $this->_checkboxes(false);
     }
     if ($this->form->noproc) {
         $this->_checkboxes(true);
     }
     $text = new CHAW_text($this->title . $this->labelseparator);
     $text->set_br(1);
     if (!empty($this->title)) {
         $form->add_text($text);
     }
     $count = 0;
     foreach ($this->checklist_checkboxes as $index => $checkbox) {
         if ($this->updatable) {
             $count++;
             if ($count % $this->cols != 0) {
                 $checkbox->set_br(0);
             }
             $form->add_input($checkbox);
         } else {
             if ($checkbox->value > 0) {
                 $myText = new CHAW_text($checkbox->label . $this->labelseparator . ' ' . $checkbox->value);
                 $form->add_text($myText);
             }
         }
     }
 }
Beispiel #2
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);
     }
 }
Beispiel #3
0
 function draw(&$form)
 {
     parent::draw($form);
     global $_CAMILA;
     $tDate = '';
     $tFormat = '';
     $fmt = '';
     $fmt2 = '';
     $f = array();
     $m = camila_get_translation('camila.dateformat.monthpos');
     $d = camila_get_translation('camila.dateformat.daypos');
     $y = camila_get_translation('camila.dateformat.yearpos');
     $f[$m] = 'm';
     $f[$d] = 'd';
     $f[$y] = 'Y';
     ksort($f);
     reset($f);
     $count = 0;
     while (list($k, $v) = each($f)) {
         $fmt .= $v;
         $fmt2 .= '%' . $v;
         $tFormat .= camila_get_translation('camila.dateformat.placeholder.' . $v);
         if ($count < 2) {
             $fmt .= camila_get_translation('camila.dateformat.separator');
             $fmt2 .= camila_get_translation('camila.dateformat.separator');
             $tFormat .= camila_get_translation('camila.date.separator');
         }
         $count++;
     }
     if ($this->value != '' && $this->value != '0000-00-00') {
         $tDate = $_CAMILA['db']->UserDate($this->value, $fmt);
     } else {
         $this->value = '';
     }
     if ($this->updatable) {
         $myInput = new CHAW_input($this->key, $tDate, $this->title . ' (' . $tFormat . ')' . $this->labelseparator);
         if ($this->maxlength > 0) {
             $myInput->set_maxlength($this->maxlength);
         }
         if ($this->size > 0) {
             $myInput->set_size($this->size);
         }
         $myInput->set_br(1);
         $form->add_input($myInput);
         global $_CAMILA;
         $code = '<link rel="stylesheet" type="text/css" media="all" href="' . CAMILA_LIB_DIR . 'jscalendar/' . $this->calendar_theme_file . '" />';
         $code .= '<script src=\'' . CAMILA_LIB_DIR . 'jscalendar/calendar.js\'></script>';
         $code .= '<script src=\'' . CAMILA_LIB_DIR . 'jscalendar/' . $this->calendar_lang_file . '\'></script>';
         $code .= '<script src=\'' . CAMILA_LIB_DIR . 'jscalendar/' . $this->calendar_setup_file . '\'></script>';
         $_CAMILA['page']->camila_add_js($code, 'jscalendar');
         $code = '<script>xParent(\'' . $this->key . '\',true).removeChild(xNextSib(\'' . $this->key . '\',\'br\'))</script>';
         $js = new CHAW_js($code);
         $form->add_userdefined($js);
         $popup = new CHAW_js("<a href=\"#\" id=\"f-calendar-trigger-" . $this->key . "\"><img src=\"" . CAMILA_LIB_DIR . "jscalendar/img.gif\" alt=\"\" align=\"middle\" border=\"0\"></a><script type=\"text/javascript\">Calendar.setup({\"ifFormat\":\"" . $fmt2 . "\",\"daFormat\":\"" . $fmt2 . "\",\"firstDay\":1,\"showsTime\":false,\"showOthers\":false,\"timeFormat\":12,\"inputField\":\"" . $this->key . "\",\"button\":\"f-calendar-trigger-" . $this->key . "\"});</script>");
         $form->add_userdefined($popup);
     } else {
         $myText = new CHAW_text($this->title . $this->labelseparator . ' ' . $tDate);
         $form->add_text($myText);
     }
 }
 function draw(&$form)
 {
     parent::draw($form);
     reset($this->options);
     if ($this->updatable) {
         $myText = new CHAW_text($this->title . $this->labelseparator);
         $myText->set_br(0);
     } else {
         while ($tok = each($this->options)) {
             //$mySelect->add_option($tok[1][1], $tok[1][0], $selected);
             if ($tok[1][0] == $this->value) {
                 $value = $tok[1][1];
             }
         }
         $myText = new CHAW_text($this->title . $this->labelseparator . ' ' . $value);
     }
     $form->add_text($myText);
     if ($this->updatable) {
         $mySelect = new CHAW_select($this->key);
         while ($tok = each($this->options)) {
             $selected = $tok[1][0] == $this->value ? HAW_SELECTED : HAW_NOTSELECTED;
             $mySelect->add_option($tok[1][1], $tok[1][0], $selected);
         }
         $form->add_select($mySelect);
         $text = new CHAW_text('');
         $form->add_text($text);
     }
 }
 function draw(&$form)
 {
     parent::draw($form);
     if (!$this->_checkboxes_loaded) {
         $this->_checkboxes(false);
     }
     if ($this->form->noproc) {
         $this->_checkboxes(true);
     }
     $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);
     $count = 0;
     foreach ($this->checklist_checkboxes as $index => $checkbox) {
         $checkbox->cols = $this->cols;
         if ($this->updatable) {
             $count++;
             if ($count % $this->cols != 0) {
                 $checkbox->set_br(0);
             }
             $form->add_checkbox($checkbox);
         } else {
             if ($checkbox->is_checked()) {
                 $myText = new CHAW_text($checkbox->label);
                 $form->add_text($myText);
             }
         }
     }
 }
Beispiel #6
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);
     }
 }
 function draw(&$form)
 {
     parent::draw($form);
     global $_CAMILA;
     $code = '<script type="text/javascript" src="' . CAMILA_LIB_DIR . 'tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>';
     $_CAMILA['page']->camila_add_js($code, 'tinymce');
     $code = "<script>";
     $code .= 'tinyMCE.init({' . $this->init . '});';
     $code .= "</script>";
     $_CAMILA['page']->camila_add_js($code);
     $myTextarea = new CHAW_textarea($this->key, $this->value, $this->title . $this->labelseparator, $this->rows, $this->cols);
     $form->add_textarea($myTextarea);
 }
Beispiel #8
0
 function draw(&$form)
 {
     parent::draw($form);
     if (!is_array($this->value)) {
         $myHidden = new CHAW_hidden($this->key, $this->value);
         $form->add_input($myHidden);
     } else {
         foreach ($this->value as $key => $value) {
             $myHidden = new CHAW_hidden($this->key . '[]', $value);
             $form->add_input($myHidden);
         }
     }
 }
 function draw(&$form)
 {
     parent::draw($form);
     if (isset($_REQUEST['camila_print'])) {
         return;
     }
     $text = new CHAW_text('');
     $form->add_text($text);
     if ($form->_collapsible_pending) {
         $form->camila_collapsible_end();
     }
     $form->camila_collapsible_start('db_form', true, $this->text);
     $form->_collapsible_pending = true;
 }
Beispiel #10
0
 function draw(&$form)
 {
     parent::draw($form);
     $value = str_replace('.', camila_get_translation('camila.decimal.separator'), $this->value);
     if ($this->updatable) {
         $myInput = new CHAW_input($this->key, $value, $this->title . $this->labelseparator);
         if ($this->precision + $this->scale > 0) {
             $myInput->set_maxlength($this->precision + $this->scale + 1);
         }
         $form->add_input($myInput);
     } else {
         $myText = new CHAW_text($this->title . $this->labelseparator . ' ' . $value);
         $form->add_text($myText);
     }
 }
 function draw(&$form)
 {
     parent::draw($form);
     global $_CAMILA;
     $code = '<script type="text/javascript" src="' . CAMILA_LIB_DIR . 'editarea/edit_area/edit_area_full.js"></script>';
     $code .= "<script>\n";
     $code .= 'function camila_editarea_save(id, content){xGetElementById(id).value=content; xGetElementById(id).parentNode.submit();}';
     $code .= "</script>\n";
     $_CAMILA['page']->camila_add_js($code, 'editarea');
     $code = "<script>\n";
     $code .= ' camila_addDOMLoadEvent(function(){editAreaLoader.init({id:"' . $this->key . '",' . str_replace("'", "\\'", $this->init) . '})})';
     $code .= "</script>\n";
     $_CAMILA['page']->camila_add_js($code);
     $myTextarea = new CHAW_textarea($this->key, $this->value, $this->title . $this->labelseparator, $this->rows, $this->cols);
     $form->add_textarea($myTextarea);
 }
 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 = $this->_get_select();
     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 draw(&$form)
 {
     parent::draw($form);
     if ($this->form->mode == 'insert') {
         $myInput = new CHAW_input($this->key, $this->value, $this->title . $this->labelseparator);
         if ($this->maxlength > 0) {
             $myInput->set_maxlength($this->maxlength);
         }
         if ($this->size > 0) {
             $myInput->set_size($this->size);
         }
         $form->add_input($myInput);
     } else {
         $myHidden = new CHAW_hidden($this->key, $this->value);
         $form->add_hidden($myHidden);
         $myText = new CHAW_text($this->title . $this->labelseparator . $this->value);
         $form->add_text($myText);
     }
 }
Beispiel #14
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);
 }
Beispiel #15
0
 function draw(&$form)
 {
     parent::draw($form);
     global $_CAMILA;
     if (is_array($this->form->fields[$this->field . '_camilauploaded']->value)) {
         $text = new CHAW_text(camila_get_translation('camila.fm.filealreadyuploaded'));
         $text->set_br(1);
         $form->add_text($text);
     }
     foreach ($this->form->fields[$this->field . '_camilauploaded']->value as $key => $value) {
         if ($this->extfsenabled) {
             $text = new CHAW_text(substr($value, 0, -CAMILA_FM_PREFIX));
         } else {
             $text = new CHAW_text($value);
         }
         //$text = new CHAW_text(fm_name($value, $this->usergroup));
         $text->set_br(1);
         $form->add_text($text);
     }
     $text = new CHAW_text('');
     $text->set_br(1);
     $form->add_text($text);
     $myFile = new CHAW_file($this->key . '[]', $this->title . $this->labelseparator, $this->size, $this->maxsize);
     $myFile->set_br(1);
     //$mySelect = fm_select_group_dir($this->key.'_camiladir[]', $this->usergroup);
     for ($i = 0; $i < 1; $i++) {
         $form->add_userdefined($myFile);
         //    $text = new CHAW_text(camila_get_translation('camila.fm.intofolder') . ': ');
         //    $text->set_br(0);
         //    if ($this->selectuploadfolder) {
         //        $form->add_text($text);
         //$form->add_select($mySelect);
         //        $text = new CHAW_text('');
         //        $text->set_br(0);
         $form->add_text($text);
         //    }
     }
     $text = new CHAW_text(camila_get_translation('camila.fm.maxfilesizeallowed') . ': ' . $this->_convertfilesize(CAMILA_FM_MAX_UPLOAD_SIZE));
     $text->set_br(2);
     $form->add_text($text);
 }
Beispiel #16
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);
 }
 function draw(&$form)
 {
     parent::draw($form);
     $grid_id = $this->key . '_os3grid';
     global $_CAMILA;
     $myText = new CHAW_text($this->title . $this->labelseparator);
     //$form->add_text($myText);
     $_CAMILA['page']->add_text($myText);
     $code = '<link type="text/css" rel="stylesheet" href="' . CAMILA_LIB_DIR . 'os3grid/os3grid.css" />' . "\n";
     $code .= '<script type="text/javascript" src="' . CAMILA_LIB_DIR . 'os3grid/os3grid.js" type=\'text/javascript\'></script>';
     $code .= '<script type="text/javascript" src="' . CAMILA_DIR . 'js/csv.js" type=\'text/javascript\'></script>';
     $_CAMILA['page']->camila_add_js($code, 'os3grid');
     $code = "<div class='camila_toolbar' id='toolbar_1'>";
     $cl = 'class="camilaButtonNormal" onmouseover="camila_switch_class(this,\'camilaButtonOver\');" onmouseout="camila_restore_class(this);" onmousedown="camila_restore_and_switch_class(this,\'camilaButtonDown\');"';
     $code .= "<a id=\"save\" href=\"javascript:camila_os3grid_save('" . $this->key . "_os3grid',true)\" onclick=\"camila_os3grid_save('" . $this->key . "_os3grid',true);return false;\" /><img id=\"os3grid_save\" {$cl} src=\"" . CAMILA_IMG_DIR . "png/disk.png\" border=\"0\"/></a>";
     $code .= "<img src=\"" . CAMILA_IMG_DIR . "png/spacer.png\" class=\"camilaSeparatorLine\" width=\"1\" height=\"15\">";
     $code .= "<a id=\"os3grid_newrow\" href=\"javascript:camila_os3grid_newrow()\" onclick=\"camila_os3grid_newrow();return false;\" /><img id=\"os3grid_newrow\" {$cl} src=\"" . CAMILA_IMG_DIR . "png/table_row_insert.png\" border=\"0\"/></a>";
     $code .= "<a id=\"os3grid_delrows\" href=\"javascript:camila_os3grid_delrows('{$grid_id}')\" onclick=\"camila_os3grid_delrows('{$grid_id}');return false;\" /><img id=\"os3grid_delrows\" {$cl} src=\"" . CAMILA_IMG_DIR . "png/table_row_delete.png\" border=\"0\"/></a>";
     $code .= "</div>";
     $js = new CHAW_js($code);
     //problems with IE
     //$form->add_userdefined($js);
     $_CAMILA['page']->add_userdefined($js);
     $code = "<div id='" . $this->key . "_os3grid'></div>";
     $code .= "<script type='text/javascript'>\nfunction " . $this->key . "_csv_init()\n{var g = new OS3Grid();\n";
     $code .= "camila_os3grid_init(g, '" . $this->key . "');\n";
     global $_CAMILA;
     $filename = CAMILA_TMP_DIR . '/csv_' . $_CAMILA['user_id'];
     // . camila_hash(CAMILA_FM_PREFIX);
     $this->filename = $filename;
     $f = fopen($filename, 'w');
     fwrite($f, $this->value);
     fclose($f);
     $csv =& new csv_bv($this->filename, ',', '"', '\\');
     $csv->SkipEmptyRows(true);
     $csv->TrimFields(false);
     $header = $csv->NextLine();
     $row = '';
     $count = 0;
     $editable = '';
     $newrow .= "os3grid_get_grid('" . $this->key . "_os3grid').add_row(";
     foreach ($header as $key => $value) {
         $row .= "'" . str_replace("'", "\\'", $value) . "',";
         $editable .= "g.set_col_editable({$count}, 'txt');\n";
         $editable .= "g.set_click_cb ({$count}, 'camila_os3grid_col_click_cb(this,\\'" . $this->key . "_os3grid\\')' );\n";
         $newrow .= "'',";
         $count++;
     }
     $newrow = substr($newrow, 0, -1) . ");";
     if ($count > 0) {
         $code2 = "<script type='text/javascript'>\n";
         $code2 .= 'function camila_os3grid_newrow(){' . $newrow . 'os3grid_get_grid(\'' . $this->key . '_os3grid\').render();}';
         $code2 .= "</script>\n";
         $_CAMILA['page']->camila_add_js($code2);
         $code .= "g.set_headers(" . substr($row, 0, -1) . ");\n";
         $code .= $editable;
         $count = 0;
         while ($arr_data = $csv->NextLine()) {
             $row = '';
             $code .= "g.add_row(";
             $count = 0;
             foreach ($arr_data as $key => $value) {
                 $row .= "'" . str_replace("'", "\\'", $value) . "',";
                 $count++;
             }
             $code .= substr($row, 0, -1) . ");\n";
         }
     } else {
         $code2 = "<script  type='text/javascript'>\n";
         $code2 .= 'function camila_os3grid_newrow(){os3grid_get_grid(\'' . $this->key . '_os3grid\').add_row(\'\',\'\',\'\',\'\',\'\');os3grid_get_grid(\'' . $this->key . '_os3grid\').render();}';
         $code2 .= "</script>\n";
         $_CAMILA['page']->camila_add_js($code2);
         $code .= "g.set_headers('A','B','C','D','E');\n";
         $code .= "g.add_row('Doppio click per cambiare il valore','...','...','...','...');\n";
         $code .= "g.set_col_editable(0, 'txt');\n";
         $code .= "g.set_col_editable(1, 'txt');\n";
         $code .= "g.set_col_editable(2, 'txt');\n";
         $code .= "g.set_col_editable(3, 'txt');\n";
         $code .= "g.set_col_editable(4, 'txt');\n";
     }
     $code .= "g.render('" . $this->key . "_os3grid');\n};";
     $code .= ' camila_addDOMLoadEvent(' . $this->key . "_csv_init);</script>";
     $js = new CHAW_js($code);
     //Problems with IE
     //$form->add_userdefined($js);
     $_CAMILA['page']->add_userdefined($js);
     $myHidden = new CHAW_hidden($this->key, $this->value);
     $form->add_hidden($myHidden);
 }
Beispiel #18
0
 function base_draw(&$form)
 {
     parent::draw($form);
 }
Beispiel #19
0
 function draw(&$form)
 {
     parent::draw($form);
     global $_CAMILA;
     $this->tDate = '';
     $this->tFormat = '';
     $fmt = '';
     $fmt2 = '';
     $f = array();
     $m = camila_get_translation('camila.dateformat.monthpos');
     $d = camila_get_translation('camila.dateformat.daypos');
     $y = camila_get_translation('camila.dateformat.yearpos');
     $f[$m] = 'm';
     $f[$d] = 'd';
     $f[$y] = 'Y';
     ksort($f);
     reset($f);
     $count = 0;
     while (list($k, $v) = each($f)) {
         $fmt .= $v;
         $fmt2 .= '%' . $v;
         $this->tFormat .= camila_get_translation('camila.dateformat.placeholder.' . $v);
         if ($count < 2) {
             $fmt .= camila_get_translation('camila.dateformat.separator');
             $fmt2 .= camila_get_translation('camila.dateformat.separator');
             $this->tFormat .= camila_get_translation('camila.date.separator');
         }
         $count++;
     }
     if ($this->value != '') {
         $this->tDate = $_CAMILA['db']->UserTimeStamp($this->value, $fmt);
         $this->value_hour = $_CAMILA['db']->UserTimeStamp($this->value, 'H');
         $this->value_minute = $_CAMILA['db']->UserTimeStamp($this->value, 'i');
     }
     if ($this->updatable && !isset($_REQUEST['camila_inline_field'])) {
         $myInput = new CHAW_input($this->key, $this->tDate, $this->title . ' - Data (' . $this->tFormat . ')' . $this->labelseparator);
         if ($this->maxlength > 0) {
             $myInput->set_maxlength($this->maxlength);
         }
         if ($this->size > 0) {
             $myInput->set_size($this->size);
         }
         $myInput->set_br(1);
         $form->add_input($myInput);
         $code = '<link rel="stylesheet" type="text/css" media="all" href="' . CAMILA_LIB_DIR . 'jscalendar/' . $this->calendar_theme_file . '" />';
         $code .= '<script src=\'' . CAMILA_LIB_DIR . 'jscalendar/calendar.js\' type=\'text/javascript\'></script>';
         $code .= '<script src=\'' . CAMILA_LIB_DIR . 'jscalendar/' . $this->calendar_lang_file . '\'  type=\'text/javascript\'></script>';
         $code .= '<script src=\'' . CAMILA_LIB_DIR . 'jscalendar/' . $this->calendar_setup_file . '\' type=\'text/javascript\'></script>';
         $_CAMILA['page']->camila_add_js($code, 'jscalendar');
         $code = '<script type=\'text/javascript\'>xParent(\'' . $this->key . '\',true).removeChild(xNextSib(\'' . $this->key . '\',\'br\'))</script>';
         $js = new CHAW_js($code);
         $form->add_userdefined($js);
         $popup = new CHAW_js("<a href=\"#\" id=\"f-calendar-trigger-" . $this->key . "\"><img src=\"" . CAMILA_LIB_DIR . "jscalendar/img.gif\" alt=\"\" align=\"middle\" border=\"0\"></a><script type=\"text/javascript\">Calendar.setup({\"ifFormat\":\"" . $fmt2 . "\",\"daFormat\":\"" . $fmt2 . "\",\"firstDay\":1,\"showsTime\":false,\"showOthers\":false,\"timeFormat\":12,\"inputField\":\"" . $this->key . "\",\"button\":\"f-calendar-trigger-" . $this->key . "\"});</script>");
         $form->add_userdefined($popup);
         $myText = new CHAW_text(' Ora' . $this->labelseparator);
         $myText->set_br(0);
         $form->add_text($myText);
         $tok = strtok('00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23', ',');
         while ($tok) {
             $pos = strpos($tok, ';');
             if ($pos === false) {
                 $this->hour_options[] = array($tok, $tok);
             } else {
                 $this->hour_options[] = array(substr($tok, 0, $pos), substr($tok, $pos + 1));
             }
             $tok = strtok(',');
         }
         $mySelect = new CHAW_select($this->key . '_hour');
         while ($tok = each($this->hour_options)) {
             $selected = $tok[1][0] == $this->value_hour ? HAW_SELECTED : HAW_NOTSELECTED;
             $mySelect->add_option($tok[1][1], $tok[1][0], $selected);
         }
         $form->add_select($mySelect);
         $text = new CHAW_text(':');
         $text->set_br(0);
         $form->add_text($text);
         $this->minute_options = array();
         for ($i = 0; $i < 60; $i += 60 / $this->hslots) {
             $this->minute_options[] = array(str_pad($i, 2, '0', STR_PAD_LEFT), str_pad($i, 2, '0', STR_PAD_LEFT));
         }
         $mySelect = new CHAW_select($this->key . '_minute');
         while ($tok = each($this->minute_options)) {
             $selected = $tok[1][0] == $this->value_minute ? HAW_SELECTED : HAW_NOTSELECTED;
             $mySelect->add_option($tok[1][1], $tok[1][0], $selected);
         }
         $form->add_select($mySelect);
         $text = new CHAW_text('');
         $form->add_text($text);
     } elseif (isset($_REQUEST['camila_inline_field'])) {
         $fVal = $this->tDate . ' ' . $this->value_hour . camila_get_translation('camila.time.separator') . $this->value_minute . camila_get_translation('camila.time.separator') . '00';
         $mySelect = new CHAW_select($this->key);
         if ($this->value == '-' || $this->value == '') {
             $mySelect->add_option('-', '-', HAW_SELECTED);
         } else {
             $mySelect->add_option($fVal, $fVal, HAW_SELECTED);
             $mySelect->add_option('-', '-', HAW_NOTSELECTED);
         }
         $now = $_CAMILA['db']->UserTimeStamp(date('Y-m-d H:i:s'), $fmt) . ' ' . date('H') . camila_get_translation('camila.time.separator') . date('i') . camila_get_translation('camila.time.separator') . '00';
         $fVal = $this->tDate . ' ' . $this->value_hour . camila_get_translation('camila.time.separator') . $this->value_minute . camila_get_translation('camila.time.separator') . '00';
         if ($fVal == $now) {
             $mySelect->add_option($now, $now, HAW_SELECTED);
         } else {
             $mySelect->add_option($now, $now, HAW_NOTSELECTED);
         }
         $form->add_select($mySelect);
     } else {
         if ($this->value_hour != '00' || $this->value_minute != '00') {
             $myText = new CHAW_text($this->title . $this->labelseparator . ' ' . $this->tDate . ' - Ore ' . $this->value_hour . camila_get_translation('camila.time.separator') . $this->value_minute);
         } else {
             $myText = new CHAW_text($this->title . $this->labelseparator . ' ' . $this->tDate);
         }
         $form->add_text($myText);
     }
 }