public function preprocess()
 {
     $fname = 'form_' . $this->name;
     if (isset($_POST[$fname . '-input'])) {
         $v = isset($this->row->call->preprocess) ? xform_helper::evaluate_method($this->row, 'preprocess') : $_POST[$fname . '-input'];
         $this->form->set_post($fname, $v);
     }
 }
Ejemplo n.º 2
0
$default = '';
$selection = array();
if ($row->choose and $row->choose == true) {
    $selection[] = 'Choose ' . $row->field;
}
if (isset($row->value) and count($row->value->children())) {
    foreach ($row->value->children() as $c) {
        $key = (string) $c->value;
        $option = (string) $c->title;
        $selection[$key] = $option;
        if ($key == $o->cval or isset($c['default']) and $c['default'] and trim($o->cval) == '') {
            $default = $key;
        }
    }
} else {
    if ($select = xform_helper::evaluate_method($row)) {
        foreach ($select as $key => $option) {
            if (is_object($option)) {
                $key = $option->id;
                $option = $option->title;
            }
            $selection[$key] = $option;
            if ($key == $o->cval or isset($row->default) and $row->default == $key) {
                $default = $key;
            }
        }
    }
}
$atts = array('name' => $o->form_name . $o->group_id, 'id' => $o->form->name . '-' . $o->name, 'class' => $row->class);
?>
<span><?php 
Ejemplo n.º 3
0
 /**
  * show the row
  *
  * @param boolean $submitted : has the form been submitted?
  * @return void
  * @author Andy Bennett
  */
 public function render()
 {
     // $this->init();
     $submitted = $this->form->submitted;
     $n = $this->name;
     $e = $n . '_error';
     // check there is a valid row type
     if (!isset($this->row->type) || (string) $this->row->type == '') {
         throw new Exception("Type must be supplied");
     }
     $type = (string) $this->row->type;
     $errors = $this->form->post->errors();
     if (is_object($this->validation)) {
         $errors = array_merge($errors, $this->validation->errors());
     }
     $post_val = $this->form->post($this->form_name);
     if (is_array($post_val) && isset($post_val[$this->gid])) {
         $post_val = $post_val[$this->gid];
     }
     // if submitted CVAL = the value from the validation system
     // otherwise if there is a current value, use that
     // otherwise use the row value
     $this->cval = $submitted && !isset($errors[$this->form_name]) ? $post_val : (!is_null($this->current) ? $this->current : (isset($row->call) ? xform_helper::evaluate_method($row) : $this->row->value));
     $data = array('o' => $this, 'ename' => $e, 'row' => $this->row, 'rownum' => $this->rownum);
     // does 'row' exist? if so display it
     if (Kohana::find_file('views/xformrow/' . $type, 'row', false, 'php')) {
         View::factory('xformrow/' . $type . '/row', $data)->render(TRUE);
     } else {
         // otherwise use default 'row'
         $data['item'] = View::factory('xformrow/' . $type . '/content', $data)->render();
         View::factory('xformrow/row', $data)->render(TRUE);
     }
 }
Ejemplo n.º 4
0
<?php

$dates = xform_helper::create_dates();
echo form::dropdown($o->form_name . '_day' . $o->group_id, $dates['days'], date("d", strtotime($o->cval)), 'class="date-dropdown"');
echo form::dropdown($o->form_name . '_month' . $o->group_id, $dates['months'], date("m", strtotime($o->cval)), 'class="date-dropdown"');
echo form::dropdown($o->form_name . '_year' . $o->group_id, $dates['years'], date("Y", strtotime($o->cval)), 'class="date-dropdown"');
echo $o->get_error($o->name);