Example #1
0
 /**
  * function to get token record, depend on condition
  */
 function getToken_lookup($primary_key, $name_key, $search, $limit = 10)
 {
     $data = array();
     /*
               if ($table == $this->user_table)
               {
               //$row = $this->get_comboRow($table, $primary_key, $name_key, "", $name_key." like '%$search%'", "", true);
               $row = $this->table($table)->where($name_key . " like '%$search%'")->get();
               $row = gen_combo_row($row, $primary_key, $name_key, '');
               }
               else
               {
               //$row = $this->get_comboRow($table, $primary_key, $name_key, "", $name_key." like '%$search%'");
               $row = $this->table($table)->where($name_key . " like '%$search%'")->get();
               $row = gen_combo_row($row, $primary_key, $name_key, "");
               } */
     $row = $this->table($this->table)->where($name_key . " like '%{$search}%'")->get();
     $row = gen_combo_row($row, $primary_key, $name_key, '');
     $row = array_unique($row);
     foreach ($row as $key => $val) {
         if (count($data) <= $limit - 1) {
             $data[] = array("id" => $key, "name" => $val);
         }
     }
     //special case for keywords : allow new record
     $data[] = array("id" => 'new_' . date("His"), "name" => $search);
     //END special case for keywords : allow new record
     return json_encode($data);
 }
Example #2
0
 /**
  * function to get token record, depend on condition
  */
 function getToken_lookup($primary_key, $name_key, $search, $limit = 10)
 {
     $data = array();
     $row = $this->table($this->table)->where($name_key . " like '%{$search}%'")->get();
     $row = gen_combo_row($row, $primary_key, $name_key, '');
     $row = array_unique($row);
     foreach ($row as $key => $val) {
         if (count($data) <= $limit - 1) {
             $data[] = array("id" => $key, "name" => $val);
         }
     }
     return json_encode($data);
 }
Example #3
0
 /**
  * function to fetch photo list for ajax token request
  */
 function getUser_combo($primary_key, $name_key, $search, $limit = 10)
 {
     $data = array();
     if ($search != '') {
         $this->where($name_key . " like '%{$search}%'");
     }
     $row = $this->table($this->table)->get();
     $row = gen_combo_row($row, $primary_key, $name_key, '');
     $row = array_unique($row);
     //foreach ($row as $key => $val)
     //{
     //    if (count($data) <= ($limit - 1)) $data[] = array("id" => $key, "name" => $val);
     //}
     //return json_encode($data);
     return $row;
 }
Example #4
0
 /**
  * function to fetch photo list for ajax token request
  */
 function getToken_lookup($primary_key, $name_key, $search, $limit = 10)
 {
     $data = array();
     //$row = $this->get_comboRow($table, $primary_key, $name_key, "", $name_key." like '%$search%'");
     $sql = $this->table($this->table)->where($name_key . " like '%{$search}%'")->create_query();
     //echo $sql;
     $row = $this->query($sql)->fetchrow();
     $row = gen_combo_row($row, $primary_key, $name_key, "");
     $row = array_unique($row);
     foreach ($row as $key => $val) {
         if (count($data) <= $limit - 1) {
             $data[] = array("id" => $key, "name" => $val);
         }
     }
     //END special case for keywords : allow new record
     return json_encode($data);
 }