Advertisement
Guest User

Contoh.php

a guest
Aug 14th, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class Contoh extends MY_Controller{
  5.  
  6. public function __construct()
  7. {
  8. parent::__construct();
  9. $this->load->library(array("btree"));
  10. }
  11.  
  12.  
  13. function get($id)
  14. {
  15. $is_parent = $this->btree->cek_is_parent($id);
  16.  
  17. foreach ($is_parent as $value) {
  18. $data[$value]= $this->add_pairing($value);
  19. }
  20.  
  21. echo json_encode($data);
  22. }
  23.  
  24.  
  25. function add_pairing($id)
  26. {
  27. $left = $this->btree->get_left_id_children($id);
  28. $right = $this->btree->get_right_id_children($id);
  29.  
  30. $data = array($left ,$right );
  31.  
  32. return $data;
  33. }
  34.  
  35.  
  36. } //end class contoh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement