示例#1
0
 function __construct()
 {
     parent::__construct();
     $this->set_skin_ccs("my_form.css");
     /*
      * กำหนดคุณสมบัติของหน้าจอดังนี้
      * $table : ชื่อ Table
      * $sql : คำสั่ง SQL
      * $key : ชื่อ Field ที่เป็น PRIMARY
      */
     $table = 'my_can';
     $sql = 'SELECT * FROM `' . $table . '` ';
     $key = array('sys_id', 'user');
     $my_sec = new OrSec();
     $user_list = $my_sec->get_user_list();
     $sys_list = $my_sec->get_sys_list();
     $clip_sys_id = new OrClip('sys_id');
     $my_form = new OrDbFrmForm('my_form', $this->get_my_db(), $table, $key);
     $my_form->OP_[list_page_url]->set('my_can_list.php');
     //$my_form->OP_[column]->set(2);
     /*
      * สร้าง Control ในฟอร์ม ประกอบด้วย Class ในกลุ่ม GUI
      */
     $my_form->set_controls(new OrDojoTextSearch('sys_id'));
     $my_form->controls[sys_id]->OP_[default_value]->set($clip_sys_id->OP_[value]->get());
     //$my_form->controls[sys_id]->OP_[option]->set($sys_list);
     $my_form->controls[sys_id]->OP_[popup_url]->set('my_sys_popup_list.php');
     $my_form->set_controls(new OrDojoTextSearch('user'));
     //$my_form->controls['user']->OP_[option]->set($user_list);
     $my_form->controls[user]->OP_[popup_url]->set('my_user_popup_list.php');
     $my_form->set_controls(new OrSelectbox('aut_to_group'));
     $my_form->controls['aut_to_group']->OP_[option]->set(array('ไม่มีสิทธิ์' => '0', 'ให้สิทธ์' => '1'));
     $my_form->set_controls(new OrTextarea('str_sql'));
     $my_form->controls['str_sql']->set_rowcol('5', '50');
     //กำหนดจำนวนแถวที่ Row จำนวน
     $my_form->controls['str_sql']->OP_[check_null]->set(false);
     /*
      * ตัวอย่างการสร้าง controls textbox ความกว้าง 10 ฟิลด์ชื่อ name
      * $my_form->set_controls(new OrTextbox('name'));
      * $my_form->controls[name]->set_size(10);
      * เพิ่ม control ต่อไว้ด้านล่างนี้
      */
     /*
      * กระบวนการจัดการข้อมูลจากฐานข้อมูล
      */
     $my_form->fetch_record($sql);
     /*
      * กำหนดส่วนหัวของฟอร์ม ปกติจะแสดงช่อง Filter สำหรับกรองข้อมูล
      */
     $my_form->set_header('ค้นหา ' . $my_form->get_control_filter() . ' เรียง ' . $my_form->get_control_order() . ' ' . $my_form->get_button_filter());
     /*
      * กำหนดฟอร์มลงในหน้า และแสดงหน้าจอ
      */
     $this->set_form($my_form->get_tag());
     $this->set_filter_msg($my_form->OP_[cmd_msg]->get());
     $this->show();
 }
