function get_body_tag() { $my_table = new OrTable('db_' . $this->OP_[id]->get()); $my_table->OP_[align_table]->set('center'); $my_table->OP_[class_name]->set('tbl_body'); $my_col = 0; $control_count = 0; $form_col = $this->OP_[column]->get(); /** * หาจำนวนช่องข้อมูลทั้งหมด เพื่อใช้กำหนด Column Row ให้ถูกต้อง */ foreach ($this->controls as $id => $control) { if ($control->OP_[auto_visible]->get()) { $control_count++; } } $my_row = ceil($control_count / $form_col); foreach ($this->controls as $id => $control) { if ($control->OP_[auto_visible]->get()) { if ($control->OP_[type]->get() != 'hidden' and $control->OP_[id]->get() != 'sec_user') { $my_col++; $control_count--; $my_table->set_col($control->OP_[caption]->get(), "td_caption"); $this->set_class_name($id); if ($my_row == 1 && $control_count == 1) { $colspan = $form_col * 2 - $my_col; $my_table->set_join_cells($control->get_tag() . $control->OP_[description]->get(), $colspan, 0, "td_data"); } else { $my_table->set_col($control->get_tag() . $control->OP_[description]->get(), "td_data"); } if ($my_col >= $form_col) { $my_table->set_row('tr_body'); $my_row--; $my_col = 0; } } } } /** ตรวจสอบจำนวน column ว่าครบหรือไม่ เพื่อแก้ไขปัญหา ไม่โชว์บรรทัดสุดท้าย* */ if ($my_col > 0) { $my_table->set_row('tr_body'); $my_col = 0; } return $my_table->get_tag(); }
function get_form_query() { $my_table = new OrTable('table_query'); $my_table->OP_[align_table]->set('center'); $my_table->OP_[class_name]->set('tbl_query_body'); $my_table->set_col($this->get_button_filter()); $my_table->set_col('เงื่อนไข '); $my_table->set_col(' ค่าที่ค้นหา '); $my_table->set_row(); foreach ($this->caption_fields as $caption => $id) { if (!is_object($this->filter_controls[$id])) { $this->set_filter_controls(new OrTextbox($id)); } $my_compare = new OrSelectbox('val_compare_' . $id . '_', 'val_compare[' . $id . ']'); $my_compare->OP_[option]->set(array('=' => '=', '<>' => '<>', '>=' => '>=', '<=' => '<=', 'BETWEEN' => 'BETWEEN', 'LIKE' => 'LIKE', 'IN' => 'IN')); $my_compare->OP_[default_value]->set($this->get_filter_compare($id)); //สร้าง Function เพื่อค้นหาค่า Default compare $my_compare->OP_[auto_post]->set(true); //$my_table->set_col($my_control->OP_[caption]->get() , "td_caption"); debug_mode(__FILE__, __LINE__, $this->filter_controls[$id]->OP_[caption]->get(), 'Filter_controls'); $my_table->set_col($this->filter_controls[$id]->OP_[caption]->get(), "td_query_caption"); $my_table->set_col($my_compare->get_tag(), "td_query_compare"); $my_table->set_col($this->filter_controls[$id]->get_tag(), "td_query_value"); $my_table->set_row('tr_query_body'); } $my_table->set_col('ค้นคำ เรียงลำดับ'); $my_table->set_col($this->get_control_filter()); $my_table->set_col($this->get_control_order()); $my_table->set_row(); return $my_table->get_tag(); }