Esempio n. 1
0
 public function many_get_childlist_detail($the_type, $parent_id, $child_table, $child_wanted_column = NULL, $want_string = 0, $separator = ',', $reverse_parent_child = 0, $child_wanted_column2 = NULL)
 {
     if ($reverse_parent_child == 1) {
         $query = $this->db->get_where('many_to_many', array('many_type' => $the_type, 'many_child_id' => $parent_id));
     } else {
         $query = $this->db->get_where('many_to_many', array('many_type' => $the_type, 'many_parent_id' => $parent_id));
     }
     $return = array();
     if ($query->num_rows() > 0) {
         $child_id_column = $this->m_custom->table_id_column($child_table);
         foreach ($query->result_array() as $row) {
             if ($reverse_parent_child == 1) {
                 $many_child_id = $row['many_parent_id'];
             } else {
                 $many_child_id = $row['many_child_id'];
             }
             $child = $this->db->get_where($child_table, array($child_id_column => $many_child_id), 1);
             if ($child->num_rows() == 1) {
                 if ($child_wanted_column == NULL) {
                     $return[$many_child_id] = $child->row_array();
                 } else {
                     $result = $child->row_array();
                     if ($child_wanted_column2 != NULL) {
                         $return[$many_child_id] = $result[$child_wanted_column] . ' ' . $result[$child_wanted_column2];
                     } else {
                         $return[$many_child_id] = $result[$child_wanted_column];
                     }
                 }
             }
         }
     }
     if ($want_string == 1 && $child_wanted_column != NULL) {
         $return = arraylist_to_string($return, $separator);
     }
     return $return;
 }
Esempio n. 2
0
 function get_key_string_from_list_array($list_array, $column_wanted, $separator = ',')
 {
     $key_string = array();
     foreach ($list_array as $row) {
         $key_string[] = $row[$column_wanted];
     }
     $return = arraylist_to_string($key_string, $separator);
     return $return;
 }