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 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); } } } }
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); } } } }
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); } } }
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); } }
public function __construct($name, $caption, $value = NULL) { parent::__construct($name, $caption, 1); $this->input->type = 'checkbox'; if ($value) { $this->input->checked = "checked"; } }
function validate() { if (!$this->updatable || strpos(strtolower($this->validation), 'ignore') !== false) { return true; } parent::validate(); if ($this->value != '' and $this->maxchars > 0) { $this->form->validator->length($this->field, '<=', $this->maxchars); } }
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; }
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 validate() { parent::validate(); $ar = explode('.', $this->value); $count = 0; foreach ($ar as $val) { $strlen = strlen($val); if ($strlen > 0) { if (!preg_match("/^[0-9]{" . $strlen . "}\$/", $val)) { $this->form->validator->setError($this->field, 908); } } $count++; } if ($count > 2) { $this->form->validator->setError($this->field, 908); } }
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); }
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 validate() { parent::validate(); if ($this->value != '') { global $_CAMILA; $query = 'select password from ' . CAMILA_TABLE_USERS . ' where id=' . $_CAMILA['db']->Quote($_CAMILA['user_id']); $result = $_CAMILA['db']->Execute($query); if ($result === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg()); } if ($result->RecordCount() == 1) { if ($result->fields['password'] != $_REQUEST[$this->key . '_old']) { $this->form->validator->setError($this->field, 910); } } else { $this->form->validator->setError($this->field, 910); } } if ($_REQUEST[$this->key . '_confirm'] != $this->value) { $this->form->validator->setError($this->field, 911); } }
public function __construct($name, $value = NULL) { parent::__construct($name, '', $value); $this->input->type = 'hidden'; }
public function __construct($name) { parent::__construct($name); $this->attrs['type'] = 'text'; $this->autocomplete = true; }
function validate() { global $_CAMILA; $fmt = ''; $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] = 'mm'; $f[$d] = 'dd'; $f[$y] = 'yyyy'; ksort($f); reset($f); $count = 0; while (list($k, $v) = each($f)) { $fmt .= $v; if ($count < 2) { $fmt .= camila_get_translation('camila.dateformat.separator'); } $count++; } if ($this->value != '') { if ($this->form->validator->date($this->field, $fmt)) { $mm = substr($this->value, camila_get_translation('camila.dateformat.monthpos'), 2); $dd = substr($this->value, camila_get_translation('camila.dateformat.daypos'), 2); $yyyy = substr($this->value, camila_get_translation('camila.dateformat.yearpos'), 4); $this->value = $_CAMILA['db']->BindTimeStamp($yyyy . '-' . $mm . '-' . $dd . ' ' . $this->value_hour . ':' . $this->value_minute . ':00'); } } parent::validate(); }
public function __construct($name, $caption, $value = NULL) { parent::__construct($name, $caption, $value); $this->input->type = 'text'; }
function validate() { parent::validate(); if (is_array($this->uploaderrors)) { foreach ($this->uploaderrors as $key => $value) { if ($this->uploaderrors[$key] == null) { continue; } $this->form->validator->setError($this->field, $this->uploaderrors[$key]); } } }
function validate() { $fmt = ''; $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] = 'mm'; $f[$d] = 'dd'; $f[$y] = 'yyyy'; ksort($f); reset($f); $count = 0; while (list($k, $v) = each($f)) { $fmt .= $v; if ($count < 2) { $fmt .= camila_get_translation('camila.dateformat.separator'); } $count++; } if ($this->value != '') { if ($this->form->validator->date($this->field, $fmt)) { $mm = substr($this->value, camila_get_translation('camila.dateformat.monthpos'), 2); $dd = substr($this->value, camila_get_translation('camila.dateformat.daypos'), 2); $yyyy = substr($this->value, camila_get_translation('camila.dateformat.yearpos'), 4); $this->value = date('Y-m-d', mktime(0, 0, 0, $mm, $dd, $yyyy)); } } parent::validate(); }
function validate() { if (!$this->updatable || strpos(strtolower($this->validation), 'ignore') !== false) { return true; } parent::validate(); $found = false; reset($this->options); while ($tok = each($this->options)) { $curr = isUTF8($tok[1][0]) ? $tok[1][0] : utf8_encode($tok[1][0]); if ($curr == $this->value) { $found = true; } } if (!$found) { $this->form->validator->setError($this->field, 901); } }