示例#2
0
 function __construct()
 {
     parent::__construct();
     $this->set_skin_ccs("my_form.css");
     $my_sec = new OrSec();
     $user_list = $my_sec->get_user_list();
     /*
      * กำหนดคุณสมบัติของหน้าจอดังนี้
      * $table : ชื่อ Table
      * $sql : คำสั่ง SQL
      * $key : ชื่อ Field ที่เป็น PRIMARY
      */
     $table = 'my_group';
     $sql = 'SELECT * FROM `' . $table . '` ';
     $key = array('group', 'user');
     $clip_user = new OrClip('user');
     $my_form = new OrDbFrmForm('my_form', $this->get_my_db(), $table, $key);
     $my_form->OP_[list_page_url]->set('my_group_list.php');
     $my_form->OP_[column]->set(3);
     /*$my_form->OE_[after_add]->set($my_cmd);
     		$my_form->OE_[after_save]->set($my_cmd);
     		$my_form->OE_[after_delete]->set($my_cmd);*/
     /*
      * สร้าง Control ในฟอร์ม ประกอบด้วย Class ในกลุ่ม GUI
      */
     //$my_form->set_controls(new OrLabel('id'));
     //$my_form->controls[id]->OP_[check_null]->set(false);
     /*
      * ตัวอย่างการสร้าง controls textbox ความกว้าง 10 ฟิลด์ชื่อ name
      * $my_form->set_controls(new OrTextbox('name'));
      * $my_form->controls[name]->set_size(10);
      * เพิ่ม control ต่อไว้ด้านล่างนี้
      */
     $my_form->set_controls(new OrSelectbox('group'));
     $my_form->controls[group]->OP_[option]->set($user_list);
     $my_form->set_controls(new OrSelectbox('user'));
     $my_form->controls['user']->OP_[default_value]->set($clip_user->OP_[value]->get());
     $my_form->controls['user']->OP_[option]->set($user_list);
     $my_form->set_controls(new OrTextbox('description'));
     $my_form->controls[description]->set_size(20, 50);
     $my_form->controls[description]->OP_[check_null]->set(false);
     /*
      * กระบวนการจัดการข้อมูลจากฐานข้อมูล
      */
     $my_form->fetch_record($sql);
     /*
      * กำหนดส่วนหัวของฟอร์ม ปกติจะแสดงช่อง Filter สำหรับกรองข้อมูล
      */
     $my_form->set_header('ค้นหา ' . $my_form->get_control_filter() . ' เรียง ' . $my_form->get_control_order() . ' ' . $my_form->get_button_filter());
     /*
      * กำหนดฟอร์มลงในหน้า และแสดงหน้าจอ
      */
     $this->set_form($my_form->get_tag($this->get_skins_path('form_button.html')));
     $this->set_filter_msg($my_form->OP_[cmd_msg]->get());
     $this->show();
 }
示例#3
0
 function update_controls($sql, $limit)
 {
     $g_my_sec = new OrSec();
     /* ตรวจสอบค่าเกี่ยวกับสิทธิ์การใช้งาน */
     //if($this->OP_[cmd_filter]->get()!="")$sql.="WHERE ((".$this->OP_[cmd_filter]->get()."))";
     /* ตรวจสอบจำนวนหน้าทั้งหมด */
     //$this->db->get_query($sql);
     //$this->OP_[total_rec]->set($this->db->get_total_row());
     /* -------------------------------- */
     $sql .= $limit;
     //die("<b>debug</b> ".__FILE__." | ".__LINE__." | sql =".$sql."<br>");
     $this->db->get_query($sql);
     $this->db->get_record();
     $g_my_sec->OP_[sec_user]->set($this->db->record[sec_user]);
     /* แสดงข้อมูลในหน้าจอ */
     if ($g_my_sec->can_read()) {
         foreach ($this->controls as $id => $obj) {
             if ($this->controls[$id]->OP_[db_field]->get()) {
                 $this->controls[$id]->OP_[default_value]->set(null);
                 //ไม่แสดงค่า default_value กรณีใน field ไม่มีข้อมูลอยู่แล้ว
                 $this->controls[$id]->OP_[value]->set($this->db->record[$id]);
             }
         }
     }
     if ($this->OP_[chg_owner]->get()) {
         $this->controls[sec_user]->OP_[option]->set($g_my_sec->get_user_list());
         $this->OP_['sec_status_tag']->set('เลือกเจ้าของที่ต้องการเปลี่ยน : ' . $this->controls[sec_user]->get_tag());
     } else {
         $this->set_body($this->controls[sec_user]->get_tag());
         $this->OP_['sec_status_tag']->set($g_my_sec->get_status());
     }
     $this->db->close_conn();
     return null;
 }